index.js 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889
  1. "use strict";
  2. var __getOwnPropNames = Object.getOwnPropertyNames;
  3. var __commonJS = (cb, mod) => function __require() {
  4. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  5. };
  6. // node_modules/core-js/internals/global.js
  7. var require_global = __commonJS({
  8. "node_modules/core-js/internals/global.js"(exports2, module2) {
  9. var check = function(it) {
  10. return it && it.Math == Math && it;
  11. };
  12. module2.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || function() {
  13. return this;
  14. }() || Function("return this")();
  15. }
  16. });
  17. // node_modules/core-js/internals/fails.js
  18. var require_fails = __commonJS({
  19. "node_modules/core-js/internals/fails.js"(exports2, module2) {
  20. module2.exports = function(exec) {
  21. try {
  22. return !!exec();
  23. } catch (error) {
  24. return true;
  25. }
  26. };
  27. }
  28. });
  29. // node_modules/core-js/internals/descriptors.js
  30. var require_descriptors = __commonJS({
  31. "node_modules/core-js/internals/descriptors.js"(exports2, module2) {
  32. var fails = require_fails();
  33. module2.exports = !fails(function() {
  34. return Object.defineProperty({}, 1, { get: function() {
  35. return 7;
  36. } })[1] != 7;
  37. });
  38. }
  39. });
  40. // node_modules/core-js/internals/function-bind-native.js
  41. var require_function_bind_native = __commonJS({
  42. "node_modules/core-js/internals/function-bind-native.js"(exports2, module2) {
  43. var fails = require_fails();
  44. module2.exports = !fails(function() {
  45. var test = function() {
  46. }.bind();
  47. return typeof test != "function" || test.hasOwnProperty("prototype");
  48. });
  49. }
  50. });
  51. // node_modules/core-js/internals/function-call.js
  52. var require_function_call = __commonJS({
  53. "node_modules/core-js/internals/function-call.js"(exports2, module2) {
  54. var NATIVE_BIND = require_function_bind_native();
  55. var call = Function.prototype.call;
  56. module2.exports = NATIVE_BIND ? call.bind(call) : function() {
  57. return call.apply(call, arguments);
  58. };
  59. }
  60. });
  61. // node_modules/core-js/internals/object-property-is-enumerable.js
  62. var require_object_property_is_enumerable = __commonJS({
  63. "node_modules/core-js/internals/object-property-is-enumerable.js"(exports2) {
  64. "use strict";
  65. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  66. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  67. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  68. exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  69. var descriptor = getOwnPropertyDescriptor(this, V);
  70. return !!descriptor && descriptor.enumerable;
  71. } : $propertyIsEnumerable;
  72. }
  73. });
  74. // node_modules/core-js/internals/create-property-descriptor.js
  75. var require_create_property_descriptor = __commonJS({
  76. "node_modules/core-js/internals/create-property-descriptor.js"(exports2, module2) {
  77. module2.exports = function(bitmap, value) {
  78. return {
  79. enumerable: !(bitmap & 1),
  80. configurable: !(bitmap & 2),
  81. writable: !(bitmap & 4),
  82. value
  83. };
  84. };
  85. }
  86. });
  87. // node_modules/core-js/internals/function-uncurry-this.js
  88. var require_function_uncurry_this = __commonJS({
  89. "node_modules/core-js/internals/function-uncurry-this.js"(exports2, module2) {
  90. var NATIVE_BIND = require_function_bind_native();
  91. var FunctionPrototype = Function.prototype;
  92. var bind = FunctionPrototype.bind;
  93. var call = FunctionPrototype.call;
  94. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  95. module2.exports = NATIVE_BIND ? function(fn) {
  96. return fn && uncurryThis(fn);
  97. } : function(fn) {
  98. return fn && function() {
  99. return call.apply(fn, arguments);
  100. };
  101. };
  102. }
  103. });
  104. // node_modules/core-js/internals/classof-raw.js
  105. var require_classof_raw = __commonJS({
  106. "node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
  107. var uncurryThis = require_function_uncurry_this();
  108. var toString = uncurryThis({}.toString);
  109. var stringSlice = uncurryThis("".slice);
  110. module2.exports = function(it) {
  111. return stringSlice(toString(it), 8, -1);
  112. };
  113. }
  114. });
  115. // node_modules/core-js/internals/indexed-object.js
  116. var require_indexed_object = __commonJS({
  117. "node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
  118. var global2 = require_global();
  119. var uncurryThis = require_function_uncurry_this();
  120. var fails = require_fails();
  121. var classof = require_classof_raw();
  122. var Object2 = global2.Object;
  123. var split = uncurryThis("".split);
  124. module2.exports = fails(function() {
  125. return !Object2("z").propertyIsEnumerable(0);
  126. }) ? function(it) {
  127. return classof(it) == "String" ? split(it, "") : Object2(it);
  128. } : Object2;
  129. }
  130. });
  131. // node_modules/core-js/internals/require-object-coercible.js
  132. var require_require_object_coercible = __commonJS({
  133. "node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
  134. var global2 = require_global();
  135. var TypeError2 = global2.TypeError;
  136. module2.exports = function(it) {
  137. if (it == void 0)
  138. throw TypeError2("Can't call method on " + it);
  139. return it;
  140. };
  141. }
  142. });
  143. // node_modules/core-js/internals/to-indexed-object.js
  144. var require_to_indexed_object = __commonJS({
  145. "node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
  146. var IndexedObject = require_indexed_object();
  147. var requireObjectCoercible = require_require_object_coercible();
  148. module2.exports = function(it) {
  149. return IndexedObject(requireObjectCoercible(it));
  150. };
  151. }
  152. });
  153. // node_modules/core-js/internals/is-callable.js
  154. var require_is_callable = __commonJS({
  155. "node_modules/core-js/internals/is-callable.js"(exports2, module2) {
  156. module2.exports = function(argument) {
  157. return typeof argument == "function";
  158. };
  159. }
  160. });
  161. // node_modules/core-js/internals/is-object.js
  162. var require_is_object = __commonJS({
  163. "node_modules/core-js/internals/is-object.js"(exports2, module2) {
  164. var isCallable = require_is_callable();
  165. module2.exports = function(it) {
  166. return typeof it == "object" ? it !== null : isCallable(it);
  167. };
  168. }
  169. });
  170. // node_modules/core-js/internals/get-built-in.js
  171. var require_get_built_in = __commonJS({
  172. "node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
  173. var global2 = require_global();
  174. var isCallable = require_is_callable();
  175. var aFunction = function(argument) {
  176. return isCallable(argument) ? argument : void 0;
  177. };
  178. module2.exports = function(namespace, method) {
  179. return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
  180. };
  181. }
  182. });
  183. // node_modules/core-js/internals/object-is-prototype-of.js
  184. var require_object_is_prototype_of = __commonJS({
  185. "node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
  186. var uncurryThis = require_function_uncurry_this();
  187. module2.exports = uncurryThis({}.isPrototypeOf);
  188. }
  189. });
  190. // node_modules/core-js/internals/engine-user-agent.js
  191. var require_engine_user_agent = __commonJS({
  192. "node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
  193. var getBuiltIn = require_get_built_in();
  194. module2.exports = getBuiltIn("navigator", "userAgent") || "";
  195. }
  196. });
  197. // node_modules/core-js/internals/engine-v8-version.js
  198. var require_engine_v8_version = __commonJS({
  199. "node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
  200. var global2 = require_global();
  201. var userAgent = require_engine_user_agent();
  202. var process2 = global2.process;
  203. var Deno = global2.Deno;
  204. var versions = process2 && process2.versions || Deno && Deno.version;
  205. var v8 = versions && versions.v8;
  206. var match;
  207. var version2;
  208. if (v8) {
  209. match = v8.split(".");
  210. version2 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  211. }
  212. if (!version2 && userAgent) {
  213. match = userAgent.match(/Edge\/(\d+)/);
  214. if (!match || match[1] >= 74) {
  215. match = userAgent.match(/Chrome\/(\d+)/);
  216. if (match)
  217. version2 = +match[1];
  218. }
  219. }
  220. module2.exports = version2;
  221. }
  222. });
  223. // node_modules/core-js/internals/native-symbol.js
  224. var require_native_symbol = __commonJS({
  225. "node_modules/core-js/internals/native-symbol.js"(exports2, module2) {
  226. var V8_VERSION = require_engine_v8_version();
  227. var fails = require_fails();
  228. module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
  229. var symbol = Symbol();
  230. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  231. });
  232. }
  233. });
  234. // node_modules/core-js/internals/use-symbol-as-uid.js
  235. var require_use_symbol_as_uid = __commonJS({
  236. "node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
  237. var NATIVE_SYMBOL = require_native_symbol();
  238. module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
  239. }
  240. });
  241. // node_modules/core-js/internals/is-symbol.js
  242. var require_is_symbol = __commonJS({
  243. "node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
  244. var global2 = require_global();
  245. var getBuiltIn = require_get_built_in();
  246. var isCallable = require_is_callable();
  247. var isPrototypeOf = require_object_is_prototype_of();
  248. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  249. var Object2 = global2.Object;
  250. module2.exports = USE_SYMBOL_AS_UID ? function(it) {
  251. return typeof it == "symbol";
  252. } : function(it) {
  253. var $Symbol = getBuiltIn("Symbol");
  254. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object2(it));
  255. };
  256. }
  257. });
  258. // node_modules/core-js/internals/try-to-string.js
  259. var require_try_to_string = __commonJS({
  260. "node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
  261. var global2 = require_global();
  262. var String2 = global2.String;
  263. module2.exports = function(argument) {
  264. try {
  265. return String2(argument);
  266. } catch (error) {
  267. return "Object";
  268. }
  269. };
  270. }
  271. });
  272. // node_modules/core-js/internals/a-callable.js
  273. var require_a_callable = __commonJS({
  274. "node_modules/core-js/internals/a-callable.js"(exports2, module2) {
  275. var global2 = require_global();
  276. var isCallable = require_is_callable();
  277. var tryToString = require_try_to_string();
  278. var TypeError2 = global2.TypeError;
  279. module2.exports = function(argument) {
  280. if (isCallable(argument))
  281. return argument;
  282. throw TypeError2(tryToString(argument) + " is not a function");
  283. };
  284. }
  285. });
  286. // node_modules/core-js/internals/get-method.js
  287. var require_get_method = __commonJS({
  288. "node_modules/core-js/internals/get-method.js"(exports2, module2) {
  289. var aCallable = require_a_callable();
  290. module2.exports = function(V, P) {
  291. var func = V[P];
  292. return func == null ? void 0 : aCallable(func);
  293. };
  294. }
  295. });
  296. // node_modules/core-js/internals/ordinary-to-primitive.js
  297. var require_ordinary_to_primitive = __commonJS({
  298. "node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
  299. var global2 = require_global();
  300. var call = require_function_call();
  301. var isCallable = require_is_callable();
  302. var isObject = require_is_object();
  303. var TypeError2 = global2.TypeError;
  304. module2.exports = function(input, pref) {
  305. var fn, val;
  306. if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  307. return val;
  308. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  309. return val;
  310. if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  311. return val;
  312. throw TypeError2("Can't convert object to primitive value");
  313. };
  314. }
  315. });
  316. // node_modules/core-js/internals/is-pure.js
  317. var require_is_pure = __commonJS({
  318. "node_modules/core-js/internals/is-pure.js"(exports2, module2) {
  319. module2.exports = false;
  320. }
  321. });
  322. // node_modules/core-js/internals/set-global.js
  323. var require_set_global = __commonJS({
  324. "node_modules/core-js/internals/set-global.js"(exports2, module2) {
  325. var global2 = require_global();
  326. var defineProperty = Object.defineProperty;
  327. module2.exports = function(key, value) {
  328. try {
  329. defineProperty(global2, key, { value, configurable: true, writable: true });
  330. } catch (error) {
  331. global2[key] = value;
  332. }
  333. return value;
  334. };
  335. }
  336. });
  337. // node_modules/core-js/internals/shared-store.js
  338. var require_shared_store = __commonJS({
  339. "node_modules/core-js/internals/shared-store.js"(exports2, module2) {
  340. var global2 = require_global();
  341. var setGlobal = require_set_global();
  342. var SHARED = "__core-js_shared__";
  343. var store = global2[SHARED] || setGlobal(SHARED, {});
  344. module2.exports = store;
  345. }
  346. });
  347. // node_modules/core-js/internals/shared.js
  348. var require_shared = __commonJS({
  349. "node_modules/core-js/internals/shared.js"(exports2, module2) {
  350. var IS_PURE = require_is_pure();
  351. var store = require_shared_store();
  352. (module2.exports = function(key, value) {
  353. return store[key] || (store[key] = value !== void 0 ? value : {});
  354. })("versions", []).push({
  355. version: "3.22.2",
  356. mode: IS_PURE ? "pure" : "global",
  357. copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
  358. license: "https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE",
  359. source: "https://github.com/zloirock/core-js"
  360. });
  361. }
  362. });
  363. // node_modules/core-js/internals/to-object.js
  364. var require_to_object = __commonJS({
  365. "node_modules/core-js/internals/to-object.js"(exports2, module2) {
  366. var global2 = require_global();
  367. var requireObjectCoercible = require_require_object_coercible();
  368. var Object2 = global2.Object;
  369. module2.exports = function(argument) {
  370. return Object2(requireObjectCoercible(argument));
  371. };
  372. }
  373. });
  374. // node_modules/core-js/internals/has-own-property.js
  375. var require_has_own_property = __commonJS({
  376. "node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
  377. var uncurryThis = require_function_uncurry_this();
  378. var toObject = require_to_object();
  379. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  380. module2.exports = Object.hasOwn || function hasOwn(it, key) {
  381. return hasOwnProperty(toObject(it), key);
  382. };
  383. }
  384. });
  385. // node_modules/core-js/internals/uid.js
  386. var require_uid = __commonJS({
  387. "node_modules/core-js/internals/uid.js"(exports2, module2) {
  388. var uncurryThis = require_function_uncurry_this();
  389. var id = 0;
  390. var postfix = Math.random();
  391. var toString = uncurryThis(1 .toString);
  392. module2.exports = function(key) {
  393. return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
  394. };
  395. }
  396. });
  397. // node_modules/core-js/internals/well-known-symbol.js
  398. var require_well_known_symbol = __commonJS({
  399. "node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
  400. var global2 = require_global();
  401. var shared = require_shared();
  402. var hasOwn = require_has_own_property();
  403. var uid = require_uid();
  404. var NATIVE_SYMBOL = require_native_symbol();
  405. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  406. var WellKnownSymbolsStore = shared("wks");
  407. var Symbol2 = global2.Symbol;
  408. var symbolFor = Symbol2 && Symbol2["for"];
  409. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
  410. module2.exports = function(name) {
  411. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
  412. var description = "Symbol." + name;
  413. if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
  414. WellKnownSymbolsStore[name] = Symbol2[name];
  415. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  416. WellKnownSymbolsStore[name] = symbolFor(description);
  417. } else {
  418. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  419. }
  420. }
  421. return WellKnownSymbolsStore[name];
  422. };
  423. }
  424. });
  425. // node_modules/core-js/internals/to-primitive.js
  426. var require_to_primitive = __commonJS({
  427. "node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
  428. var global2 = require_global();
  429. var call = require_function_call();
  430. var isObject = require_is_object();
  431. var isSymbol = require_is_symbol();
  432. var getMethod = require_get_method();
  433. var ordinaryToPrimitive = require_ordinary_to_primitive();
  434. var wellKnownSymbol = require_well_known_symbol();
  435. var TypeError2 = global2.TypeError;
  436. var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
  437. module2.exports = function(input, pref) {
  438. if (!isObject(input) || isSymbol(input))
  439. return input;
  440. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  441. var result;
  442. if (exoticToPrim) {
  443. if (pref === void 0)
  444. pref = "default";
  445. result = call(exoticToPrim, input, pref);
  446. if (!isObject(result) || isSymbol(result))
  447. return result;
  448. throw TypeError2("Can't convert object to primitive value");
  449. }
  450. if (pref === void 0)
  451. pref = "number";
  452. return ordinaryToPrimitive(input, pref);
  453. };
  454. }
  455. });
  456. // node_modules/core-js/internals/to-property-key.js
  457. var require_to_property_key = __commonJS({
  458. "node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
  459. var toPrimitive = require_to_primitive();
  460. var isSymbol = require_is_symbol();
  461. module2.exports = function(argument) {
  462. var key = toPrimitive(argument, "string");
  463. return isSymbol(key) ? key : key + "";
  464. };
  465. }
  466. });
  467. // node_modules/core-js/internals/document-create-element.js
  468. var require_document_create_element = __commonJS({
  469. "node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
  470. var global2 = require_global();
  471. var isObject = require_is_object();
  472. var document = global2.document;
  473. var EXISTS = isObject(document) && isObject(document.createElement);
  474. module2.exports = function(it) {
  475. return EXISTS ? document.createElement(it) : {};
  476. };
  477. }
  478. });
  479. // node_modules/core-js/internals/ie8-dom-define.js
  480. var require_ie8_dom_define = __commonJS({
  481. "node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
  482. var DESCRIPTORS = require_descriptors();
  483. var fails = require_fails();
  484. var createElement = require_document_create_element();
  485. module2.exports = !DESCRIPTORS && !fails(function() {
  486. return Object.defineProperty(createElement("div"), "a", {
  487. get: function() {
  488. return 7;
  489. }
  490. }).a != 7;
  491. });
  492. }
  493. });
  494. // node_modules/core-js/internals/object-get-own-property-descriptor.js
  495. var require_object_get_own_property_descriptor = __commonJS({
  496. "node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
  497. var DESCRIPTORS = require_descriptors();
  498. var call = require_function_call();
  499. var propertyIsEnumerableModule = require_object_property_is_enumerable();
  500. var createPropertyDescriptor = require_create_property_descriptor();
  501. var toIndexedObject = require_to_indexed_object();
  502. var toPropertyKey = require_to_property_key();
  503. var hasOwn = require_has_own_property();
  504. var IE8_DOM_DEFINE = require_ie8_dom_define();
  505. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  506. exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  507. O = toIndexedObject(O);
  508. P = toPropertyKey(P);
  509. if (IE8_DOM_DEFINE)
  510. try {
  511. return $getOwnPropertyDescriptor(O, P);
  512. } catch (error) {
  513. }
  514. if (hasOwn(O, P))
  515. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  516. };
  517. }
  518. });
  519. // node_modules/core-js/internals/v8-prototype-define-bug.js
  520. var require_v8_prototype_define_bug = __commonJS({
  521. "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
  522. var DESCRIPTORS = require_descriptors();
  523. var fails = require_fails();
  524. module2.exports = DESCRIPTORS && fails(function() {
  525. return Object.defineProperty(function() {
  526. }, "prototype", {
  527. value: 42,
  528. writable: false
  529. }).prototype != 42;
  530. });
  531. }
  532. });
  533. // node_modules/core-js/internals/an-object.js
  534. var require_an_object = __commonJS({
  535. "node_modules/core-js/internals/an-object.js"(exports2, module2) {
  536. var global2 = require_global();
  537. var isObject = require_is_object();
  538. var String2 = global2.String;
  539. var TypeError2 = global2.TypeError;
  540. module2.exports = function(argument) {
  541. if (isObject(argument))
  542. return argument;
  543. throw TypeError2(String2(argument) + " is not an object");
  544. };
  545. }
  546. });
  547. // node_modules/core-js/internals/object-define-property.js
  548. var require_object_define_property = __commonJS({
  549. "node_modules/core-js/internals/object-define-property.js"(exports2) {
  550. var global2 = require_global();
  551. var DESCRIPTORS = require_descriptors();
  552. var IE8_DOM_DEFINE = require_ie8_dom_define();
  553. var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
  554. var anObject = require_an_object();
  555. var toPropertyKey = require_to_property_key();
  556. var TypeError2 = global2.TypeError;
  557. var $defineProperty = Object.defineProperty;
  558. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  559. var ENUMERABLE = "enumerable";
  560. var CONFIGURABLE = "configurable";
  561. var WRITABLE = "writable";
  562. exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  563. anObject(O);
  564. P = toPropertyKey(P);
  565. anObject(Attributes);
  566. if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  567. var current = $getOwnPropertyDescriptor(O, P);
  568. if (current && current[WRITABLE]) {
  569. O[P] = Attributes.value;
  570. Attributes = {
  571. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  572. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  573. writable: false
  574. };
  575. }
  576. }
  577. return $defineProperty(O, P, Attributes);
  578. } : $defineProperty : function defineProperty(O, P, Attributes) {
  579. anObject(O);
  580. P = toPropertyKey(P);
  581. anObject(Attributes);
  582. if (IE8_DOM_DEFINE)
  583. try {
  584. return $defineProperty(O, P, Attributes);
  585. } catch (error) {
  586. }
  587. if ("get" in Attributes || "set" in Attributes)
  588. throw TypeError2("Accessors not supported");
  589. if ("value" in Attributes)
  590. O[P] = Attributes.value;
  591. return O;
  592. };
  593. }
  594. });
  595. // node_modules/core-js/internals/create-non-enumerable-property.js
  596. var require_create_non_enumerable_property = __commonJS({
  597. "node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
  598. var DESCRIPTORS = require_descriptors();
  599. var definePropertyModule = require_object_define_property();
  600. var createPropertyDescriptor = require_create_property_descriptor();
  601. module2.exports = DESCRIPTORS ? function(object, key, value) {
  602. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  603. } : function(object, key, value) {
  604. object[key] = value;
  605. return object;
  606. };
  607. }
  608. });
  609. // node_modules/core-js/internals/inspect-source.js
  610. var require_inspect_source = __commonJS({
  611. "node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
  612. var uncurryThis = require_function_uncurry_this();
  613. var isCallable = require_is_callable();
  614. var store = require_shared_store();
  615. var functionToString = uncurryThis(Function.toString);
  616. if (!isCallable(store.inspectSource)) {
  617. store.inspectSource = function(it) {
  618. return functionToString(it);
  619. };
  620. }
  621. module2.exports = store.inspectSource;
  622. }
  623. });
  624. // node_modules/core-js/internals/native-weak-map.js
  625. var require_native_weak_map = __commonJS({
  626. "node_modules/core-js/internals/native-weak-map.js"(exports2, module2) {
  627. var global2 = require_global();
  628. var isCallable = require_is_callable();
  629. var inspectSource = require_inspect_source();
  630. var WeakMap2 = global2.WeakMap;
  631. module2.exports = isCallable(WeakMap2) && /native code/.test(inspectSource(WeakMap2));
  632. }
  633. });
  634. // node_modules/core-js/internals/shared-key.js
  635. var require_shared_key = __commonJS({
  636. "node_modules/core-js/internals/shared-key.js"(exports2, module2) {
  637. var shared = require_shared();
  638. var uid = require_uid();
  639. var keys = shared("keys");
  640. module2.exports = function(key) {
  641. return keys[key] || (keys[key] = uid(key));
  642. };
  643. }
  644. });
  645. // node_modules/core-js/internals/hidden-keys.js
  646. var require_hidden_keys = __commonJS({
  647. "node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
  648. module2.exports = {};
  649. }
  650. });
  651. // node_modules/core-js/internals/internal-state.js
  652. var require_internal_state = __commonJS({
  653. "node_modules/core-js/internals/internal-state.js"(exports2, module2) {
  654. var NATIVE_WEAK_MAP = require_native_weak_map();
  655. var global2 = require_global();
  656. var uncurryThis = require_function_uncurry_this();
  657. var isObject = require_is_object();
  658. var createNonEnumerableProperty = require_create_non_enumerable_property();
  659. var hasOwn = require_has_own_property();
  660. var shared = require_shared_store();
  661. var sharedKey = require_shared_key();
  662. var hiddenKeys = require_hidden_keys();
  663. var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
  664. var TypeError2 = global2.TypeError;
  665. var WeakMap2 = global2.WeakMap;
  666. var set;
  667. var get;
  668. var has;
  669. var enforce = function(it) {
  670. return has(it) ? get(it) : set(it, {});
  671. };
  672. var getterFor = function(TYPE) {
  673. return function(it) {
  674. var state;
  675. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  676. throw TypeError2("Incompatible receiver, " + TYPE + " required");
  677. }
  678. return state;
  679. };
  680. };
  681. if (NATIVE_WEAK_MAP || shared.state) {
  682. store = shared.state || (shared.state = new WeakMap2());
  683. wmget = uncurryThis(store.get);
  684. wmhas = uncurryThis(store.has);
  685. wmset = uncurryThis(store.set);
  686. set = function(it, metadata) {
  687. if (wmhas(store, it))
  688. throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
  689. metadata.facade = it;
  690. wmset(store, it, metadata);
  691. return metadata;
  692. };
  693. get = function(it) {
  694. return wmget(store, it) || {};
  695. };
  696. has = function(it) {
  697. return wmhas(store, it);
  698. };
  699. } else {
  700. STATE = sharedKey("state");
  701. hiddenKeys[STATE] = true;
  702. set = function(it, metadata) {
  703. if (hasOwn(it, STATE))
  704. throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
  705. metadata.facade = it;
  706. createNonEnumerableProperty(it, STATE, metadata);
  707. return metadata;
  708. };
  709. get = function(it) {
  710. return hasOwn(it, STATE) ? it[STATE] : {};
  711. };
  712. has = function(it) {
  713. return hasOwn(it, STATE);
  714. };
  715. }
  716. var store;
  717. var wmget;
  718. var wmhas;
  719. var wmset;
  720. var STATE;
  721. module2.exports = {
  722. set,
  723. get,
  724. has,
  725. enforce,
  726. getterFor
  727. };
  728. }
  729. });
  730. // node_modules/core-js/internals/function-name.js
  731. var require_function_name = __commonJS({
  732. "node_modules/core-js/internals/function-name.js"(exports2, module2) {
  733. var DESCRIPTORS = require_descriptors();
  734. var hasOwn = require_has_own_property();
  735. var FunctionPrototype = Function.prototype;
  736. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  737. var EXISTS = hasOwn(FunctionPrototype, "name");
  738. var PROPER = EXISTS && function something() {
  739. }.name === "something";
  740. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
  741. module2.exports = {
  742. EXISTS,
  743. PROPER,
  744. CONFIGURABLE
  745. };
  746. }
  747. });
  748. // node_modules/core-js/internals/redefine.js
  749. var require_redefine = __commonJS({
  750. "node_modules/core-js/internals/redefine.js"(exports2, module2) {
  751. var global2 = require_global();
  752. var isCallable = require_is_callable();
  753. var hasOwn = require_has_own_property();
  754. var createNonEnumerableProperty = require_create_non_enumerable_property();
  755. var setGlobal = require_set_global();
  756. var inspectSource = require_inspect_source();
  757. var InternalStateModule = require_internal_state();
  758. var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
  759. var getInternalState = InternalStateModule.get;
  760. var enforceInternalState = InternalStateModule.enforce;
  761. var TEMPLATE = String(String).split("String");
  762. (module2.exports = function(O, key, value, options) {
  763. var unsafe = options ? !!options.unsafe : false;
  764. var simple = options ? !!options.enumerable : false;
  765. var noTargetGet = options ? !!options.noTargetGet : false;
  766. var name = options && options.name !== void 0 ? options.name : key;
  767. var state;
  768. if (isCallable(value)) {
  769. if (String(name).slice(0, 7) === "Symbol(") {
  770. name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
  771. }
  772. if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  773. createNonEnumerableProperty(value, "name", name);
  774. }
  775. state = enforceInternalState(value);
  776. if (!state.source) {
  777. state.source = TEMPLATE.join(typeof name == "string" ? name : "");
  778. }
  779. }
  780. if (O === global2) {
  781. if (simple)
  782. O[key] = value;
  783. else
  784. setGlobal(key, value);
  785. return;
  786. } else if (!unsafe) {
  787. delete O[key];
  788. } else if (!noTargetGet && O[key]) {
  789. simple = true;
  790. }
  791. if (simple)
  792. O[key] = value;
  793. else
  794. createNonEnumerableProperty(O, key, value);
  795. })(Function.prototype, "toString", function toString() {
  796. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  797. });
  798. }
  799. });
  800. // node_modules/core-js/internals/to-integer-or-infinity.js
  801. var require_to_integer_or_infinity = __commonJS({
  802. "node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
  803. var ceil = Math.ceil;
  804. var floor = Math.floor;
  805. module2.exports = function(argument) {
  806. var number = +argument;
  807. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  808. };
  809. }
  810. });
  811. // node_modules/core-js/internals/to-absolute-index.js
  812. var require_to_absolute_index = __commonJS({
  813. "node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
  814. var toIntegerOrInfinity = require_to_integer_or_infinity();
  815. var max = Math.max;
  816. var min = Math.min;
  817. module2.exports = function(index, length) {
  818. var integer = toIntegerOrInfinity(index);
  819. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  820. };
  821. }
  822. });
  823. // node_modules/core-js/internals/to-length.js
  824. var require_to_length = __commonJS({
  825. "node_modules/core-js/internals/to-length.js"(exports2, module2) {
  826. var toIntegerOrInfinity = require_to_integer_or_infinity();
  827. var min = Math.min;
  828. module2.exports = function(argument) {
  829. return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
  830. };
  831. }
  832. });
  833. // node_modules/core-js/internals/length-of-array-like.js
  834. var require_length_of_array_like = __commonJS({
  835. "node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
  836. var toLength = require_to_length();
  837. module2.exports = function(obj) {
  838. return toLength(obj.length);
  839. };
  840. }
  841. });
  842. // node_modules/core-js/internals/array-includes.js
  843. var require_array_includes = __commonJS({
  844. "node_modules/core-js/internals/array-includes.js"(exports2, module2) {
  845. var toIndexedObject = require_to_indexed_object();
  846. var toAbsoluteIndex = require_to_absolute_index();
  847. var lengthOfArrayLike = require_length_of_array_like();
  848. var createMethod = function(IS_INCLUDES) {
  849. return function($this, el, fromIndex) {
  850. var O = toIndexedObject($this);
  851. var length = lengthOfArrayLike(O);
  852. var index = toAbsoluteIndex(fromIndex, length);
  853. var value;
  854. if (IS_INCLUDES && el != el)
  855. while (length > index) {
  856. value = O[index++];
  857. if (value != value)
  858. return true;
  859. }
  860. else
  861. for (; length > index; index++) {
  862. if ((IS_INCLUDES || index in O) && O[index] === el)
  863. return IS_INCLUDES || index || 0;
  864. }
  865. return !IS_INCLUDES && -1;
  866. };
  867. };
  868. module2.exports = {
  869. includes: createMethod(true),
  870. indexOf: createMethod(false)
  871. };
  872. }
  873. });
  874. // node_modules/core-js/internals/object-keys-internal.js
  875. var require_object_keys_internal = __commonJS({
  876. "node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
  877. var uncurryThis = require_function_uncurry_this();
  878. var hasOwn = require_has_own_property();
  879. var toIndexedObject = require_to_indexed_object();
  880. var indexOf = require_array_includes().indexOf;
  881. var hiddenKeys = require_hidden_keys();
  882. var push = uncurryThis([].push);
  883. module2.exports = function(object, names) {
  884. var O = toIndexedObject(object);
  885. var i = 0;
  886. var result = [];
  887. var key;
  888. for (key in O)
  889. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  890. while (names.length > i)
  891. if (hasOwn(O, key = names[i++])) {
  892. ~indexOf(result, key) || push(result, key);
  893. }
  894. return result;
  895. };
  896. }
  897. });
  898. // node_modules/core-js/internals/enum-bug-keys.js
  899. var require_enum_bug_keys = __commonJS({
  900. "node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
  901. module2.exports = [
  902. "constructor",
  903. "hasOwnProperty",
  904. "isPrototypeOf",
  905. "propertyIsEnumerable",
  906. "toLocaleString",
  907. "toString",
  908. "valueOf"
  909. ];
  910. }
  911. });
  912. // node_modules/core-js/internals/object-get-own-property-names.js
  913. var require_object_get_own_property_names = __commonJS({
  914. "node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
  915. var internalObjectKeys = require_object_keys_internal();
  916. var enumBugKeys = require_enum_bug_keys();
  917. var hiddenKeys = enumBugKeys.concat("length", "prototype");
  918. exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  919. return internalObjectKeys(O, hiddenKeys);
  920. };
  921. }
  922. });
  923. // node_modules/core-js/internals/object-get-own-property-symbols.js
  924. var require_object_get_own_property_symbols = __commonJS({
  925. "node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
  926. exports2.f = Object.getOwnPropertySymbols;
  927. }
  928. });
  929. // node_modules/core-js/internals/own-keys.js
  930. var require_own_keys = __commonJS({
  931. "node_modules/core-js/internals/own-keys.js"(exports2, module2) {
  932. var getBuiltIn = require_get_built_in();
  933. var uncurryThis = require_function_uncurry_this();
  934. var getOwnPropertyNamesModule = require_object_get_own_property_names();
  935. var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
  936. var anObject = require_an_object();
  937. var concat = uncurryThis([].concat);
  938. module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
  939. var keys = getOwnPropertyNamesModule.f(anObject(it));
  940. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  941. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  942. };
  943. }
  944. });
  945. // node_modules/core-js/internals/copy-constructor-properties.js
  946. var require_copy_constructor_properties = __commonJS({
  947. "node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
  948. var hasOwn = require_has_own_property();
  949. var ownKeys = require_own_keys();
  950. var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
  951. var definePropertyModule = require_object_define_property();
  952. module2.exports = function(target, source, exceptions) {
  953. var keys = ownKeys(source);
  954. var defineProperty = definePropertyModule.f;
  955. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  956. for (var i = 0; i < keys.length; i++) {
  957. var key = keys[i];
  958. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  959. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  960. }
  961. }
  962. };
  963. }
  964. });
  965. // node_modules/core-js/internals/is-forced.js
  966. var require_is_forced = __commonJS({
  967. "node_modules/core-js/internals/is-forced.js"(exports2, module2) {
  968. var fails = require_fails();
  969. var isCallable = require_is_callable();
  970. var replacement = /#|\.prototype\./;
  971. var isForced = function(feature, detection) {
  972. var value = data[normalize(feature)];
  973. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  974. };
  975. var normalize = isForced.normalize = function(string) {
  976. return String(string).replace(replacement, ".").toLowerCase();
  977. };
  978. var data = isForced.data = {};
  979. var NATIVE = isForced.NATIVE = "N";
  980. var POLYFILL = isForced.POLYFILL = "P";
  981. module2.exports = isForced;
  982. }
  983. });
  984. // node_modules/core-js/internals/export.js
  985. var require_export = __commonJS({
  986. "node_modules/core-js/internals/export.js"(exports2, module2) {
  987. var global2 = require_global();
  988. var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
  989. var createNonEnumerableProperty = require_create_non_enumerable_property();
  990. var redefine = require_redefine();
  991. var setGlobal = require_set_global();
  992. var copyConstructorProperties = require_copy_constructor_properties();
  993. var isForced = require_is_forced();
  994. module2.exports = function(options, source) {
  995. var TARGET = options.target;
  996. var GLOBAL = options.global;
  997. var STATIC = options.stat;
  998. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  999. if (GLOBAL) {
  1000. target = global2;
  1001. } else if (STATIC) {
  1002. target = global2[TARGET] || setGlobal(TARGET, {});
  1003. } else {
  1004. target = (global2[TARGET] || {}).prototype;
  1005. }
  1006. if (target)
  1007. for (key in source) {
  1008. sourceProperty = source[key];
  1009. if (options.noTargetGet) {
  1010. descriptor = getOwnPropertyDescriptor(target, key);
  1011. targetProperty = descriptor && descriptor.value;
  1012. } else
  1013. targetProperty = target[key];
  1014. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
  1015. if (!FORCED && targetProperty !== void 0) {
  1016. if (typeof sourceProperty == typeof targetProperty)
  1017. continue;
  1018. copyConstructorProperties(sourceProperty, targetProperty);
  1019. }
  1020. if (options.sham || targetProperty && targetProperty.sham) {
  1021. createNonEnumerableProperty(sourceProperty, "sham", true);
  1022. }
  1023. redefine(target, key, sourceProperty, options);
  1024. }
  1025. };
  1026. }
  1027. });
  1028. // node_modules/core-js/internals/is-array.js
  1029. var require_is_array = __commonJS({
  1030. "node_modules/core-js/internals/is-array.js"(exports2, module2) {
  1031. var classof = require_classof_raw();
  1032. module2.exports = Array.isArray || function isArray(argument) {
  1033. return classof(argument) == "Array";
  1034. };
  1035. }
  1036. });
  1037. // node_modules/core-js/internals/function-bind-context.js
  1038. var require_function_bind_context = __commonJS({
  1039. "node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
  1040. var uncurryThis = require_function_uncurry_this();
  1041. var aCallable = require_a_callable();
  1042. var NATIVE_BIND = require_function_bind_native();
  1043. var bind = uncurryThis(uncurryThis.bind);
  1044. module2.exports = function(fn, that) {
  1045. aCallable(fn);
  1046. return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
  1047. return fn.apply(that, arguments);
  1048. };
  1049. };
  1050. }
  1051. });
  1052. // node_modules/core-js/internals/flatten-into-array.js
  1053. var require_flatten_into_array = __commonJS({
  1054. "node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
  1055. "use strict";
  1056. var global2 = require_global();
  1057. var isArray = require_is_array();
  1058. var lengthOfArrayLike = require_length_of_array_like();
  1059. var bind = require_function_bind_context();
  1060. var TypeError2 = global2.TypeError;
  1061. var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
  1062. var targetIndex = start;
  1063. var sourceIndex = 0;
  1064. var mapFn = mapper ? bind(mapper, thisArg) : false;
  1065. var element, elementLen;
  1066. while (sourceIndex < sourceLen) {
  1067. if (sourceIndex in source) {
  1068. element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
  1069. if (depth > 0 && isArray(element)) {
  1070. elementLen = lengthOfArrayLike(element);
  1071. targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
  1072. } else {
  1073. if (targetIndex >= 9007199254740991)
  1074. throw TypeError2("Exceed the acceptable array length");
  1075. target[targetIndex] = element;
  1076. }
  1077. targetIndex++;
  1078. }
  1079. sourceIndex++;
  1080. }
  1081. return targetIndex;
  1082. };
  1083. module2.exports = flattenIntoArray;
  1084. }
  1085. });
  1086. // node_modules/core-js/internals/to-string-tag-support.js
  1087. var require_to_string_tag_support = __commonJS({
  1088. "node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
  1089. var wellKnownSymbol = require_well_known_symbol();
  1090. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1091. var test = {};
  1092. test[TO_STRING_TAG] = "z";
  1093. module2.exports = String(test) === "[object z]";
  1094. }
  1095. });
  1096. // node_modules/core-js/internals/classof.js
  1097. var require_classof = __commonJS({
  1098. "node_modules/core-js/internals/classof.js"(exports2, module2) {
  1099. var global2 = require_global();
  1100. var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
  1101. var isCallable = require_is_callable();
  1102. var classofRaw = require_classof_raw();
  1103. var wellKnownSymbol = require_well_known_symbol();
  1104. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1105. var Object2 = global2.Object;
  1106. var CORRECT_ARGUMENTS = classofRaw(function() {
  1107. return arguments;
  1108. }()) == "Arguments";
  1109. var tryGet = function(it, key) {
  1110. try {
  1111. return it[key];
  1112. } catch (error) {
  1113. }
  1114. };
  1115. module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
  1116. var O, tag, result;
  1117. return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = Object2(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
  1118. };
  1119. }
  1120. });
  1121. // node_modules/core-js/internals/is-constructor.js
  1122. var require_is_constructor = __commonJS({
  1123. "node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
  1124. var uncurryThis = require_function_uncurry_this();
  1125. var fails = require_fails();
  1126. var isCallable = require_is_callable();
  1127. var classof = require_classof();
  1128. var getBuiltIn = require_get_built_in();
  1129. var inspectSource = require_inspect_source();
  1130. var noop = function() {
  1131. };
  1132. var empty = [];
  1133. var construct = getBuiltIn("Reflect", "construct");
  1134. var constructorRegExp = /^\s*(?:class|function)\b/;
  1135. var exec = uncurryThis(constructorRegExp.exec);
  1136. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  1137. var isConstructorModern = function isConstructor(argument) {
  1138. if (!isCallable(argument))
  1139. return false;
  1140. try {
  1141. construct(noop, empty, argument);
  1142. return true;
  1143. } catch (error) {
  1144. return false;
  1145. }
  1146. };
  1147. var isConstructorLegacy = function isConstructor(argument) {
  1148. if (!isCallable(argument))
  1149. return false;
  1150. switch (classof(argument)) {
  1151. case "AsyncFunction":
  1152. case "GeneratorFunction":
  1153. case "AsyncGeneratorFunction":
  1154. return false;
  1155. }
  1156. try {
  1157. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  1158. } catch (error) {
  1159. return true;
  1160. }
  1161. };
  1162. isConstructorLegacy.sham = true;
  1163. module2.exports = !construct || fails(function() {
  1164. var called;
  1165. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
  1166. called = true;
  1167. }) || called;
  1168. }) ? isConstructorLegacy : isConstructorModern;
  1169. }
  1170. });
  1171. // node_modules/core-js/internals/array-species-constructor.js
  1172. var require_array_species_constructor = __commonJS({
  1173. "node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
  1174. var global2 = require_global();
  1175. var isArray = require_is_array();
  1176. var isConstructor = require_is_constructor();
  1177. var isObject = require_is_object();
  1178. var wellKnownSymbol = require_well_known_symbol();
  1179. var SPECIES = wellKnownSymbol("species");
  1180. var Array2 = global2.Array;
  1181. module2.exports = function(originalArray) {
  1182. var C;
  1183. if (isArray(originalArray)) {
  1184. C = originalArray.constructor;
  1185. if (isConstructor(C) && (C === Array2 || isArray(C.prototype)))
  1186. C = void 0;
  1187. else if (isObject(C)) {
  1188. C = C[SPECIES];
  1189. if (C === null)
  1190. C = void 0;
  1191. }
  1192. }
  1193. return C === void 0 ? Array2 : C;
  1194. };
  1195. }
  1196. });
  1197. // node_modules/core-js/internals/array-species-create.js
  1198. var require_array_species_create = __commonJS({
  1199. "node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
  1200. var arraySpeciesConstructor = require_array_species_constructor();
  1201. module2.exports = function(originalArray, length) {
  1202. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  1203. };
  1204. }
  1205. });
  1206. // node_modules/core-js/modules/es.array.flat-map.js
  1207. var require_es_array_flat_map = __commonJS({
  1208. "node_modules/core-js/modules/es.array.flat-map.js"() {
  1209. "use strict";
  1210. var $ = require_export();
  1211. var flattenIntoArray = require_flatten_into_array();
  1212. var aCallable = require_a_callable();
  1213. var toObject = require_to_object();
  1214. var lengthOfArrayLike = require_length_of_array_like();
  1215. var arraySpeciesCreate = require_array_species_create();
  1216. $({ target: "Array", proto: true }, {
  1217. flatMap: function flatMap(callbackfn) {
  1218. var O = toObject(this);
  1219. var sourceLen = lengthOfArrayLike(O);
  1220. var A;
  1221. aCallable(callbackfn);
  1222. A = arraySpeciesCreate(O, 0);
  1223. A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
  1224. return A;
  1225. }
  1226. });
  1227. }
  1228. });
  1229. // node_modules/core-js/internals/iterators.js
  1230. var require_iterators = __commonJS({
  1231. "node_modules/core-js/internals/iterators.js"(exports2, module2) {
  1232. module2.exports = {};
  1233. }
  1234. });
  1235. // node_modules/core-js/internals/is-array-iterator-method.js
  1236. var require_is_array_iterator_method = __commonJS({
  1237. "node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
  1238. var wellKnownSymbol = require_well_known_symbol();
  1239. var Iterators = require_iterators();
  1240. var ITERATOR = wellKnownSymbol("iterator");
  1241. var ArrayPrototype = Array.prototype;
  1242. module2.exports = function(it) {
  1243. return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  1244. };
  1245. }
  1246. });
  1247. // node_modules/core-js/internals/get-iterator-method.js
  1248. var require_get_iterator_method = __commonJS({
  1249. "node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
  1250. var classof = require_classof();
  1251. var getMethod = require_get_method();
  1252. var Iterators = require_iterators();
  1253. var wellKnownSymbol = require_well_known_symbol();
  1254. var ITERATOR = wellKnownSymbol("iterator");
  1255. module2.exports = function(it) {
  1256. if (it != void 0)
  1257. return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
  1258. };
  1259. }
  1260. });
  1261. // node_modules/core-js/internals/get-iterator.js
  1262. var require_get_iterator = __commonJS({
  1263. "node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
  1264. var global2 = require_global();
  1265. var call = require_function_call();
  1266. var aCallable = require_a_callable();
  1267. var anObject = require_an_object();
  1268. var tryToString = require_try_to_string();
  1269. var getIteratorMethod = require_get_iterator_method();
  1270. var TypeError2 = global2.TypeError;
  1271. module2.exports = function(argument, usingIterator) {
  1272. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  1273. if (aCallable(iteratorMethod))
  1274. return anObject(call(iteratorMethod, argument));
  1275. throw TypeError2(tryToString(argument) + " is not iterable");
  1276. };
  1277. }
  1278. });
  1279. // node_modules/core-js/internals/iterator-close.js
  1280. var require_iterator_close = __commonJS({
  1281. "node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
  1282. var call = require_function_call();
  1283. var anObject = require_an_object();
  1284. var getMethod = require_get_method();
  1285. module2.exports = function(iterator, kind, value) {
  1286. var innerResult, innerError;
  1287. anObject(iterator);
  1288. try {
  1289. innerResult = getMethod(iterator, "return");
  1290. if (!innerResult) {
  1291. if (kind === "throw")
  1292. throw value;
  1293. return value;
  1294. }
  1295. innerResult = call(innerResult, iterator);
  1296. } catch (error) {
  1297. innerError = true;
  1298. innerResult = error;
  1299. }
  1300. if (kind === "throw")
  1301. throw value;
  1302. if (innerError)
  1303. throw innerResult;
  1304. anObject(innerResult);
  1305. return value;
  1306. };
  1307. }
  1308. });
  1309. // node_modules/core-js/internals/iterate.js
  1310. var require_iterate = __commonJS({
  1311. "node_modules/core-js/internals/iterate.js"(exports2, module2) {
  1312. var global2 = require_global();
  1313. var bind = require_function_bind_context();
  1314. var call = require_function_call();
  1315. var anObject = require_an_object();
  1316. var tryToString = require_try_to_string();
  1317. var isArrayIteratorMethod = require_is_array_iterator_method();
  1318. var lengthOfArrayLike = require_length_of_array_like();
  1319. var isPrototypeOf = require_object_is_prototype_of();
  1320. var getIterator = require_get_iterator();
  1321. var getIteratorMethod = require_get_iterator_method();
  1322. var iteratorClose = require_iterator_close();
  1323. var TypeError2 = global2.TypeError;
  1324. var Result = function(stopped, result) {
  1325. this.stopped = stopped;
  1326. this.result = result;
  1327. };
  1328. var ResultPrototype = Result.prototype;
  1329. module2.exports = function(iterable, unboundFunction, options) {
  1330. var that = options && options.that;
  1331. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1332. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1333. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1334. var fn = bind(unboundFunction, that);
  1335. var iterator, iterFn, index, length, result, next, step;
  1336. var stop = function(condition) {
  1337. if (iterator)
  1338. iteratorClose(iterator, "normal", condition);
  1339. return new Result(true, condition);
  1340. };
  1341. var callFn = function(value) {
  1342. if (AS_ENTRIES) {
  1343. anObject(value);
  1344. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1345. }
  1346. return INTERRUPTED ? fn(value, stop) : fn(value);
  1347. };
  1348. if (IS_ITERATOR) {
  1349. iterator = iterable;
  1350. } else {
  1351. iterFn = getIteratorMethod(iterable);
  1352. if (!iterFn)
  1353. throw TypeError2(tryToString(iterable) + " is not iterable");
  1354. if (isArrayIteratorMethod(iterFn)) {
  1355. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1356. result = callFn(iterable[index]);
  1357. if (result && isPrototypeOf(ResultPrototype, result))
  1358. return result;
  1359. }
  1360. return new Result(false);
  1361. }
  1362. iterator = getIterator(iterable, iterFn);
  1363. }
  1364. next = iterator.next;
  1365. while (!(step = call(next, iterator)).done) {
  1366. try {
  1367. result = callFn(step.value);
  1368. } catch (error) {
  1369. iteratorClose(iterator, "throw", error);
  1370. }
  1371. if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
  1372. return result;
  1373. }
  1374. return new Result(false);
  1375. };
  1376. }
  1377. });
  1378. // node_modules/core-js/internals/create-property.js
  1379. var require_create_property = __commonJS({
  1380. "node_modules/core-js/internals/create-property.js"(exports2, module2) {
  1381. "use strict";
  1382. var toPropertyKey = require_to_property_key();
  1383. var definePropertyModule = require_object_define_property();
  1384. var createPropertyDescriptor = require_create_property_descriptor();
  1385. module2.exports = function(object, key, value) {
  1386. var propertyKey = toPropertyKey(key);
  1387. if (propertyKey in object)
  1388. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  1389. else
  1390. object[propertyKey] = value;
  1391. };
  1392. }
  1393. });
  1394. // node_modules/core-js/modules/es.object.from-entries.js
  1395. var require_es_object_from_entries = __commonJS({
  1396. "node_modules/core-js/modules/es.object.from-entries.js"() {
  1397. var $ = require_export();
  1398. var iterate = require_iterate();
  1399. var createProperty = require_create_property();
  1400. $({ target: "Object", stat: true }, {
  1401. fromEntries: function fromEntries(iterable) {
  1402. var obj = {};
  1403. iterate(iterable, function(k, v) {
  1404. createProperty(obj, k, v);
  1405. }, { AS_ENTRIES: true });
  1406. return obj;
  1407. }
  1408. });
  1409. }
  1410. });
  1411. // node_modules/core-js/modules/es.array.flat.js
  1412. var require_es_array_flat = __commonJS({
  1413. "node_modules/core-js/modules/es.array.flat.js"() {
  1414. "use strict";
  1415. var $ = require_export();
  1416. var flattenIntoArray = require_flatten_into_array();
  1417. var toObject = require_to_object();
  1418. var lengthOfArrayLike = require_length_of_array_like();
  1419. var toIntegerOrInfinity = require_to_integer_or_infinity();
  1420. var arraySpeciesCreate = require_array_species_create();
  1421. $({ target: "Array", proto: true }, {
  1422. flat: function flat() {
  1423. var depthArg = arguments.length ? arguments[0] : void 0;
  1424. var O = toObject(this);
  1425. var sourceLen = lengthOfArrayLike(O);
  1426. var A = arraySpeciesCreate(O, 0);
  1427. A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
  1428. return A;
  1429. }
  1430. });
  1431. }
  1432. });
  1433. // dist/_index.js.cjs.js
  1434. var _excluded = ["cliName", "cliCategory", "cliDescription"];
  1435. var _excluded2 = ["_"];
  1436. var _excluded3 = ["overrides"];
  1437. var _excluded4 = ["languageId"];
  1438. function _objectWithoutProperties(source, excluded) {
  1439. if (source == null)
  1440. return {};
  1441. var target = _objectWithoutPropertiesLoose(source, excluded);
  1442. var key, i;
  1443. if (Object.getOwnPropertySymbols) {
  1444. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  1445. for (i = 0; i < sourceSymbolKeys.length; i++) {
  1446. key = sourceSymbolKeys[i];
  1447. if (excluded.indexOf(key) >= 0)
  1448. continue;
  1449. if (!Object.prototype.propertyIsEnumerable.call(source, key))
  1450. continue;
  1451. target[key] = source[key];
  1452. }
  1453. }
  1454. return target;
  1455. }
  1456. function _objectWithoutPropertiesLoose(source, excluded) {
  1457. if (source == null)
  1458. return {};
  1459. var target = {};
  1460. var sourceKeys = Object.keys(source);
  1461. var key, i;
  1462. for (i = 0; i < sourceKeys.length; i++) {
  1463. key = sourceKeys[i];
  1464. if (excluded.indexOf(key) >= 0)
  1465. continue;
  1466. target[key] = source[key];
  1467. }
  1468. return target;
  1469. }
  1470. require_es_array_flat_map();
  1471. require_es_object_from_entries();
  1472. require_es_array_flat();
  1473. var __create = Object.create;
  1474. var __defProp = Object.defineProperty;
  1475. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  1476. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  1477. var __getProtoOf = Object.getPrototypeOf;
  1478. var __hasOwnProp = Object.prototype.hasOwnProperty;
  1479. var __esm = (fn, res) => function __init() {
  1480. return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
  1481. };
  1482. var __commonJS2 = (cb, mod) => function __require() {
  1483. return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
  1484. exports: {}
  1485. }).exports, mod), mod.exports;
  1486. };
  1487. var __export = (target, all) => {
  1488. for (var name in all)
  1489. __defProp(target, name, {
  1490. get: all[name],
  1491. enumerable: true
  1492. });
  1493. };
  1494. var __copyProps = (to, from, except, desc) => {
  1495. if (from && typeof from === "object" || typeof from === "function") {
  1496. for (let key of __getOwnPropNames2(from))
  1497. if (!__hasOwnProp.call(to, key) && key !== except)
  1498. __defProp(to, key, {
  1499. get: () => from[key],
  1500. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  1501. });
  1502. }
  1503. return to;
  1504. };
  1505. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  1506. value: mod,
  1507. enumerable: true
  1508. }) : target, mod));
  1509. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
  1510. value: true
  1511. }), mod);
  1512. var require_base = __commonJS2({
  1513. "node_modules/diff/lib/diff/base.js"(exports2) {
  1514. "use strict";
  1515. Object.defineProperty(exports2, "__esModule", {
  1516. value: true
  1517. });
  1518. exports2["default"] = Diff;
  1519. function Diff() {
  1520. }
  1521. Diff.prototype = {
  1522. diff: function diff(oldString, newString) {
  1523. var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  1524. var callback = options.callback;
  1525. if (typeof options === "function") {
  1526. callback = options;
  1527. options = {};
  1528. }
  1529. this.options = options;
  1530. var self2 = this;
  1531. function done(value) {
  1532. if (callback) {
  1533. setTimeout(function() {
  1534. callback(void 0, value);
  1535. }, 0);
  1536. return true;
  1537. } else {
  1538. return value;
  1539. }
  1540. }
  1541. oldString = this.castInput(oldString);
  1542. newString = this.castInput(newString);
  1543. oldString = this.removeEmpty(this.tokenize(oldString));
  1544. newString = this.removeEmpty(this.tokenize(newString));
  1545. var newLen = newString.length, oldLen = oldString.length;
  1546. var editLength = 1;
  1547. var maxEditLength = newLen + oldLen;
  1548. var bestPath = [{
  1549. newPos: -1,
  1550. components: []
  1551. }];
  1552. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  1553. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  1554. return done([{
  1555. value: this.join(newString),
  1556. count: newString.length
  1557. }]);
  1558. }
  1559. function execEditLength() {
  1560. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  1561. var basePath = void 0;
  1562. var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  1563. if (addPath) {
  1564. bestPath[diagonalPath - 1] = void 0;
  1565. }
  1566. var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  1567. if (!canAdd && !canRemove) {
  1568. bestPath[diagonalPath] = void 0;
  1569. continue;
  1570. }
  1571. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  1572. basePath = clonePath(removePath);
  1573. self2.pushComponent(basePath.components, void 0, true);
  1574. } else {
  1575. basePath = addPath;
  1576. basePath.newPos++;
  1577. self2.pushComponent(basePath.components, true, void 0);
  1578. }
  1579. _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
  1580. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  1581. return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
  1582. } else {
  1583. bestPath[diagonalPath] = basePath;
  1584. }
  1585. }
  1586. editLength++;
  1587. }
  1588. if (callback) {
  1589. (function exec() {
  1590. setTimeout(function() {
  1591. if (editLength > maxEditLength) {
  1592. return callback();
  1593. }
  1594. if (!execEditLength()) {
  1595. exec();
  1596. }
  1597. }, 0);
  1598. })();
  1599. } else {
  1600. while (editLength <= maxEditLength) {
  1601. var ret = execEditLength();
  1602. if (ret) {
  1603. return ret;
  1604. }
  1605. }
  1606. }
  1607. },
  1608. pushComponent: function pushComponent(components, added, removed) {
  1609. var last = components[components.length - 1];
  1610. if (last && last.added === added && last.removed === removed) {
  1611. components[components.length - 1] = {
  1612. count: last.count + 1,
  1613. added,
  1614. removed
  1615. };
  1616. } else {
  1617. components.push({
  1618. count: 1,
  1619. added,
  1620. removed
  1621. });
  1622. }
  1623. },
  1624. extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  1625. var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
  1626. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  1627. newPos++;
  1628. oldPos++;
  1629. commonCount++;
  1630. }
  1631. if (commonCount) {
  1632. basePath.components.push({
  1633. count: commonCount
  1634. });
  1635. }
  1636. basePath.newPos = newPos;
  1637. return oldPos;
  1638. },
  1639. equals: function equals(left, right) {
  1640. if (this.options.comparator) {
  1641. return this.options.comparator(left, right);
  1642. } else {
  1643. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  1644. }
  1645. },
  1646. removeEmpty: function removeEmpty(array) {
  1647. var ret = [];
  1648. for (var i = 0; i < array.length; i++) {
  1649. if (array[i]) {
  1650. ret.push(array[i]);
  1651. }
  1652. }
  1653. return ret;
  1654. },
  1655. castInput: function castInput(value) {
  1656. return value;
  1657. },
  1658. tokenize: function tokenize(value) {
  1659. return value.split("");
  1660. },
  1661. join: function join(chars) {
  1662. return chars.join("");
  1663. }
  1664. };
  1665. function buildValues(diff, components, newString, oldString, useLongestToken) {
  1666. var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
  1667. for (; componentPos < componentLen; componentPos++) {
  1668. var component = components[componentPos];
  1669. if (!component.removed) {
  1670. if (!component.added && useLongestToken) {
  1671. var value = newString.slice(newPos, newPos + component.count);
  1672. value = value.map(function(value2, i) {
  1673. var oldValue = oldString[oldPos + i];
  1674. return oldValue.length > value2.length ? oldValue : value2;
  1675. });
  1676. component.value = diff.join(value);
  1677. } else {
  1678. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  1679. }
  1680. newPos += component.count;
  1681. if (!component.added) {
  1682. oldPos += component.count;
  1683. }
  1684. } else {
  1685. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  1686. oldPos += component.count;
  1687. if (componentPos && components[componentPos - 1].added) {
  1688. var tmp = components[componentPos - 1];
  1689. components[componentPos - 1] = components[componentPos];
  1690. components[componentPos] = tmp;
  1691. }
  1692. }
  1693. }
  1694. var lastComponent = components[componentLen - 1];
  1695. if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
  1696. components[componentLen - 2].value += lastComponent.value;
  1697. components.pop();
  1698. }
  1699. return components;
  1700. }
  1701. function clonePath(path) {
  1702. return {
  1703. newPos: path.newPos,
  1704. components: path.components.slice(0)
  1705. };
  1706. }
  1707. }
  1708. });
  1709. var require_array = __commonJS2({
  1710. "node_modules/diff/lib/diff/array.js"(exports2) {
  1711. "use strict";
  1712. Object.defineProperty(exports2, "__esModule", {
  1713. value: true
  1714. });
  1715. exports2.diffArrays = diffArrays;
  1716. exports2.arrayDiff = void 0;
  1717. var _base = _interopRequireDefault(require_base());
  1718. function _interopRequireDefault(obj) {
  1719. return obj && obj.__esModule ? obj : {
  1720. "default": obj
  1721. };
  1722. }
  1723. var arrayDiff = new _base["default"]();
  1724. exports2.arrayDiff = arrayDiff;
  1725. arrayDiff.tokenize = function(value) {
  1726. return value.slice();
  1727. };
  1728. arrayDiff.join = arrayDiff.removeEmpty = function(value) {
  1729. return value;
  1730. };
  1731. function diffArrays(oldArr, newArr, callback) {
  1732. return arrayDiff.diff(oldArr, newArr, callback);
  1733. }
  1734. }
  1735. });
  1736. var escape_string_regexp_exports = {};
  1737. __export(escape_string_regexp_exports, {
  1738. default: () => escapeStringRegexp
  1739. });
  1740. function escapeStringRegexp(string) {
  1741. if (typeof string !== "string") {
  1742. throw new TypeError("Expected a string");
  1743. }
  1744. return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  1745. }
  1746. var init_escape_string_regexp = __esm({
  1747. "node_modules/escape-string-regexp/index.js"() {
  1748. }
  1749. });
  1750. var require_get_last = __commonJS2({
  1751. "src/utils/get-last.js"(exports2, module2) {
  1752. "use strict";
  1753. var getLast = (arr) => arr[arr.length - 1];
  1754. module2.exports = getLast;
  1755. }
  1756. });
  1757. var require_debug = __commonJS2({
  1758. "node_modules/semver/internal/debug.js"(exports2, module2) {
  1759. var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
  1760. };
  1761. module2.exports = debug;
  1762. }
  1763. });
  1764. var require_constants = __commonJS2({
  1765. "node_modules/semver/internal/constants.js"(exports2, module2) {
  1766. var SEMVER_SPEC_VERSION = "2.0.0";
  1767. var MAX_LENGTH = 256;
  1768. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  1769. var MAX_SAFE_COMPONENT_LENGTH = 16;
  1770. module2.exports = {
  1771. SEMVER_SPEC_VERSION,
  1772. MAX_LENGTH,
  1773. MAX_SAFE_INTEGER,
  1774. MAX_SAFE_COMPONENT_LENGTH
  1775. };
  1776. }
  1777. });
  1778. var require_re = __commonJS2({
  1779. "node_modules/semver/internal/re.js"(exports2, module2) {
  1780. var {
  1781. MAX_SAFE_COMPONENT_LENGTH
  1782. } = require_constants();
  1783. var debug = require_debug();
  1784. exports2 = module2.exports = {};
  1785. var re = exports2.re = [];
  1786. var src = exports2.src = [];
  1787. var t = exports2.t = {};
  1788. var R = 0;
  1789. var createToken = (name, value, isGlobal) => {
  1790. const index = R++;
  1791. debug(name, index, value);
  1792. t[name] = index;
  1793. src[index] = value;
  1794. re[index] = new RegExp(value, isGlobal ? "g" : void 0);
  1795. };
  1796. createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
  1797. createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
  1798. createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
  1799. createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
  1800. createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
  1801. createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1802. createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1803. createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
  1804. createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
  1805. createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
  1806. createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
  1807. createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
  1808. createToken("FULL", `^${src[t.FULLPLAIN]}$`);
  1809. createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
  1810. createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
  1811. createToken("GTLT", "((?:<|>)?=?)");
  1812. createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
  1813. createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
  1814. createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
  1815. createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
  1816. createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
  1817. createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
  1818. createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
  1819. createToken("COERCERTL", src[t.COERCE], true);
  1820. createToken("LONETILDE", "(?:~>?)");
  1821. createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
  1822. exports2.tildeTrimReplace = "$1~";
  1823. createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
  1824. createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
  1825. createToken("LONECARET", "(?:\\^)");
  1826. createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
  1827. exports2.caretTrimReplace = "$1^";
  1828. createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
  1829. createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
  1830. createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
  1831. createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
  1832. createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
  1833. exports2.comparatorTrimReplace = "$1$2$3";
  1834. createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
  1835. createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
  1836. createToken("STAR", "(<|>)?=?\\s*\\*");
  1837. createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
  1838. createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
  1839. }
  1840. });
  1841. var require_parse_options = __commonJS2({
  1842. "node_modules/semver/internal/parse-options.js"(exports2, module2) {
  1843. var opts = ["includePrerelease", "loose", "rtl"];
  1844. var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {
  1845. loose: true
  1846. } : opts.filter((k) => options[k]).reduce((o, k) => {
  1847. o[k] = true;
  1848. return o;
  1849. }, {});
  1850. module2.exports = parseOptions;
  1851. }
  1852. });
  1853. var require_identifiers = __commonJS2({
  1854. "node_modules/semver/internal/identifiers.js"(exports2, module2) {
  1855. var numeric = /^[0-9]+$/;
  1856. var compareIdentifiers = (a, b) => {
  1857. const anum = numeric.test(a);
  1858. const bnum = numeric.test(b);
  1859. if (anum && bnum) {
  1860. a = +a;
  1861. b = +b;
  1862. }
  1863. return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
  1864. };
  1865. var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
  1866. module2.exports = {
  1867. compareIdentifiers,
  1868. rcompareIdentifiers
  1869. };
  1870. }
  1871. });
  1872. var require_semver = __commonJS2({
  1873. "node_modules/semver/classes/semver.js"(exports2, module2) {
  1874. var debug = require_debug();
  1875. var {
  1876. MAX_LENGTH,
  1877. MAX_SAFE_INTEGER
  1878. } = require_constants();
  1879. var {
  1880. re,
  1881. t
  1882. } = require_re();
  1883. var parseOptions = require_parse_options();
  1884. var {
  1885. compareIdentifiers
  1886. } = require_identifiers();
  1887. var SemVer = class {
  1888. constructor(version2, options) {
  1889. options = parseOptions(options);
  1890. if (version2 instanceof SemVer) {
  1891. if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
  1892. return version2;
  1893. } else {
  1894. version2 = version2.version;
  1895. }
  1896. } else if (typeof version2 !== "string") {
  1897. throw new TypeError(`Invalid Version: ${version2}`);
  1898. }
  1899. if (version2.length > MAX_LENGTH) {
  1900. throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
  1901. }
  1902. debug("SemVer", version2, options);
  1903. this.options = options;
  1904. this.loose = !!options.loose;
  1905. this.includePrerelease = !!options.includePrerelease;
  1906. const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
  1907. if (!m) {
  1908. throw new TypeError(`Invalid Version: ${version2}`);
  1909. }
  1910. this.raw = version2;
  1911. this.major = +m[1];
  1912. this.minor = +m[2];
  1913. this.patch = +m[3];
  1914. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  1915. throw new TypeError("Invalid major version");
  1916. }
  1917. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  1918. throw new TypeError("Invalid minor version");
  1919. }
  1920. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  1921. throw new TypeError("Invalid patch version");
  1922. }
  1923. if (!m[4]) {
  1924. this.prerelease = [];
  1925. } else {
  1926. this.prerelease = m[4].split(".").map((id) => {
  1927. if (/^[0-9]+$/.test(id)) {
  1928. const num = +id;
  1929. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  1930. return num;
  1931. }
  1932. }
  1933. return id;
  1934. });
  1935. }
  1936. this.build = m[5] ? m[5].split(".") : [];
  1937. this.format();
  1938. }
  1939. format() {
  1940. this.version = `${this.major}.${this.minor}.${this.patch}`;
  1941. if (this.prerelease.length) {
  1942. this.version += `-${this.prerelease.join(".")}`;
  1943. }
  1944. return this.version;
  1945. }
  1946. toString() {
  1947. return this.version;
  1948. }
  1949. compare(other) {
  1950. debug("SemVer.compare", this.version, this.options, other);
  1951. if (!(other instanceof SemVer)) {
  1952. if (typeof other === "string" && other === this.version) {
  1953. return 0;
  1954. }
  1955. other = new SemVer(other, this.options);
  1956. }
  1957. if (other.version === this.version) {
  1958. return 0;
  1959. }
  1960. return this.compareMain(other) || this.comparePre(other);
  1961. }
  1962. compareMain(other) {
  1963. if (!(other instanceof SemVer)) {
  1964. other = new SemVer(other, this.options);
  1965. }
  1966. return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
  1967. }
  1968. comparePre(other) {
  1969. if (!(other instanceof SemVer)) {
  1970. other = new SemVer(other, this.options);
  1971. }
  1972. if (this.prerelease.length && !other.prerelease.length) {
  1973. return -1;
  1974. } else if (!this.prerelease.length && other.prerelease.length) {
  1975. return 1;
  1976. } else if (!this.prerelease.length && !other.prerelease.length) {
  1977. return 0;
  1978. }
  1979. let i = 0;
  1980. do {
  1981. const a = this.prerelease[i];
  1982. const b = other.prerelease[i];
  1983. debug("prerelease compare", i, a, b);
  1984. if (a === void 0 && b === void 0) {
  1985. return 0;
  1986. } else if (b === void 0) {
  1987. return 1;
  1988. } else if (a === void 0) {
  1989. return -1;
  1990. } else if (a === b) {
  1991. continue;
  1992. } else {
  1993. return compareIdentifiers(a, b);
  1994. }
  1995. } while (++i);
  1996. }
  1997. compareBuild(other) {
  1998. if (!(other instanceof SemVer)) {
  1999. other = new SemVer(other, this.options);
  2000. }
  2001. let i = 0;
  2002. do {
  2003. const a = this.build[i];
  2004. const b = other.build[i];
  2005. debug("prerelease compare", i, a, b);
  2006. if (a === void 0 && b === void 0) {
  2007. return 0;
  2008. } else if (b === void 0) {
  2009. return 1;
  2010. } else if (a === void 0) {
  2011. return -1;
  2012. } else if (a === b) {
  2013. continue;
  2014. } else {
  2015. return compareIdentifiers(a, b);
  2016. }
  2017. } while (++i);
  2018. }
  2019. inc(release, identifier) {
  2020. switch (release) {
  2021. case "premajor":
  2022. this.prerelease.length = 0;
  2023. this.patch = 0;
  2024. this.minor = 0;
  2025. this.major++;
  2026. this.inc("pre", identifier);
  2027. break;
  2028. case "preminor":
  2029. this.prerelease.length = 0;
  2030. this.patch = 0;
  2031. this.minor++;
  2032. this.inc("pre", identifier);
  2033. break;
  2034. case "prepatch":
  2035. this.prerelease.length = 0;
  2036. this.inc("patch", identifier);
  2037. this.inc("pre", identifier);
  2038. break;
  2039. case "prerelease":
  2040. if (this.prerelease.length === 0) {
  2041. this.inc("patch", identifier);
  2042. }
  2043. this.inc("pre", identifier);
  2044. break;
  2045. case "major":
  2046. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
  2047. this.major++;
  2048. }
  2049. this.minor = 0;
  2050. this.patch = 0;
  2051. this.prerelease = [];
  2052. break;
  2053. case "minor":
  2054. if (this.patch !== 0 || this.prerelease.length === 0) {
  2055. this.minor++;
  2056. }
  2057. this.patch = 0;
  2058. this.prerelease = [];
  2059. break;
  2060. case "patch":
  2061. if (this.prerelease.length === 0) {
  2062. this.patch++;
  2063. }
  2064. this.prerelease = [];
  2065. break;
  2066. case "pre":
  2067. if (this.prerelease.length === 0) {
  2068. this.prerelease = [0];
  2069. } else {
  2070. let i = this.prerelease.length;
  2071. while (--i >= 0) {
  2072. if (typeof this.prerelease[i] === "number") {
  2073. this.prerelease[i]++;
  2074. i = -2;
  2075. }
  2076. }
  2077. if (i === -1) {
  2078. this.prerelease.push(0);
  2079. }
  2080. }
  2081. if (identifier) {
  2082. if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
  2083. if (isNaN(this.prerelease[1])) {
  2084. this.prerelease = [identifier, 0];
  2085. }
  2086. } else {
  2087. this.prerelease = [identifier, 0];
  2088. }
  2089. }
  2090. break;
  2091. default:
  2092. throw new Error(`invalid increment argument: ${release}`);
  2093. }
  2094. this.format();
  2095. this.raw = this.version;
  2096. return this;
  2097. }
  2098. };
  2099. module2.exports = SemVer;
  2100. }
  2101. });
  2102. var require_compare = __commonJS2({
  2103. "node_modules/semver/functions/compare.js"(exports2, module2) {
  2104. var SemVer = require_semver();
  2105. var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
  2106. module2.exports = compare;
  2107. }
  2108. });
  2109. var require_lt = __commonJS2({
  2110. "node_modules/semver/functions/lt.js"(exports2, module2) {
  2111. var compare = require_compare();
  2112. var lt = (a, b, loose) => compare(a, b, loose) < 0;
  2113. module2.exports = lt;
  2114. }
  2115. });
  2116. var require_gte = __commonJS2({
  2117. "node_modules/semver/functions/gte.js"(exports2, module2) {
  2118. var compare = require_compare();
  2119. var gte = (a, b, loose) => compare(a, b, loose) >= 0;
  2120. module2.exports = gte;
  2121. }
  2122. });
  2123. var require_arrayify = __commonJS2({
  2124. "src/utils/arrayify.js"(exports2, module2) {
  2125. "use strict";
  2126. module2.exports = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
  2127. [keyName]: key
  2128. }, value));
  2129. }
  2130. });
  2131. var require_lib = __commonJS2({
  2132. "node_modules/outdent/lib/index.js"(exports2, module2) {
  2133. "use strict";
  2134. Object.defineProperty(exports2, "__esModule", {
  2135. value: true
  2136. });
  2137. exports2.outdent = void 0;
  2138. function noop() {
  2139. var args = [];
  2140. for (var _i = 0; _i < arguments.length; _i++) {
  2141. args[_i] = arguments[_i];
  2142. }
  2143. }
  2144. function createWeakMap() {
  2145. if (typeof WeakMap !== "undefined") {
  2146. return /* @__PURE__ */ new WeakMap();
  2147. } else {
  2148. return fakeSetOrMap();
  2149. }
  2150. }
  2151. function fakeSetOrMap() {
  2152. return {
  2153. add: noop,
  2154. delete: noop,
  2155. get: noop,
  2156. set: noop,
  2157. has: function(k) {
  2158. return false;
  2159. }
  2160. };
  2161. }
  2162. var hop = Object.prototype.hasOwnProperty;
  2163. var has = function(obj, prop) {
  2164. return hop.call(obj, prop);
  2165. };
  2166. function extend(target, source) {
  2167. for (var prop in source) {
  2168. if (has(source, prop)) {
  2169. target[prop] = source[prop];
  2170. }
  2171. }
  2172. return target;
  2173. }
  2174. var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
  2175. var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
  2176. var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
  2177. var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
  2178. var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
  2179. function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
  2180. var indentationLevel = 0;
  2181. var match = strings[0].match(reDetectIndentation);
  2182. if (match) {
  2183. indentationLevel = match[1].length;
  2184. }
  2185. var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
  2186. var reMatchIndent = new RegExp(reSource, "g");
  2187. if (firstInterpolatedValueSetsIndentationLevel) {
  2188. strings = strings.slice(1);
  2189. }
  2190. var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
  2191. var normalizeNewlines = typeof newline === "string";
  2192. var l = strings.length;
  2193. var outdentedStrings = strings.map(function(v, i) {
  2194. v = v.replace(reMatchIndent, "$1");
  2195. if (i === 0 && trimLeadingNewline) {
  2196. v = v.replace(reLeadingNewline, "");
  2197. }
  2198. if (i === l - 1 && trimTrailingNewline) {
  2199. v = v.replace(reTrailingNewline, "");
  2200. }
  2201. if (normalizeNewlines) {
  2202. v = v.replace(/\r\n|\n|\r/g, function(_) {
  2203. return newline;
  2204. });
  2205. }
  2206. return v;
  2207. });
  2208. return outdentedStrings;
  2209. }
  2210. function concatStringsAndValues(strings, values) {
  2211. var ret = "";
  2212. for (var i = 0, l = strings.length; i < l; i++) {
  2213. ret += strings[i];
  2214. if (i < l - 1) {
  2215. ret += values[i];
  2216. }
  2217. }
  2218. return ret;
  2219. }
  2220. function isTemplateStringsArray(v) {
  2221. return has(v, "raw") && has(v, "length");
  2222. }
  2223. function createInstance(options) {
  2224. var arrayAutoIndentCache = createWeakMap();
  2225. var arrayFirstInterpSetsIndentCache = createWeakMap();
  2226. function outdent(stringsOrOptions) {
  2227. var values = [];
  2228. for (var _i = 1; _i < arguments.length; _i++) {
  2229. values[_i - 1] = arguments[_i];
  2230. }
  2231. if (isTemplateStringsArray(stringsOrOptions)) {
  2232. var strings = stringsOrOptions;
  2233. var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
  2234. var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
  2235. var renderedArray = cache.get(strings);
  2236. if (!renderedArray) {
  2237. renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
  2238. cache.set(strings, renderedArray);
  2239. }
  2240. if (values.length === 0) {
  2241. return renderedArray[0];
  2242. }
  2243. var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
  2244. return rendered;
  2245. } else {
  2246. return createInstance(extend(extend({}, options), stringsOrOptions || {}));
  2247. }
  2248. }
  2249. var fullOutdent = extend(outdent, {
  2250. string: function(str) {
  2251. return _outdentArray([str], false, options)[0];
  2252. }
  2253. });
  2254. return fullOutdent;
  2255. }
  2256. var defaultOutdent = createInstance({
  2257. trimLeadingNewline: true,
  2258. trimTrailingNewline: true
  2259. });
  2260. exports2.outdent = defaultOutdent;
  2261. exports2.default = defaultOutdent;
  2262. if (typeof module2 !== "undefined") {
  2263. try {
  2264. module2.exports = defaultOutdent;
  2265. Object.defineProperty(defaultOutdent, "__esModule", {
  2266. value: true
  2267. });
  2268. defaultOutdent.default = defaultOutdent;
  2269. defaultOutdent.outdent = defaultOutdent;
  2270. } catch (e) {
  2271. }
  2272. }
  2273. }
  2274. });
  2275. var require_core_options = __commonJS2({
  2276. "src/main/core-options.js"(exports2, module2) {
  2277. "use strict";
  2278. var {
  2279. outdent
  2280. } = require_lib();
  2281. var CATEGORY_CONFIG = "Config";
  2282. var CATEGORY_EDITOR = "Editor";
  2283. var CATEGORY_FORMAT = "Format";
  2284. var CATEGORY_OTHER = "Other";
  2285. var CATEGORY_OUTPUT = "Output";
  2286. var CATEGORY_GLOBAL = "Global";
  2287. var CATEGORY_SPECIAL = "Special";
  2288. var options = {
  2289. cursorOffset: {
  2290. since: "1.4.0",
  2291. category: CATEGORY_SPECIAL,
  2292. type: "int",
  2293. default: -1,
  2294. range: {
  2295. start: -1,
  2296. end: Number.POSITIVE_INFINITY,
  2297. step: 1
  2298. },
  2299. description: outdent`
  2300. Print (to stderr) where a cursor at the given position would move to after formatting.
  2301. This option cannot be used with --range-start and --range-end.
  2302. `,
  2303. cliCategory: CATEGORY_EDITOR
  2304. },
  2305. endOfLine: {
  2306. since: "1.15.0",
  2307. category: CATEGORY_GLOBAL,
  2308. type: "choice",
  2309. default: [{
  2310. since: "1.15.0",
  2311. value: "auto"
  2312. }, {
  2313. since: "2.0.0",
  2314. value: "lf"
  2315. }],
  2316. description: "Which end of line characters to apply.",
  2317. choices: [{
  2318. value: "lf",
  2319. description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
  2320. }, {
  2321. value: "crlf",
  2322. description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
  2323. }, {
  2324. value: "cr",
  2325. description: "Carriage Return character only (\\r), used very rarely"
  2326. }, {
  2327. value: "auto",
  2328. description: outdent`
  2329. Maintain existing
  2330. (mixed values within one file are normalised by looking at what's used after the first line)
  2331. `
  2332. }]
  2333. },
  2334. filepath: {
  2335. since: "1.4.0",
  2336. category: CATEGORY_SPECIAL,
  2337. type: "path",
  2338. description: "Specify the input filepath. This will be used to do parser inference.",
  2339. cliName: "stdin-filepath",
  2340. cliCategory: CATEGORY_OTHER,
  2341. cliDescription: "Path to the file to pretend that stdin comes from."
  2342. },
  2343. insertPragma: {
  2344. since: "1.8.0",
  2345. category: CATEGORY_SPECIAL,
  2346. type: "boolean",
  2347. default: false,
  2348. description: "Insert @format pragma into file's first docblock comment.",
  2349. cliCategory: CATEGORY_OTHER
  2350. },
  2351. parser: {
  2352. since: "0.0.10",
  2353. category: CATEGORY_GLOBAL,
  2354. type: "choice",
  2355. default: [{
  2356. since: "0.0.10",
  2357. value: "babylon"
  2358. }, {
  2359. since: "1.13.0",
  2360. value: void 0
  2361. }],
  2362. description: "Which parser to use.",
  2363. exception: (value) => typeof value === "string" || typeof value === "function",
  2364. choices: [{
  2365. value: "flow",
  2366. description: "Flow"
  2367. }, {
  2368. value: "babel",
  2369. since: "1.16.0",
  2370. description: "JavaScript"
  2371. }, {
  2372. value: "babel-flow",
  2373. since: "1.16.0",
  2374. description: "Flow"
  2375. }, {
  2376. value: "babel-ts",
  2377. since: "2.0.0",
  2378. description: "TypeScript"
  2379. }, {
  2380. value: "typescript",
  2381. since: "1.4.0",
  2382. description: "TypeScript"
  2383. }, {
  2384. value: "acorn",
  2385. since: "2.6.0",
  2386. description: "JavaScript"
  2387. }, {
  2388. value: "espree",
  2389. since: "2.2.0",
  2390. description: "JavaScript"
  2391. }, {
  2392. value: "meriyah",
  2393. since: "2.2.0",
  2394. description: "JavaScript"
  2395. }, {
  2396. value: "css",
  2397. since: "1.7.1",
  2398. description: "CSS"
  2399. }, {
  2400. value: "less",
  2401. since: "1.7.1",
  2402. description: "Less"
  2403. }, {
  2404. value: "scss",
  2405. since: "1.7.1",
  2406. description: "SCSS"
  2407. }, {
  2408. value: "json",
  2409. since: "1.5.0",
  2410. description: "JSON"
  2411. }, {
  2412. value: "json5",
  2413. since: "1.13.0",
  2414. description: "JSON5"
  2415. }, {
  2416. value: "json-stringify",
  2417. since: "1.13.0",
  2418. description: "JSON.stringify"
  2419. }, {
  2420. value: "graphql",
  2421. since: "1.5.0",
  2422. description: "GraphQL"
  2423. }, {
  2424. value: "markdown",
  2425. since: "1.8.0",
  2426. description: "Markdown"
  2427. }, {
  2428. value: "mdx",
  2429. since: "1.15.0",
  2430. description: "MDX"
  2431. }, {
  2432. value: "vue",
  2433. since: "1.10.0",
  2434. description: "Vue"
  2435. }, {
  2436. value: "yaml",
  2437. since: "1.14.0",
  2438. description: "YAML"
  2439. }, {
  2440. value: "glimmer",
  2441. since: "2.3.0",
  2442. description: "Ember / Handlebars"
  2443. }, {
  2444. value: "html",
  2445. since: "1.15.0",
  2446. description: "HTML"
  2447. }, {
  2448. value: "angular",
  2449. since: "1.15.0",
  2450. description: "Angular"
  2451. }, {
  2452. value: "lwc",
  2453. since: "1.17.0",
  2454. description: "Lightning Web Components"
  2455. }]
  2456. },
  2457. plugins: {
  2458. since: "1.10.0",
  2459. type: "path",
  2460. array: true,
  2461. default: [{
  2462. value: []
  2463. }],
  2464. category: CATEGORY_GLOBAL,
  2465. description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
  2466. exception: (value) => typeof value === "string" || typeof value === "object",
  2467. cliName: "plugin",
  2468. cliCategory: CATEGORY_CONFIG
  2469. },
  2470. pluginSearchDirs: {
  2471. since: "1.13.0",
  2472. type: "path",
  2473. array: true,
  2474. default: [{
  2475. value: []
  2476. }],
  2477. category: CATEGORY_GLOBAL,
  2478. description: outdent`
  2479. Custom directory that contains prettier plugins in node_modules subdirectory.
  2480. Overrides default behavior when plugins are searched relatively to the location of Prettier.
  2481. Multiple values are accepted.
  2482. `,
  2483. exception: (value) => typeof value === "string" || typeof value === "object",
  2484. cliName: "plugin-search-dir",
  2485. cliCategory: CATEGORY_CONFIG
  2486. },
  2487. printWidth: {
  2488. since: "0.0.0",
  2489. category: CATEGORY_GLOBAL,
  2490. type: "int",
  2491. default: 80,
  2492. description: "The line length where Prettier will try wrap.",
  2493. range: {
  2494. start: 0,
  2495. end: Number.POSITIVE_INFINITY,
  2496. step: 1
  2497. }
  2498. },
  2499. rangeEnd: {
  2500. since: "1.4.0",
  2501. category: CATEGORY_SPECIAL,
  2502. type: "int",
  2503. default: Number.POSITIVE_INFINITY,
  2504. range: {
  2505. start: 0,
  2506. end: Number.POSITIVE_INFINITY,
  2507. step: 1
  2508. },
  2509. description: outdent`
  2510. Format code ending at a given character offset (exclusive).
  2511. The range will extend forwards to the end of the selected statement.
  2512. This option cannot be used with --cursor-offset.
  2513. `,
  2514. cliCategory: CATEGORY_EDITOR
  2515. },
  2516. rangeStart: {
  2517. since: "1.4.0",
  2518. category: CATEGORY_SPECIAL,
  2519. type: "int",
  2520. default: 0,
  2521. range: {
  2522. start: 0,
  2523. end: Number.POSITIVE_INFINITY,
  2524. step: 1
  2525. },
  2526. description: outdent`
  2527. Format code starting at a given character offset.
  2528. The range will extend backwards to the start of the first line containing the selected statement.
  2529. This option cannot be used with --cursor-offset.
  2530. `,
  2531. cliCategory: CATEGORY_EDITOR
  2532. },
  2533. requirePragma: {
  2534. since: "1.7.0",
  2535. category: CATEGORY_SPECIAL,
  2536. type: "boolean",
  2537. default: false,
  2538. description: outdent`
  2539. Require either '@prettier' or '@format' to be present in the file's first docblock comment
  2540. in order for it to be formatted.
  2541. `,
  2542. cliCategory: CATEGORY_OTHER
  2543. },
  2544. tabWidth: {
  2545. type: "int",
  2546. category: CATEGORY_GLOBAL,
  2547. default: 2,
  2548. description: "Number of spaces per indentation level.",
  2549. range: {
  2550. start: 0,
  2551. end: Number.POSITIVE_INFINITY,
  2552. step: 1
  2553. }
  2554. },
  2555. useTabs: {
  2556. since: "1.0.0",
  2557. category: CATEGORY_GLOBAL,
  2558. type: "boolean",
  2559. default: false,
  2560. description: "Indent with tabs instead of spaces."
  2561. },
  2562. embeddedLanguageFormatting: {
  2563. since: "2.1.0",
  2564. category: CATEGORY_GLOBAL,
  2565. type: "choice",
  2566. default: [{
  2567. since: "2.1.0",
  2568. value: "auto"
  2569. }],
  2570. description: "Control how Prettier formats quoted code embedded in the file.",
  2571. choices: [{
  2572. value: "auto",
  2573. description: "Format embedded code if Prettier can automatically identify it."
  2574. }, {
  2575. value: "off",
  2576. description: "Never automatically format embedded code."
  2577. }]
  2578. }
  2579. };
  2580. module2.exports = {
  2581. CATEGORY_CONFIG,
  2582. CATEGORY_EDITOR,
  2583. CATEGORY_FORMAT,
  2584. CATEGORY_OTHER,
  2585. CATEGORY_OUTPUT,
  2586. CATEGORY_GLOBAL,
  2587. CATEGORY_SPECIAL,
  2588. options
  2589. };
  2590. }
  2591. });
  2592. var require_support = __commonJS2({
  2593. "src/main/support.js"(exports2, module2) {
  2594. "use strict";
  2595. var semver = {
  2596. compare: require_compare(),
  2597. lt: require_lt(),
  2598. gte: require_gte()
  2599. };
  2600. var arrayify = require_arrayify();
  2601. var currentVersion = require("./package.json").version;
  2602. var coreOptions = require_core_options().options;
  2603. function getSupportInfo2({
  2604. plugins: plugins2 = [],
  2605. showUnreleased = false,
  2606. showDeprecated = false,
  2607. showInternal = false
  2608. } = {}) {
  2609. const version2 = currentVersion.split("-", 1)[0];
  2610. const languages = plugins2.flatMap((plugin) => plugin.languages || []).filter(filterSince);
  2611. const options = arrayify(Object.assign({}, ...plugins2.map(({
  2612. options: options2
  2613. }) => options2), coreOptions), "name").filter((option) => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map((option) => {
  2614. option = Object.assign({}, option);
  2615. if (Array.isArray(option.default)) {
  2616. option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver.compare(info2.since, info1.since))[0].value;
  2617. }
  2618. if (Array.isArray(option.choices)) {
  2619. option.choices = option.choices.filter((option2) => filterSince(option2) && filterDeprecated(option2));
  2620. if (option.name === "parser") {
  2621. collectParsersFromLanguages(option, languages, plugins2);
  2622. }
  2623. }
  2624. const pluginDefaults = Object.fromEntries(plugins2.filter((plugin) => plugin.defaultOptions && plugin.defaultOptions[option.name] !== void 0).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]]));
  2625. return Object.assign(Object.assign({}, option), {}, {
  2626. pluginDefaults
  2627. });
  2628. });
  2629. return {
  2630. languages,
  2631. options
  2632. };
  2633. function filterSince(object) {
  2634. return showUnreleased || !("since" in object) || object.since && semver.gte(version2, object.since);
  2635. }
  2636. function filterDeprecated(object) {
  2637. return showDeprecated || !("deprecated" in object) || object.deprecated && semver.lt(version2, object.deprecated);
  2638. }
  2639. function mapInternal(object) {
  2640. if (showInternal) {
  2641. return object;
  2642. }
  2643. const {
  2644. cliName,
  2645. cliCategory,
  2646. cliDescription
  2647. } = object, newObject = _objectWithoutProperties(object, _excluded);
  2648. return newObject;
  2649. }
  2650. }
  2651. function collectParsersFromLanguages(option, languages, plugins2) {
  2652. const existingValues = new Set(option.choices.map((choice) => choice.value));
  2653. for (const language of languages) {
  2654. if (language.parsers) {
  2655. for (const value of language.parsers) {
  2656. if (!existingValues.has(value)) {
  2657. existingValues.add(value);
  2658. const plugin = plugins2.find((plugin2) => plugin2.parsers && plugin2.parsers[value]);
  2659. let description = language.name;
  2660. if (plugin && plugin.name) {
  2661. description += ` (plugin: ${plugin.name})`;
  2662. }
  2663. option.choices.push({
  2664. value,
  2665. description
  2666. });
  2667. }
  2668. }
  2669. }
  2670. }
  2671. }
  2672. module2.exports = {
  2673. getSupportInfo: getSupportInfo2
  2674. };
  2675. }
  2676. });
  2677. var require_is_non_empty_array = __commonJS2({
  2678. "src/utils/is-non-empty-array.js"(exports2, module2) {
  2679. "use strict";
  2680. function isNonEmptyArray(object) {
  2681. return Array.isArray(object) && object.length > 0;
  2682. }
  2683. module2.exports = isNonEmptyArray;
  2684. }
  2685. });
  2686. function ansiRegex({
  2687. onlyFirst = false
  2688. } = {}) {
  2689. const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
  2690. return new RegExp(pattern, onlyFirst ? void 0 : "g");
  2691. }
  2692. var init_ansi_regex = __esm({
  2693. "node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
  2694. }
  2695. });
  2696. function stripAnsi(string) {
  2697. if (typeof string !== "string") {
  2698. throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
  2699. }
  2700. return string.replace(ansiRegex(), "");
  2701. }
  2702. var init_strip_ansi = __esm({
  2703. "node_modules/strip-ansi/index.js"() {
  2704. init_ansi_regex();
  2705. }
  2706. });
  2707. function isFullwidthCodePoint(codePoint) {
  2708. if (!Number.isInteger(codePoint)) {
  2709. return false;
  2710. }
  2711. return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141);
  2712. }
  2713. var init_is_fullwidth_code_point = __esm({
  2714. "node_modules/is-fullwidth-code-point/index.js"() {
  2715. }
  2716. });
  2717. var require_emoji_regex = __commonJS2({
  2718. "node_modules/emoji-regex/index.js"(exports2, module2) {
  2719. "use strict";
  2720. module2.exports = function() {
  2721. return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  2722. };
  2723. }
  2724. });
  2725. var string_width_exports = {};
  2726. __export(string_width_exports, {
  2727. default: () => stringWidth
  2728. });
  2729. function stringWidth(string) {
  2730. if (typeof string !== "string" || string.length === 0) {
  2731. return 0;
  2732. }
  2733. string = stripAnsi(string);
  2734. if (string.length === 0) {
  2735. return 0;
  2736. }
  2737. string = string.replace((0, import_emoji_regex.default)(), " ");
  2738. let width = 0;
  2739. for (let index = 0; index < string.length; index++) {
  2740. const codePoint = string.codePointAt(index);
  2741. if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
  2742. continue;
  2743. }
  2744. if (codePoint >= 768 && codePoint <= 879) {
  2745. continue;
  2746. }
  2747. if (codePoint > 65535) {
  2748. index++;
  2749. }
  2750. width += isFullwidthCodePoint(codePoint) ? 2 : 1;
  2751. }
  2752. return width;
  2753. }
  2754. var import_emoji_regex;
  2755. var init_string_width = __esm({
  2756. "node_modules/string-width/index.js"() {
  2757. init_strip_ansi();
  2758. init_is_fullwidth_code_point();
  2759. import_emoji_regex = __toESM(require_emoji_regex());
  2760. }
  2761. });
  2762. var require_get_string_width = __commonJS2({
  2763. "src/utils/get-string-width.js"(exports2, module2) {
  2764. "use strict";
  2765. var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
  2766. var notAsciiRegex = /[^\x20-\x7F]/;
  2767. function getStringWidth(text) {
  2768. if (!text) {
  2769. return 0;
  2770. }
  2771. if (!notAsciiRegex.test(text)) {
  2772. return text.length;
  2773. }
  2774. return stringWidth2(text);
  2775. }
  2776. module2.exports = getStringWidth;
  2777. }
  2778. });
  2779. var require_skip = __commonJS2({
  2780. "src/utils/text/skip.js"(exports2, module2) {
  2781. "use strict";
  2782. function skip(chars) {
  2783. return (text, index, opts) => {
  2784. const backwards = opts && opts.backwards;
  2785. if (index === false) {
  2786. return false;
  2787. }
  2788. const {
  2789. length
  2790. } = text;
  2791. let cursor = index;
  2792. while (cursor >= 0 && cursor < length) {
  2793. const c = text.charAt(cursor);
  2794. if (chars instanceof RegExp) {
  2795. if (!chars.test(c)) {
  2796. return cursor;
  2797. }
  2798. } else if (!chars.includes(c)) {
  2799. return cursor;
  2800. }
  2801. backwards ? cursor-- : cursor++;
  2802. }
  2803. if (cursor === -1 || cursor === length) {
  2804. return cursor;
  2805. }
  2806. return false;
  2807. };
  2808. }
  2809. var skipWhitespace = skip(/\s/);
  2810. var skipSpaces = skip(" ");
  2811. var skipToLineEnd = skip(",; ");
  2812. var skipEverythingButNewLine = skip(/[^\n\r]/);
  2813. module2.exports = {
  2814. skipWhitespace,
  2815. skipSpaces,
  2816. skipToLineEnd,
  2817. skipEverythingButNewLine
  2818. };
  2819. }
  2820. });
  2821. var require_skip_inline_comment = __commonJS2({
  2822. "src/utils/text/skip-inline-comment.js"(exports2, module2) {
  2823. "use strict";
  2824. function skipInlineComment(text, index) {
  2825. if (index === false) {
  2826. return false;
  2827. }
  2828. if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
  2829. for (let i = index + 2; i < text.length; ++i) {
  2830. if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
  2831. return i + 2;
  2832. }
  2833. }
  2834. }
  2835. return index;
  2836. }
  2837. module2.exports = skipInlineComment;
  2838. }
  2839. });
  2840. var require_skip_trailing_comment = __commonJS2({
  2841. "src/utils/text/skip-trailing-comment.js"(exports2, module2) {
  2842. "use strict";
  2843. var {
  2844. skipEverythingButNewLine
  2845. } = require_skip();
  2846. function skipTrailingComment(text, index) {
  2847. if (index === false) {
  2848. return false;
  2849. }
  2850. if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
  2851. return skipEverythingButNewLine(text, index);
  2852. }
  2853. return index;
  2854. }
  2855. module2.exports = skipTrailingComment;
  2856. }
  2857. });
  2858. var require_skip_newline = __commonJS2({
  2859. "src/utils/text/skip-newline.js"(exports2, module2) {
  2860. "use strict";
  2861. function skipNewline(text, index, opts) {
  2862. const backwards = opts && opts.backwards;
  2863. if (index === false) {
  2864. return false;
  2865. }
  2866. const atIndex = text.charAt(index);
  2867. if (backwards) {
  2868. if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
  2869. return index - 2;
  2870. }
  2871. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  2872. return index - 1;
  2873. }
  2874. } else {
  2875. if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
  2876. return index + 2;
  2877. }
  2878. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  2879. return index + 1;
  2880. }
  2881. }
  2882. return index;
  2883. }
  2884. module2.exports = skipNewline;
  2885. }
  2886. });
  2887. var require_get_next_non_space_non_comment_character_index_with_start_index = __commonJS2({
  2888. "src/utils/text/get-next-non-space-non-comment-character-index-with-start-index.js"(exports2, module2) {
  2889. "use strict";
  2890. var skipInlineComment = require_skip_inline_comment();
  2891. var skipNewline = require_skip_newline();
  2892. var skipTrailingComment = require_skip_trailing_comment();
  2893. var {
  2894. skipSpaces
  2895. } = require_skip();
  2896. function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
  2897. let oldIdx = null;
  2898. let nextIdx = idx;
  2899. while (nextIdx !== oldIdx) {
  2900. oldIdx = nextIdx;
  2901. nextIdx = skipSpaces(text, nextIdx);
  2902. nextIdx = skipInlineComment(text, nextIdx);
  2903. nextIdx = skipTrailingComment(text, nextIdx);
  2904. nextIdx = skipNewline(text, nextIdx);
  2905. }
  2906. return nextIdx;
  2907. }
  2908. module2.exports = getNextNonSpaceNonCommentCharacterIndexWithStartIndex;
  2909. }
  2910. });
  2911. var require_util = __commonJS2({
  2912. "src/common/util.js"(exports2, module2) {
  2913. "use strict";
  2914. var {
  2915. default: escapeStringRegexp2
  2916. } = (init_escape_string_regexp(), __toCommonJS(escape_string_regexp_exports));
  2917. var getLast = require_get_last();
  2918. var {
  2919. getSupportInfo: getSupportInfo2
  2920. } = require_support();
  2921. var isNonEmptyArray = require_is_non_empty_array();
  2922. var getStringWidth = require_get_string_width();
  2923. var {
  2924. skipWhitespace,
  2925. skipSpaces,
  2926. skipToLineEnd,
  2927. skipEverythingButNewLine
  2928. } = require_skip();
  2929. var skipInlineComment = require_skip_inline_comment();
  2930. var skipTrailingComment = require_skip_trailing_comment();
  2931. var skipNewline = require_skip_newline();
  2932. var getNextNonSpaceNonCommentCharacterIndexWithStartIndex = require_get_next_non_space_non_comment_character_index_with_start_index();
  2933. var getPenultimate = (arr) => arr[arr.length - 2];
  2934. function skip(chars) {
  2935. return (text, index, opts) => {
  2936. const backwards = opts && opts.backwards;
  2937. if (index === false) {
  2938. return false;
  2939. }
  2940. const {
  2941. length
  2942. } = text;
  2943. let cursor = index;
  2944. while (cursor >= 0 && cursor < length) {
  2945. const c = text.charAt(cursor);
  2946. if (chars instanceof RegExp) {
  2947. if (!chars.test(c)) {
  2948. return cursor;
  2949. }
  2950. } else if (!chars.includes(c)) {
  2951. return cursor;
  2952. }
  2953. backwards ? cursor-- : cursor++;
  2954. }
  2955. if (cursor === -1 || cursor === length) {
  2956. return cursor;
  2957. }
  2958. return false;
  2959. };
  2960. }
  2961. function hasNewline(text, index, opts = {}) {
  2962. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  2963. const idx2 = skipNewline(text, idx, opts);
  2964. return idx !== idx2;
  2965. }
  2966. function hasNewlineInRange(text, start, end) {
  2967. for (let i = start; i < end; ++i) {
  2968. if (text.charAt(i) === "\n") {
  2969. return true;
  2970. }
  2971. }
  2972. return false;
  2973. }
  2974. function isPreviousLineEmpty(text, node, locStart) {
  2975. let idx = locStart(node) - 1;
  2976. idx = skipSpaces(text, idx, {
  2977. backwards: true
  2978. });
  2979. idx = skipNewline(text, idx, {
  2980. backwards: true
  2981. });
  2982. idx = skipSpaces(text, idx, {
  2983. backwards: true
  2984. });
  2985. const idx2 = skipNewline(text, idx, {
  2986. backwards: true
  2987. });
  2988. return idx !== idx2;
  2989. }
  2990. function isNextLineEmptyAfterIndex(text, index) {
  2991. let oldIdx = null;
  2992. let idx = index;
  2993. while (idx !== oldIdx) {
  2994. oldIdx = idx;
  2995. idx = skipToLineEnd(text, idx);
  2996. idx = skipInlineComment(text, idx);
  2997. idx = skipSpaces(text, idx);
  2998. }
  2999. idx = skipTrailingComment(text, idx);
  3000. idx = skipNewline(text, idx);
  3001. return idx !== false && hasNewline(text, idx);
  3002. }
  3003. function isNextLineEmpty(text, node, locEnd) {
  3004. return isNextLineEmptyAfterIndex(text, locEnd(node));
  3005. }
  3006. function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
  3007. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
  3008. }
  3009. function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
  3010. return text.charAt(getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
  3011. }
  3012. function hasSpaces(text, index, opts = {}) {
  3013. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  3014. return idx !== index;
  3015. }
  3016. function getAlignmentSize(value, tabWidth, startIndex = 0) {
  3017. let size = 0;
  3018. for (let i = startIndex; i < value.length; ++i) {
  3019. if (value[i] === " ") {
  3020. size = size + tabWidth - size % tabWidth;
  3021. } else {
  3022. size++;
  3023. }
  3024. }
  3025. return size;
  3026. }
  3027. function getIndentSize(value, tabWidth) {
  3028. const lastNewlineIndex = value.lastIndexOf("\n");
  3029. if (lastNewlineIndex === -1) {
  3030. return 0;
  3031. }
  3032. return getAlignmentSize(value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
  3033. }
  3034. function getPreferredQuote(rawContent, preferredQuote) {
  3035. const double = {
  3036. quote: '"',
  3037. regex: /"/g,
  3038. escaped: "&quot;"
  3039. };
  3040. const single = {
  3041. quote: "'",
  3042. regex: /'/g,
  3043. escaped: "&apos;"
  3044. };
  3045. const preferred = preferredQuote === "'" ? single : double;
  3046. const alternate = preferred === single ? double : single;
  3047. let result = preferred;
  3048. if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
  3049. const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
  3050. const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
  3051. result = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;
  3052. }
  3053. return result;
  3054. }
  3055. function printString(raw, options) {
  3056. const rawContent = raw.slice(1, -1);
  3057. const enclosingQuote = options.parser === "json" || options.parser === "json5" && options.quoteProps === "preserve" && !options.singleQuote ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(rawContent, options.singleQuote ? "'" : '"').quote;
  3058. return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.__embeddedInHtml));
  3059. }
  3060. function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
  3061. const otherQuote = enclosingQuote === '"' ? "'" : '"';
  3062. const regex = /\\(.)|(["'])/gs;
  3063. const newContent = rawContent.replace(regex, (match, escaped, quote) => {
  3064. if (escaped === otherQuote) {
  3065. return escaped;
  3066. }
  3067. if (quote === enclosingQuote) {
  3068. return "\\" + quote;
  3069. }
  3070. if (quote) {
  3071. return quote;
  3072. }
  3073. return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
  3074. });
  3075. return enclosingQuote + newContent + enclosingQuote;
  3076. }
  3077. function printNumber(rawNumber) {
  3078. return rawNumber.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3").replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1").replace(/^([+-])?\./, "$10.").replace(/(\.\d+?)0+(?=e|$)/, "$1").replace(/\.(?=e|$)/, "");
  3079. }
  3080. function getMaxContinuousCount(str, target) {
  3081. const results = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3082. if (results === null) {
  3083. return 0;
  3084. }
  3085. return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
  3086. }
  3087. function getMinNotPresentContinuousCount(str, target) {
  3088. const matches = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3089. if (matches === null) {
  3090. return 0;
  3091. }
  3092. const countPresent = /* @__PURE__ */ new Map();
  3093. let max = 0;
  3094. for (const match of matches) {
  3095. const count = match.length / target.length;
  3096. countPresent.set(count, true);
  3097. if (count > max) {
  3098. max = count;
  3099. }
  3100. }
  3101. for (let i = 1; i < max; i++) {
  3102. if (!countPresent.get(i)) {
  3103. return i;
  3104. }
  3105. }
  3106. return max + 1;
  3107. }
  3108. function addCommentHelper(node, comment) {
  3109. const comments = node.comments || (node.comments = []);
  3110. comments.push(comment);
  3111. comment.printed = false;
  3112. comment.nodeDescription = describeNodeForDebugging(node);
  3113. }
  3114. function addLeadingComment(node, comment) {
  3115. comment.leading = true;
  3116. comment.trailing = false;
  3117. addCommentHelper(node, comment);
  3118. }
  3119. function addDanglingComment(node, comment, marker) {
  3120. comment.leading = false;
  3121. comment.trailing = false;
  3122. if (marker) {
  3123. comment.marker = marker;
  3124. }
  3125. addCommentHelper(node, comment);
  3126. }
  3127. function addTrailingComment(node, comment) {
  3128. comment.leading = false;
  3129. comment.trailing = true;
  3130. addCommentHelper(node, comment);
  3131. }
  3132. function inferParserByLanguage(language, options) {
  3133. const {
  3134. languages
  3135. } = getSupportInfo2({
  3136. plugins: options.plugins
  3137. });
  3138. const matched = languages.find(({
  3139. name
  3140. }) => name.toLowerCase() === language) || languages.find(({
  3141. aliases
  3142. }) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
  3143. extensions
  3144. }) => Array.isArray(extensions) && extensions.includes(`.${language}`));
  3145. return matched && matched.parsers[0];
  3146. }
  3147. function isFrontMatterNode(node) {
  3148. return node && node.type === "front-matter";
  3149. }
  3150. function createGroupIdMapper(description) {
  3151. const groupIds = /* @__PURE__ */ new WeakMap();
  3152. return function(node) {
  3153. if (!groupIds.has(node)) {
  3154. groupIds.set(node, Symbol(description));
  3155. }
  3156. return groupIds.get(node);
  3157. };
  3158. }
  3159. function describeNodeForDebugging(node) {
  3160. const nodeType = node.type || node.kind || "(unknown type)";
  3161. let nodeName = String(node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "");
  3162. if (nodeName.length > 20) {
  3163. nodeName = nodeName.slice(0, 19) + "\u2026";
  3164. }
  3165. return nodeType + (nodeName ? " " + nodeName : "");
  3166. }
  3167. module2.exports = {
  3168. inferParserByLanguage,
  3169. getStringWidth,
  3170. getMaxContinuousCount,
  3171. getMinNotPresentContinuousCount,
  3172. getPenultimate,
  3173. getLast,
  3174. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  3175. getNextNonSpaceNonCommentCharacterIndex,
  3176. getNextNonSpaceNonCommentCharacter,
  3177. skip,
  3178. skipWhitespace,
  3179. skipSpaces,
  3180. skipToLineEnd,
  3181. skipEverythingButNewLine,
  3182. skipInlineComment,
  3183. skipTrailingComment,
  3184. skipNewline,
  3185. isNextLineEmptyAfterIndex,
  3186. isNextLineEmpty,
  3187. isPreviousLineEmpty,
  3188. hasNewline,
  3189. hasNewlineInRange,
  3190. hasSpaces,
  3191. getAlignmentSize,
  3192. getIndentSize,
  3193. getPreferredQuote,
  3194. printString,
  3195. printNumber,
  3196. makeString,
  3197. addLeadingComment,
  3198. addDanglingComment,
  3199. addTrailingComment,
  3200. isFrontMatterNode,
  3201. isNonEmptyArray,
  3202. createGroupIdMapper
  3203. };
  3204. }
  3205. });
  3206. var require_end_of_line = __commonJS2({
  3207. "src/common/end-of-line.js"(exports2, module2) {
  3208. "use strict";
  3209. function guessEndOfLine(text) {
  3210. const index = text.indexOf("\r");
  3211. if (index >= 0) {
  3212. return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
  3213. }
  3214. return "lf";
  3215. }
  3216. function convertEndOfLineToChars(value) {
  3217. switch (value) {
  3218. case "cr":
  3219. return "\r";
  3220. case "crlf":
  3221. return "\r\n";
  3222. default:
  3223. return "\n";
  3224. }
  3225. }
  3226. function countEndOfLineChars(text, eol) {
  3227. let regex;
  3228. switch (eol) {
  3229. case "\n":
  3230. regex = /\n/g;
  3231. break;
  3232. case "\r":
  3233. regex = /\r/g;
  3234. break;
  3235. case "\r\n":
  3236. regex = /\r\n/g;
  3237. break;
  3238. default:
  3239. throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
  3240. }
  3241. const endOfLines = text.match(regex);
  3242. return endOfLines ? endOfLines.length : 0;
  3243. }
  3244. function normalizeEndOfLine(text) {
  3245. return text.replace(/\r\n?/g, "\n");
  3246. }
  3247. module2.exports = {
  3248. guessEndOfLine,
  3249. convertEndOfLineToChars,
  3250. countEndOfLineChars,
  3251. normalizeEndOfLine
  3252. };
  3253. }
  3254. });
  3255. var require_errors = __commonJS2({
  3256. "src/common/errors.js"(exports2, module2) {
  3257. "use strict";
  3258. var ConfigError = class extends Error {
  3259. };
  3260. var DebugError = class extends Error {
  3261. };
  3262. var UndefinedParserError = class extends Error {
  3263. };
  3264. var ArgExpansionBailout = class extends Error {
  3265. };
  3266. module2.exports = {
  3267. ConfigError,
  3268. DebugError,
  3269. UndefinedParserError,
  3270. ArgExpansionBailout
  3271. };
  3272. }
  3273. });
  3274. var tslib_es6_exports = {};
  3275. __export(tslib_es6_exports, {
  3276. __assign: () => __assign,
  3277. __asyncDelegator: () => __asyncDelegator,
  3278. __asyncGenerator: () => __asyncGenerator,
  3279. __asyncValues: () => __asyncValues,
  3280. __await: () => __await,
  3281. __awaiter: () => __awaiter,
  3282. __classPrivateFieldGet: () => __classPrivateFieldGet,
  3283. __classPrivateFieldSet: () => __classPrivateFieldSet,
  3284. __createBinding: () => __createBinding,
  3285. __decorate: () => __decorate,
  3286. __exportStar: () => __exportStar,
  3287. __extends: () => __extends,
  3288. __generator: () => __generator,
  3289. __importDefault: () => __importDefault,
  3290. __importStar: () => __importStar,
  3291. __makeTemplateObject: () => __makeTemplateObject,
  3292. __metadata: () => __metadata,
  3293. __param: () => __param,
  3294. __read: () => __read,
  3295. __rest: () => __rest,
  3296. __spread: () => __spread,
  3297. __spreadArrays: () => __spreadArrays,
  3298. __values: () => __values
  3299. });
  3300. function __extends(d, b) {
  3301. extendStatics(d, b);
  3302. function __() {
  3303. this.constructor = d;
  3304. }
  3305. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3306. }
  3307. function __rest(s, e) {
  3308. var t = {};
  3309. for (var p in s)
  3310. if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  3311. t[p] = s[p];
  3312. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  3313. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  3314. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  3315. t[p[i]] = s[p[i]];
  3316. }
  3317. return t;
  3318. }
  3319. function __decorate(decorators, target, key, desc) {
  3320. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3321. if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
  3322. r = Reflect.decorate(decorators, target, key, desc);
  3323. else
  3324. for (var i = decorators.length - 1; i >= 0; i--)
  3325. if (d = decorators[i])
  3326. r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3327. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3328. }
  3329. function __param(paramIndex, decorator) {
  3330. return function(target, key) {
  3331. decorator(target, key, paramIndex);
  3332. };
  3333. }
  3334. function __metadata(metadataKey, metadataValue) {
  3335. if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
  3336. return Reflect.metadata(metadataKey, metadataValue);
  3337. }
  3338. function __awaiter(thisArg, _arguments, P, generator) {
  3339. function adopt(value) {
  3340. return value instanceof P ? value : new P(function(resolve) {
  3341. resolve(value);
  3342. });
  3343. }
  3344. return new (P || (P = Promise))(function(resolve, reject) {
  3345. function fulfilled(value) {
  3346. try {
  3347. step(generator.next(value));
  3348. } catch (e) {
  3349. reject(e);
  3350. }
  3351. }
  3352. function rejected(value) {
  3353. try {
  3354. step(generator["throw"](value));
  3355. } catch (e) {
  3356. reject(e);
  3357. }
  3358. }
  3359. function step(result) {
  3360. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  3361. }
  3362. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3363. });
  3364. }
  3365. function __generator(thisArg, body) {
  3366. var _ = {
  3367. label: 0,
  3368. sent: function() {
  3369. if (t[0] & 1)
  3370. throw t[1];
  3371. return t[1];
  3372. },
  3373. trys: [],
  3374. ops: []
  3375. }, f, y, t, g;
  3376. return g = {
  3377. next: verb(0),
  3378. "throw": verb(1),
  3379. "return": verb(2)
  3380. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  3381. return this;
  3382. }), g;
  3383. function verb(n) {
  3384. return function(v) {
  3385. return step([n, v]);
  3386. };
  3387. }
  3388. function step(op) {
  3389. if (f)
  3390. throw new TypeError("Generator is already executing.");
  3391. while (_)
  3392. try {
  3393. 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)
  3394. return t;
  3395. if (y = 0, t)
  3396. op = [op[0] & 2, t.value];
  3397. switch (op[0]) {
  3398. case 0:
  3399. case 1:
  3400. t = op;
  3401. break;
  3402. case 4:
  3403. _.label++;
  3404. return {
  3405. value: op[1],
  3406. done: false
  3407. };
  3408. case 5:
  3409. _.label++;
  3410. y = op[1];
  3411. op = [0];
  3412. continue;
  3413. case 7:
  3414. op = _.ops.pop();
  3415. _.trys.pop();
  3416. continue;
  3417. default:
  3418. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  3419. _ = 0;
  3420. continue;
  3421. }
  3422. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  3423. _.label = op[1];
  3424. break;
  3425. }
  3426. if (op[0] === 6 && _.label < t[1]) {
  3427. _.label = t[1];
  3428. t = op;
  3429. break;
  3430. }
  3431. if (t && _.label < t[2]) {
  3432. _.label = t[2];
  3433. _.ops.push(op);
  3434. break;
  3435. }
  3436. if (t[2])
  3437. _.ops.pop();
  3438. _.trys.pop();
  3439. continue;
  3440. }
  3441. op = body.call(thisArg, _);
  3442. } catch (e) {
  3443. op = [6, e];
  3444. y = 0;
  3445. } finally {
  3446. f = t = 0;
  3447. }
  3448. if (op[0] & 5)
  3449. throw op[1];
  3450. return {
  3451. value: op[0] ? op[1] : void 0,
  3452. done: true
  3453. };
  3454. }
  3455. }
  3456. function __createBinding(o, m, k, k2) {
  3457. if (k2 === void 0)
  3458. k2 = k;
  3459. o[k2] = m[k];
  3460. }
  3461. function __exportStar(m, exports2) {
  3462. for (var p in m)
  3463. if (p !== "default" && !exports2.hasOwnProperty(p))
  3464. exports2[p] = m[p];
  3465. }
  3466. function __values(o) {
  3467. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  3468. if (m)
  3469. return m.call(o);
  3470. if (o && typeof o.length === "number")
  3471. return {
  3472. next: function() {
  3473. if (o && i >= o.length)
  3474. o = void 0;
  3475. return {
  3476. value: o && o[i++],
  3477. done: !o
  3478. };
  3479. }
  3480. };
  3481. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  3482. }
  3483. function __read(o, n) {
  3484. var m = typeof Symbol === "function" && o[Symbol.iterator];
  3485. if (!m)
  3486. return o;
  3487. var i = m.call(o), r, ar = [], e;
  3488. try {
  3489. while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
  3490. ar.push(r.value);
  3491. } catch (error) {
  3492. e = {
  3493. error
  3494. };
  3495. } finally {
  3496. try {
  3497. if (r && !r.done && (m = i["return"]))
  3498. m.call(i);
  3499. } finally {
  3500. if (e)
  3501. throw e.error;
  3502. }
  3503. }
  3504. return ar;
  3505. }
  3506. function __spread() {
  3507. for (var ar = [], i = 0; i < arguments.length; i++)
  3508. ar = ar.concat(__read(arguments[i]));
  3509. return ar;
  3510. }
  3511. function __spreadArrays() {
  3512. for (var s = 0, i = 0, il = arguments.length; i < il; i++)
  3513. s += arguments[i].length;
  3514. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  3515. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  3516. r[k] = a[j];
  3517. return r;
  3518. }
  3519. function __await(v) {
  3520. return this instanceof __await ? (this.v = v, this) : new __await(v);
  3521. }
  3522. function __asyncGenerator(thisArg, _arguments, generator) {
  3523. if (!Symbol.asyncIterator)
  3524. throw new TypeError("Symbol.asyncIterator is not defined.");
  3525. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  3526. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  3527. return this;
  3528. }, i;
  3529. function verb(n) {
  3530. if (g[n])
  3531. i[n] = function(v) {
  3532. return new Promise(function(a, b) {
  3533. q.push([n, v, a, b]) > 1 || resume(n, v);
  3534. });
  3535. };
  3536. }
  3537. function resume(n, v) {
  3538. try {
  3539. step(g[n](v));
  3540. } catch (e) {
  3541. settle(q[0][3], e);
  3542. }
  3543. }
  3544. function step(r) {
  3545. r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  3546. }
  3547. function fulfill(value) {
  3548. resume("next", value);
  3549. }
  3550. function reject(value) {
  3551. resume("throw", value);
  3552. }
  3553. function settle(f, v) {
  3554. if (f(v), q.shift(), q.length)
  3555. resume(q[0][0], q[0][1]);
  3556. }
  3557. }
  3558. function __asyncDelegator(o) {
  3559. var i, p;
  3560. return i = {}, verb("next"), verb("throw", function(e) {
  3561. throw e;
  3562. }), verb("return"), i[Symbol.iterator] = function() {
  3563. return this;
  3564. }, i;
  3565. function verb(n, f) {
  3566. i[n] = o[n] ? function(v) {
  3567. return (p = !p) ? {
  3568. value: __await(o[n](v)),
  3569. done: n === "return"
  3570. } : f ? f(v) : v;
  3571. } : f;
  3572. }
  3573. }
  3574. function __asyncValues(o) {
  3575. if (!Symbol.asyncIterator)
  3576. throw new TypeError("Symbol.asyncIterator is not defined.");
  3577. var m = o[Symbol.asyncIterator], i;
  3578. 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() {
  3579. return this;
  3580. }, i);
  3581. function verb(n) {
  3582. i[n] = o[n] && function(v) {
  3583. return new Promise(function(resolve, reject) {
  3584. v = o[n](v), settle(resolve, reject, v.done, v.value);
  3585. });
  3586. };
  3587. }
  3588. function settle(resolve, reject, d, v) {
  3589. Promise.resolve(v).then(function(v2) {
  3590. resolve({
  3591. value: v2,
  3592. done: d
  3593. });
  3594. }, reject);
  3595. }
  3596. }
  3597. function __makeTemplateObject(cooked, raw) {
  3598. if (Object.defineProperty) {
  3599. Object.defineProperty(cooked, "raw", {
  3600. value: raw
  3601. });
  3602. } else {
  3603. cooked.raw = raw;
  3604. }
  3605. return cooked;
  3606. }
  3607. function __importStar(mod) {
  3608. if (mod && mod.__esModule)
  3609. return mod;
  3610. var result = {};
  3611. if (mod != null) {
  3612. for (var k in mod)
  3613. if (Object.hasOwnProperty.call(mod, k))
  3614. result[k] = mod[k];
  3615. }
  3616. result.default = mod;
  3617. return result;
  3618. }
  3619. function __importDefault(mod) {
  3620. return mod && mod.__esModule ? mod : {
  3621. default: mod
  3622. };
  3623. }
  3624. function __classPrivateFieldGet(receiver, privateMap) {
  3625. if (!privateMap.has(receiver)) {
  3626. throw new TypeError("attempted to get private field on non-instance");
  3627. }
  3628. return privateMap.get(receiver);
  3629. }
  3630. function __classPrivateFieldSet(receiver, privateMap, value) {
  3631. if (!privateMap.has(receiver)) {
  3632. throw new TypeError("attempted to set private field on non-instance");
  3633. }
  3634. privateMap.set(receiver, value);
  3635. return value;
  3636. }
  3637. var extendStatics;
  3638. var __assign;
  3639. var init_tslib_es6 = __esm({
  3640. "node_modules/tslib/tslib.es6.js"() {
  3641. extendStatics = function(d, b) {
  3642. extendStatics = Object.setPrototypeOf || {
  3643. __proto__: []
  3644. } instanceof Array && function(d2, b2) {
  3645. d2.__proto__ = b2;
  3646. } || function(d2, b2) {
  3647. for (var p in b2)
  3648. if (b2.hasOwnProperty(p))
  3649. d2[p] = b2[p];
  3650. };
  3651. return extendStatics(d, b);
  3652. };
  3653. __assign = function() {
  3654. __assign = Object.assign || function __assign2(t) {
  3655. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3656. s = arguments[i];
  3657. for (var p in s)
  3658. if (Object.prototype.hasOwnProperty.call(s, p))
  3659. t[p] = s[p];
  3660. }
  3661. return t;
  3662. };
  3663. return __assign.apply(this, arguments);
  3664. };
  3665. }
  3666. });
  3667. var require_api = __commonJS2({
  3668. "node_modules/vnopts/lib/descriptors/api.js"(exports2) {
  3669. "use strict";
  3670. Object.defineProperty(exports2, "__esModule", {
  3671. value: true
  3672. });
  3673. exports2.apiDescriptor = {
  3674. key: (key) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key),
  3675. value(value) {
  3676. if (value === null || typeof value !== "object") {
  3677. return JSON.stringify(value);
  3678. }
  3679. if (Array.isArray(value)) {
  3680. return `[${value.map((subValue) => exports2.apiDescriptor.value(subValue)).join(", ")}]`;
  3681. }
  3682. const keys = Object.keys(value);
  3683. return keys.length === 0 ? "{}" : `{ ${keys.map((key) => `${exports2.apiDescriptor.key(key)}: ${exports2.apiDescriptor.value(value[key])}`).join(", ")} }`;
  3684. },
  3685. pair: ({
  3686. key,
  3687. value
  3688. }) => exports2.apiDescriptor.value({
  3689. [key]: value
  3690. })
  3691. };
  3692. }
  3693. });
  3694. var require_descriptors2 = __commonJS2({
  3695. "node_modules/vnopts/lib/descriptors/index.js"(exports2) {
  3696. "use strict";
  3697. Object.defineProperty(exports2, "__esModule", {
  3698. value: true
  3699. });
  3700. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  3701. tslib_1.__exportStar(require_api(), exports2);
  3702. }
  3703. });
  3704. var require_escape_string_regexp = __commonJS2({
  3705. "node_modules/vnopts/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  3706. "use strict";
  3707. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  3708. module2.exports = function(str) {
  3709. if (typeof str !== "string") {
  3710. throw new TypeError("Expected a string");
  3711. }
  3712. return str.replace(matchOperatorsRe, "\\$&");
  3713. };
  3714. }
  3715. });
  3716. var require_color_name = __commonJS2({
  3717. "node_modules/color-name/index.js"(exports2, module2) {
  3718. "use strict";
  3719. module2.exports = {
  3720. "aliceblue": [240, 248, 255],
  3721. "antiquewhite": [250, 235, 215],
  3722. "aqua": [0, 255, 255],
  3723. "aquamarine": [127, 255, 212],
  3724. "azure": [240, 255, 255],
  3725. "beige": [245, 245, 220],
  3726. "bisque": [255, 228, 196],
  3727. "black": [0, 0, 0],
  3728. "blanchedalmond": [255, 235, 205],
  3729. "blue": [0, 0, 255],
  3730. "blueviolet": [138, 43, 226],
  3731. "brown": [165, 42, 42],
  3732. "burlywood": [222, 184, 135],
  3733. "cadetblue": [95, 158, 160],
  3734. "chartreuse": [127, 255, 0],
  3735. "chocolate": [210, 105, 30],
  3736. "coral": [255, 127, 80],
  3737. "cornflowerblue": [100, 149, 237],
  3738. "cornsilk": [255, 248, 220],
  3739. "crimson": [220, 20, 60],
  3740. "cyan": [0, 255, 255],
  3741. "darkblue": [0, 0, 139],
  3742. "darkcyan": [0, 139, 139],
  3743. "darkgoldenrod": [184, 134, 11],
  3744. "darkgray": [169, 169, 169],
  3745. "darkgreen": [0, 100, 0],
  3746. "darkgrey": [169, 169, 169],
  3747. "darkkhaki": [189, 183, 107],
  3748. "darkmagenta": [139, 0, 139],
  3749. "darkolivegreen": [85, 107, 47],
  3750. "darkorange": [255, 140, 0],
  3751. "darkorchid": [153, 50, 204],
  3752. "darkred": [139, 0, 0],
  3753. "darksalmon": [233, 150, 122],
  3754. "darkseagreen": [143, 188, 143],
  3755. "darkslateblue": [72, 61, 139],
  3756. "darkslategray": [47, 79, 79],
  3757. "darkslategrey": [47, 79, 79],
  3758. "darkturquoise": [0, 206, 209],
  3759. "darkviolet": [148, 0, 211],
  3760. "deeppink": [255, 20, 147],
  3761. "deepskyblue": [0, 191, 255],
  3762. "dimgray": [105, 105, 105],
  3763. "dimgrey": [105, 105, 105],
  3764. "dodgerblue": [30, 144, 255],
  3765. "firebrick": [178, 34, 34],
  3766. "floralwhite": [255, 250, 240],
  3767. "forestgreen": [34, 139, 34],
  3768. "fuchsia": [255, 0, 255],
  3769. "gainsboro": [220, 220, 220],
  3770. "ghostwhite": [248, 248, 255],
  3771. "gold": [255, 215, 0],
  3772. "goldenrod": [218, 165, 32],
  3773. "gray": [128, 128, 128],
  3774. "green": [0, 128, 0],
  3775. "greenyellow": [173, 255, 47],
  3776. "grey": [128, 128, 128],
  3777. "honeydew": [240, 255, 240],
  3778. "hotpink": [255, 105, 180],
  3779. "indianred": [205, 92, 92],
  3780. "indigo": [75, 0, 130],
  3781. "ivory": [255, 255, 240],
  3782. "khaki": [240, 230, 140],
  3783. "lavender": [230, 230, 250],
  3784. "lavenderblush": [255, 240, 245],
  3785. "lawngreen": [124, 252, 0],
  3786. "lemonchiffon": [255, 250, 205],
  3787. "lightblue": [173, 216, 230],
  3788. "lightcoral": [240, 128, 128],
  3789. "lightcyan": [224, 255, 255],
  3790. "lightgoldenrodyellow": [250, 250, 210],
  3791. "lightgray": [211, 211, 211],
  3792. "lightgreen": [144, 238, 144],
  3793. "lightgrey": [211, 211, 211],
  3794. "lightpink": [255, 182, 193],
  3795. "lightsalmon": [255, 160, 122],
  3796. "lightseagreen": [32, 178, 170],
  3797. "lightskyblue": [135, 206, 250],
  3798. "lightslategray": [119, 136, 153],
  3799. "lightslategrey": [119, 136, 153],
  3800. "lightsteelblue": [176, 196, 222],
  3801. "lightyellow": [255, 255, 224],
  3802. "lime": [0, 255, 0],
  3803. "limegreen": [50, 205, 50],
  3804. "linen": [250, 240, 230],
  3805. "magenta": [255, 0, 255],
  3806. "maroon": [128, 0, 0],
  3807. "mediumaquamarine": [102, 205, 170],
  3808. "mediumblue": [0, 0, 205],
  3809. "mediumorchid": [186, 85, 211],
  3810. "mediumpurple": [147, 112, 219],
  3811. "mediumseagreen": [60, 179, 113],
  3812. "mediumslateblue": [123, 104, 238],
  3813. "mediumspringgreen": [0, 250, 154],
  3814. "mediumturquoise": [72, 209, 204],
  3815. "mediumvioletred": [199, 21, 133],
  3816. "midnightblue": [25, 25, 112],
  3817. "mintcream": [245, 255, 250],
  3818. "mistyrose": [255, 228, 225],
  3819. "moccasin": [255, 228, 181],
  3820. "navajowhite": [255, 222, 173],
  3821. "navy": [0, 0, 128],
  3822. "oldlace": [253, 245, 230],
  3823. "olive": [128, 128, 0],
  3824. "olivedrab": [107, 142, 35],
  3825. "orange": [255, 165, 0],
  3826. "orangered": [255, 69, 0],
  3827. "orchid": [218, 112, 214],
  3828. "palegoldenrod": [238, 232, 170],
  3829. "palegreen": [152, 251, 152],
  3830. "paleturquoise": [175, 238, 238],
  3831. "palevioletred": [219, 112, 147],
  3832. "papayawhip": [255, 239, 213],
  3833. "peachpuff": [255, 218, 185],
  3834. "peru": [205, 133, 63],
  3835. "pink": [255, 192, 203],
  3836. "plum": [221, 160, 221],
  3837. "powderblue": [176, 224, 230],
  3838. "purple": [128, 0, 128],
  3839. "rebeccapurple": [102, 51, 153],
  3840. "red": [255, 0, 0],
  3841. "rosybrown": [188, 143, 143],
  3842. "royalblue": [65, 105, 225],
  3843. "saddlebrown": [139, 69, 19],
  3844. "salmon": [250, 128, 114],
  3845. "sandybrown": [244, 164, 96],
  3846. "seagreen": [46, 139, 87],
  3847. "seashell": [255, 245, 238],
  3848. "sienna": [160, 82, 45],
  3849. "silver": [192, 192, 192],
  3850. "skyblue": [135, 206, 235],
  3851. "slateblue": [106, 90, 205],
  3852. "slategray": [112, 128, 144],
  3853. "slategrey": [112, 128, 144],
  3854. "snow": [255, 250, 250],
  3855. "springgreen": [0, 255, 127],
  3856. "steelblue": [70, 130, 180],
  3857. "tan": [210, 180, 140],
  3858. "teal": [0, 128, 128],
  3859. "thistle": [216, 191, 216],
  3860. "tomato": [255, 99, 71],
  3861. "turquoise": [64, 224, 208],
  3862. "violet": [238, 130, 238],
  3863. "wheat": [245, 222, 179],
  3864. "white": [255, 255, 255],
  3865. "whitesmoke": [245, 245, 245],
  3866. "yellow": [255, 255, 0],
  3867. "yellowgreen": [154, 205, 50]
  3868. };
  3869. }
  3870. });
  3871. var require_conversions = __commonJS2({
  3872. "node_modules/color-convert/conversions.js"(exports2, module2) {
  3873. var cssKeywords = require_color_name();
  3874. var reverseKeywords = {};
  3875. for (key in cssKeywords) {
  3876. if (cssKeywords.hasOwnProperty(key)) {
  3877. reverseKeywords[cssKeywords[key]] = key;
  3878. }
  3879. }
  3880. var key;
  3881. var convert = module2.exports = {
  3882. rgb: {
  3883. channels: 3,
  3884. labels: "rgb"
  3885. },
  3886. hsl: {
  3887. channels: 3,
  3888. labels: "hsl"
  3889. },
  3890. hsv: {
  3891. channels: 3,
  3892. labels: "hsv"
  3893. },
  3894. hwb: {
  3895. channels: 3,
  3896. labels: "hwb"
  3897. },
  3898. cmyk: {
  3899. channels: 4,
  3900. labels: "cmyk"
  3901. },
  3902. xyz: {
  3903. channels: 3,
  3904. labels: "xyz"
  3905. },
  3906. lab: {
  3907. channels: 3,
  3908. labels: "lab"
  3909. },
  3910. lch: {
  3911. channels: 3,
  3912. labels: "lch"
  3913. },
  3914. hex: {
  3915. channels: 1,
  3916. labels: ["hex"]
  3917. },
  3918. keyword: {
  3919. channels: 1,
  3920. labels: ["keyword"]
  3921. },
  3922. ansi16: {
  3923. channels: 1,
  3924. labels: ["ansi16"]
  3925. },
  3926. ansi256: {
  3927. channels: 1,
  3928. labels: ["ansi256"]
  3929. },
  3930. hcg: {
  3931. channels: 3,
  3932. labels: ["h", "c", "g"]
  3933. },
  3934. apple: {
  3935. channels: 3,
  3936. labels: ["r16", "g16", "b16"]
  3937. },
  3938. gray: {
  3939. channels: 1,
  3940. labels: ["gray"]
  3941. }
  3942. };
  3943. for (model in convert) {
  3944. if (convert.hasOwnProperty(model)) {
  3945. if (!("channels" in convert[model])) {
  3946. throw new Error("missing channels property: " + model);
  3947. }
  3948. if (!("labels" in convert[model])) {
  3949. throw new Error("missing channel labels property: " + model);
  3950. }
  3951. if (convert[model].labels.length !== convert[model].channels) {
  3952. throw new Error("channel and label counts mismatch: " + model);
  3953. }
  3954. channels = convert[model].channels;
  3955. labels = convert[model].labels;
  3956. delete convert[model].channels;
  3957. delete convert[model].labels;
  3958. Object.defineProperty(convert[model], "channels", {
  3959. value: channels
  3960. });
  3961. Object.defineProperty(convert[model], "labels", {
  3962. value: labels
  3963. });
  3964. }
  3965. }
  3966. var channels;
  3967. var labels;
  3968. var model;
  3969. convert.rgb.hsl = function(rgb) {
  3970. var r = rgb[0] / 255;
  3971. var g = rgb[1] / 255;
  3972. var b = rgb[2] / 255;
  3973. var min = Math.min(r, g, b);
  3974. var max = Math.max(r, g, b);
  3975. var delta = max - min;
  3976. var h;
  3977. var s;
  3978. var l;
  3979. if (max === min) {
  3980. h = 0;
  3981. } else if (r === max) {
  3982. h = (g - b) / delta;
  3983. } else if (g === max) {
  3984. h = 2 + (b - r) / delta;
  3985. } else if (b === max) {
  3986. h = 4 + (r - g) / delta;
  3987. }
  3988. h = Math.min(h * 60, 360);
  3989. if (h < 0) {
  3990. h += 360;
  3991. }
  3992. l = (min + max) / 2;
  3993. if (max === min) {
  3994. s = 0;
  3995. } else if (l <= 0.5) {
  3996. s = delta / (max + min);
  3997. } else {
  3998. s = delta / (2 - max - min);
  3999. }
  4000. return [h, s * 100, l * 100];
  4001. };
  4002. convert.rgb.hsv = function(rgb) {
  4003. var rdif;
  4004. var gdif;
  4005. var bdif;
  4006. var h;
  4007. var s;
  4008. var r = rgb[0] / 255;
  4009. var g = rgb[1] / 255;
  4010. var b = rgb[2] / 255;
  4011. var v = Math.max(r, g, b);
  4012. var diff = v - Math.min(r, g, b);
  4013. var diffc = function(c) {
  4014. return (v - c) / 6 / diff + 1 / 2;
  4015. };
  4016. if (diff === 0) {
  4017. h = s = 0;
  4018. } else {
  4019. s = diff / v;
  4020. rdif = diffc(r);
  4021. gdif = diffc(g);
  4022. bdif = diffc(b);
  4023. if (r === v) {
  4024. h = bdif - gdif;
  4025. } else if (g === v) {
  4026. h = 1 / 3 + rdif - bdif;
  4027. } else if (b === v) {
  4028. h = 2 / 3 + gdif - rdif;
  4029. }
  4030. if (h < 0) {
  4031. h += 1;
  4032. } else if (h > 1) {
  4033. h -= 1;
  4034. }
  4035. }
  4036. return [h * 360, s * 100, v * 100];
  4037. };
  4038. convert.rgb.hwb = function(rgb) {
  4039. var r = rgb[0];
  4040. var g = rgb[1];
  4041. var b = rgb[2];
  4042. var h = convert.rgb.hsl(rgb)[0];
  4043. var w = 1 / 255 * Math.min(r, Math.min(g, b));
  4044. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  4045. return [h, w * 100, b * 100];
  4046. };
  4047. convert.rgb.cmyk = function(rgb) {
  4048. var r = rgb[0] / 255;
  4049. var g = rgb[1] / 255;
  4050. var b = rgb[2] / 255;
  4051. var c;
  4052. var m;
  4053. var y;
  4054. var k;
  4055. k = Math.min(1 - r, 1 - g, 1 - b);
  4056. c = (1 - r - k) / (1 - k) || 0;
  4057. m = (1 - g - k) / (1 - k) || 0;
  4058. y = (1 - b - k) / (1 - k) || 0;
  4059. return [c * 100, m * 100, y * 100, k * 100];
  4060. };
  4061. function comparativeDistance(x, y) {
  4062. return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
  4063. }
  4064. convert.rgb.keyword = function(rgb) {
  4065. var reversed = reverseKeywords[rgb];
  4066. if (reversed) {
  4067. return reversed;
  4068. }
  4069. var currentClosestDistance = Infinity;
  4070. var currentClosestKeyword;
  4071. for (var keyword in cssKeywords) {
  4072. if (cssKeywords.hasOwnProperty(keyword)) {
  4073. var value = cssKeywords[keyword];
  4074. var distance = comparativeDistance(rgb, value);
  4075. if (distance < currentClosestDistance) {
  4076. currentClosestDistance = distance;
  4077. currentClosestKeyword = keyword;
  4078. }
  4079. }
  4080. }
  4081. return currentClosestKeyword;
  4082. };
  4083. convert.keyword.rgb = function(keyword) {
  4084. return cssKeywords[keyword];
  4085. };
  4086. convert.rgb.xyz = function(rgb) {
  4087. var r = rgb[0] / 255;
  4088. var g = rgb[1] / 255;
  4089. var b = rgb[2] / 255;
  4090. r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
  4091. g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
  4092. b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
  4093. var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
  4094. var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
  4095. var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
  4096. return [x * 100, y * 100, z * 100];
  4097. };
  4098. convert.rgb.lab = function(rgb) {
  4099. var xyz = convert.rgb.xyz(rgb);
  4100. var x = xyz[0];
  4101. var y = xyz[1];
  4102. var z = xyz[2];
  4103. var l;
  4104. var a;
  4105. var b;
  4106. x /= 95.047;
  4107. y /= 100;
  4108. z /= 108.883;
  4109. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4110. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4111. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4112. l = 116 * y - 16;
  4113. a = 500 * (x - y);
  4114. b = 200 * (y - z);
  4115. return [l, a, b];
  4116. };
  4117. convert.hsl.rgb = function(hsl) {
  4118. var h = hsl[0] / 360;
  4119. var s = hsl[1] / 100;
  4120. var l = hsl[2] / 100;
  4121. var t1;
  4122. var t2;
  4123. var t3;
  4124. var rgb;
  4125. var val;
  4126. if (s === 0) {
  4127. val = l * 255;
  4128. return [val, val, val];
  4129. }
  4130. if (l < 0.5) {
  4131. t2 = l * (1 + s);
  4132. } else {
  4133. t2 = l + s - l * s;
  4134. }
  4135. t1 = 2 * l - t2;
  4136. rgb = [0, 0, 0];
  4137. for (var i = 0; i < 3; i++) {
  4138. t3 = h + 1 / 3 * -(i - 1);
  4139. if (t3 < 0) {
  4140. t3++;
  4141. }
  4142. if (t3 > 1) {
  4143. t3--;
  4144. }
  4145. if (6 * t3 < 1) {
  4146. val = t1 + (t2 - t1) * 6 * t3;
  4147. } else if (2 * t3 < 1) {
  4148. val = t2;
  4149. } else if (3 * t3 < 2) {
  4150. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  4151. } else {
  4152. val = t1;
  4153. }
  4154. rgb[i] = val * 255;
  4155. }
  4156. return rgb;
  4157. };
  4158. convert.hsl.hsv = function(hsl) {
  4159. var h = hsl[0];
  4160. var s = hsl[1] / 100;
  4161. var l = hsl[2] / 100;
  4162. var smin = s;
  4163. var lmin = Math.max(l, 0.01);
  4164. var sv;
  4165. var v;
  4166. l *= 2;
  4167. s *= l <= 1 ? l : 2 - l;
  4168. smin *= lmin <= 1 ? lmin : 2 - lmin;
  4169. v = (l + s) / 2;
  4170. sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
  4171. return [h, sv * 100, v * 100];
  4172. };
  4173. convert.hsv.rgb = function(hsv) {
  4174. var h = hsv[0] / 60;
  4175. var s = hsv[1] / 100;
  4176. var v = hsv[2] / 100;
  4177. var hi = Math.floor(h) % 6;
  4178. var f = h - Math.floor(h);
  4179. var p = 255 * v * (1 - s);
  4180. var q = 255 * v * (1 - s * f);
  4181. var t = 255 * v * (1 - s * (1 - f));
  4182. v *= 255;
  4183. switch (hi) {
  4184. case 0:
  4185. return [v, t, p];
  4186. case 1:
  4187. return [q, v, p];
  4188. case 2:
  4189. return [p, v, t];
  4190. case 3:
  4191. return [p, q, v];
  4192. case 4:
  4193. return [t, p, v];
  4194. case 5:
  4195. return [v, p, q];
  4196. }
  4197. };
  4198. convert.hsv.hsl = function(hsv) {
  4199. var h = hsv[0];
  4200. var s = hsv[1] / 100;
  4201. var v = hsv[2] / 100;
  4202. var vmin = Math.max(v, 0.01);
  4203. var lmin;
  4204. var sl;
  4205. var l;
  4206. l = (2 - s) * v;
  4207. lmin = (2 - s) * vmin;
  4208. sl = s * vmin;
  4209. sl /= lmin <= 1 ? lmin : 2 - lmin;
  4210. sl = sl || 0;
  4211. l /= 2;
  4212. return [h, sl * 100, l * 100];
  4213. };
  4214. convert.hwb.rgb = function(hwb) {
  4215. var h = hwb[0] / 360;
  4216. var wh = hwb[1] / 100;
  4217. var bl = hwb[2] / 100;
  4218. var ratio = wh + bl;
  4219. var i;
  4220. var v;
  4221. var f;
  4222. var n;
  4223. if (ratio > 1) {
  4224. wh /= ratio;
  4225. bl /= ratio;
  4226. }
  4227. i = Math.floor(6 * h);
  4228. v = 1 - bl;
  4229. f = 6 * h - i;
  4230. if ((i & 1) !== 0) {
  4231. f = 1 - f;
  4232. }
  4233. n = wh + f * (v - wh);
  4234. var r;
  4235. var g;
  4236. var b;
  4237. switch (i) {
  4238. default:
  4239. case 6:
  4240. case 0:
  4241. r = v;
  4242. g = n;
  4243. b = wh;
  4244. break;
  4245. case 1:
  4246. r = n;
  4247. g = v;
  4248. b = wh;
  4249. break;
  4250. case 2:
  4251. r = wh;
  4252. g = v;
  4253. b = n;
  4254. break;
  4255. case 3:
  4256. r = wh;
  4257. g = n;
  4258. b = v;
  4259. break;
  4260. case 4:
  4261. r = n;
  4262. g = wh;
  4263. b = v;
  4264. break;
  4265. case 5:
  4266. r = v;
  4267. g = wh;
  4268. b = n;
  4269. break;
  4270. }
  4271. return [r * 255, g * 255, b * 255];
  4272. };
  4273. convert.cmyk.rgb = function(cmyk) {
  4274. var c = cmyk[0] / 100;
  4275. var m = cmyk[1] / 100;
  4276. var y = cmyk[2] / 100;
  4277. var k = cmyk[3] / 100;
  4278. var r;
  4279. var g;
  4280. var b;
  4281. r = 1 - Math.min(1, c * (1 - k) + k);
  4282. g = 1 - Math.min(1, m * (1 - k) + k);
  4283. b = 1 - Math.min(1, y * (1 - k) + k);
  4284. return [r * 255, g * 255, b * 255];
  4285. };
  4286. convert.xyz.rgb = function(xyz) {
  4287. var x = xyz[0] / 100;
  4288. var y = xyz[1] / 100;
  4289. var z = xyz[2] / 100;
  4290. var r;
  4291. var g;
  4292. var b;
  4293. r = x * 3.2406 + y * -1.5372 + z * -0.4986;
  4294. g = x * -0.9689 + y * 1.8758 + z * 0.0415;
  4295. b = x * 0.0557 + y * -0.204 + z * 1.057;
  4296. r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
  4297. g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
  4298. b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
  4299. r = Math.min(Math.max(0, r), 1);
  4300. g = Math.min(Math.max(0, g), 1);
  4301. b = Math.min(Math.max(0, b), 1);
  4302. return [r * 255, g * 255, b * 255];
  4303. };
  4304. convert.xyz.lab = function(xyz) {
  4305. var x = xyz[0];
  4306. var y = xyz[1];
  4307. var z = xyz[2];
  4308. var l;
  4309. var a;
  4310. var b;
  4311. x /= 95.047;
  4312. y /= 100;
  4313. z /= 108.883;
  4314. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4315. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4316. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4317. l = 116 * y - 16;
  4318. a = 500 * (x - y);
  4319. b = 200 * (y - z);
  4320. return [l, a, b];
  4321. };
  4322. convert.lab.xyz = function(lab) {
  4323. var l = lab[0];
  4324. var a = lab[1];
  4325. var b = lab[2];
  4326. var x;
  4327. var y;
  4328. var z;
  4329. y = (l + 16) / 116;
  4330. x = a / 500 + y;
  4331. z = y - b / 200;
  4332. var y2 = Math.pow(y, 3);
  4333. var x2 = Math.pow(x, 3);
  4334. var z2 = Math.pow(z, 3);
  4335. y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
  4336. x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
  4337. z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
  4338. x *= 95.047;
  4339. y *= 100;
  4340. z *= 108.883;
  4341. return [x, y, z];
  4342. };
  4343. convert.lab.lch = function(lab) {
  4344. var l = lab[0];
  4345. var a = lab[1];
  4346. var b = lab[2];
  4347. var hr;
  4348. var h;
  4349. var c;
  4350. hr = Math.atan2(b, a);
  4351. h = hr * 360 / 2 / Math.PI;
  4352. if (h < 0) {
  4353. h += 360;
  4354. }
  4355. c = Math.sqrt(a * a + b * b);
  4356. return [l, c, h];
  4357. };
  4358. convert.lch.lab = function(lch) {
  4359. var l = lch[0];
  4360. var c = lch[1];
  4361. var h = lch[2];
  4362. var a;
  4363. var b;
  4364. var hr;
  4365. hr = h / 360 * 2 * Math.PI;
  4366. a = c * Math.cos(hr);
  4367. b = c * Math.sin(hr);
  4368. return [l, a, b];
  4369. };
  4370. convert.rgb.ansi16 = function(args) {
  4371. var r = args[0];
  4372. var g = args[1];
  4373. var b = args[2];
  4374. var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
  4375. value = Math.round(value / 50);
  4376. if (value === 0) {
  4377. return 30;
  4378. }
  4379. var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  4380. if (value === 2) {
  4381. ansi += 60;
  4382. }
  4383. return ansi;
  4384. };
  4385. convert.hsv.ansi16 = function(args) {
  4386. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  4387. };
  4388. convert.rgb.ansi256 = function(args) {
  4389. var r = args[0];
  4390. var g = args[1];
  4391. var b = args[2];
  4392. if (r === g && g === b) {
  4393. if (r < 8) {
  4394. return 16;
  4395. }
  4396. if (r > 248) {
  4397. return 231;
  4398. }
  4399. return Math.round((r - 8) / 247 * 24) + 232;
  4400. }
  4401. var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
  4402. return ansi;
  4403. };
  4404. convert.ansi16.rgb = function(args) {
  4405. var color = args % 10;
  4406. if (color === 0 || color === 7) {
  4407. if (args > 50) {
  4408. color += 3.5;
  4409. }
  4410. color = color / 10.5 * 255;
  4411. return [color, color, color];
  4412. }
  4413. var mult = (~~(args > 50) + 1) * 0.5;
  4414. var r = (color & 1) * mult * 255;
  4415. var g = (color >> 1 & 1) * mult * 255;
  4416. var b = (color >> 2 & 1) * mult * 255;
  4417. return [r, g, b];
  4418. };
  4419. convert.ansi256.rgb = function(args) {
  4420. if (args >= 232) {
  4421. var c = (args - 232) * 10 + 8;
  4422. return [c, c, c];
  4423. }
  4424. args -= 16;
  4425. var rem;
  4426. var r = Math.floor(args / 36) / 5 * 255;
  4427. var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  4428. var b = rem % 6 / 5 * 255;
  4429. return [r, g, b];
  4430. };
  4431. convert.rgb.hex = function(args) {
  4432. var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
  4433. var string = integer.toString(16).toUpperCase();
  4434. return "000000".substring(string.length) + string;
  4435. };
  4436. convert.hex.rgb = function(args) {
  4437. var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  4438. if (!match) {
  4439. return [0, 0, 0];
  4440. }
  4441. var colorString = match[0];
  4442. if (match[0].length === 3) {
  4443. colorString = colorString.split("").map(function(char) {
  4444. return char + char;
  4445. }).join("");
  4446. }
  4447. var integer = parseInt(colorString, 16);
  4448. var r = integer >> 16 & 255;
  4449. var g = integer >> 8 & 255;
  4450. var b = integer & 255;
  4451. return [r, g, b];
  4452. };
  4453. convert.rgb.hcg = function(rgb) {
  4454. var r = rgb[0] / 255;
  4455. var g = rgb[1] / 255;
  4456. var b = rgb[2] / 255;
  4457. var max = Math.max(Math.max(r, g), b);
  4458. var min = Math.min(Math.min(r, g), b);
  4459. var chroma = max - min;
  4460. var grayscale;
  4461. var hue;
  4462. if (chroma < 1) {
  4463. grayscale = min / (1 - chroma);
  4464. } else {
  4465. grayscale = 0;
  4466. }
  4467. if (chroma <= 0) {
  4468. hue = 0;
  4469. } else if (max === r) {
  4470. hue = (g - b) / chroma % 6;
  4471. } else if (max === g) {
  4472. hue = 2 + (b - r) / chroma;
  4473. } else {
  4474. hue = 4 + (r - g) / chroma + 4;
  4475. }
  4476. hue /= 6;
  4477. hue %= 1;
  4478. return [hue * 360, chroma * 100, grayscale * 100];
  4479. };
  4480. convert.hsl.hcg = function(hsl) {
  4481. var s = hsl[1] / 100;
  4482. var l = hsl[2] / 100;
  4483. var c = 1;
  4484. var f = 0;
  4485. if (l < 0.5) {
  4486. c = 2 * s * l;
  4487. } else {
  4488. c = 2 * s * (1 - l);
  4489. }
  4490. if (c < 1) {
  4491. f = (l - 0.5 * c) / (1 - c);
  4492. }
  4493. return [hsl[0], c * 100, f * 100];
  4494. };
  4495. convert.hsv.hcg = function(hsv) {
  4496. var s = hsv[1] / 100;
  4497. var v = hsv[2] / 100;
  4498. var c = s * v;
  4499. var f = 0;
  4500. if (c < 1) {
  4501. f = (v - c) / (1 - c);
  4502. }
  4503. return [hsv[0], c * 100, f * 100];
  4504. };
  4505. convert.hcg.rgb = function(hcg) {
  4506. var h = hcg[0] / 360;
  4507. var c = hcg[1] / 100;
  4508. var g = hcg[2] / 100;
  4509. if (c === 0) {
  4510. return [g * 255, g * 255, g * 255];
  4511. }
  4512. var pure = [0, 0, 0];
  4513. var hi = h % 1 * 6;
  4514. var v = hi % 1;
  4515. var w = 1 - v;
  4516. var mg = 0;
  4517. switch (Math.floor(hi)) {
  4518. case 0:
  4519. pure[0] = 1;
  4520. pure[1] = v;
  4521. pure[2] = 0;
  4522. break;
  4523. case 1:
  4524. pure[0] = w;
  4525. pure[1] = 1;
  4526. pure[2] = 0;
  4527. break;
  4528. case 2:
  4529. pure[0] = 0;
  4530. pure[1] = 1;
  4531. pure[2] = v;
  4532. break;
  4533. case 3:
  4534. pure[0] = 0;
  4535. pure[1] = w;
  4536. pure[2] = 1;
  4537. break;
  4538. case 4:
  4539. pure[0] = v;
  4540. pure[1] = 0;
  4541. pure[2] = 1;
  4542. break;
  4543. default:
  4544. pure[0] = 1;
  4545. pure[1] = 0;
  4546. pure[2] = w;
  4547. }
  4548. mg = (1 - c) * g;
  4549. return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  4550. };
  4551. convert.hcg.hsv = function(hcg) {
  4552. var c = hcg[1] / 100;
  4553. var g = hcg[2] / 100;
  4554. var v = c + g * (1 - c);
  4555. var f = 0;
  4556. if (v > 0) {
  4557. f = c / v;
  4558. }
  4559. return [hcg[0], f * 100, v * 100];
  4560. };
  4561. convert.hcg.hsl = function(hcg) {
  4562. var c = hcg[1] / 100;
  4563. var g = hcg[2] / 100;
  4564. var l = g * (1 - c) + 0.5 * c;
  4565. var s = 0;
  4566. if (l > 0 && l < 0.5) {
  4567. s = c / (2 * l);
  4568. } else if (l >= 0.5 && l < 1) {
  4569. s = c / (2 * (1 - l));
  4570. }
  4571. return [hcg[0], s * 100, l * 100];
  4572. };
  4573. convert.hcg.hwb = function(hcg) {
  4574. var c = hcg[1] / 100;
  4575. var g = hcg[2] / 100;
  4576. var v = c + g * (1 - c);
  4577. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  4578. };
  4579. convert.hwb.hcg = function(hwb) {
  4580. var w = hwb[1] / 100;
  4581. var b = hwb[2] / 100;
  4582. var v = 1 - b;
  4583. var c = v - w;
  4584. var g = 0;
  4585. if (c < 1) {
  4586. g = (v - c) / (1 - c);
  4587. }
  4588. return [hwb[0], c * 100, g * 100];
  4589. };
  4590. convert.apple.rgb = function(apple) {
  4591. return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  4592. };
  4593. convert.rgb.apple = function(rgb) {
  4594. return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  4595. };
  4596. convert.gray.rgb = function(args) {
  4597. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  4598. };
  4599. convert.gray.hsl = convert.gray.hsv = function(args) {
  4600. return [0, 0, args[0]];
  4601. };
  4602. convert.gray.hwb = function(gray) {
  4603. return [0, 100, gray[0]];
  4604. };
  4605. convert.gray.cmyk = function(gray) {
  4606. return [0, 0, 0, gray[0]];
  4607. };
  4608. convert.gray.lab = function(gray) {
  4609. return [gray[0], 0, 0];
  4610. };
  4611. convert.gray.hex = function(gray) {
  4612. var val = Math.round(gray[0] / 100 * 255) & 255;
  4613. var integer = (val << 16) + (val << 8) + val;
  4614. var string = integer.toString(16).toUpperCase();
  4615. return "000000".substring(string.length) + string;
  4616. };
  4617. convert.rgb.gray = function(rgb) {
  4618. var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  4619. return [val / 255 * 100];
  4620. };
  4621. }
  4622. });
  4623. var require_route = __commonJS2({
  4624. "node_modules/color-convert/route.js"(exports2, module2) {
  4625. var conversions = require_conversions();
  4626. function buildGraph() {
  4627. var graph = {};
  4628. var models = Object.keys(conversions);
  4629. for (var len = models.length, i = 0; i < len; i++) {
  4630. graph[models[i]] = {
  4631. distance: -1,
  4632. parent: null
  4633. };
  4634. }
  4635. return graph;
  4636. }
  4637. function deriveBFS(fromModel) {
  4638. var graph = buildGraph();
  4639. var queue = [fromModel];
  4640. graph[fromModel].distance = 0;
  4641. while (queue.length) {
  4642. var current = queue.pop();
  4643. var adjacents = Object.keys(conversions[current]);
  4644. for (var len = adjacents.length, i = 0; i < len; i++) {
  4645. var adjacent = adjacents[i];
  4646. var node = graph[adjacent];
  4647. if (node.distance === -1) {
  4648. node.distance = graph[current].distance + 1;
  4649. node.parent = current;
  4650. queue.unshift(adjacent);
  4651. }
  4652. }
  4653. }
  4654. return graph;
  4655. }
  4656. function link(from, to) {
  4657. return function(args) {
  4658. return to(from(args));
  4659. };
  4660. }
  4661. function wrapConversion(toModel, graph) {
  4662. var path = [graph[toModel].parent, toModel];
  4663. var fn = conversions[graph[toModel].parent][toModel];
  4664. var cur = graph[toModel].parent;
  4665. while (graph[cur].parent) {
  4666. path.unshift(graph[cur].parent);
  4667. fn = link(conversions[graph[cur].parent][cur], fn);
  4668. cur = graph[cur].parent;
  4669. }
  4670. fn.conversion = path;
  4671. return fn;
  4672. }
  4673. module2.exports = function(fromModel) {
  4674. var graph = deriveBFS(fromModel);
  4675. var conversion = {};
  4676. var models = Object.keys(graph);
  4677. for (var len = models.length, i = 0; i < len; i++) {
  4678. var toModel = models[i];
  4679. var node = graph[toModel];
  4680. if (node.parent === null) {
  4681. continue;
  4682. }
  4683. conversion[toModel] = wrapConversion(toModel, graph);
  4684. }
  4685. return conversion;
  4686. };
  4687. }
  4688. });
  4689. var require_color_convert = __commonJS2({
  4690. "node_modules/color-convert/index.js"(exports2, module2) {
  4691. var conversions = require_conversions();
  4692. var route = require_route();
  4693. var convert = {};
  4694. var models = Object.keys(conversions);
  4695. function wrapRaw(fn) {
  4696. var wrappedFn = function(args) {
  4697. if (args === void 0 || args === null) {
  4698. return args;
  4699. }
  4700. if (arguments.length > 1) {
  4701. args = Array.prototype.slice.call(arguments);
  4702. }
  4703. return fn(args);
  4704. };
  4705. if ("conversion" in fn) {
  4706. wrappedFn.conversion = fn.conversion;
  4707. }
  4708. return wrappedFn;
  4709. }
  4710. function wrapRounded(fn) {
  4711. var wrappedFn = function(args) {
  4712. if (args === void 0 || args === null) {
  4713. return args;
  4714. }
  4715. if (arguments.length > 1) {
  4716. args = Array.prototype.slice.call(arguments);
  4717. }
  4718. var result = fn(args);
  4719. if (typeof result === "object") {
  4720. for (var len = result.length, i = 0; i < len; i++) {
  4721. result[i] = Math.round(result[i]);
  4722. }
  4723. }
  4724. return result;
  4725. };
  4726. if ("conversion" in fn) {
  4727. wrappedFn.conversion = fn.conversion;
  4728. }
  4729. return wrappedFn;
  4730. }
  4731. models.forEach(function(fromModel) {
  4732. convert[fromModel] = {};
  4733. Object.defineProperty(convert[fromModel], "channels", {
  4734. value: conversions[fromModel].channels
  4735. });
  4736. Object.defineProperty(convert[fromModel], "labels", {
  4737. value: conversions[fromModel].labels
  4738. });
  4739. var routes = route(fromModel);
  4740. var routeModels = Object.keys(routes);
  4741. routeModels.forEach(function(toModel) {
  4742. var fn = routes[toModel];
  4743. convert[fromModel][toModel] = wrapRounded(fn);
  4744. convert[fromModel][toModel].raw = wrapRaw(fn);
  4745. });
  4746. });
  4747. module2.exports = convert;
  4748. }
  4749. });
  4750. var require_ansi_styles = __commonJS2({
  4751. "node_modules/ansi-styles/index.js"(exports2, module2) {
  4752. "use strict";
  4753. var colorConvert = require_color_convert();
  4754. var wrapAnsi16 = (fn, offset) => function() {
  4755. const code = fn.apply(colorConvert, arguments);
  4756. return `\x1B[${code + offset}m`;
  4757. };
  4758. var wrapAnsi256 = (fn, offset) => function() {
  4759. const code = fn.apply(colorConvert, arguments);
  4760. return `\x1B[${38 + offset};5;${code}m`;
  4761. };
  4762. var wrapAnsi16m = (fn, offset) => function() {
  4763. const rgb = fn.apply(colorConvert, arguments);
  4764. return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  4765. };
  4766. function assembleStyles() {
  4767. const codes = /* @__PURE__ */ new Map();
  4768. const styles = {
  4769. modifier: {
  4770. reset: [0, 0],
  4771. bold: [1, 22],
  4772. dim: [2, 22],
  4773. italic: [3, 23],
  4774. underline: [4, 24],
  4775. inverse: [7, 27],
  4776. hidden: [8, 28],
  4777. strikethrough: [9, 29]
  4778. },
  4779. color: {
  4780. black: [30, 39],
  4781. red: [31, 39],
  4782. green: [32, 39],
  4783. yellow: [33, 39],
  4784. blue: [34, 39],
  4785. magenta: [35, 39],
  4786. cyan: [36, 39],
  4787. white: [37, 39],
  4788. gray: [90, 39],
  4789. redBright: [91, 39],
  4790. greenBright: [92, 39],
  4791. yellowBright: [93, 39],
  4792. blueBright: [94, 39],
  4793. magentaBright: [95, 39],
  4794. cyanBright: [96, 39],
  4795. whiteBright: [97, 39]
  4796. },
  4797. bgColor: {
  4798. bgBlack: [40, 49],
  4799. bgRed: [41, 49],
  4800. bgGreen: [42, 49],
  4801. bgYellow: [43, 49],
  4802. bgBlue: [44, 49],
  4803. bgMagenta: [45, 49],
  4804. bgCyan: [46, 49],
  4805. bgWhite: [47, 49],
  4806. bgBlackBright: [100, 49],
  4807. bgRedBright: [101, 49],
  4808. bgGreenBright: [102, 49],
  4809. bgYellowBright: [103, 49],
  4810. bgBlueBright: [104, 49],
  4811. bgMagentaBright: [105, 49],
  4812. bgCyanBright: [106, 49],
  4813. bgWhiteBright: [107, 49]
  4814. }
  4815. };
  4816. styles.color.grey = styles.color.gray;
  4817. for (const groupName of Object.keys(styles)) {
  4818. const group = styles[groupName];
  4819. for (const styleName of Object.keys(group)) {
  4820. const style = group[styleName];
  4821. styles[styleName] = {
  4822. open: `\x1B[${style[0]}m`,
  4823. close: `\x1B[${style[1]}m`
  4824. };
  4825. group[styleName] = styles[styleName];
  4826. codes.set(style[0], style[1]);
  4827. }
  4828. Object.defineProperty(styles, groupName, {
  4829. value: group,
  4830. enumerable: false
  4831. });
  4832. Object.defineProperty(styles, "codes", {
  4833. value: codes,
  4834. enumerable: false
  4835. });
  4836. }
  4837. const ansi2ansi = (n) => n;
  4838. const rgb2rgb = (r, g, b) => [r, g, b];
  4839. styles.color.close = "\x1B[39m";
  4840. styles.bgColor.close = "\x1B[49m";
  4841. styles.color.ansi = {
  4842. ansi: wrapAnsi16(ansi2ansi, 0)
  4843. };
  4844. styles.color.ansi256 = {
  4845. ansi256: wrapAnsi256(ansi2ansi, 0)
  4846. };
  4847. styles.color.ansi16m = {
  4848. rgb: wrapAnsi16m(rgb2rgb, 0)
  4849. };
  4850. styles.bgColor.ansi = {
  4851. ansi: wrapAnsi16(ansi2ansi, 10)
  4852. };
  4853. styles.bgColor.ansi256 = {
  4854. ansi256: wrapAnsi256(ansi2ansi, 10)
  4855. };
  4856. styles.bgColor.ansi16m = {
  4857. rgb: wrapAnsi16m(rgb2rgb, 10)
  4858. };
  4859. for (let key of Object.keys(colorConvert)) {
  4860. if (typeof colorConvert[key] !== "object") {
  4861. continue;
  4862. }
  4863. const suite = colorConvert[key];
  4864. if (key === "ansi16") {
  4865. key = "ansi";
  4866. }
  4867. if ("ansi16" in suite) {
  4868. styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
  4869. styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
  4870. }
  4871. if ("ansi256" in suite) {
  4872. styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
  4873. styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
  4874. }
  4875. if ("rgb" in suite) {
  4876. styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
  4877. styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
  4878. }
  4879. }
  4880. return styles;
  4881. }
  4882. Object.defineProperty(module2, "exports", {
  4883. enumerable: true,
  4884. get: assembleStyles
  4885. });
  4886. }
  4887. });
  4888. var require_has_flag = __commonJS2({
  4889. "node_modules/vnopts/node_modules/has-flag/index.js"(exports2, module2) {
  4890. "use strict";
  4891. module2.exports = (flag, argv) => {
  4892. argv = argv || process.argv;
  4893. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  4894. const pos = argv.indexOf(prefix + flag);
  4895. const terminatorPos = argv.indexOf("--");
  4896. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  4897. };
  4898. }
  4899. });
  4900. var require_supports_color = __commonJS2({
  4901. "node_modules/vnopts/node_modules/supports-color/index.js"(exports2, module2) {
  4902. "use strict";
  4903. var os = require("os");
  4904. var hasFlag = require_has_flag();
  4905. var env = process.env;
  4906. var forceColor;
  4907. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  4908. forceColor = false;
  4909. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  4910. forceColor = true;
  4911. }
  4912. if ("FORCE_COLOR" in env) {
  4913. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  4914. }
  4915. function translateLevel(level) {
  4916. if (level === 0) {
  4917. return false;
  4918. }
  4919. return {
  4920. level,
  4921. hasBasic: true,
  4922. has256: level >= 2,
  4923. has16m: level >= 3
  4924. };
  4925. }
  4926. function supportsColor(stream) {
  4927. if (forceColor === false) {
  4928. return 0;
  4929. }
  4930. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  4931. return 3;
  4932. }
  4933. if (hasFlag("color=256")) {
  4934. return 2;
  4935. }
  4936. if (stream && !stream.isTTY && forceColor !== true) {
  4937. return 0;
  4938. }
  4939. const min = forceColor ? 1 : 0;
  4940. if (process.platform === "win32") {
  4941. const osRelease = os.release().split(".");
  4942. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  4943. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  4944. }
  4945. return 1;
  4946. }
  4947. if ("CI" in env) {
  4948. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  4949. return 1;
  4950. }
  4951. return min;
  4952. }
  4953. if ("TEAMCITY_VERSION" in env) {
  4954. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  4955. }
  4956. if (env.COLORTERM === "truecolor") {
  4957. return 3;
  4958. }
  4959. if ("TERM_PROGRAM" in env) {
  4960. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  4961. switch (env.TERM_PROGRAM) {
  4962. case "iTerm.app":
  4963. return version2 >= 3 ? 3 : 2;
  4964. case "Apple_Terminal":
  4965. return 2;
  4966. }
  4967. }
  4968. if (/-256(color)?$/i.test(env.TERM)) {
  4969. return 2;
  4970. }
  4971. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  4972. return 1;
  4973. }
  4974. if ("COLORTERM" in env) {
  4975. return 1;
  4976. }
  4977. if (env.TERM === "dumb") {
  4978. return min;
  4979. }
  4980. return min;
  4981. }
  4982. function getSupportLevel(stream) {
  4983. const level = supportsColor(stream);
  4984. return translateLevel(level);
  4985. }
  4986. module2.exports = {
  4987. supportsColor: getSupportLevel,
  4988. stdout: getSupportLevel(process.stdout),
  4989. stderr: getSupportLevel(process.stderr)
  4990. };
  4991. }
  4992. });
  4993. var require_templates = __commonJS2({
  4994. "node_modules/vnopts/node_modules/chalk/templates.js"(exports2, module2) {
  4995. "use strict";
  4996. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  4997. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  4998. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  4999. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  5000. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  5001. function unescape(c) {
  5002. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  5003. return String.fromCharCode(parseInt(c.slice(1), 16));
  5004. }
  5005. return ESCAPES.get(c) || c;
  5006. }
  5007. function parseArguments(name, args) {
  5008. const results = [];
  5009. const chunks = args.trim().split(/\s*,\s*/g);
  5010. let matches;
  5011. for (const chunk of chunks) {
  5012. if (!isNaN(chunk)) {
  5013. results.push(Number(chunk));
  5014. } else if (matches = chunk.match(STRING_REGEX)) {
  5015. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  5016. } else {
  5017. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  5018. }
  5019. }
  5020. return results;
  5021. }
  5022. function parseStyle(style) {
  5023. STYLE_REGEX.lastIndex = 0;
  5024. const results = [];
  5025. let matches;
  5026. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  5027. const name = matches[1];
  5028. if (matches[2]) {
  5029. const args = parseArguments(name, matches[2]);
  5030. results.push([name].concat(args));
  5031. } else {
  5032. results.push([name]);
  5033. }
  5034. }
  5035. return results;
  5036. }
  5037. function buildStyle(chalk, styles) {
  5038. const enabled = {};
  5039. for (const layer of styles) {
  5040. for (const style of layer.styles) {
  5041. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  5042. }
  5043. }
  5044. let current = chalk;
  5045. for (const styleName of Object.keys(enabled)) {
  5046. if (Array.isArray(enabled[styleName])) {
  5047. if (!(styleName in current)) {
  5048. throw new Error(`Unknown Chalk style: ${styleName}`);
  5049. }
  5050. if (enabled[styleName].length > 0) {
  5051. current = current[styleName].apply(current, enabled[styleName]);
  5052. } else {
  5053. current = current[styleName];
  5054. }
  5055. }
  5056. }
  5057. return current;
  5058. }
  5059. module2.exports = (chalk, tmp) => {
  5060. const styles = [];
  5061. const chunks = [];
  5062. let chunk = [];
  5063. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  5064. if (escapeChar) {
  5065. chunk.push(unescape(escapeChar));
  5066. } else if (style) {
  5067. const str = chunk.join("");
  5068. chunk = [];
  5069. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  5070. styles.push({
  5071. inverse,
  5072. styles: parseStyle(style)
  5073. });
  5074. } else if (close) {
  5075. if (styles.length === 0) {
  5076. throw new Error("Found extraneous } in Chalk template literal");
  5077. }
  5078. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  5079. chunk = [];
  5080. styles.pop();
  5081. } else {
  5082. chunk.push(chr);
  5083. }
  5084. });
  5085. chunks.push(chunk.join(""));
  5086. if (styles.length > 0) {
  5087. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  5088. throw new Error(errMsg);
  5089. }
  5090. return chunks.join("");
  5091. };
  5092. }
  5093. });
  5094. var require_chalk = __commonJS2({
  5095. "node_modules/vnopts/node_modules/chalk/index.js"(exports2, module2) {
  5096. "use strict";
  5097. var escapeStringRegexp2 = require_escape_string_regexp();
  5098. var ansiStyles = require_ansi_styles();
  5099. var stdoutColor = require_supports_color().stdout;
  5100. var template = require_templates();
  5101. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  5102. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  5103. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  5104. var styles = /* @__PURE__ */ Object.create(null);
  5105. function applyOptions(obj, options) {
  5106. options = options || {};
  5107. const scLevel = stdoutColor ? stdoutColor.level : 0;
  5108. obj.level = options.level === void 0 ? scLevel : options.level;
  5109. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  5110. }
  5111. function Chalk(options) {
  5112. if (!this || !(this instanceof Chalk) || this.template) {
  5113. const chalk = {};
  5114. applyOptions(chalk, options);
  5115. chalk.template = function() {
  5116. const args = [].slice.call(arguments);
  5117. return chalkTag.apply(null, [chalk.template].concat(args));
  5118. };
  5119. Object.setPrototypeOf(chalk, Chalk.prototype);
  5120. Object.setPrototypeOf(chalk.template, chalk);
  5121. chalk.template.constructor = Chalk;
  5122. return chalk.template;
  5123. }
  5124. applyOptions(this, options);
  5125. }
  5126. if (isSimpleWindowsTerm) {
  5127. ansiStyles.blue.open = "\x1B[94m";
  5128. }
  5129. for (const key of Object.keys(ansiStyles)) {
  5130. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  5131. styles[key] = {
  5132. get() {
  5133. const codes = ansiStyles[key];
  5134. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  5135. }
  5136. };
  5137. }
  5138. styles.visible = {
  5139. get() {
  5140. return build.call(this, this._styles || [], true, "visible");
  5141. }
  5142. };
  5143. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  5144. for (const model of Object.keys(ansiStyles.color.ansi)) {
  5145. if (skipModels.has(model)) {
  5146. continue;
  5147. }
  5148. styles[model] = {
  5149. get() {
  5150. const level = this.level;
  5151. return function() {
  5152. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  5153. const codes = {
  5154. open,
  5155. close: ansiStyles.color.close,
  5156. closeRe: ansiStyles.color.closeRe
  5157. };
  5158. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5159. };
  5160. }
  5161. };
  5162. }
  5163. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  5164. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  5165. if (skipModels.has(model)) {
  5166. continue;
  5167. }
  5168. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  5169. styles[bgModel] = {
  5170. get() {
  5171. const level = this.level;
  5172. return function() {
  5173. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  5174. const codes = {
  5175. open,
  5176. close: ansiStyles.bgColor.close,
  5177. closeRe: ansiStyles.bgColor.closeRe
  5178. };
  5179. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5180. };
  5181. }
  5182. };
  5183. }
  5184. var proto = Object.defineProperties(() => {
  5185. }, styles);
  5186. function build(_styles, _empty, key) {
  5187. const builder = function() {
  5188. return applyStyle.apply(builder, arguments);
  5189. };
  5190. builder._styles = _styles;
  5191. builder._empty = _empty;
  5192. const self2 = this;
  5193. Object.defineProperty(builder, "level", {
  5194. enumerable: true,
  5195. get() {
  5196. return self2.level;
  5197. },
  5198. set(level) {
  5199. self2.level = level;
  5200. }
  5201. });
  5202. Object.defineProperty(builder, "enabled", {
  5203. enumerable: true,
  5204. get() {
  5205. return self2.enabled;
  5206. },
  5207. set(enabled) {
  5208. self2.enabled = enabled;
  5209. }
  5210. });
  5211. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  5212. builder.__proto__ = proto;
  5213. return builder;
  5214. }
  5215. function applyStyle() {
  5216. const args = arguments;
  5217. const argsLen = args.length;
  5218. let str = String(arguments[0]);
  5219. if (argsLen === 0) {
  5220. return "";
  5221. }
  5222. if (argsLen > 1) {
  5223. for (let a = 1; a < argsLen; a++) {
  5224. str += " " + args[a];
  5225. }
  5226. }
  5227. if (!this.enabled || this.level <= 0 || !str) {
  5228. return this._empty ? "" : str;
  5229. }
  5230. const originalDim = ansiStyles.dim.open;
  5231. if (isSimpleWindowsTerm && this.hasGrey) {
  5232. ansiStyles.dim.open = "";
  5233. }
  5234. for (const code of this._styles.slice().reverse()) {
  5235. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  5236. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  5237. }
  5238. ansiStyles.dim.open = originalDim;
  5239. return str;
  5240. }
  5241. function chalkTag(chalk, strings) {
  5242. if (!Array.isArray(strings)) {
  5243. return [].slice.call(arguments, 1).join(" ");
  5244. }
  5245. const args = [].slice.call(arguments, 2);
  5246. const parts = [strings.raw[0]];
  5247. for (let i = 1; i < strings.length; i++) {
  5248. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  5249. parts.push(String(strings.raw[i]));
  5250. }
  5251. return template(chalk, parts.join(""));
  5252. }
  5253. Object.defineProperties(Chalk.prototype, styles);
  5254. module2.exports = Chalk();
  5255. module2.exports.supportsColor = stdoutColor;
  5256. module2.exports.default = module2.exports;
  5257. }
  5258. });
  5259. var require_common = __commonJS2({
  5260. "node_modules/vnopts/lib/handlers/deprecated/common.js"(exports2) {
  5261. "use strict";
  5262. Object.defineProperty(exports2, "__esModule", {
  5263. value: true
  5264. });
  5265. var chalk_1 = require_chalk();
  5266. exports2.commonDeprecatedHandler = (keyOrPair, redirectTo, {
  5267. descriptor
  5268. }) => {
  5269. const messages = [`${chalk_1.default.yellow(typeof keyOrPair === "string" ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`];
  5270. if (redirectTo) {
  5271. messages.push(`we now treat it as ${chalk_1.default.blue(typeof redirectTo === "string" ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
  5272. }
  5273. return messages.join("; ") + ".";
  5274. };
  5275. }
  5276. });
  5277. var require_deprecated = __commonJS2({
  5278. "node_modules/vnopts/lib/handlers/deprecated/index.js"(exports2) {
  5279. "use strict";
  5280. Object.defineProperty(exports2, "__esModule", {
  5281. value: true
  5282. });
  5283. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5284. tslib_1.__exportStar(require_common(), exports2);
  5285. }
  5286. });
  5287. var require_common2 = __commonJS2({
  5288. "node_modules/vnopts/lib/handlers/invalid/common.js"(exports2) {
  5289. "use strict";
  5290. Object.defineProperty(exports2, "__esModule", {
  5291. value: true
  5292. });
  5293. var chalk_1 = require_chalk();
  5294. exports2.commonInvalidHandler = (key, value, utils) => [`Invalid ${chalk_1.default.red(utils.descriptor.key(key))} value.`, `Expected ${chalk_1.default.blue(utils.schemas[key].expected(utils))},`, `but received ${chalk_1.default.red(utils.descriptor.value(value))}.`].join(" ");
  5295. }
  5296. });
  5297. var require_invalid = __commonJS2({
  5298. "node_modules/vnopts/lib/handlers/invalid/index.js"(exports2) {
  5299. "use strict";
  5300. Object.defineProperty(exports2, "__esModule", {
  5301. value: true
  5302. });
  5303. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5304. tslib_1.__exportStar(require_common2(), exports2);
  5305. }
  5306. });
  5307. var require_leven = __commonJS2({
  5308. "node_modules/vnopts/node_modules/leven/index.js"(exports2, module2) {
  5309. "use strict";
  5310. var arr = [];
  5311. var charCodeCache = [];
  5312. module2.exports = function(a, b) {
  5313. if (a === b) {
  5314. return 0;
  5315. }
  5316. var swap = a;
  5317. if (a.length > b.length) {
  5318. a = b;
  5319. b = swap;
  5320. }
  5321. var aLen = a.length;
  5322. var bLen = b.length;
  5323. if (aLen === 0) {
  5324. return bLen;
  5325. }
  5326. if (bLen === 0) {
  5327. return aLen;
  5328. }
  5329. while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
  5330. aLen--;
  5331. bLen--;
  5332. }
  5333. if (aLen === 0) {
  5334. return bLen;
  5335. }
  5336. var start = 0;
  5337. while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
  5338. start++;
  5339. }
  5340. aLen -= start;
  5341. bLen -= start;
  5342. if (aLen === 0) {
  5343. return bLen;
  5344. }
  5345. var bCharCode;
  5346. var ret;
  5347. var tmp;
  5348. var tmp2;
  5349. var i = 0;
  5350. var j = 0;
  5351. while (i < aLen) {
  5352. charCodeCache[start + i] = a.charCodeAt(start + i);
  5353. arr[i] = ++i;
  5354. }
  5355. while (j < bLen) {
  5356. bCharCode = b.charCodeAt(start + j);
  5357. tmp = j++;
  5358. ret = j;
  5359. for (i = 0; i < aLen; i++) {
  5360. tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
  5361. tmp = arr[i];
  5362. ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
  5363. }
  5364. }
  5365. return ret;
  5366. };
  5367. }
  5368. });
  5369. var require_leven2 = __commonJS2({
  5370. "node_modules/vnopts/lib/handlers/unknown/leven.js"(exports2) {
  5371. "use strict";
  5372. Object.defineProperty(exports2, "__esModule", {
  5373. value: true
  5374. });
  5375. var chalk_1 = require_chalk();
  5376. var leven = require_leven();
  5377. exports2.levenUnknownHandler = (key, value, {
  5378. descriptor,
  5379. logger,
  5380. schemas
  5381. }) => {
  5382. const messages = [`Ignored unknown option ${chalk_1.default.yellow(descriptor.pair({
  5383. key,
  5384. value
  5385. }))}.`];
  5386. const suggestion = Object.keys(schemas).sort().find((knownKey) => leven(key, knownKey) < 3);
  5387. if (suggestion) {
  5388. messages.push(`Did you mean ${chalk_1.default.blue(descriptor.key(suggestion))}?`);
  5389. }
  5390. logger.warn(messages.join(" "));
  5391. };
  5392. }
  5393. });
  5394. var require_unknown = __commonJS2({
  5395. "node_modules/vnopts/lib/handlers/unknown/index.js"(exports2) {
  5396. "use strict";
  5397. Object.defineProperty(exports2, "__esModule", {
  5398. value: true
  5399. });
  5400. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5401. tslib_1.__exportStar(require_leven2(), exports2);
  5402. }
  5403. });
  5404. var require_handlers = __commonJS2({
  5405. "node_modules/vnopts/lib/handlers/index.js"(exports2) {
  5406. "use strict";
  5407. Object.defineProperty(exports2, "__esModule", {
  5408. value: true
  5409. });
  5410. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5411. tslib_1.__exportStar(require_deprecated(), exports2);
  5412. tslib_1.__exportStar(require_invalid(), exports2);
  5413. tslib_1.__exportStar(require_unknown(), exports2);
  5414. }
  5415. });
  5416. var require_schema = __commonJS2({
  5417. "node_modules/vnopts/lib/schema.js"(exports2) {
  5418. "use strict";
  5419. Object.defineProperty(exports2, "__esModule", {
  5420. value: true
  5421. });
  5422. var HANDLER_KEYS = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
  5423. function createSchema(SchemaConstructor, parameters) {
  5424. const schema = new SchemaConstructor(parameters);
  5425. const subSchema = Object.create(schema);
  5426. for (const handlerKey of HANDLER_KEYS) {
  5427. if (handlerKey in parameters) {
  5428. subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
  5429. }
  5430. }
  5431. return subSchema;
  5432. }
  5433. exports2.createSchema = createSchema;
  5434. var Schema = class {
  5435. constructor(parameters) {
  5436. this.name = parameters.name;
  5437. }
  5438. static create(parameters) {
  5439. return createSchema(this, parameters);
  5440. }
  5441. default(_utils) {
  5442. return void 0;
  5443. }
  5444. expected(_utils) {
  5445. return "nothing";
  5446. }
  5447. validate(_value, _utils) {
  5448. return false;
  5449. }
  5450. deprecated(_value, _utils) {
  5451. return false;
  5452. }
  5453. forward(_value, _utils) {
  5454. return void 0;
  5455. }
  5456. redirect(_value, _utils) {
  5457. return void 0;
  5458. }
  5459. overlap(currentValue, _newValue, _utils) {
  5460. return currentValue;
  5461. }
  5462. preprocess(value, _utils) {
  5463. return value;
  5464. }
  5465. postprocess(value, _utils) {
  5466. return value;
  5467. }
  5468. };
  5469. exports2.Schema = Schema;
  5470. function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
  5471. return typeof handler === "function" ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
  5472. }
  5473. }
  5474. });
  5475. var require_alias = __commonJS2({
  5476. "node_modules/vnopts/lib/schemas/alias.js"(exports2) {
  5477. "use strict";
  5478. Object.defineProperty(exports2, "__esModule", {
  5479. value: true
  5480. });
  5481. var schema_1 = require_schema();
  5482. var AliasSchema = class extends schema_1.Schema {
  5483. constructor(parameters) {
  5484. super(parameters);
  5485. this._sourceName = parameters.sourceName;
  5486. }
  5487. expected(utils) {
  5488. return utils.schemas[this._sourceName].expected(utils);
  5489. }
  5490. validate(value, utils) {
  5491. return utils.schemas[this._sourceName].validate(value, utils);
  5492. }
  5493. redirect(_value, _utils) {
  5494. return this._sourceName;
  5495. }
  5496. };
  5497. exports2.AliasSchema = AliasSchema;
  5498. }
  5499. });
  5500. var require_any = __commonJS2({
  5501. "node_modules/vnopts/lib/schemas/any.js"(exports2) {
  5502. "use strict";
  5503. Object.defineProperty(exports2, "__esModule", {
  5504. value: true
  5505. });
  5506. var schema_1 = require_schema();
  5507. var AnySchema = class extends schema_1.Schema {
  5508. expected() {
  5509. return "anything";
  5510. }
  5511. validate() {
  5512. return true;
  5513. }
  5514. };
  5515. exports2.AnySchema = AnySchema;
  5516. }
  5517. });
  5518. var require_array2 = __commonJS2({
  5519. "node_modules/vnopts/lib/schemas/array.js"(exports2) {
  5520. "use strict";
  5521. Object.defineProperty(exports2, "__esModule", {
  5522. value: true
  5523. });
  5524. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5525. var schema_1 = require_schema();
  5526. var ArraySchema = class extends schema_1.Schema {
  5527. constructor(_a) {
  5528. var {
  5529. valueSchema,
  5530. name = valueSchema.name
  5531. } = _a, handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
  5532. super(Object.assign({}, handlers, {
  5533. name
  5534. }));
  5535. this._valueSchema = valueSchema;
  5536. }
  5537. expected(utils) {
  5538. return `an array of ${this._valueSchema.expected(utils)}`;
  5539. }
  5540. validate(value, utils) {
  5541. if (!Array.isArray(value)) {
  5542. return false;
  5543. }
  5544. const invalidValues = [];
  5545. for (const subValue of value) {
  5546. const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
  5547. if (subValidateResult !== true) {
  5548. invalidValues.push(subValidateResult.value);
  5549. }
  5550. }
  5551. return invalidValues.length === 0 ? true : {
  5552. value: invalidValues
  5553. };
  5554. }
  5555. deprecated(value, utils) {
  5556. const deprecatedResult = [];
  5557. for (const subValue of value) {
  5558. const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
  5559. if (subDeprecatedResult !== false) {
  5560. deprecatedResult.push(...subDeprecatedResult.map(({
  5561. value: deprecatedValue
  5562. }) => ({
  5563. value: [deprecatedValue]
  5564. })));
  5565. }
  5566. }
  5567. return deprecatedResult;
  5568. }
  5569. forward(value, utils) {
  5570. const forwardResult = [];
  5571. for (const subValue of value) {
  5572. const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
  5573. forwardResult.push(...subForwardResult.map(wrapTransferResult));
  5574. }
  5575. return forwardResult;
  5576. }
  5577. redirect(value, utils) {
  5578. const remain = [];
  5579. const redirect = [];
  5580. for (const subValue of value) {
  5581. const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
  5582. if ("remain" in subRedirectResult) {
  5583. remain.push(subRedirectResult.remain);
  5584. }
  5585. redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
  5586. }
  5587. return remain.length === 0 ? {
  5588. redirect
  5589. } : {
  5590. redirect,
  5591. remain
  5592. };
  5593. }
  5594. overlap(currentValue, newValue) {
  5595. return currentValue.concat(newValue);
  5596. }
  5597. };
  5598. exports2.ArraySchema = ArraySchema;
  5599. function wrapTransferResult({
  5600. from,
  5601. to
  5602. }) {
  5603. return {
  5604. from: [from],
  5605. to
  5606. };
  5607. }
  5608. }
  5609. });
  5610. var require_boolean = __commonJS2({
  5611. "node_modules/vnopts/lib/schemas/boolean.js"(exports2) {
  5612. "use strict";
  5613. Object.defineProperty(exports2, "__esModule", {
  5614. value: true
  5615. });
  5616. var schema_1 = require_schema();
  5617. var BooleanSchema = class extends schema_1.Schema {
  5618. expected() {
  5619. return "true or false";
  5620. }
  5621. validate(value) {
  5622. return typeof value === "boolean";
  5623. }
  5624. };
  5625. exports2.BooleanSchema = BooleanSchema;
  5626. }
  5627. });
  5628. var require_utils = __commonJS2({
  5629. "node_modules/vnopts/lib/utils.js"(exports2) {
  5630. "use strict";
  5631. Object.defineProperty(exports2, "__esModule", {
  5632. value: true
  5633. });
  5634. function recordFromArray(array, mainKey) {
  5635. const record = /* @__PURE__ */ Object.create(null);
  5636. for (const value of array) {
  5637. const key = value[mainKey];
  5638. if (record[key]) {
  5639. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5640. }
  5641. record[key] = value;
  5642. }
  5643. return record;
  5644. }
  5645. exports2.recordFromArray = recordFromArray;
  5646. function mapFromArray(array, mainKey) {
  5647. const map = /* @__PURE__ */ new Map();
  5648. for (const value of array) {
  5649. const key = value[mainKey];
  5650. if (map.has(key)) {
  5651. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5652. }
  5653. map.set(key, value);
  5654. }
  5655. return map;
  5656. }
  5657. exports2.mapFromArray = mapFromArray;
  5658. function createAutoChecklist() {
  5659. const map = /* @__PURE__ */ Object.create(null);
  5660. return (id) => {
  5661. const idString = JSON.stringify(id);
  5662. if (map[idString]) {
  5663. return true;
  5664. }
  5665. map[idString] = true;
  5666. return false;
  5667. };
  5668. }
  5669. exports2.createAutoChecklist = createAutoChecklist;
  5670. function partition(array, predicate) {
  5671. const trueArray = [];
  5672. const falseArray = [];
  5673. for (const value of array) {
  5674. if (predicate(value)) {
  5675. trueArray.push(value);
  5676. } else {
  5677. falseArray.push(value);
  5678. }
  5679. }
  5680. return [trueArray, falseArray];
  5681. }
  5682. exports2.partition = partition;
  5683. function isInt(value) {
  5684. return value === Math.floor(value);
  5685. }
  5686. exports2.isInt = isInt;
  5687. function comparePrimitive(a, b) {
  5688. if (a === b) {
  5689. return 0;
  5690. }
  5691. const typeofA = typeof a;
  5692. const typeofB = typeof b;
  5693. const orders = ["undefined", "object", "boolean", "number", "string"];
  5694. if (typeofA !== typeofB) {
  5695. return orders.indexOf(typeofA) - orders.indexOf(typeofB);
  5696. }
  5697. if (typeofA !== "string") {
  5698. return Number(a) - Number(b);
  5699. }
  5700. return a.localeCompare(b);
  5701. }
  5702. exports2.comparePrimitive = comparePrimitive;
  5703. function normalizeDefaultResult(result) {
  5704. return result === void 0 ? {} : result;
  5705. }
  5706. exports2.normalizeDefaultResult = normalizeDefaultResult;
  5707. function normalizeValidateResult(result, value) {
  5708. return result === true ? true : result === false ? {
  5709. value
  5710. } : result;
  5711. }
  5712. exports2.normalizeValidateResult = normalizeValidateResult;
  5713. function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
  5714. return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
  5715. value
  5716. }] : "value" in result ? [result] : result.length === 0 ? false : result;
  5717. }
  5718. exports2.normalizeDeprecatedResult = normalizeDeprecatedResult;
  5719. function normalizeTransferResult(result, value) {
  5720. return typeof result === "string" || "key" in result ? {
  5721. from: value,
  5722. to: result
  5723. } : "from" in result ? {
  5724. from: result.from,
  5725. to: result.to
  5726. } : {
  5727. from: value,
  5728. to: result.to
  5729. };
  5730. }
  5731. exports2.normalizeTransferResult = normalizeTransferResult;
  5732. function normalizeForwardResult(result, value) {
  5733. return result === void 0 ? [] : Array.isArray(result) ? result.map((transferResult) => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
  5734. }
  5735. exports2.normalizeForwardResult = normalizeForwardResult;
  5736. function normalizeRedirectResult(result, value) {
  5737. const redirect = normalizeForwardResult(typeof result === "object" && "redirect" in result ? result.redirect : result, value);
  5738. return redirect.length === 0 ? {
  5739. remain: value,
  5740. redirect
  5741. } : typeof result === "object" && "remain" in result ? {
  5742. remain: result.remain,
  5743. redirect
  5744. } : {
  5745. redirect
  5746. };
  5747. }
  5748. exports2.normalizeRedirectResult = normalizeRedirectResult;
  5749. }
  5750. });
  5751. var require_choice = __commonJS2({
  5752. "node_modules/vnopts/lib/schemas/choice.js"(exports2) {
  5753. "use strict";
  5754. Object.defineProperty(exports2, "__esModule", {
  5755. value: true
  5756. });
  5757. var schema_1 = require_schema();
  5758. var utils_1 = require_utils();
  5759. var ChoiceSchema = class extends schema_1.Schema {
  5760. constructor(parameters) {
  5761. super(parameters);
  5762. this._choices = utils_1.mapFromArray(parameters.choices.map((choice) => choice && typeof choice === "object" ? choice : {
  5763. value: choice
  5764. }), "value");
  5765. }
  5766. expected({
  5767. descriptor
  5768. }) {
  5769. const choiceValues = Array.from(this._choices.keys()).map((value) => this._choices.get(value)).filter((choiceInfo) => !choiceInfo.deprecated).map((choiceInfo) => choiceInfo.value).sort(utils_1.comparePrimitive).map(descriptor.value);
  5770. const head = choiceValues.slice(0, -2);
  5771. const tail = choiceValues.slice(-2);
  5772. return head.concat(tail.join(" or ")).join(", ");
  5773. }
  5774. validate(value) {
  5775. return this._choices.has(value);
  5776. }
  5777. deprecated(value) {
  5778. const choiceInfo = this._choices.get(value);
  5779. return choiceInfo && choiceInfo.deprecated ? {
  5780. value
  5781. } : false;
  5782. }
  5783. forward(value) {
  5784. const choiceInfo = this._choices.get(value);
  5785. return choiceInfo ? choiceInfo.forward : void 0;
  5786. }
  5787. redirect(value) {
  5788. const choiceInfo = this._choices.get(value);
  5789. return choiceInfo ? choiceInfo.redirect : void 0;
  5790. }
  5791. };
  5792. exports2.ChoiceSchema = ChoiceSchema;
  5793. }
  5794. });
  5795. var require_number = __commonJS2({
  5796. "node_modules/vnopts/lib/schemas/number.js"(exports2) {
  5797. "use strict";
  5798. Object.defineProperty(exports2, "__esModule", {
  5799. value: true
  5800. });
  5801. var schema_1 = require_schema();
  5802. var NumberSchema = class extends schema_1.Schema {
  5803. expected() {
  5804. return "a number";
  5805. }
  5806. validate(value, _utils) {
  5807. return typeof value === "number";
  5808. }
  5809. };
  5810. exports2.NumberSchema = NumberSchema;
  5811. }
  5812. });
  5813. var require_integer = __commonJS2({
  5814. "node_modules/vnopts/lib/schemas/integer.js"(exports2) {
  5815. "use strict";
  5816. Object.defineProperty(exports2, "__esModule", {
  5817. value: true
  5818. });
  5819. var utils_1 = require_utils();
  5820. var number_1 = require_number();
  5821. var IntegerSchema = class extends number_1.NumberSchema {
  5822. expected() {
  5823. return "an integer";
  5824. }
  5825. validate(value, utils) {
  5826. return utils.normalizeValidateResult(super.validate(value, utils), value) === true && utils_1.isInt(value);
  5827. }
  5828. };
  5829. exports2.IntegerSchema = IntegerSchema;
  5830. }
  5831. });
  5832. var require_string = __commonJS2({
  5833. "node_modules/vnopts/lib/schemas/string.js"(exports2) {
  5834. "use strict";
  5835. Object.defineProperty(exports2, "__esModule", {
  5836. value: true
  5837. });
  5838. var schema_1 = require_schema();
  5839. var StringSchema = class extends schema_1.Schema {
  5840. expected() {
  5841. return "a string";
  5842. }
  5843. validate(value) {
  5844. return typeof value === "string";
  5845. }
  5846. };
  5847. exports2.StringSchema = StringSchema;
  5848. }
  5849. });
  5850. var require_schemas = __commonJS2({
  5851. "node_modules/vnopts/lib/schemas/index.js"(exports2) {
  5852. "use strict";
  5853. Object.defineProperty(exports2, "__esModule", {
  5854. value: true
  5855. });
  5856. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5857. tslib_1.__exportStar(require_alias(), exports2);
  5858. tslib_1.__exportStar(require_any(), exports2);
  5859. tslib_1.__exportStar(require_array2(), exports2);
  5860. tslib_1.__exportStar(require_boolean(), exports2);
  5861. tslib_1.__exportStar(require_choice(), exports2);
  5862. tslib_1.__exportStar(require_integer(), exports2);
  5863. tslib_1.__exportStar(require_number(), exports2);
  5864. tslib_1.__exportStar(require_string(), exports2);
  5865. }
  5866. });
  5867. var require_defaults = __commonJS2({
  5868. "node_modules/vnopts/lib/defaults.js"(exports2) {
  5869. "use strict";
  5870. Object.defineProperty(exports2, "__esModule", {
  5871. value: true
  5872. });
  5873. var api_1 = require_api();
  5874. var common_1 = require_common();
  5875. var invalid_1 = require_invalid();
  5876. var leven_1 = require_leven2();
  5877. exports2.defaultDescriptor = api_1.apiDescriptor;
  5878. exports2.defaultUnknownHandler = leven_1.levenUnknownHandler;
  5879. exports2.defaultInvalidHandler = invalid_1.commonInvalidHandler;
  5880. exports2.defaultDeprecatedHandler = common_1.commonDeprecatedHandler;
  5881. }
  5882. });
  5883. var require_normalize = __commonJS2({
  5884. "node_modules/vnopts/lib/normalize.js"(exports2) {
  5885. "use strict";
  5886. Object.defineProperty(exports2, "__esModule", {
  5887. value: true
  5888. });
  5889. var defaults_1 = require_defaults();
  5890. var utils_1 = require_utils();
  5891. exports2.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
  5892. var Normalizer = class {
  5893. constructor(schemas, opts) {
  5894. const {
  5895. logger = console,
  5896. descriptor = defaults_1.defaultDescriptor,
  5897. unknown = defaults_1.defaultUnknownHandler,
  5898. invalid = defaults_1.defaultInvalidHandler,
  5899. deprecated = defaults_1.defaultDeprecatedHandler
  5900. } = opts || {};
  5901. this._utils = {
  5902. descriptor,
  5903. logger: logger || {
  5904. warn: () => {
  5905. }
  5906. },
  5907. schemas: utils_1.recordFromArray(schemas, "name"),
  5908. normalizeDefaultResult: utils_1.normalizeDefaultResult,
  5909. normalizeDeprecatedResult: utils_1.normalizeDeprecatedResult,
  5910. normalizeForwardResult: utils_1.normalizeForwardResult,
  5911. normalizeRedirectResult: utils_1.normalizeRedirectResult,
  5912. normalizeValidateResult: utils_1.normalizeValidateResult
  5913. };
  5914. this._unknownHandler = unknown;
  5915. this._invalidHandler = invalid;
  5916. this._deprecatedHandler = deprecated;
  5917. this.cleanHistory();
  5918. }
  5919. cleanHistory() {
  5920. this._hasDeprecationWarned = utils_1.createAutoChecklist();
  5921. }
  5922. normalize(options) {
  5923. const normalized = {};
  5924. const restOptionsArray = [options];
  5925. const applyNormalization = () => {
  5926. while (restOptionsArray.length !== 0) {
  5927. const currentOptions = restOptionsArray.shift();
  5928. const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
  5929. restOptionsArray.push(...transferredOptionsArray);
  5930. }
  5931. };
  5932. applyNormalization();
  5933. for (const key of Object.keys(this._utils.schemas)) {
  5934. const schema = this._utils.schemas[key];
  5935. if (!(key in normalized)) {
  5936. const defaultResult = utils_1.normalizeDefaultResult(schema.default(this._utils));
  5937. if ("value" in defaultResult) {
  5938. restOptionsArray.push({
  5939. [key]: defaultResult.value
  5940. });
  5941. }
  5942. }
  5943. }
  5944. applyNormalization();
  5945. for (const key of Object.keys(this._utils.schemas)) {
  5946. const schema = this._utils.schemas[key];
  5947. if (key in normalized) {
  5948. normalized[key] = schema.postprocess(normalized[key], this._utils);
  5949. }
  5950. }
  5951. return normalized;
  5952. }
  5953. _applyNormalization(options, normalized) {
  5954. const transferredOptionsArray = [];
  5955. const [knownOptionNames, unknownOptionNames] = utils_1.partition(Object.keys(options), (key) => key in this._utils.schemas);
  5956. for (const key of knownOptionNames) {
  5957. const schema = this._utils.schemas[key];
  5958. const value = schema.preprocess(options[key], this._utils);
  5959. const validateResult = utils_1.normalizeValidateResult(schema.validate(value, this._utils), value);
  5960. if (validateResult !== true) {
  5961. const {
  5962. value: invalidValue
  5963. } = validateResult;
  5964. const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
  5965. throw typeof errorMessageOrError === "string" ? new Error(errorMessageOrError) : errorMessageOrError;
  5966. }
  5967. const appendTransferredOptions = ({
  5968. from,
  5969. to
  5970. }) => {
  5971. transferredOptionsArray.push(typeof to === "string" ? {
  5972. [to]: from
  5973. } : {
  5974. [to.key]: to.value
  5975. });
  5976. };
  5977. const warnDeprecated = ({
  5978. value: currentValue,
  5979. redirectTo
  5980. }) => {
  5981. const deprecatedResult = utils_1.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value, true);
  5982. if (deprecatedResult === false) {
  5983. return;
  5984. }
  5985. if (deprecatedResult === true) {
  5986. if (!this._hasDeprecationWarned(key)) {
  5987. this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
  5988. }
  5989. } else {
  5990. for (const {
  5991. value: deprecatedValue
  5992. } of deprecatedResult) {
  5993. const pair = {
  5994. key,
  5995. value: deprecatedValue
  5996. };
  5997. if (!this._hasDeprecationWarned(pair)) {
  5998. const redirectToPair = typeof redirectTo === "string" ? {
  5999. key: redirectTo,
  6000. value: deprecatedValue
  6001. } : redirectTo;
  6002. this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
  6003. }
  6004. }
  6005. }
  6006. };
  6007. const forwardResult = utils_1.normalizeForwardResult(schema.forward(value, this._utils), value);
  6008. forwardResult.forEach(appendTransferredOptions);
  6009. const redirectResult = utils_1.normalizeRedirectResult(schema.redirect(value, this._utils), value);
  6010. redirectResult.redirect.forEach(appendTransferredOptions);
  6011. if ("remain" in redirectResult) {
  6012. const remainingValue = redirectResult.remain;
  6013. normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
  6014. warnDeprecated({
  6015. value: remainingValue
  6016. });
  6017. }
  6018. for (const {
  6019. from,
  6020. to
  6021. } of redirectResult.redirect) {
  6022. warnDeprecated({
  6023. value: from,
  6024. redirectTo: to
  6025. });
  6026. }
  6027. }
  6028. for (const key of unknownOptionNames) {
  6029. const value = options[key];
  6030. const unknownResult = this._unknownHandler(key, value, this._utils);
  6031. if (unknownResult) {
  6032. for (const unknownKey of Object.keys(unknownResult)) {
  6033. const unknownOption = {
  6034. [unknownKey]: unknownResult[unknownKey]
  6035. };
  6036. if (unknownKey in this._utils.schemas) {
  6037. transferredOptionsArray.push(unknownOption);
  6038. } else {
  6039. Object.assign(normalized, unknownOption);
  6040. }
  6041. }
  6042. }
  6043. }
  6044. return transferredOptionsArray;
  6045. }
  6046. };
  6047. exports2.Normalizer = Normalizer;
  6048. }
  6049. });
  6050. var require_lib2 = __commonJS2({
  6051. "node_modules/vnopts/lib/index.js"(exports2) {
  6052. "use strict";
  6053. Object.defineProperty(exports2, "__esModule", {
  6054. value: true
  6055. });
  6056. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  6057. tslib_1.__exportStar(require_descriptors2(), exports2);
  6058. tslib_1.__exportStar(require_handlers(), exports2);
  6059. tslib_1.__exportStar(require_schemas(), exports2);
  6060. tslib_1.__exportStar(require_normalize(), exports2);
  6061. tslib_1.__exportStar(require_schema(), exports2);
  6062. }
  6063. });
  6064. var require_options_normalizer = __commonJS2({
  6065. "src/main/options-normalizer.js"(exports2, module2) {
  6066. "use strict";
  6067. var vnopts = require_lib2();
  6068. var getLast = require_get_last();
  6069. var cliDescriptor = {
  6070. key: (key) => key.length === 1 ? `-${key}` : `--${key}`,
  6071. value: (value) => vnopts.apiDescriptor.value(value),
  6072. pair: ({
  6073. key,
  6074. value
  6075. }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}`
  6076. };
  6077. var getFlagSchema = ({
  6078. colorsModule,
  6079. levenshteinDistance
  6080. }) => class FlagSchema extends vnopts.ChoiceSchema {
  6081. constructor({
  6082. name,
  6083. flags
  6084. }) {
  6085. super({
  6086. name,
  6087. choices: flags
  6088. });
  6089. this._flags = [...flags].sort();
  6090. }
  6091. preprocess(value, utils) {
  6092. if (typeof value === "string" && value.length > 0 && !this._flags.includes(value)) {
  6093. const suggestion = this._flags.find((flag) => levenshteinDistance(flag, value) < 3);
  6094. if (suggestion) {
  6095. utils.logger.warn([`Unknown flag ${colorsModule.yellow(utils.descriptor.value(value))},`, `did you mean ${colorsModule.blue(utils.descriptor.value(suggestion))}?`].join(" "));
  6096. return suggestion;
  6097. }
  6098. }
  6099. return value;
  6100. }
  6101. expected() {
  6102. return "a flag";
  6103. }
  6104. };
  6105. var hasDeprecationWarned;
  6106. function normalizeOptions(options, optionInfos, {
  6107. logger = false,
  6108. isCLI = false,
  6109. passThrough = false,
  6110. colorsModule = null,
  6111. levenshteinDistance = null
  6112. } = {}) {
  6113. const unknown = !passThrough ? (key, value, options2) => {
  6114. const _options2$schemas = options2.schemas, {
  6115. _
  6116. } = _options2$schemas, schemas2 = _objectWithoutProperties(_options2$schemas, _excluded2);
  6117. return vnopts.levenUnknownHandler(key, value, Object.assign(Object.assign({}, options2), {}, {
  6118. schemas: schemas2
  6119. }));
  6120. } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? void 0 : {
  6121. [key]: value
  6122. } : (key, value) => ({
  6123. [key]: value
  6124. });
  6125. const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
  6126. const schemas = optionInfosToSchemas(optionInfos, {
  6127. isCLI,
  6128. colorsModule,
  6129. levenshteinDistance
  6130. });
  6131. const normalizer = new vnopts.Normalizer(schemas, {
  6132. logger,
  6133. unknown,
  6134. descriptor
  6135. });
  6136. const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
  6137. if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
  6138. normalizer._hasDeprecationWarned = hasDeprecationWarned;
  6139. }
  6140. const normalized = normalizer.normalize(options);
  6141. if (shouldSuppressDuplicateDeprecationWarnings) {
  6142. hasDeprecationWarned = normalizer._hasDeprecationWarned;
  6143. }
  6144. if (isCLI && normalized["plugin-search"] === false) {
  6145. normalized["plugin-search-dir"] = false;
  6146. }
  6147. return normalized;
  6148. }
  6149. function optionInfosToSchemas(optionInfos, {
  6150. isCLI,
  6151. colorsModule,
  6152. levenshteinDistance
  6153. }) {
  6154. const schemas = [];
  6155. if (isCLI) {
  6156. schemas.push(vnopts.AnySchema.create({
  6157. name: "_"
  6158. }));
  6159. }
  6160. for (const optionInfo of optionInfos) {
  6161. schemas.push(optionInfoToSchema(optionInfo, {
  6162. isCLI,
  6163. optionInfos,
  6164. colorsModule,
  6165. levenshteinDistance
  6166. }));
  6167. if (optionInfo.alias && isCLI) {
  6168. schemas.push(vnopts.AliasSchema.create({
  6169. name: optionInfo.alias,
  6170. sourceName: optionInfo.name
  6171. }));
  6172. }
  6173. }
  6174. return schemas;
  6175. }
  6176. function optionInfoToSchema(optionInfo, {
  6177. isCLI,
  6178. optionInfos,
  6179. colorsModule,
  6180. levenshteinDistance
  6181. }) {
  6182. const {
  6183. name
  6184. } = optionInfo;
  6185. if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
  6186. return vnopts.AnySchema.create({
  6187. name,
  6188. preprocess(value) {
  6189. if (value === false) {
  6190. return value;
  6191. }
  6192. value = Array.isArray(value) ? value : [value];
  6193. return value;
  6194. },
  6195. validate(value) {
  6196. if (value === false) {
  6197. return true;
  6198. }
  6199. return value.every((dir) => typeof dir === "string");
  6200. },
  6201. expected() {
  6202. return "false or paths to plugin search dir";
  6203. }
  6204. });
  6205. }
  6206. const parameters = {
  6207. name
  6208. };
  6209. let SchemaConstructor;
  6210. const handlers = {};
  6211. switch (optionInfo.type) {
  6212. case "int":
  6213. SchemaConstructor = vnopts.IntegerSchema;
  6214. if (isCLI) {
  6215. parameters.preprocess = Number;
  6216. }
  6217. break;
  6218. case "string":
  6219. SchemaConstructor = vnopts.StringSchema;
  6220. break;
  6221. case "choice":
  6222. SchemaConstructor = vnopts.ChoiceSchema;
  6223. parameters.choices = optionInfo.choices.map((choiceInfo) => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign(Object.assign({}, choiceInfo), {}, {
  6224. redirect: {
  6225. to: {
  6226. key: optionInfo.name,
  6227. value: choiceInfo.redirect
  6228. }
  6229. }
  6230. }) : choiceInfo);
  6231. break;
  6232. case "boolean":
  6233. SchemaConstructor = vnopts.BooleanSchema;
  6234. break;
  6235. case "flag":
  6236. SchemaConstructor = getFlagSchema({
  6237. colorsModule,
  6238. levenshteinDistance
  6239. });
  6240. parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean));
  6241. break;
  6242. case "path":
  6243. SchemaConstructor = vnopts.StringSchema;
  6244. break;
  6245. default:
  6246. throw new Error(`Unexpected type ${optionInfo.type}`);
  6247. }
  6248. if (optionInfo.exception) {
  6249. parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils);
  6250. } else {
  6251. parameters.validate = (value, schema, utils) => value === void 0 || schema.validate(value, utils);
  6252. }
  6253. if (optionInfo.redirect) {
  6254. handlers.redirect = (value) => !value ? void 0 : {
  6255. to: {
  6256. key: optionInfo.redirect.option,
  6257. value: optionInfo.redirect.value
  6258. }
  6259. };
  6260. }
  6261. if (optionInfo.deprecated) {
  6262. handlers.deprecated = true;
  6263. }
  6264. if (isCLI && !optionInfo.array) {
  6265. const originalPreprocess = parameters.preprocess || ((x) => x);
  6266. parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? getLast(value) : value), utils);
  6267. }
  6268. return optionInfo.array ? vnopts.ArraySchema.create(Object.assign(Object.assign(Object.assign({}, isCLI ? {
  6269. preprocess: (v) => Array.isArray(v) ? v : [v]
  6270. } : {}), handlers), {}, {
  6271. valueSchema: SchemaConstructor.create(parameters)
  6272. })) : SchemaConstructor.create(Object.assign(Object.assign({}, parameters), handlers));
  6273. }
  6274. function normalizeApiOptions(options, optionInfos, opts) {
  6275. return normalizeOptions(options, optionInfos, opts);
  6276. }
  6277. function normalizeCliOptions(options, optionInfos, opts) {
  6278. if (false) {
  6279. if (!opts.colorsModule) {
  6280. throw new Error("'colorsModule' option is required.");
  6281. }
  6282. if (!opts.levenshteinDistance) {
  6283. throw new Error("'levenshteinDistance' option is required.");
  6284. }
  6285. }
  6286. return normalizeOptions(options, optionInfos, Object.assign({
  6287. isCLI: true
  6288. }, opts));
  6289. }
  6290. module2.exports = {
  6291. normalizeApiOptions,
  6292. normalizeCliOptions
  6293. };
  6294. }
  6295. });
  6296. var require_loc = __commonJS2({
  6297. "src/language-js/loc.js"(exports2, module2) {
  6298. "use strict";
  6299. var isNonEmptyArray = require_is_non_empty_array();
  6300. function locStart(node) {
  6301. var _node$declaration$dec, _node$declaration;
  6302. const start = node.range ? node.range[0] : node.start;
  6303. const decorators = (_node$declaration$dec = (_node$declaration = node.declaration) === null || _node$declaration === void 0 ? void 0 : _node$declaration.decorators) !== null && _node$declaration$dec !== void 0 ? _node$declaration$dec : node.decorators;
  6304. if (isNonEmptyArray(decorators)) {
  6305. return Math.min(locStart(decorators[0]), start);
  6306. }
  6307. return start;
  6308. }
  6309. function locEnd(node) {
  6310. return node.range ? node.range[1] : node.end;
  6311. }
  6312. function hasSameLocStart(nodeA, nodeB) {
  6313. const nodeAStart = locStart(nodeA);
  6314. return Number.isInteger(nodeAStart) && nodeAStart === locStart(nodeB);
  6315. }
  6316. function hasSameLocEnd(nodeA, nodeB) {
  6317. const nodeAEnd = locEnd(nodeA);
  6318. return Number.isInteger(nodeAEnd) && nodeAEnd === locEnd(nodeB);
  6319. }
  6320. function hasSameLoc(nodeA, nodeB) {
  6321. return hasSameLocStart(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB);
  6322. }
  6323. module2.exports = {
  6324. locStart,
  6325. locEnd,
  6326. hasSameLocStart,
  6327. hasSameLoc
  6328. };
  6329. }
  6330. });
  6331. var require_load_parser = __commonJS2({
  6332. "src/main/load-parser.js"(exports2, module2) {
  6333. "use strict";
  6334. var path = require("path");
  6335. var {
  6336. ConfigError
  6337. } = require_errors();
  6338. var {
  6339. locStart,
  6340. locEnd
  6341. } = require_loc();
  6342. function requireParser(parser) {
  6343. try {
  6344. return {
  6345. parse: require(path.resolve(process.cwd(), parser)),
  6346. astFormat: "estree",
  6347. locStart,
  6348. locEnd
  6349. };
  6350. } catch {
  6351. throw new ConfigError(`Couldn't resolve parser "${parser}"`);
  6352. }
  6353. }
  6354. module2.exports = requireParser;
  6355. }
  6356. });
  6357. var require_js_tokens = __commonJS2({
  6358. "node_modules/js-tokens/index.js"(exports2) {
  6359. Object.defineProperty(exports2, "__esModule", {
  6360. value: true
  6361. });
  6362. exports2.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
  6363. exports2.matchToToken = function(match) {
  6364. var token = {
  6365. type: "invalid",
  6366. value: match[0],
  6367. closed: void 0
  6368. };
  6369. if (match[1])
  6370. token.type = "string", token.closed = !!(match[3] || match[4]);
  6371. else if (match[5])
  6372. token.type = "comment";
  6373. else if (match[6])
  6374. token.type = "comment", token.closed = !!match[7];
  6375. else if (match[8])
  6376. token.type = "regex";
  6377. else if (match[9])
  6378. token.type = "number";
  6379. else if (match[10])
  6380. token.type = "name";
  6381. else if (match[11])
  6382. token.type = "punctuator";
  6383. else if (match[12])
  6384. token.type = "whitespace";
  6385. return token;
  6386. };
  6387. }
  6388. });
  6389. var require_identifier = __commonJS2({
  6390. "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
  6391. "use strict";
  6392. Object.defineProperty(exports2, "__esModule", {
  6393. value: true
  6394. });
  6395. exports2.isIdentifierChar = isIdentifierChar;
  6396. exports2.isIdentifierName = isIdentifierName;
  6397. exports2.isIdentifierStart = isIdentifierStart;
  6398. 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\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\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\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\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-\u1711\u171F-\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-\u1B4C\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-\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-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\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";
  6399. 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\u0898-\u089F\u08CA-\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\u0C3C\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\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-\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";
  6400. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  6401. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  6402. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  6403. 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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 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, 38, 6, 186, 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, 19, 72, 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, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 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, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 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, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
  6404. 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, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 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, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
  6405. function isInAstralSet(code, set) {
  6406. let pos = 65536;
  6407. for (let i = 0, length = set.length; i < length; i += 2) {
  6408. pos += set[i];
  6409. if (pos > code)
  6410. return false;
  6411. pos += set[i + 1];
  6412. if (pos >= code)
  6413. return true;
  6414. }
  6415. return false;
  6416. }
  6417. function isIdentifierStart(code) {
  6418. if (code < 65)
  6419. return code === 36;
  6420. if (code <= 90)
  6421. return true;
  6422. if (code < 97)
  6423. return code === 95;
  6424. if (code <= 122)
  6425. return true;
  6426. if (code <= 65535) {
  6427. return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
  6428. }
  6429. return isInAstralSet(code, astralIdentifierStartCodes);
  6430. }
  6431. function isIdentifierChar(code) {
  6432. if (code < 48)
  6433. return code === 36;
  6434. if (code < 58)
  6435. return true;
  6436. if (code < 65)
  6437. return false;
  6438. if (code <= 90)
  6439. return true;
  6440. if (code < 97)
  6441. return code === 95;
  6442. if (code <= 122)
  6443. return true;
  6444. if (code <= 65535) {
  6445. return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
  6446. }
  6447. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  6448. }
  6449. function isIdentifierName(name) {
  6450. let isFirst = true;
  6451. for (let i = 0; i < name.length; i++) {
  6452. let cp = name.charCodeAt(i);
  6453. if ((cp & 64512) === 55296 && i + 1 < name.length) {
  6454. const trail = name.charCodeAt(++i);
  6455. if ((trail & 64512) === 56320) {
  6456. cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
  6457. }
  6458. }
  6459. if (isFirst) {
  6460. isFirst = false;
  6461. if (!isIdentifierStart(cp)) {
  6462. return false;
  6463. }
  6464. } else if (!isIdentifierChar(cp)) {
  6465. return false;
  6466. }
  6467. }
  6468. return !isFirst;
  6469. }
  6470. }
  6471. });
  6472. var require_keyword = __commonJS2({
  6473. "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
  6474. "use strict";
  6475. Object.defineProperty(exports2, "__esModule", {
  6476. value: true
  6477. });
  6478. exports2.isKeyword = isKeyword;
  6479. exports2.isReservedWord = isReservedWord;
  6480. exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
  6481. exports2.isStrictBindReservedWord = isStrictBindReservedWord;
  6482. exports2.isStrictReservedWord = isStrictReservedWord;
  6483. var reservedWords = {
  6484. keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
  6485. strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  6486. strictBind: ["eval", "arguments"]
  6487. };
  6488. var keywords = new Set(reservedWords.keyword);
  6489. var reservedWordsStrictSet = new Set(reservedWords.strict);
  6490. var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  6491. function isReservedWord(word, inModule) {
  6492. return inModule && word === "await" || word === "enum";
  6493. }
  6494. function isStrictReservedWord(word, inModule) {
  6495. return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  6496. }
  6497. function isStrictBindOnlyReservedWord(word) {
  6498. return reservedWordsStrictBindSet.has(word);
  6499. }
  6500. function isStrictBindReservedWord(word, inModule) {
  6501. return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  6502. }
  6503. function isKeyword(word) {
  6504. return keywords.has(word);
  6505. }
  6506. }
  6507. });
  6508. var require_lib3 = __commonJS2({
  6509. "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
  6510. "use strict";
  6511. Object.defineProperty(exports2, "__esModule", {
  6512. value: true
  6513. });
  6514. Object.defineProperty(exports2, "isIdentifierChar", {
  6515. enumerable: true,
  6516. get: function() {
  6517. return _identifier.isIdentifierChar;
  6518. }
  6519. });
  6520. Object.defineProperty(exports2, "isIdentifierName", {
  6521. enumerable: true,
  6522. get: function() {
  6523. return _identifier.isIdentifierName;
  6524. }
  6525. });
  6526. Object.defineProperty(exports2, "isIdentifierStart", {
  6527. enumerable: true,
  6528. get: function() {
  6529. return _identifier.isIdentifierStart;
  6530. }
  6531. });
  6532. Object.defineProperty(exports2, "isKeyword", {
  6533. enumerable: true,
  6534. get: function() {
  6535. return _keyword.isKeyword;
  6536. }
  6537. });
  6538. Object.defineProperty(exports2, "isReservedWord", {
  6539. enumerable: true,
  6540. get: function() {
  6541. return _keyword.isReservedWord;
  6542. }
  6543. });
  6544. Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
  6545. enumerable: true,
  6546. get: function() {
  6547. return _keyword.isStrictBindOnlyReservedWord;
  6548. }
  6549. });
  6550. Object.defineProperty(exports2, "isStrictBindReservedWord", {
  6551. enumerable: true,
  6552. get: function() {
  6553. return _keyword.isStrictBindReservedWord;
  6554. }
  6555. });
  6556. Object.defineProperty(exports2, "isStrictReservedWord", {
  6557. enumerable: true,
  6558. get: function() {
  6559. return _keyword.isStrictReservedWord;
  6560. }
  6561. });
  6562. var _identifier = require_identifier();
  6563. var _keyword = require_keyword();
  6564. }
  6565. });
  6566. var require_escape_string_regexp2 = __commonJS2({
  6567. "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  6568. "use strict";
  6569. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  6570. module2.exports = function(str) {
  6571. if (typeof str !== "string") {
  6572. throw new TypeError("Expected a string");
  6573. }
  6574. return str.replace(matchOperatorsRe, "\\$&");
  6575. };
  6576. }
  6577. });
  6578. var require_has_flag2 = __commonJS2({
  6579. "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
  6580. "use strict";
  6581. module2.exports = (flag, argv) => {
  6582. argv = argv || process.argv;
  6583. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  6584. const pos = argv.indexOf(prefix + flag);
  6585. const terminatorPos = argv.indexOf("--");
  6586. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  6587. };
  6588. }
  6589. });
  6590. var require_supports_color2 = __commonJS2({
  6591. "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
  6592. "use strict";
  6593. var os = require("os");
  6594. var hasFlag = require_has_flag2();
  6595. var env = process.env;
  6596. var forceColor;
  6597. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  6598. forceColor = false;
  6599. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  6600. forceColor = true;
  6601. }
  6602. if ("FORCE_COLOR" in env) {
  6603. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  6604. }
  6605. function translateLevel(level) {
  6606. if (level === 0) {
  6607. return false;
  6608. }
  6609. return {
  6610. level,
  6611. hasBasic: true,
  6612. has256: level >= 2,
  6613. has16m: level >= 3
  6614. };
  6615. }
  6616. function supportsColor(stream) {
  6617. if (forceColor === false) {
  6618. return 0;
  6619. }
  6620. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  6621. return 3;
  6622. }
  6623. if (hasFlag("color=256")) {
  6624. return 2;
  6625. }
  6626. if (stream && !stream.isTTY && forceColor !== true) {
  6627. return 0;
  6628. }
  6629. const min = forceColor ? 1 : 0;
  6630. if (process.platform === "win32") {
  6631. const osRelease = os.release().split(".");
  6632. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  6633. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  6634. }
  6635. return 1;
  6636. }
  6637. if ("CI" in env) {
  6638. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  6639. return 1;
  6640. }
  6641. return min;
  6642. }
  6643. if ("TEAMCITY_VERSION" in env) {
  6644. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  6645. }
  6646. if (env.COLORTERM === "truecolor") {
  6647. return 3;
  6648. }
  6649. if ("TERM_PROGRAM" in env) {
  6650. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  6651. switch (env.TERM_PROGRAM) {
  6652. case "iTerm.app":
  6653. return version2 >= 3 ? 3 : 2;
  6654. case "Apple_Terminal":
  6655. return 2;
  6656. }
  6657. }
  6658. if (/-256(color)?$/i.test(env.TERM)) {
  6659. return 2;
  6660. }
  6661. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  6662. return 1;
  6663. }
  6664. if ("COLORTERM" in env) {
  6665. return 1;
  6666. }
  6667. if (env.TERM === "dumb") {
  6668. return min;
  6669. }
  6670. return min;
  6671. }
  6672. function getSupportLevel(stream) {
  6673. const level = supportsColor(stream);
  6674. return translateLevel(level);
  6675. }
  6676. module2.exports = {
  6677. supportsColor: getSupportLevel,
  6678. stdout: getSupportLevel(process.stdout),
  6679. stderr: getSupportLevel(process.stderr)
  6680. };
  6681. }
  6682. });
  6683. var require_templates2 = __commonJS2({
  6684. "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
  6685. "use strict";
  6686. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  6687. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  6688. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  6689. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  6690. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  6691. function unescape(c) {
  6692. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  6693. return String.fromCharCode(parseInt(c.slice(1), 16));
  6694. }
  6695. return ESCAPES.get(c) || c;
  6696. }
  6697. function parseArguments(name, args) {
  6698. const results = [];
  6699. const chunks = args.trim().split(/\s*,\s*/g);
  6700. let matches;
  6701. for (const chunk of chunks) {
  6702. if (!isNaN(chunk)) {
  6703. results.push(Number(chunk));
  6704. } else if (matches = chunk.match(STRING_REGEX)) {
  6705. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  6706. } else {
  6707. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  6708. }
  6709. }
  6710. return results;
  6711. }
  6712. function parseStyle(style) {
  6713. STYLE_REGEX.lastIndex = 0;
  6714. const results = [];
  6715. let matches;
  6716. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  6717. const name = matches[1];
  6718. if (matches[2]) {
  6719. const args = parseArguments(name, matches[2]);
  6720. results.push([name].concat(args));
  6721. } else {
  6722. results.push([name]);
  6723. }
  6724. }
  6725. return results;
  6726. }
  6727. function buildStyle(chalk, styles) {
  6728. const enabled = {};
  6729. for (const layer of styles) {
  6730. for (const style of layer.styles) {
  6731. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  6732. }
  6733. }
  6734. let current = chalk;
  6735. for (const styleName of Object.keys(enabled)) {
  6736. if (Array.isArray(enabled[styleName])) {
  6737. if (!(styleName in current)) {
  6738. throw new Error(`Unknown Chalk style: ${styleName}`);
  6739. }
  6740. if (enabled[styleName].length > 0) {
  6741. current = current[styleName].apply(current, enabled[styleName]);
  6742. } else {
  6743. current = current[styleName];
  6744. }
  6745. }
  6746. }
  6747. return current;
  6748. }
  6749. module2.exports = (chalk, tmp) => {
  6750. const styles = [];
  6751. const chunks = [];
  6752. let chunk = [];
  6753. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  6754. if (escapeChar) {
  6755. chunk.push(unescape(escapeChar));
  6756. } else if (style) {
  6757. const str = chunk.join("");
  6758. chunk = [];
  6759. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  6760. styles.push({
  6761. inverse,
  6762. styles: parseStyle(style)
  6763. });
  6764. } else if (close) {
  6765. if (styles.length === 0) {
  6766. throw new Error("Found extraneous } in Chalk template literal");
  6767. }
  6768. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  6769. chunk = [];
  6770. styles.pop();
  6771. } else {
  6772. chunk.push(chr);
  6773. }
  6774. });
  6775. chunks.push(chunk.join(""));
  6776. if (styles.length > 0) {
  6777. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  6778. throw new Error(errMsg);
  6779. }
  6780. return chunks.join("");
  6781. };
  6782. }
  6783. });
  6784. var require_chalk2 = __commonJS2({
  6785. "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
  6786. "use strict";
  6787. var escapeStringRegexp2 = require_escape_string_regexp2();
  6788. var ansiStyles = require_ansi_styles();
  6789. var stdoutColor = require_supports_color2().stdout;
  6790. var template = require_templates2();
  6791. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  6792. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  6793. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  6794. var styles = /* @__PURE__ */ Object.create(null);
  6795. function applyOptions(obj, options) {
  6796. options = options || {};
  6797. const scLevel = stdoutColor ? stdoutColor.level : 0;
  6798. obj.level = options.level === void 0 ? scLevel : options.level;
  6799. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  6800. }
  6801. function Chalk(options) {
  6802. if (!this || !(this instanceof Chalk) || this.template) {
  6803. const chalk = {};
  6804. applyOptions(chalk, options);
  6805. chalk.template = function() {
  6806. const args = [].slice.call(arguments);
  6807. return chalkTag.apply(null, [chalk.template].concat(args));
  6808. };
  6809. Object.setPrototypeOf(chalk, Chalk.prototype);
  6810. Object.setPrototypeOf(chalk.template, chalk);
  6811. chalk.template.constructor = Chalk;
  6812. return chalk.template;
  6813. }
  6814. applyOptions(this, options);
  6815. }
  6816. if (isSimpleWindowsTerm) {
  6817. ansiStyles.blue.open = "\x1B[94m";
  6818. }
  6819. for (const key of Object.keys(ansiStyles)) {
  6820. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  6821. styles[key] = {
  6822. get() {
  6823. const codes = ansiStyles[key];
  6824. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  6825. }
  6826. };
  6827. }
  6828. styles.visible = {
  6829. get() {
  6830. return build.call(this, this._styles || [], true, "visible");
  6831. }
  6832. };
  6833. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  6834. for (const model of Object.keys(ansiStyles.color.ansi)) {
  6835. if (skipModels.has(model)) {
  6836. continue;
  6837. }
  6838. styles[model] = {
  6839. get() {
  6840. const level = this.level;
  6841. return function() {
  6842. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  6843. const codes = {
  6844. open,
  6845. close: ansiStyles.color.close,
  6846. closeRe: ansiStyles.color.closeRe
  6847. };
  6848. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  6849. };
  6850. }
  6851. };
  6852. }
  6853. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  6854. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  6855. if (skipModels.has(model)) {
  6856. continue;
  6857. }
  6858. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  6859. styles[bgModel] = {
  6860. get() {
  6861. const level = this.level;
  6862. return function() {
  6863. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  6864. const codes = {
  6865. open,
  6866. close: ansiStyles.bgColor.close,
  6867. closeRe: ansiStyles.bgColor.closeRe
  6868. };
  6869. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  6870. };
  6871. }
  6872. };
  6873. }
  6874. var proto = Object.defineProperties(() => {
  6875. }, styles);
  6876. function build(_styles, _empty, key) {
  6877. const builder = function() {
  6878. return applyStyle.apply(builder, arguments);
  6879. };
  6880. builder._styles = _styles;
  6881. builder._empty = _empty;
  6882. const self2 = this;
  6883. Object.defineProperty(builder, "level", {
  6884. enumerable: true,
  6885. get() {
  6886. return self2.level;
  6887. },
  6888. set(level) {
  6889. self2.level = level;
  6890. }
  6891. });
  6892. Object.defineProperty(builder, "enabled", {
  6893. enumerable: true,
  6894. get() {
  6895. return self2.enabled;
  6896. },
  6897. set(enabled) {
  6898. self2.enabled = enabled;
  6899. }
  6900. });
  6901. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  6902. builder.__proto__ = proto;
  6903. return builder;
  6904. }
  6905. function applyStyle() {
  6906. const args = arguments;
  6907. const argsLen = args.length;
  6908. let str = String(arguments[0]);
  6909. if (argsLen === 0) {
  6910. return "";
  6911. }
  6912. if (argsLen > 1) {
  6913. for (let a = 1; a < argsLen; a++) {
  6914. str += " " + args[a];
  6915. }
  6916. }
  6917. if (!this.enabled || this.level <= 0 || !str) {
  6918. return this._empty ? "" : str;
  6919. }
  6920. const originalDim = ansiStyles.dim.open;
  6921. if (isSimpleWindowsTerm && this.hasGrey) {
  6922. ansiStyles.dim.open = "";
  6923. }
  6924. for (const code of this._styles.slice().reverse()) {
  6925. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  6926. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  6927. }
  6928. ansiStyles.dim.open = originalDim;
  6929. return str;
  6930. }
  6931. function chalkTag(chalk, strings) {
  6932. if (!Array.isArray(strings)) {
  6933. return [].slice.call(arguments, 1).join(" ");
  6934. }
  6935. const args = [].slice.call(arguments, 2);
  6936. const parts = [strings.raw[0]];
  6937. for (let i = 1; i < strings.length; i++) {
  6938. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  6939. parts.push(String(strings.raw[i]));
  6940. }
  6941. return template(chalk, parts.join(""));
  6942. }
  6943. Object.defineProperties(Chalk.prototype, styles);
  6944. module2.exports = Chalk();
  6945. module2.exports.supportsColor = stdoutColor;
  6946. module2.exports.default = module2.exports;
  6947. }
  6948. });
  6949. var require_lib4 = __commonJS2({
  6950. "node_modules/@babel/highlight/lib/index.js"(exports2) {
  6951. "use strict";
  6952. Object.defineProperty(exports2, "__esModule", {
  6953. value: true
  6954. });
  6955. exports2.default = highlight;
  6956. exports2.getChalk = getChalk;
  6957. exports2.shouldHighlight = shouldHighlight;
  6958. var _jsTokens = require_js_tokens();
  6959. var _helperValidatorIdentifier = require_lib3();
  6960. var _chalk = require_chalk2();
  6961. var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
  6962. function getDefs(chalk) {
  6963. return {
  6964. keyword: chalk.cyan,
  6965. capitalized: chalk.yellow,
  6966. jsxIdentifier: chalk.yellow,
  6967. punctuator: chalk.yellow,
  6968. number: chalk.magenta,
  6969. string: chalk.green,
  6970. regex: chalk.magenta,
  6971. comment: chalk.grey,
  6972. invalid: chalk.white.bgRed.bold
  6973. };
  6974. }
  6975. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  6976. var BRACKET = /^[()[\]{}]$/;
  6977. var tokenize;
  6978. {
  6979. const JSX_TAG = /^[a-z][\w-]*$/i;
  6980. const getTokenType = function(token, offset, text) {
  6981. if (token.type === "name") {
  6982. if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
  6983. return "keyword";
  6984. }
  6985. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
  6986. return "jsxIdentifier";
  6987. }
  6988. if (token.value[0] !== token.value[0].toLowerCase()) {
  6989. return "capitalized";
  6990. }
  6991. }
  6992. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  6993. return "bracket";
  6994. }
  6995. if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
  6996. return "punctuator";
  6997. }
  6998. return token.type;
  6999. };
  7000. tokenize = function* (text) {
  7001. let match;
  7002. while (match = _jsTokens.default.exec(text)) {
  7003. const token = _jsTokens.matchToToken(match);
  7004. yield {
  7005. type: getTokenType(token, match.index, text),
  7006. value: token.value
  7007. };
  7008. }
  7009. };
  7010. }
  7011. function highlightTokens(defs, text) {
  7012. let highlighted = "";
  7013. for (const {
  7014. type,
  7015. value
  7016. } of tokenize(text)) {
  7017. const colorize = defs[type];
  7018. if (colorize) {
  7019. highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
  7020. } else {
  7021. highlighted += value;
  7022. }
  7023. }
  7024. return highlighted;
  7025. }
  7026. function shouldHighlight(options) {
  7027. return !!_chalk.supportsColor || options.forceColor;
  7028. }
  7029. function getChalk(options) {
  7030. return options.forceColor ? new _chalk.constructor({
  7031. enabled: true,
  7032. level: 1
  7033. }) : _chalk;
  7034. }
  7035. function highlight(code, options = {}) {
  7036. if (code !== "" && shouldHighlight(options)) {
  7037. const chalk = getChalk(options);
  7038. const defs = getDefs(chalk);
  7039. return highlightTokens(defs, code);
  7040. } else {
  7041. return code;
  7042. }
  7043. }
  7044. }
  7045. });
  7046. var require_lib5 = __commonJS2({
  7047. "node_modules/@babel/code-frame/lib/index.js"(exports2) {
  7048. "use strict";
  7049. Object.defineProperty(exports2, "__esModule", {
  7050. value: true
  7051. });
  7052. exports2.codeFrameColumns = codeFrameColumns;
  7053. exports2.default = _default;
  7054. var _highlight = require_lib4();
  7055. var deprecationWarningShown = false;
  7056. function getDefs(chalk) {
  7057. return {
  7058. gutter: chalk.grey,
  7059. marker: chalk.red.bold,
  7060. message: chalk.red.bold
  7061. };
  7062. }
  7063. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  7064. function getMarkerLines(loc, source, opts) {
  7065. const startLoc = Object.assign({
  7066. column: 0,
  7067. line: -1
  7068. }, loc.start);
  7069. const endLoc = Object.assign({}, startLoc, loc.end);
  7070. const {
  7071. linesAbove = 2,
  7072. linesBelow = 3
  7073. } = opts || {};
  7074. const startLine = startLoc.line;
  7075. const startColumn = startLoc.column;
  7076. const endLine = endLoc.line;
  7077. const endColumn = endLoc.column;
  7078. let start = Math.max(startLine - (linesAbove + 1), 0);
  7079. let end = Math.min(source.length, endLine + linesBelow);
  7080. if (startLine === -1) {
  7081. start = 0;
  7082. }
  7083. if (endLine === -1) {
  7084. end = source.length;
  7085. }
  7086. const lineDiff = endLine - startLine;
  7087. const markerLines = {};
  7088. if (lineDiff) {
  7089. for (let i = 0; i <= lineDiff; i++) {
  7090. const lineNumber = i + startLine;
  7091. if (!startColumn) {
  7092. markerLines[lineNumber] = true;
  7093. } else if (i === 0) {
  7094. const sourceLength = source[lineNumber - 1].length;
  7095. markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
  7096. } else if (i === lineDiff) {
  7097. markerLines[lineNumber] = [0, endColumn];
  7098. } else {
  7099. const sourceLength = source[lineNumber - i].length;
  7100. markerLines[lineNumber] = [0, sourceLength];
  7101. }
  7102. }
  7103. } else {
  7104. if (startColumn === endColumn) {
  7105. if (startColumn) {
  7106. markerLines[startLine] = [startColumn, 0];
  7107. } else {
  7108. markerLines[startLine] = true;
  7109. }
  7110. } else {
  7111. markerLines[startLine] = [startColumn, endColumn - startColumn];
  7112. }
  7113. }
  7114. return {
  7115. start,
  7116. end,
  7117. markerLines
  7118. };
  7119. }
  7120. function codeFrameColumns(rawLines, loc, opts = {}) {
  7121. const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
  7122. const chalk = (0, _highlight.getChalk)(opts);
  7123. const defs = getDefs(chalk);
  7124. const maybeHighlight = (chalkFn, string) => {
  7125. return highlighted ? chalkFn(string) : string;
  7126. };
  7127. const lines = rawLines.split(NEWLINE);
  7128. const {
  7129. start,
  7130. end,
  7131. markerLines
  7132. } = getMarkerLines(loc, lines, opts);
  7133. const hasColumns = loc.start && typeof loc.start.column === "number";
  7134. const numberMaxWidth = String(end).length;
  7135. const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
  7136. let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
  7137. const number = start + 1 + index;
  7138. const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
  7139. const gutter = ` ${paddedNumber} |`;
  7140. const hasMarker = markerLines[number];
  7141. const lastMarkerLine = !markerLines[number + 1];
  7142. if (hasMarker) {
  7143. let markerLine = "";
  7144. if (Array.isArray(hasMarker)) {
  7145. const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
  7146. const numberOfMarkers = hasMarker[1] || 1;
  7147. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
  7148. if (lastMarkerLine && opts.message) {
  7149. markerLine += " " + maybeHighlight(defs.message, opts.message);
  7150. }
  7151. }
  7152. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
  7153. } else {
  7154. return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
  7155. }
  7156. }).join("\n");
  7157. if (opts.message && !hasColumns) {
  7158. frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
  7159. ${frame}`;
  7160. }
  7161. if (highlighted) {
  7162. return chalk.reset(frame);
  7163. } else {
  7164. return frame;
  7165. }
  7166. }
  7167. function _default(rawLines, lineNumber, colNumber, opts = {}) {
  7168. if (!deprecationWarningShown) {
  7169. deprecationWarningShown = true;
  7170. const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
  7171. if (process.emitWarning) {
  7172. process.emitWarning(message, "DeprecationWarning");
  7173. } else {
  7174. const deprecationError = new Error(message);
  7175. deprecationError.name = "DeprecationWarning";
  7176. console.warn(new Error(message));
  7177. }
  7178. }
  7179. colNumber = Math.max(colNumber, 0);
  7180. const location = {
  7181. start: {
  7182. column: colNumber,
  7183. line: lineNumber
  7184. }
  7185. };
  7186. return codeFrameColumns(rawLines, location, opts);
  7187. }
  7188. }
  7189. });
  7190. var require_parser = __commonJS2({
  7191. "src/main/parser.js"(exports2, module2) {
  7192. "use strict";
  7193. var {
  7194. ConfigError
  7195. } = require_errors();
  7196. var jsLoc = require_loc();
  7197. var loadParser = require_load_parser();
  7198. var {
  7199. locStart,
  7200. locEnd
  7201. } = jsLoc;
  7202. var ownNames = Object.getOwnPropertyNames;
  7203. var ownDescriptor = Object.getOwnPropertyDescriptor;
  7204. function getParsers(options) {
  7205. const parsers = {};
  7206. for (const plugin of options.plugins) {
  7207. if (!plugin.parsers) {
  7208. continue;
  7209. }
  7210. for (const name of ownNames(plugin.parsers)) {
  7211. Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
  7212. }
  7213. }
  7214. return parsers;
  7215. }
  7216. function resolveParser(opts, parsers = getParsers(opts)) {
  7217. if (typeof opts.parser === "function") {
  7218. return {
  7219. parse: opts.parser,
  7220. astFormat: "estree",
  7221. locStart,
  7222. locEnd
  7223. };
  7224. }
  7225. if (typeof opts.parser === "string") {
  7226. if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
  7227. return parsers[opts.parser];
  7228. }
  7229. if (false) {
  7230. throw new ConfigError(`Couldn't resolve parser "${opts.parser}". Parsers must be explicitly added to the standalone bundle.`);
  7231. }
  7232. return loadParser(opts.parser);
  7233. }
  7234. }
  7235. function parse(text, opts) {
  7236. const parsers = getParsers(opts);
  7237. const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map((parserName) => [parserName, {
  7238. enumerable: true,
  7239. get() {
  7240. return parsers[parserName].parse;
  7241. }
  7242. }])));
  7243. const parser = resolveParser(opts, parsers);
  7244. try {
  7245. if (parser.preprocess) {
  7246. text = parser.preprocess(text, opts);
  7247. }
  7248. return {
  7249. text,
  7250. ast: parser.parse(text, parsersForCustomParserApi, opts)
  7251. };
  7252. } catch (error) {
  7253. const {
  7254. loc
  7255. } = error;
  7256. if (loc) {
  7257. const {
  7258. codeFrameColumns
  7259. } = require_lib5();
  7260. error.codeFrame = codeFrameColumns(text, loc, {
  7261. highlightCode: true
  7262. });
  7263. error.message += "\n" + error.codeFrame;
  7264. throw error;
  7265. }
  7266. throw error;
  7267. }
  7268. }
  7269. module2.exports = {
  7270. parse,
  7271. resolveParser
  7272. };
  7273. }
  7274. });
  7275. var require_readlines = __commonJS2({
  7276. "node_modules/n-readlines/readlines.js"(exports2, module2) {
  7277. "use strict";
  7278. var fs = require("fs");
  7279. var LineByLine = class {
  7280. constructor(file, options) {
  7281. options = options || {};
  7282. if (!options.readChunk)
  7283. options.readChunk = 1024;
  7284. if (!options.newLineCharacter) {
  7285. options.newLineCharacter = 10;
  7286. } else {
  7287. options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
  7288. }
  7289. if (typeof file === "number") {
  7290. this.fd = file;
  7291. } else {
  7292. this.fd = fs.openSync(file, "r");
  7293. }
  7294. this.options = options;
  7295. this.newLineCharacter = options.newLineCharacter;
  7296. this.reset();
  7297. }
  7298. _searchInBuffer(buffer, hexNeedle) {
  7299. let found = -1;
  7300. for (let i = 0; i <= buffer.length; i++) {
  7301. let b_byte = buffer[i];
  7302. if (b_byte === hexNeedle) {
  7303. found = i;
  7304. break;
  7305. }
  7306. }
  7307. return found;
  7308. }
  7309. reset() {
  7310. this.eofReached = false;
  7311. this.linesCache = [];
  7312. this.fdPosition = 0;
  7313. }
  7314. close() {
  7315. fs.closeSync(this.fd);
  7316. this.fd = null;
  7317. }
  7318. _extractLines(buffer) {
  7319. let line;
  7320. const lines = [];
  7321. let bufferPosition = 0;
  7322. let lastNewLineBufferPosition = 0;
  7323. while (true) {
  7324. let bufferPositionValue = buffer[bufferPosition++];
  7325. if (bufferPositionValue === this.newLineCharacter) {
  7326. line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7327. lines.push(line);
  7328. lastNewLineBufferPosition = bufferPosition;
  7329. } else if (bufferPositionValue === void 0) {
  7330. break;
  7331. }
  7332. }
  7333. let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7334. if (leftovers.length) {
  7335. lines.push(leftovers);
  7336. }
  7337. return lines;
  7338. }
  7339. _readChunk(lineLeftovers) {
  7340. let totalBytesRead = 0;
  7341. let bytesRead;
  7342. const buffers = [];
  7343. do {
  7344. const readBuffer = new Buffer(this.options.readChunk);
  7345. bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
  7346. totalBytesRead = totalBytesRead + bytesRead;
  7347. this.fdPosition = this.fdPosition + bytesRead;
  7348. buffers.push(readBuffer);
  7349. } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
  7350. let bufferData = Buffer.concat(buffers);
  7351. if (bytesRead < this.options.readChunk) {
  7352. this.eofReached = true;
  7353. bufferData = bufferData.slice(0, totalBytesRead);
  7354. }
  7355. if (totalBytesRead) {
  7356. this.linesCache = this._extractLines(bufferData);
  7357. if (lineLeftovers) {
  7358. this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
  7359. }
  7360. }
  7361. return totalBytesRead;
  7362. }
  7363. next() {
  7364. if (!this.fd)
  7365. return false;
  7366. let line = false;
  7367. if (this.eofReached && this.linesCache.length === 0) {
  7368. return line;
  7369. }
  7370. let bytesRead;
  7371. if (!this.linesCache.length) {
  7372. bytesRead = this._readChunk();
  7373. }
  7374. if (this.linesCache.length) {
  7375. line = this.linesCache.shift();
  7376. const lastLineCharacter = line[line.length - 1];
  7377. if (lastLineCharacter !== this.newLineCharacter) {
  7378. bytesRead = this._readChunk(line);
  7379. if (bytesRead) {
  7380. line = this.linesCache.shift();
  7381. }
  7382. }
  7383. }
  7384. if (this.eofReached && this.linesCache.length === 0) {
  7385. this.close();
  7386. }
  7387. if (line && line[line.length - 1] === this.newLineCharacter) {
  7388. line = line.slice(0, line.length - 1);
  7389. }
  7390. return line;
  7391. }
  7392. };
  7393. module2.exports = LineByLine;
  7394. }
  7395. });
  7396. var require_get_interpreter = __commonJS2({
  7397. "src/utils/get-interpreter.js"(exports2, module2) {
  7398. "use strict";
  7399. var fs = require("fs");
  7400. var readlines = require_readlines();
  7401. function getInterpreter(filepath) {
  7402. if (typeof filepath !== "string") {
  7403. return "";
  7404. }
  7405. let fd;
  7406. try {
  7407. fd = fs.openSync(filepath, "r");
  7408. } catch {
  7409. return "";
  7410. }
  7411. try {
  7412. const liner = new readlines(fd);
  7413. const firstLine = liner.next().toString("utf8");
  7414. const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
  7415. if (m1) {
  7416. return m1[1];
  7417. }
  7418. const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
  7419. if (m2) {
  7420. return m2[1];
  7421. }
  7422. return "";
  7423. } catch {
  7424. return "";
  7425. } finally {
  7426. try {
  7427. fs.closeSync(fd);
  7428. } catch {
  7429. }
  7430. }
  7431. }
  7432. module2.exports = getInterpreter;
  7433. }
  7434. });
  7435. var require_options = __commonJS2({
  7436. "src/main/options.js"(exports2, module2) {
  7437. "use strict";
  7438. var path = require("path");
  7439. var {
  7440. UndefinedParserError
  7441. } = require_errors();
  7442. var {
  7443. getSupportInfo: getSupportInfo2
  7444. } = require_support();
  7445. var normalizer = require_options_normalizer();
  7446. var {
  7447. resolveParser
  7448. } = require_parser();
  7449. var hiddenDefaults = {
  7450. astFormat: "estree",
  7451. printer: {},
  7452. originalText: void 0,
  7453. locStart: null,
  7454. locEnd: null
  7455. };
  7456. function normalize(options, opts = {}) {
  7457. const rawOptions = Object.assign({}, options);
  7458. const supportOptions = getSupportInfo2({
  7459. plugins: options.plugins,
  7460. showUnreleased: true,
  7461. showDeprecated: true
  7462. }).options;
  7463. const defaults = Object.assign(Object.assign({}, hiddenDefaults), Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default])));
  7464. if (!rawOptions.parser) {
  7465. if (!rawOptions.filepath) {
  7466. const logger = opts.logger || console;
  7467. logger.warn("No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.");
  7468. rawOptions.parser = "babel";
  7469. } else {
  7470. rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
  7471. if (!rawOptions.parser) {
  7472. throw new UndefinedParserError(`No parser could be inferred for file: ${rawOptions.filepath}`);
  7473. }
  7474. }
  7475. }
  7476. const parser = resolveParser(normalizer.normalizeApiOptions(rawOptions, [supportOptions.find((x) => x.name === "parser")], {
  7477. passThrough: true,
  7478. logger: false
  7479. }));
  7480. rawOptions.astFormat = parser.astFormat;
  7481. rawOptions.locEnd = parser.locEnd;
  7482. rawOptions.locStart = parser.locStart;
  7483. const plugin = getPlugin(rawOptions);
  7484. rawOptions.printer = plugin.printers[rawOptions.astFormat];
  7485. const pluginDefaults = Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== void 0).map((optionInfo) => [optionInfo.name, optionInfo.pluginDefaults[plugin.name]]));
  7486. const mixedDefaults = Object.assign(Object.assign({}, defaults), pluginDefaults);
  7487. for (const [k, value] of Object.entries(mixedDefaults)) {
  7488. if (rawOptions[k] === null || rawOptions[k] === void 0) {
  7489. rawOptions[k] = value;
  7490. }
  7491. }
  7492. if (rawOptions.parser === "json") {
  7493. rawOptions.trailingComma = "none";
  7494. }
  7495. return normalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
  7496. passThrough: Object.keys(hiddenDefaults)
  7497. }, opts));
  7498. }
  7499. function getPlugin(options) {
  7500. const {
  7501. astFormat
  7502. } = options;
  7503. if (!astFormat) {
  7504. throw new Error("getPlugin() requires astFormat to be set");
  7505. }
  7506. const printerPlugin = options.plugins.find((plugin) => plugin.printers && plugin.printers[astFormat]);
  7507. if (!printerPlugin) {
  7508. throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
  7509. }
  7510. return printerPlugin;
  7511. }
  7512. function inferParser(filepath, plugins2) {
  7513. const filename = path.basename(filepath).toLowerCase();
  7514. const languages = getSupportInfo2({
  7515. plugins: plugins2
  7516. }).languages.filter((language2) => language2.since !== null);
  7517. let language = languages.find((language2) => language2.extensions && language2.extensions.some((extension) => filename.endsWith(extension)) || language2.filenames && language2.filenames.some((name) => name.toLowerCase() === filename));
  7518. if (!language && !filename.includes(".")) {
  7519. const getInterpreter = require_get_interpreter();
  7520. const interpreter = getInterpreter(filepath);
  7521. language = languages.find((language2) => language2.interpreters && language2.interpreters.includes(interpreter));
  7522. }
  7523. return language && language.parsers[0];
  7524. }
  7525. module2.exports = {
  7526. normalize,
  7527. hiddenDefaults,
  7528. inferParser
  7529. };
  7530. }
  7531. });
  7532. var require_massage_ast = __commonJS2({
  7533. "src/main/massage-ast.js"(exports2, module2) {
  7534. "use strict";
  7535. function massageAST(ast, options, parent) {
  7536. if (Array.isArray(ast)) {
  7537. return ast.map((e) => massageAST(e, options, parent)).filter(Boolean);
  7538. }
  7539. if (!ast || typeof ast !== "object") {
  7540. return ast;
  7541. }
  7542. const cleanFunction = options.printer.massageAstNode;
  7543. let ignoredProperties;
  7544. if (cleanFunction && cleanFunction.ignoredProperties) {
  7545. ignoredProperties = cleanFunction.ignoredProperties;
  7546. } else {
  7547. ignoredProperties = /* @__PURE__ */ new Set();
  7548. }
  7549. const newObj = {};
  7550. for (const [key, value] of Object.entries(ast)) {
  7551. if (!ignoredProperties.has(key) && typeof value !== "function") {
  7552. newObj[key] = massageAST(value, options, ast);
  7553. }
  7554. }
  7555. if (cleanFunction) {
  7556. const result = cleanFunction(ast, newObj, parent);
  7557. if (result === null) {
  7558. return;
  7559. }
  7560. if (result) {
  7561. return result;
  7562. }
  7563. }
  7564. return newObj;
  7565. }
  7566. module2.exports = massageAST;
  7567. }
  7568. });
  7569. var require_comments = __commonJS2({
  7570. "src/main/comments.js"(exports2, module2) {
  7571. "use strict";
  7572. var assert = require("assert");
  7573. var {
  7574. builders: {
  7575. line,
  7576. hardline,
  7577. breakParent,
  7578. indent,
  7579. lineSuffix,
  7580. join,
  7581. cursor
  7582. }
  7583. } = require("./doc.js");
  7584. var {
  7585. hasNewline,
  7586. skipNewline,
  7587. skipSpaces,
  7588. isPreviousLineEmpty,
  7589. addLeadingComment,
  7590. addDanglingComment,
  7591. addTrailingComment
  7592. } = require_util();
  7593. var childNodesCache = /* @__PURE__ */ new WeakMap();
  7594. function getSortedChildNodes(node, options, resultArray) {
  7595. if (!node) {
  7596. return;
  7597. }
  7598. const {
  7599. printer,
  7600. locStart,
  7601. locEnd
  7602. } = options;
  7603. if (resultArray) {
  7604. if (printer.canAttachComment && printer.canAttachComment(node)) {
  7605. let i;
  7606. for (i = resultArray.length - 1; i >= 0; --i) {
  7607. if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
  7608. break;
  7609. }
  7610. }
  7611. resultArray.splice(i + 1, 0, node);
  7612. return;
  7613. }
  7614. } else if (childNodesCache.has(node)) {
  7615. return childNodesCache.get(node);
  7616. }
  7617. const childNodes = printer.getCommentChildNodes && printer.getCommentChildNodes(node, options) || typeof node === "object" && Object.entries(node).filter(([key]) => key !== "enclosingNode" && key !== "precedingNode" && key !== "followingNode" && key !== "tokens" && key !== "comments" && key !== "parent").map(([, value]) => value);
  7618. if (!childNodes) {
  7619. return;
  7620. }
  7621. if (!resultArray) {
  7622. resultArray = [];
  7623. childNodesCache.set(node, resultArray);
  7624. }
  7625. for (const childNode of childNodes) {
  7626. getSortedChildNodes(childNode, options, resultArray);
  7627. }
  7628. return resultArray;
  7629. }
  7630. function decorateComment(node, comment, options, enclosingNode) {
  7631. const {
  7632. locStart,
  7633. locEnd
  7634. } = options;
  7635. const commentStart = locStart(comment);
  7636. const commentEnd = locEnd(comment);
  7637. const childNodes = getSortedChildNodes(node, options);
  7638. let precedingNode;
  7639. let followingNode;
  7640. let left = 0;
  7641. let right = childNodes.length;
  7642. while (left < right) {
  7643. const middle = left + right >> 1;
  7644. const child = childNodes[middle];
  7645. const start = locStart(child);
  7646. const end = locEnd(child);
  7647. if (start <= commentStart && commentEnd <= end) {
  7648. return decorateComment(child, comment, options, child);
  7649. }
  7650. if (end <= commentStart) {
  7651. precedingNode = child;
  7652. left = middle + 1;
  7653. continue;
  7654. }
  7655. if (commentEnd <= start) {
  7656. followingNode = child;
  7657. right = middle;
  7658. continue;
  7659. }
  7660. throw new Error("Comment location overlaps with node location");
  7661. }
  7662. if (enclosingNode && enclosingNode.type === "TemplateLiteral") {
  7663. const {
  7664. quasis
  7665. } = enclosingNode;
  7666. const commentIndex = findExpressionIndexForComment(quasis, comment, options);
  7667. if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
  7668. precedingNode = null;
  7669. }
  7670. if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
  7671. followingNode = null;
  7672. }
  7673. }
  7674. return {
  7675. enclosingNode,
  7676. precedingNode,
  7677. followingNode
  7678. };
  7679. }
  7680. var returnFalse = () => false;
  7681. function attach(comments, ast, text, options) {
  7682. if (!Array.isArray(comments)) {
  7683. return;
  7684. }
  7685. const tiesToBreak = [];
  7686. const {
  7687. locStart,
  7688. locEnd,
  7689. printer: {
  7690. handleComments = {}
  7691. }
  7692. } = options;
  7693. const {
  7694. avoidAstMutation,
  7695. ownLine: handleOwnLineComment = returnFalse,
  7696. endOfLine: handleEndOfLineComment = returnFalse,
  7697. remaining: handleRemainingComment = returnFalse
  7698. } = handleComments;
  7699. const decoratedComments = comments.map((comment, index) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
  7700. comment,
  7701. text,
  7702. options,
  7703. ast,
  7704. isLastComment: comments.length - 1 === index
  7705. }));
  7706. for (const [index, context] of decoratedComments.entries()) {
  7707. const {
  7708. comment,
  7709. precedingNode,
  7710. enclosingNode,
  7711. followingNode,
  7712. text: text2,
  7713. options: options2,
  7714. ast: ast2,
  7715. isLastComment
  7716. } = context;
  7717. if (options2.parser === "json" || options2.parser === "json5" || options2.parser === "__js_expression" || options2.parser === "__vue_expression" || options2.parser === "__vue_ts_expression") {
  7718. if (locStart(comment) - locStart(ast2) <= 0) {
  7719. addLeadingComment(ast2, comment);
  7720. continue;
  7721. }
  7722. if (locEnd(comment) - locEnd(ast2) >= 0) {
  7723. addTrailingComment(ast2, comment);
  7724. continue;
  7725. }
  7726. }
  7727. let args;
  7728. if (avoidAstMutation) {
  7729. args = [context];
  7730. } else {
  7731. comment.enclosingNode = enclosingNode;
  7732. comment.precedingNode = precedingNode;
  7733. comment.followingNode = followingNode;
  7734. args = [comment, text2, options2, ast2, isLastComment];
  7735. }
  7736. if (isOwnLineComment(text2, options2, decoratedComments, index)) {
  7737. comment.placement = "ownLine";
  7738. if (handleOwnLineComment(...args)) {
  7739. } else if (followingNode) {
  7740. addLeadingComment(followingNode, comment);
  7741. } else if (precedingNode) {
  7742. addTrailingComment(precedingNode, comment);
  7743. } else if (enclosingNode) {
  7744. addDanglingComment(enclosingNode, comment);
  7745. } else {
  7746. addDanglingComment(ast2, comment);
  7747. }
  7748. } else if (isEndOfLineComment(text2, options2, decoratedComments, index)) {
  7749. comment.placement = "endOfLine";
  7750. if (handleEndOfLineComment(...args)) {
  7751. } else if (precedingNode) {
  7752. addTrailingComment(precedingNode, comment);
  7753. } else if (followingNode) {
  7754. addLeadingComment(followingNode, comment);
  7755. } else if (enclosingNode) {
  7756. addDanglingComment(enclosingNode, comment);
  7757. } else {
  7758. addDanglingComment(ast2, comment);
  7759. }
  7760. } else {
  7761. comment.placement = "remaining";
  7762. if (handleRemainingComment(...args)) {
  7763. } else if (precedingNode && followingNode) {
  7764. const tieCount = tiesToBreak.length;
  7765. if (tieCount > 0) {
  7766. const lastTie = tiesToBreak[tieCount - 1];
  7767. if (lastTie.followingNode !== followingNode) {
  7768. breakTies(tiesToBreak, text2, options2);
  7769. }
  7770. }
  7771. tiesToBreak.push(context);
  7772. } else if (precedingNode) {
  7773. addTrailingComment(precedingNode, comment);
  7774. } else if (followingNode) {
  7775. addLeadingComment(followingNode, comment);
  7776. } else if (enclosingNode) {
  7777. addDanglingComment(enclosingNode, comment);
  7778. } else {
  7779. addDanglingComment(ast2, comment);
  7780. }
  7781. }
  7782. }
  7783. breakTies(tiesToBreak, text, options);
  7784. if (!avoidAstMutation) {
  7785. for (const comment of comments) {
  7786. delete comment.precedingNode;
  7787. delete comment.enclosingNode;
  7788. delete comment.followingNode;
  7789. }
  7790. }
  7791. }
  7792. var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text);
  7793. function isOwnLineComment(text, options, decoratedComments, commentIndex) {
  7794. const {
  7795. comment,
  7796. precedingNode
  7797. } = decoratedComments[commentIndex];
  7798. const {
  7799. locStart,
  7800. locEnd
  7801. } = options;
  7802. let start = locStart(comment);
  7803. if (precedingNode) {
  7804. for (let index = commentIndex - 1; index >= 0; index--) {
  7805. const {
  7806. comment: comment2,
  7807. precedingNode: currentCommentPrecedingNode
  7808. } = decoratedComments[index];
  7809. if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) {
  7810. break;
  7811. }
  7812. start = locStart(comment2);
  7813. }
  7814. }
  7815. return hasNewline(text, start, {
  7816. backwards: true
  7817. });
  7818. }
  7819. function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
  7820. const {
  7821. comment,
  7822. followingNode
  7823. } = decoratedComments[commentIndex];
  7824. const {
  7825. locStart,
  7826. locEnd
  7827. } = options;
  7828. let end = locEnd(comment);
  7829. if (followingNode) {
  7830. for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
  7831. const {
  7832. comment: comment2,
  7833. followingNode: currentCommentFollowingNode
  7834. } = decoratedComments[index];
  7835. if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) {
  7836. break;
  7837. }
  7838. end = locEnd(comment2);
  7839. }
  7840. }
  7841. return hasNewline(text, end);
  7842. }
  7843. function breakTies(tiesToBreak, text, options) {
  7844. const tieCount = tiesToBreak.length;
  7845. if (tieCount === 0) {
  7846. return;
  7847. }
  7848. const {
  7849. precedingNode,
  7850. followingNode,
  7851. enclosingNode
  7852. } = tiesToBreak[0];
  7853. const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
  7854. let gapEndPos = options.locStart(followingNode);
  7855. let indexOfFirstLeadingComment;
  7856. for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
  7857. const {
  7858. comment,
  7859. precedingNode: currentCommentPrecedingNode,
  7860. followingNode: currentCommentFollowingNode
  7861. } = tiesToBreak[indexOfFirstLeadingComment - 1];
  7862. assert.strictEqual(currentCommentPrecedingNode, precedingNode);
  7863. assert.strictEqual(currentCommentFollowingNode, followingNode);
  7864. const gap = text.slice(options.locEnd(comment), gapEndPos);
  7865. if (gapRegExp.test(gap)) {
  7866. gapEndPos = options.locStart(comment);
  7867. } else {
  7868. break;
  7869. }
  7870. }
  7871. for (const [i, {
  7872. comment
  7873. }] of tiesToBreak.entries()) {
  7874. if (i < indexOfFirstLeadingComment) {
  7875. addTrailingComment(precedingNode, comment);
  7876. } else {
  7877. addLeadingComment(followingNode, comment);
  7878. }
  7879. }
  7880. for (const node of [precedingNode, followingNode]) {
  7881. if (node.comments && node.comments.length > 1) {
  7882. node.comments.sort((a, b) => options.locStart(a) - options.locStart(b));
  7883. }
  7884. }
  7885. tiesToBreak.length = 0;
  7886. }
  7887. function printComment(path, options) {
  7888. const comment = path.getValue();
  7889. comment.printed = true;
  7890. return options.printer.printComment(path, options);
  7891. }
  7892. function findExpressionIndexForComment(quasis, comment, options) {
  7893. const startPos = options.locStart(comment) - 1;
  7894. for (let i = 1; i < quasis.length; ++i) {
  7895. if (startPos < options.locStart(quasis[i])) {
  7896. return i - 1;
  7897. }
  7898. }
  7899. return 0;
  7900. }
  7901. function printLeadingComment(path, options) {
  7902. const comment = path.getValue();
  7903. const parts = [printComment(path, options)];
  7904. const {
  7905. printer,
  7906. originalText,
  7907. locStart,
  7908. locEnd
  7909. } = options;
  7910. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  7911. if (isBlock) {
  7912. const lineBreak = hasNewline(originalText, locEnd(comment)) ? hasNewline(originalText, locStart(comment), {
  7913. backwards: true
  7914. }) ? hardline : line : " ";
  7915. parts.push(lineBreak);
  7916. } else {
  7917. parts.push(hardline);
  7918. }
  7919. const index = skipNewline(originalText, skipSpaces(originalText, locEnd(comment)));
  7920. if (index !== false && hasNewline(originalText, index)) {
  7921. parts.push(hardline);
  7922. }
  7923. return parts;
  7924. }
  7925. function printTrailingComment(path, options) {
  7926. const comment = path.getValue();
  7927. const printed = printComment(path, options);
  7928. const {
  7929. printer,
  7930. originalText,
  7931. locStart
  7932. } = options;
  7933. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  7934. if (hasNewline(originalText, locStart(comment), {
  7935. backwards: true
  7936. })) {
  7937. const isLineBeforeEmpty = isPreviousLineEmpty(originalText, comment, locStart);
  7938. return lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]);
  7939. }
  7940. let parts = [" ", printed];
  7941. if (!isBlock) {
  7942. parts = [lineSuffix(parts), breakParent];
  7943. }
  7944. return parts;
  7945. }
  7946. function printDanglingComments(path, options, sameIndent, filter) {
  7947. const parts = [];
  7948. const node = path.getValue();
  7949. if (!node || !node.comments) {
  7950. return "";
  7951. }
  7952. path.each(() => {
  7953. const comment = path.getValue();
  7954. if (!comment.leading && !comment.trailing && (!filter || filter(comment))) {
  7955. parts.push(printComment(path, options));
  7956. }
  7957. }, "comments");
  7958. if (parts.length === 0) {
  7959. return "";
  7960. }
  7961. if (sameIndent) {
  7962. return join(hardline, parts);
  7963. }
  7964. return indent([hardline, join(hardline, parts)]);
  7965. }
  7966. function printCommentsSeparately(path, options, ignored) {
  7967. const value = path.getValue();
  7968. if (!value) {
  7969. return {};
  7970. }
  7971. let comments = value.comments || [];
  7972. if (ignored) {
  7973. comments = comments.filter((comment) => !ignored.has(comment));
  7974. }
  7975. const isCursorNode = value === options.cursorNode;
  7976. if (comments.length === 0) {
  7977. const maybeCursor = isCursorNode ? cursor : "";
  7978. return {
  7979. leading: maybeCursor,
  7980. trailing: maybeCursor
  7981. };
  7982. }
  7983. const leadingParts = [];
  7984. const trailingParts = [];
  7985. path.each(() => {
  7986. const comment = path.getValue();
  7987. if (ignored && ignored.has(comment)) {
  7988. return;
  7989. }
  7990. const {
  7991. leading,
  7992. trailing
  7993. } = comment;
  7994. if (leading) {
  7995. leadingParts.push(printLeadingComment(path, options));
  7996. } else if (trailing) {
  7997. trailingParts.push(printTrailingComment(path, options));
  7998. }
  7999. }, "comments");
  8000. if (isCursorNode) {
  8001. leadingParts.unshift(cursor);
  8002. trailingParts.push(cursor);
  8003. }
  8004. return {
  8005. leading: leadingParts,
  8006. trailing: trailingParts
  8007. };
  8008. }
  8009. function printComments(path, doc2, options, ignored) {
  8010. const {
  8011. leading,
  8012. trailing
  8013. } = printCommentsSeparately(path, options, ignored);
  8014. if (!leading && !trailing) {
  8015. return doc2;
  8016. }
  8017. return [leading, doc2, trailing];
  8018. }
  8019. function ensureAllCommentsPrinted(astComments) {
  8020. if (!astComments) {
  8021. return;
  8022. }
  8023. for (const comment of astComments) {
  8024. if (!comment.printed) {
  8025. throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
  8026. }
  8027. delete comment.printed;
  8028. }
  8029. }
  8030. module2.exports = {
  8031. attach,
  8032. printComments,
  8033. printCommentsSeparately,
  8034. printDanglingComments,
  8035. getSortedChildNodes,
  8036. ensureAllCommentsPrinted
  8037. };
  8038. }
  8039. });
  8040. var require_ast_path = __commonJS2({
  8041. "src/common/ast-path.js"(exports2, module2) {
  8042. "use strict";
  8043. var getLast = require_get_last();
  8044. function getNodeHelper(path, count) {
  8045. const stackIndex = getNodeStackIndexHelper(path.stack, count);
  8046. return stackIndex === -1 ? null : path.stack[stackIndex];
  8047. }
  8048. function getNodeStackIndexHelper(stack, count) {
  8049. for (let i = stack.length - 1; i >= 0; i -= 2) {
  8050. const value = stack[i];
  8051. if (value && !Array.isArray(value) && --count < 0) {
  8052. return i;
  8053. }
  8054. }
  8055. return -1;
  8056. }
  8057. var AstPath = class {
  8058. constructor(value) {
  8059. this.stack = [value];
  8060. }
  8061. getName() {
  8062. const {
  8063. stack
  8064. } = this;
  8065. const {
  8066. length
  8067. } = stack;
  8068. if (length > 1) {
  8069. return stack[length - 2];
  8070. }
  8071. return null;
  8072. }
  8073. getValue() {
  8074. return getLast(this.stack);
  8075. }
  8076. getNode(count = 0) {
  8077. return getNodeHelper(this, count);
  8078. }
  8079. getParentNode(count = 0) {
  8080. return getNodeHelper(this, count + 1);
  8081. }
  8082. call(callback, ...names) {
  8083. const {
  8084. stack
  8085. } = this;
  8086. const {
  8087. length
  8088. } = stack;
  8089. let value = getLast(stack);
  8090. for (const name of names) {
  8091. value = value[name];
  8092. stack.push(name, value);
  8093. }
  8094. const result = callback(this);
  8095. stack.length = length;
  8096. return result;
  8097. }
  8098. callParent(callback, count = 0) {
  8099. const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
  8100. const parentValues = this.stack.splice(stackIndex + 1);
  8101. const result = callback(this);
  8102. this.stack.push(...parentValues);
  8103. return result;
  8104. }
  8105. each(callback, ...names) {
  8106. const {
  8107. stack
  8108. } = this;
  8109. const {
  8110. length
  8111. } = stack;
  8112. let value = getLast(stack);
  8113. for (const name of names) {
  8114. value = value[name];
  8115. stack.push(name, value);
  8116. }
  8117. for (let i = 0; i < value.length; ++i) {
  8118. stack.push(i, value[i]);
  8119. callback(this, i, value);
  8120. stack.length -= 2;
  8121. }
  8122. stack.length = length;
  8123. }
  8124. map(callback, ...names) {
  8125. const result = [];
  8126. this.each((path, index, value) => {
  8127. result[index] = callback(path, index, value);
  8128. }, ...names);
  8129. return result;
  8130. }
  8131. try(callback) {
  8132. const {
  8133. stack
  8134. } = this;
  8135. const stackBackup = [...stack];
  8136. try {
  8137. return callback();
  8138. } finally {
  8139. stack.length = 0;
  8140. stack.push(...stackBackup);
  8141. }
  8142. }
  8143. match(...predicates) {
  8144. let stackPointer = this.stack.length - 1;
  8145. let name = null;
  8146. let node = this.stack[stackPointer--];
  8147. for (const predicate of predicates) {
  8148. if (node === void 0) {
  8149. return false;
  8150. }
  8151. let number = null;
  8152. if (typeof name === "number") {
  8153. number = name;
  8154. name = this.stack[stackPointer--];
  8155. node = this.stack[stackPointer--];
  8156. }
  8157. if (predicate && !predicate(node, name, number)) {
  8158. return false;
  8159. }
  8160. name = this.stack[stackPointer--];
  8161. node = this.stack[stackPointer--];
  8162. }
  8163. return true;
  8164. }
  8165. findAncestor(predicate) {
  8166. let stackPointer = this.stack.length - 1;
  8167. let name = null;
  8168. let node = this.stack[stackPointer--];
  8169. while (node) {
  8170. let number = null;
  8171. if (typeof name === "number") {
  8172. number = name;
  8173. name = this.stack[stackPointer--];
  8174. node = this.stack[stackPointer--];
  8175. }
  8176. if (name !== null && predicate(node, name, number)) {
  8177. return node;
  8178. }
  8179. name = this.stack[stackPointer--];
  8180. node = this.stack[stackPointer--];
  8181. }
  8182. }
  8183. };
  8184. module2.exports = AstPath;
  8185. }
  8186. });
  8187. var require_multiparser = __commonJS2({
  8188. "src/main/multiparser.js"(exports2, module2) {
  8189. "use strict";
  8190. var {
  8191. utils: {
  8192. stripTrailingHardline
  8193. }
  8194. } = require("./doc.js");
  8195. var {
  8196. normalize
  8197. } = require_options();
  8198. var comments = require_comments();
  8199. function printSubtree(path, print, options, printAstToDoc) {
  8200. if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
  8201. return options.printer.embed(path, print, (text, partialNextOptions, textToDocOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
  8202. }
  8203. }
  8204. function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc, {
  8205. stripTrailingHardline: shouldStripTrailingHardline = false
  8206. } = {}) {
  8207. const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
  8208. parentParser: parentOptions.parser,
  8209. originalText: text
  8210. }), {
  8211. passThrough: true
  8212. });
  8213. const result = require_parser().parse(text, nextOptions);
  8214. const {
  8215. ast
  8216. } = result;
  8217. text = result.text;
  8218. const astComments = ast.comments;
  8219. delete ast.comments;
  8220. comments.attach(astComments, ast, text, nextOptions);
  8221. nextOptions[Symbol.for("comments")] = astComments || [];
  8222. nextOptions[Symbol.for("tokens")] = ast.tokens || [];
  8223. const doc2 = printAstToDoc(ast, nextOptions);
  8224. comments.ensureAllCommentsPrinted(astComments);
  8225. if (shouldStripTrailingHardline) {
  8226. if (typeof doc2 === "string") {
  8227. return doc2.replace(/(?:\r?\n)*$/, "");
  8228. }
  8229. return stripTrailingHardline(doc2);
  8230. }
  8231. return doc2;
  8232. }
  8233. module2.exports = {
  8234. printSubtree
  8235. };
  8236. }
  8237. });
  8238. var require_ast_to_doc = __commonJS2({
  8239. "src/main/ast-to-doc.js"(exports2, module2) {
  8240. "use strict";
  8241. var AstPath = require_ast_path();
  8242. var {
  8243. builders: {
  8244. hardline,
  8245. addAlignmentToDoc
  8246. },
  8247. utils: {
  8248. propagateBreaks
  8249. }
  8250. } = require("./doc.js");
  8251. var {
  8252. printComments
  8253. } = require_comments();
  8254. var multiparser = require_multiparser();
  8255. function printAstToDoc(ast, options, alignmentSize = 0) {
  8256. const {
  8257. printer
  8258. } = options;
  8259. if (printer.preprocess) {
  8260. ast = printer.preprocess(ast, options);
  8261. }
  8262. const cache = /* @__PURE__ */ new Map();
  8263. const path = new AstPath(ast);
  8264. let doc2 = mainPrint();
  8265. if (alignmentSize > 0) {
  8266. doc2 = addAlignmentToDoc([hardline, doc2], alignmentSize, options.tabWidth);
  8267. }
  8268. propagateBreaks(doc2);
  8269. return doc2;
  8270. function mainPrint(selector, args) {
  8271. if (selector === void 0 || selector === path) {
  8272. return mainPrintInternal(args);
  8273. }
  8274. if (Array.isArray(selector)) {
  8275. return path.call(() => mainPrintInternal(args), ...selector);
  8276. }
  8277. return path.call(() => mainPrintInternal(args), selector);
  8278. }
  8279. function mainPrintInternal(args) {
  8280. const value = path.getValue();
  8281. const shouldCache = value && typeof value === "object" && args === void 0;
  8282. if (shouldCache && cache.has(value)) {
  8283. return cache.get(value);
  8284. }
  8285. const doc3 = callPluginPrintFunction(path, options, mainPrint, args);
  8286. if (shouldCache) {
  8287. cache.set(value, doc3);
  8288. }
  8289. return doc3;
  8290. }
  8291. }
  8292. function printPrettierIgnoredNode(node, options) {
  8293. const {
  8294. originalText,
  8295. [Symbol.for("comments")]: comments,
  8296. locStart,
  8297. locEnd
  8298. } = options;
  8299. const start = locStart(node);
  8300. const end = locEnd(node);
  8301. const printedComments = /* @__PURE__ */ new Set();
  8302. for (const comment of comments) {
  8303. if (locStart(comment) >= start && locEnd(comment) <= end) {
  8304. comment.printed = true;
  8305. printedComments.add(comment);
  8306. }
  8307. }
  8308. return {
  8309. doc: originalText.slice(start, end),
  8310. printedComments
  8311. };
  8312. }
  8313. function callPluginPrintFunction(path, options, printPath, args) {
  8314. const node = path.getValue();
  8315. const {
  8316. printer
  8317. } = options;
  8318. let doc2;
  8319. let printedComments;
  8320. if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
  8321. ({
  8322. doc: doc2,
  8323. printedComments
  8324. } = printPrettierIgnoredNode(node, options));
  8325. } else {
  8326. if (node) {
  8327. try {
  8328. doc2 = multiparser.printSubtree(path, printPath, options, printAstToDoc);
  8329. } catch (error) {
  8330. if (process.env.PRETTIER_DEBUG) {
  8331. throw error;
  8332. }
  8333. }
  8334. }
  8335. if (!doc2) {
  8336. doc2 = printer.print(path, options, printPath, args);
  8337. }
  8338. }
  8339. if (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path, options)) {
  8340. doc2 = printComments(path, doc2, options, printedComments);
  8341. }
  8342. return doc2;
  8343. }
  8344. module2.exports = printAstToDoc;
  8345. }
  8346. });
  8347. var require_range_util = __commonJS2({
  8348. "src/main/range-util.js"(exports2, module2) {
  8349. "use strict";
  8350. var assert = require("assert");
  8351. var comments = require_comments();
  8352. var isJsonParser = ({
  8353. parser
  8354. }) => parser === "json" || parser === "json5" || parser === "json-stringify";
  8355. function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
  8356. const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
  8357. const endNodeAndAncestors = /* @__PURE__ */ new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
  8358. return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
  8359. }
  8360. function dropRootParents(parents) {
  8361. let lastParentIndex = parents.length - 1;
  8362. for (; ; ) {
  8363. const parent = parents[lastParentIndex];
  8364. if (parent && (parent.type === "Program" || parent.type === "File")) {
  8365. lastParentIndex--;
  8366. } else {
  8367. break;
  8368. }
  8369. }
  8370. return parents.slice(0, lastParentIndex + 1);
  8371. }
  8372. function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
  8373. locStart,
  8374. locEnd
  8375. }) {
  8376. let resultStartNode = startNodeAndParents.node;
  8377. let resultEndNode = endNodeAndParents.node;
  8378. if (resultStartNode === resultEndNode) {
  8379. return {
  8380. startNode: resultStartNode,
  8381. endNode: resultEndNode
  8382. };
  8383. }
  8384. const startNodeStart = locStart(startNodeAndParents.node);
  8385. for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
  8386. if (locStart(endParent) >= startNodeStart) {
  8387. resultEndNode = endParent;
  8388. } else {
  8389. break;
  8390. }
  8391. }
  8392. const endNodeEnd = locEnd(endNodeAndParents.node);
  8393. for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
  8394. if (locEnd(startParent) <= endNodeEnd) {
  8395. resultStartNode = startParent;
  8396. } else {
  8397. break;
  8398. }
  8399. if (resultStartNode === resultEndNode) {
  8400. break;
  8401. }
  8402. }
  8403. return {
  8404. startNode: resultStartNode,
  8405. endNode: resultEndNode
  8406. };
  8407. }
  8408. function findNodeAtOffset(node, offset, options, predicate, parentNodes = [], type) {
  8409. const {
  8410. locStart,
  8411. locEnd
  8412. } = options;
  8413. const start = locStart(node);
  8414. const end = locEnd(node);
  8415. if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) {
  8416. return;
  8417. }
  8418. for (const childNode of comments.getSortedChildNodes(node, options)) {
  8419. const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node, ...parentNodes], type);
  8420. if (childResult) {
  8421. return childResult;
  8422. }
  8423. }
  8424. if (!predicate || predicate(node, parentNodes[0])) {
  8425. return {
  8426. node,
  8427. parentNodes
  8428. };
  8429. }
  8430. }
  8431. function isJsSourceElement(type, parentType) {
  8432. return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration"));
  8433. }
  8434. var jsonSourceElements = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
  8435. var graphqlSourceElements = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
  8436. function isSourceElement(opts, node, parentNode) {
  8437. if (!node) {
  8438. return false;
  8439. }
  8440. switch (opts.parser) {
  8441. case "flow":
  8442. case "babel":
  8443. case "babel-flow":
  8444. case "babel-ts":
  8445. case "typescript":
  8446. case "acorn":
  8447. case "espree":
  8448. case "meriyah":
  8449. case "__babel_estree":
  8450. return isJsSourceElement(node.type, parentNode && parentNode.type);
  8451. case "json":
  8452. case "json5":
  8453. case "json-stringify":
  8454. return jsonSourceElements.has(node.type);
  8455. case "graphql":
  8456. return graphqlSourceElements.has(node.kind);
  8457. case "vue":
  8458. return node.tag !== "root";
  8459. }
  8460. return false;
  8461. }
  8462. function calculateRange(text, opts, ast) {
  8463. let {
  8464. rangeStart: start,
  8465. rangeEnd: end,
  8466. locStart,
  8467. locEnd
  8468. } = opts;
  8469. assert.ok(end > start);
  8470. const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
  8471. const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
  8472. if (!isAllWhitespace) {
  8473. start += firstNonWhitespaceCharacterIndex;
  8474. for (; end > start; --end) {
  8475. if (/\S/.test(text[end - 1])) {
  8476. break;
  8477. }
  8478. }
  8479. }
  8480. const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
  8481. const endNodeAndParents = isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd");
  8482. if (!startNodeAndParents || !endNodeAndParents) {
  8483. return {
  8484. rangeStart: 0,
  8485. rangeEnd: 0
  8486. };
  8487. }
  8488. let startNode;
  8489. let endNode;
  8490. if (isJsonParser(opts)) {
  8491. const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
  8492. startNode = commonAncestor;
  8493. endNode = commonAncestor;
  8494. } else {
  8495. ({
  8496. startNode,
  8497. endNode
  8498. } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
  8499. }
  8500. return {
  8501. rangeStart: Math.min(locStart(startNode), locStart(endNode)),
  8502. rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
  8503. };
  8504. }
  8505. module2.exports = {
  8506. calculateRange,
  8507. findNodeAtOffset
  8508. };
  8509. }
  8510. });
  8511. var require_core = __commonJS2({
  8512. "src/main/core.js"(exports2, module2) {
  8513. "use strict";
  8514. var {
  8515. diffArrays
  8516. } = require_array();
  8517. var {
  8518. printer: {
  8519. printDocToString
  8520. },
  8521. debug: {
  8522. printDocToDebug
  8523. }
  8524. } = require("./doc.js");
  8525. var {
  8526. getAlignmentSize
  8527. } = require_util();
  8528. var {
  8529. guessEndOfLine,
  8530. convertEndOfLineToChars,
  8531. countEndOfLineChars,
  8532. normalizeEndOfLine
  8533. } = require_end_of_line();
  8534. var normalizeOptions = require_options().normalize;
  8535. var massageAST = require_massage_ast();
  8536. var comments = require_comments();
  8537. var parser = require_parser();
  8538. var printAstToDoc = require_ast_to_doc();
  8539. var rangeUtil = require_range_util();
  8540. var BOM = "\uFEFF";
  8541. var CURSOR = Symbol("cursor");
  8542. function attachComments(text, ast, opts) {
  8543. const astComments = ast.comments;
  8544. if (astComments) {
  8545. delete ast.comments;
  8546. comments.attach(astComments, ast, text, opts);
  8547. }
  8548. opts[Symbol.for("comments")] = astComments || [];
  8549. opts[Symbol.for("tokens")] = ast.tokens || [];
  8550. opts.originalText = text;
  8551. return astComments;
  8552. }
  8553. function coreFormat(originalText, opts, addAlignmentSize = 0) {
  8554. if (!originalText || originalText.trim().length === 0) {
  8555. return {
  8556. formatted: "",
  8557. cursorOffset: -1,
  8558. comments: []
  8559. };
  8560. }
  8561. const {
  8562. ast,
  8563. text
  8564. } = parser.parse(originalText, opts);
  8565. if (opts.cursorOffset >= 0) {
  8566. const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
  8567. if (nodeResult && nodeResult.node) {
  8568. opts.cursorNode = nodeResult.node;
  8569. }
  8570. }
  8571. const astComments = attachComments(text, ast, opts);
  8572. const doc2 = printAstToDoc(ast, opts, addAlignmentSize);
  8573. const result = printDocToString(doc2, opts);
  8574. comments.ensureAllCommentsPrinted(astComments);
  8575. if (addAlignmentSize > 0) {
  8576. const trimmed = result.formatted.trim();
  8577. if (result.cursorNodeStart !== void 0) {
  8578. result.cursorNodeStart -= result.formatted.indexOf(trimmed);
  8579. }
  8580. result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
  8581. }
  8582. if (opts.cursorOffset >= 0) {
  8583. let oldCursorNodeStart;
  8584. let oldCursorNodeText;
  8585. let cursorOffsetRelativeToOldCursorNode;
  8586. let newCursorNodeStart;
  8587. let newCursorNodeText;
  8588. if (opts.cursorNode && result.cursorNodeText) {
  8589. oldCursorNodeStart = opts.locStart(opts.cursorNode);
  8590. oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
  8591. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
  8592. newCursorNodeStart = result.cursorNodeStart;
  8593. newCursorNodeText = result.cursorNodeText;
  8594. } else {
  8595. oldCursorNodeStart = 0;
  8596. oldCursorNodeText = text;
  8597. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
  8598. newCursorNodeStart = 0;
  8599. newCursorNodeText = result.formatted;
  8600. }
  8601. if (oldCursorNodeText === newCursorNodeText) {
  8602. return {
  8603. formatted: result.formatted,
  8604. cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
  8605. comments: astComments
  8606. };
  8607. }
  8608. const oldCursorNodeCharArray = [...oldCursorNodeText];
  8609. oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
  8610. const newCursorNodeCharArray = [...newCursorNodeText];
  8611. const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
  8612. let cursorOffset = newCursorNodeStart;
  8613. for (const entry of cursorNodeDiff) {
  8614. if (entry.removed) {
  8615. if (entry.value.includes(CURSOR)) {
  8616. break;
  8617. }
  8618. } else {
  8619. cursorOffset += entry.count;
  8620. }
  8621. }
  8622. return {
  8623. formatted: result.formatted,
  8624. cursorOffset,
  8625. comments: astComments
  8626. };
  8627. }
  8628. return {
  8629. formatted: result.formatted,
  8630. cursorOffset: -1,
  8631. comments: astComments
  8632. };
  8633. }
  8634. function formatRange(originalText, opts) {
  8635. const {
  8636. ast,
  8637. text
  8638. } = parser.parse(originalText, opts);
  8639. const {
  8640. rangeStart,
  8641. rangeEnd
  8642. } = rangeUtil.calculateRange(text, opts, ast);
  8643. const rangeString = text.slice(rangeStart, rangeEnd);
  8644. const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
  8645. const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
  8646. const alignmentSize = getAlignmentSize(indentString, opts.tabWidth);
  8647. const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
  8648. rangeStart: 0,
  8649. rangeEnd: Number.POSITIVE_INFINITY,
  8650. cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
  8651. endOfLine: "lf"
  8652. }), alignmentSize);
  8653. const rangeTrimmed = rangeResult.formatted.trimEnd();
  8654. let {
  8655. cursorOffset
  8656. } = opts;
  8657. if (cursorOffset > rangeEnd) {
  8658. cursorOffset += rangeTrimmed.length - rangeString.length;
  8659. } else if (rangeResult.cursorOffset >= 0) {
  8660. cursorOffset = rangeResult.cursorOffset + rangeStart;
  8661. }
  8662. let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
  8663. if (opts.endOfLine !== "lf") {
  8664. const eol = convertEndOfLineToChars(opts.endOfLine);
  8665. if (cursorOffset >= 0 && eol === "\r\n") {
  8666. cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
  8667. }
  8668. formatted = formatted.replace(/\n/g, eol);
  8669. }
  8670. return {
  8671. formatted,
  8672. cursorOffset,
  8673. comments: rangeResult.comments
  8674. };
  8675. }
  8676. function ensureIndexInText(text, index, defaultValue) {
  8677. if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
  8678. return defaultValue;
  8679. }
  8680. return index;
  8681. }
  8682. function normalizeIndexes(text, options) {
  8683. let {
  8684. cursorOffset,
  8685. rangeStart,
  8686. rangeEnd
  8687. } = options;
  8688. cursorOffset = ensureIndexInText(text, cursorOffset, -1);
  8689. rangeStart = ensureIndexInText(text, rangeStart, 0);
  8690. rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
  8691. return Object.assign(Object.assign({}, options), {}, {
  8692. cursorOffset,
  8693. rangeStart,
  8694. rangeEnd
  8695. });
  8696. }
  8697. function normalizeInputAndOptions(text, options) {
  8698. let {
  8699. cursorOffset,
  8700. rangeStart,
  8701. rangeEnd,
  8702. endOfLine
  8703. } = normalizeIndexes(text, options);
  8704. const hasBOM = text.charAt(0) === BOM;
  8705. if (hasBOM) {
  8706. text = text.slice(1);
  8707. cursorOffset--;
  8708. rangeStart--;
  8709. rangeEnd--;
  8710. }
  8711. if (endOfLine === "auto") {
  8712. endOfLine = guessEndOfLine(text);
  8713. }
  8714. if (text.includes("\r")) {
  8715. const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
  8716. cursorOffset -= countCrlfBefore(cursorOffset);
  8717. rangeStart -= countCrlfBefore(rangeStart);
  8718. rangeEnd -= countCrlfBefore(rangeEnd);
  8719. text = normalizeEndOfLine(text);
  8720. }
  8721. return {
  8722. hasBOM,
  8723. text,
  8724. options: normalizeIndexes(text, Object.assign(Object.assign({}, options), {}, {
  8725. cursorOffset,
  8726. rangeStart,
  8727. rangeEnd,
  8728. endOfLine
  8729. }))
  8730. };
  8731. }
  8732. function hasPragma(text, options) {
  8733. const selectedParser = parser.resolveParser(options);
  8734. return !selectedParser.hasPragma || selectedParser.hasPragma(text);
  8735. }
  8736. function formatWithCursor2(originalText, originalOptions) {
  8737. let {
  8738. hasBOM,
  8739. text,
  8740. options
  8741. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8742. if (options.rangeStart >= options.rangeEnd && text !== "" || options.requirePragma && !hasPragma(text, options)) {
  8743. return {
  8744. formatted: originalText,
  8745. cursorOffset: originalOptions.cursorOffset,
  8746. comments: []
  8747. };
  8748. }
  8749. let result;
  8750. if (options.rangeStart > 0 || options.rangeEnd < text.length) {
  8751. result = formatRange(text, options);
  8752. } else {
  8753. if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(text, options)) {
  8754. text = options.printer.insertPragma(text);
  8755. }
  8756. result = coreFormat(text, options);
  8757. }
  8758. if (hasBOM) {
  8759. result.formatted = BOM + result.formatted;
  8760. if (result.cursorOffset >= 0) {
  8761. result.cursorOffset++;
  8762. }
  8763. }
  8764. return result;
  8765. }
  8766. module2.exports = {
  8767. formatWithCursor: formatWithCursor2,
  8768. parse(originalText, originalOptions, massage) {
  8769. const {
  8770. text,
  8771. options
  8772. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8773. const parsed = parser.parse(text, options);
  8774. if (massage) {
  8775. parsed.ast = massageAST(parsed.ast, options);
  8776. }
  8777. return parsed;
  8778. },
  8779. formatAST(ast, options) {
  8780. options = normalizeOptions(options);
  8781. const doc2 = printAstToDoc(ast, options);
  8782. return printDocToString(doc2, options);
  8783. },
  8784. formatDoc(doc2, options) {
  8785. return formatWithCursor2(printDocToDebug(doc2), Object.assign(Object.assign({}, options), {}, {
  8786. parser: "__js_expression"
  8787. })).formatted;
  8788. },
  8789. printToDoc(originalText, options) {
  8790. options = normalizeOptions(options);
  8791. const {
  8792. ast,
  8793. text
  8794. } = parser.parse(originalText, options);
  8795. attachComments(text, ast, options);
  8796. return printAstToDoc(ast, options);
  8797. },
  8798. printDocToString(doc2, options) {
  8799. return printDocToString(doc2, normalizeOptions(options));
  8800. }
  8801. };
  8802. }
  8803. });
  8804. var require_utils2 = __commonJS2({
  8805. "node_modules/braces/lib/utils.js"(exports2) {
  8806. "use strict";
  8807. exports2.isInteger = (num) => {
  8808. if (typeof num === "number") {
  8809. return Number.isInteger(num);
  8810. }
  8811. if (typeof num === "string" && num.trim() !== "") {
  8812. return Number.isInteger(Number(num));
  8813. }
  8814. return false;
  8815. };
  8816. exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
  8817. exports2.exceedsLimit = (min, max, step = 1, limit) => {
  8818. if (limit === false)
  8819. return false;
  8820. if (!exports2.isInteger(min) || !exports2.isInteger(max))
  8821. return false;
  8822. return (Number(max) - Number(min)) / Number(step) >= limit;
  8823. };
  8824. exports2.escapeNode = (block, n = 0, type) => {
  8825. let node = block.nodes[n];
  8826. if (!node)
  8827. return;
  8828. if (type && node.type === type || node.type === "open" || node.type === "close") {
  8829. if (node.escaped !== true) {
  8830. node.value = "\\" + node.value;
  8831. node.escaped = true;
  8832. }
  8833. }
  8834. };
  8835. exports2.encloseBrace = (node) => {
  8836. if (node.type !== "brace")
  8837. return false;
  8838. if (node.commas >> 0 + node.ranges >> 0 === 0) {
  8839. node.invalid = true;
  8840. return true;
  8841. }
  8842. return false;
  8843. };
  8844. exports2.isInvalidBrace = (block) => {
  8845. if (block.type !== "brace")
  8846. return false;
  8847. if (block.invalid === true || block.dollar)
  8848. return true;
  8849. if (block.commas >> 0 + block.ranges >> 0 === 0) {
  8850. block.invalid = true;
  8851. return true;
  8852. }
  8853. if (block.open !== true || block.close !== true) {
  8854. block.invalid = true;
  8855. return true;
  8856. }
  8857. return false;
  8858. };
  8859. exports2.isOpenOrClose = (node) => {
  8860. if (node.type === "open" || node.type === "close") {
  8861. return true;
  8862. }
  8863. return node.open === true || node.close === true;
  8864. };
  8865. exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
  8866. if (node.type === "text")
  8867. acc.push(node.value);
  8868. if (node.type === "range")
  8869. node.type = "text";
  8870. return acc;
  8871. }, []);
  8872. exports2.flatten = (...args) => {
  8873. const result = [];
  8874. const flat = (arr) => {
  8875. for (let i = 0; i < arr.length; i++) {
  8876. let ele = arr[i];
  8877. Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
  8878. }
  8879. return result;
  8880. };
  8881. flat(args);
  8882. return result;
  8883. };
  8884. }
  8885. });
  8886. var require_stringify = __commonJS2({
  8887. "node_modules/braces/lib/stringify.js"(exports2, module2) {
  8888. "use strict";
  8889. var utils = require_utils2();
  8890. module2.exports = (ast, options = {}) => {
  8891. let stringify = (node, parent = {}) => {
  8892. let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
  8893. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  8894. let output = "";
  8895. if (node.value) {
  8896. if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
  8897. return "\\" + node.value;
  8898. }
  8899. return node.value;
  8900. }
  8901. if (node.value) {
  8902. return node.value;
  8903. }
  8904. if (node.nodes) {
  8905. for (let child of node.nodes) {
  8906. output += stringify(child);
  8907. }
  8908. }
  8909. return output;
  8910. };
  8911. return stringify(ast);
  8912. };
  8913. }
  8914. });
  8915. var require_is_number = __commonJS2({
  8916. "node_modules/is-number/index.js"(exports2, module2) {
  8917. "use strict";
  8918. module2.exports = function(num) {
  8919. if (typeof num === "number") {
  8920. return num - num === 0;
  8921. }
  8922. if (typeof num === "string" && num.trim() !== "") {
  8923. return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  8924. }
  8925. return false;
  8926. };
  8927. }
  8928. });
  8929. var require_to_regex_range = __commonJS2({
  8930. "node_modules/to-regex-range/index.js"(exports2, module2) {
  8931. "use strict";
  8932. var isNumber = require_is_number();
  8933. var toRegexRange = (min, max, options) => {
  8934. if (isNumber(min) === false) {
  8935. throw new TypeError("toRegexRange: expected the first argument to be a number");
  8936. }
  8937. if (max === void 0 || min === max) {
  8938. return String(min);
  8939. }
  8940. if (isNumber(max) === false) {
  8941. throw new TypeError("toRegexRange: expected the second argument to be a number.");
  8942. }
  8943. let opts = Object.assign({
  8944. relaxZeros: true
  8945. }, options);
  8946. if (typeof opts.strictZeros === "boolean") {
  8947. opts.relaxZeros = opts.strictZeros === false;
  8948. }
  8949. let relax = String(opts.relaxZeros);
  8950. let shorthand = String(opts.shorthand);
  8951. let capture = String(opts.capture);
  8952. let wrap = String(opts.wrap);
  8953. let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
  8954. if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
  8955. return toRegexRange.cache[cacheKey].result;
  8956. }
  8957. let a = Math.min(min, max);
  8958. let b = Math.max(min, max);
  8959. if (Math.abs(a - b) === 1) {
  8960. let result = min + "|" + max;
  8961. if (opts.capture) {
  8962. return `(${result})`;
  8963. }
  8964. if (opts.wrap === false) {
  8965. return result;
  8966. }
  8967. return `(?:${result})`;
  8968. }
  8969. let isPadded = hasPadding(min) || hasPadding(max);
  8970. let state = {
  8971. min,
  8972. max,
  8973. a,
  8974. b
  8975. };
  8976. let positives = [];
  8977. let negatives = [];
  8978. if (isPadded) {
  8979. state.isPadded = isPadded;
  8980. state.maxLen = String(state.max).length;
  8981. }
  8982. if (a < 0) {
  8983. let newMin = b < 0 ? Math.abs(b) : 1;
  8984. negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
  8985. a = state.a = 0;
  8986. }
  8987. if (b >= 0) {
  8988. positives = splitToPatterns(a, b, state, opts);
  8989. }
  8990. state.negatives = negatives;
  8991. state.positives = positives;
  8992. state.result = collatePatterns(negatives, positives, opts);
  8993. if (opts.capture === true) {
  8994. state.result = `(${state.result})`;
  8995. } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
  8996. state.result = `(?:${state.result})`;
  8997. }
  8998. toRegexRange.cache[cacheKey] = state;
  8999. return state.result;
  9000. };
  9001. function collatePatterns(neg, pos, options) {
  9002. let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
  9003. let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
  9004. let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
  9005. let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
  9006. return subpatterns.join("|");
  9007. }
  9008. function splitToRanges(min, max) {
  9009. let nines = 1;
  9010. let zeros = 1;
  9011. let stop = countNines(min, nines);
  9012. let stops = /* @__PURE__ */ new Set([max]);
  9013. while (min <= stop && stop <= max) {
  9014. stops.add(stop);
  9015. nines += 1;
  9016. stop = countNines(min, nines);
  9017. }
  9018. stop = countZeros(max + 1, zeros) - 1;
  9019. while (min < stop && stop <= max) {
  9020. stops.add(stop);
  9021. zeros += 1;
  9022. stop = countZeros(max + 1, zeros) - 1;
  9023. }
  9024. stops = [...stops];
  9025. stops.sort(compare);
  9026. return stops;
  9027. }
  9028. function rangeToPattern(start, stop, options) {
  9029. if (start === stop) {
  9030. return {
  9031. pattern: start,
  9032. count: [],
  9033. digits: 0
  9034. };
  9035. }
  9036. let zipped = zip(start, stop);
  9037. let digits = zipped.length;
  9038. let pattern = "";
  9039. let count = 0;
  9040. for (let i = 0; i < digits; i++) {
  9041. let [startDigit, stopDigit] = zipped[i];
  9042. if (startDigit === stopDigit) {
  9043. pattern += startDigit;
  9044. } else if (startDigit !== "0" || stopDigit !== "9") {
  9045. pattern += toCharacterClass(startDigit, stopDigit, options);
  9046. } else {
  9047. count++;
  9048. }
  9049. }
  9050. if (count) {
  9051. pattern += options.shorthand === true ? "\\d" : "[0-9]";
  9052. }
  9053. return {
  9054. pattern,
  9055. count: [count],
  9056. digits
  9057. };
  9058. }
  9059. function splitToPatterns(min, max, tok, options) {
  9060. let ranges = splitToRanges(min, max);
  9061. let tokens = [];
  9062. let start = min;
  9063. let prev;
  9064. for (let i = 0; i < ranges.length; i++) {
  9065. let max2 = ranges[i];
  9066. let obj = rangeToPattern(String(start), String(max2), options);
  9067. let zeros = "";
  9068. if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
  9069. if (prev.count.length > 1) {
  9070. prev.count.pop();
  9071. }
  9072. prev.count.push(obj.count[0]);
  9073. prev.string = prev.pattern + toQuantifier(prev.count);
  9074. start = max2 + 1;
  9075. continue;
  9076. }
  9077. if (tok.isPadded) {
  9078. zeros = padZeros(max2, tok, options);
  9079. }
  9080. obj.string = zeros + obj.pattern + toQuantifier(obj.count);
  9081. tokens.push(obj);
  9082. start = max2 + 1;
  9083. prev = obj;
  9084. }
  9085. return tokens;
  9086. }
  9087. function filterPatterns(arr, comparison, prefix, intersection, options) {
  9088. let result = [];
  9089. for (let ele of arr) {
  9090. let {
  9091. string
  9092. } = ele;
  9093. if (!intersection && !contains(comparison, "string", string)) {
  9094. result.push(prefix + string);
  9095. }
  9096. if (intersection && contains(comparison, "string", string)) {
  9097. result.push(prefix + string);
  9098. }
  9099. }
  9100. return result;
  9101. }
  9102. function zip(a, b) {
  9103. let arr = [];
  9104. for (let i = 0; i < a.length; i++)
  9105. arr.push([a[i], b[i]]);
  9106. return arr;
  9107. }
  9108. function compare(a, b) {
  9109. return a > b ? 1 : b > a ? -1 : 0;
  9110. }
  9111. function contains(arr, key, val) {
  9112. return arr.some((ele) => ele[key] === val);
  9113. }
  9114. function countNines(min, len) {
  9115. return Number(String(min).slice(0, -len) + "9".repeat(len));
  9116. }
  9117. function countZeros(integer, zeros) {
  9118. return integer - integer % Math.pow(10, zeros);
  9119. }
  9120. function toQuantifier(digits) {
  9121. let [start = 0, stop = ""] = digits;
  9122. if (stop || start > 1) {
  9123. return `{${start + (stop ? "," + stop : "")}}`;
  9124. }
  9125. return "";
  9126. }
  9127. function toCharacterClass(a, b, options) {
  9128. return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
  9129. }
  9130. function hasPadding(str) {
  9131. return /^-?(0+)\d/.test(str);
  9132. }
  9133. function padZeros(value, tok, options) {
  9134. if (!tok.isPadded) {
  9135. return value;
  9136. }
  9137. let diff = Math.abs(tok.maxLen - String(value).length);
  9138. let relax = options.relaxZeros !== false;
  9139. switch (diff) {
  9140. case 0:
  9141. return "";
  9142. case 1:
  9143. return relax ? "0?" : "0";
  9144. case 2:
  9145. return relax ? "0{0,2}" : "00";
  9146. default: {
  9147. return relax ? `0{0,${diff}}` : `0{${diff}}`;
  9148. }
  9149. }
  9150. }
  9151. toRegexRange.cache = {};
  9152. toRegexRange.clearCache = () => toRegexRange.cache = {};
  9153. module2.exports = toRegexRange;
  9154. }
  9155. });
  9156. var require_fill_range = __commonJS2({
  9157. "node_modules/fill-range/index.js"(exports2, module2) {
  9158. "use strict";
  9159. var util = require("util");
  9160. var toRegexRange = require_to_regex_range();
  9161. var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  9162. var transform = (toNumber) => {
  9163. return (value) => toNumber === true ? Number(value) : String(value);
  9164. };
  9165. var isValidValue = (value) => {
  9166. return typeof value === "number" || typeof value === "string" && value !== "";
  9167. };
  9168. var isNumber = (num) => Number.isInteger(+num);
  9169. var zeros = (input) => {
  9170. let value = `${input}`;
  9171. let index = -1;
  9172. if (value[0] === "-")
  9173. value = value.slice(1);
  9174. if (value === "0")
  9175. return false;
  9176. while (value[++index] === "0")
  9177. ;
  9178. return index > 0;
  9179. };
  9180. var stringify = (start, end, options) => {
  9181. if (typeof start === "string" || typeof end === "string") {
  9182. return true;
  9183. }
  9184. return options.stringify === true;
  9185. };
  9186. var pad = (input, maxLength, toNumber) => {
  9187. if (maxLength > 0) {
  9188. let dash = input[0] === "-" ? "-" : "";
  9189. if (dash)
  9190. input = input.slice(1);
  9191. input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
  9192. }
  9193. if (toNumber === false) {
  9194. return String(input);
  9195. }
  9196. return input;
  9197. };
  9198. var toMaxLen = (input, maxLength) => {
  9199. let negative = input[0] === "-" ? "-" : "";
  9200. if (negative) {
  9201. input = input.slice(1);
  9202. maxLength--;
  9203. }
  9204. while (input.length < maxLength)
  9205. input = "0" + input;
  9206. return negative ? "-" + input : input;
  9207. };
  9208. var toSequence = (parts, options) => {
  9209. parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9210. parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9211. let prefix = options.capture ? "" : "?:";
  9212. let positives = "";
  9213. let negatives = "";
  9214. let result;
  9215. if (parts.positives.length) {
  9216. positives = parts.positives.join("|");
  9217. }
  9218. if (parts.negatives.length) {
  9219. negatives = `-(${prefix}${parts.negatives.join("|")})`;
  9220. }
  9221. if (positives && negatives) {
  9222. result = `${positives}|${negatives}`;
  9223. } else {
  9224. result = positives || negatives;
  9225. }
  9226. if (options.wrap) {
  9227. return `(${prefix}${result})`;
  9228. }
  9229. return result;
  9230. };
  9231. var toRange = (a, b, isNumbers, options) => {
  9232. if (isNumbers) {
  9233. return toRegexRange(a, b, Object.assign({
  9234. wrap: false
  9235. }, options));
  9236. }
  9237. let start = String.fromCharCode(a);
  9238. if (a === b)
  9239. return start;
  9240. let stop = String.fromCharCode(b);
  9241. return `[${start}-${stop}]`;
  9242. };
  9243. var toRegex = (start, end, options) => {
  9244. if (Array.isArray(start)) {
  9245. let wrap = options.wrap === true;
  9246. let prefix = options.capture ? "" : "?:";
  9247. return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
  9248. }
  9249. return toRegexRange(start, end, options);
  9250. };
  9251. var rangeError = (...args) => {
  9252. return new RangeError("Invalid range arguments: " + util.inspect(...args));
  9253. };
  9254. var invalidRange = (start, end, options) => {
  9255. if (options.strictRanges === true)
  9256. throw rangeError([start, end]);
  9257. return [];
  9258. };
  9259. var invalidStep = (step, options) => {
  9260. if (options.strictRanges === true) {
  9261. throw new TypeError(`Expected step "${step}" to be a number`);
  9262. }
  9263. return [];
  9264. };
  9265. var fillNumbers = (start, end, step = 1, options = {}) => {
  9266. let a = Number(start);
  9267. let b = Number(end);
  9268. if (!Number.isInteger(a) || !Number.isInteger(b)) {
  9269. if (options.strictRanges === true)
  9270. throw rangeError([start, end]);
  9271. return [];
  9272. }
  9273. if (a === 0)
  9274. a = 0;
  9275. if (b === 0)
  9276. b = 0;
  9277. let descending = a > b;
  9278. let startString = String(start);
  9279. let endString = String(end);
  9280. let stepString = String(step);
  9281. step = Math.max(Math.abs(step), 1);
  9282. let padded = zeros(startString) || zeros(endString) || zeros(stepString);
  9283. let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
  9284. let toNumber = padded === false && stringify(start, end, options) === false;
  9285. let format = options.transform || transform(toNumber);
  9286. if (options.toRegex && step === 1) {
  9287. return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
  9288. }
  9289. let parts = {
  9290. negatives: [],
  9291. positives: []
  9292. };
  9293. let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
  9294. let range = [];
  9295. let index = 0;
  9296. while (descending ? a >= b : a <= b) {
  9297. if (options.toRegex === true && step > 1) {
  9298. push(a);
  9299. } else {
  9300. range.push(pad(format(a, index), maxLen, toNumber));
  9301. }
  9302. a = descending ? a - step : a + step;
  9303. index++;
  9304. }
  9305. if (options.toRegex === true) {
  9306. return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
  9307. wrap: false
  9308. }, options));
  9309. }
  9310. return range;
  9311. };
  9312. var fillLetters = (start, end, step = 1, options = {}) => {
  9313. if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
  9314. return invalidRange(start, end, options);
  9315. }
  9316. let format = options.transform || ((val) => String.fromCharCode(val));
  9317. let a = `${start}`.charCodeAt(0);
  9318. let b = `${end}`.charCodeAt(0);
  9319. let descending = a > b;
  9320. let min = Math.min(a, b);
  9321. let max = Math.max(a, b);
  9322. if (options.toRegex && step === 1) {
  9323. return toRange(min, max, false, options);
  9324. }
  9325. let range = [];
  9326. let index = 0;
  9327. while (descending ? a >= b : a <= b) {
  9328. range.push(format(a, index));
  9329. a = descending ? a - step : a + step;
  9330. index++;
  9331. }
  9332. if (options.toRegex === true) {
  9333. return toRegex(range, null, {
  9334. wrap: false,
  9335. options
  9336. });
  9337. }
  9338. return range;
  9339. };
  9340. var fill = (start, end, step, options = {}) => {
  9341. if (end == null && isValidValue(start)) {
  9342. return [start];
  9343. }
  9344. if (!isValidValue(start) || !isValidValue(end)) {
  9345. return invalidRange(start, end, options);
  9346. }
  9347. if (typeof step === "function") {
  9348. return fill(start, end, 1, {
  9349. transform: step
  9350. });
  9351. }
  9352. if (isObject(step)) {
  9353. return fill(start, end, 0, step);
  9354. }
  9355. let opts = Object.assign({}, options);
  9356. if (opts.capture === true)
  9357. opts.wrap = true;
  9358. step = step || opts.step || 1;
  9359. if (!isNumber(step)) {
  9360. if (step != null && !isObject(step))
  9361. return invalidStep(step, opts);
  9362. return fill(start, end, 1, step);
  9363. }
  9364. if (isNumber(start) && isNumber(end)) {
  9365. return fillNumbers(start, end, step, opts);
  9366. }
  9367. return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
  9368. };
  9369. module2.exports = fill;
  9370. }
  9371. });
  9372. var require_compile = __commonJS2({
  9373. "node_modules/braces/lib/compile.js"(exports2, module2) {
  9374. "use strict";
  9375. var fill = require_fill_range();
  9376. var utils = require_utils2();
  9377. var compile = (ast, options = {}) => {
  9378. let walk = (node, parent = {}) => {
  9379. let invalidBlock = utils.isInvalidBrace(parent);
  9380. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  9381. let invalid = invalidBlock === true || invalidNode === true;
  9382. let prefix = options.escapeInvalid === true ? "\\" : "";
  9383. let output = "";
  9384. if (node.isOpen === true) {
  9385. return prefix + node.value;
  9386. }
  9387. if (node.isClose === true) {
  9388. return prefix + node.value;
  9389. }
  9390. if (node.type === "open") {
  9391. return invalid ? prefix + node.value : "(";
  9392. }
  9393. if (node.type === "close") {
  9394. return invalid ? prefix + node.value : ")";
  9395. }
  9396. if (node.type === "comma") {
  9397. return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
  9398. }
  9399. if (node.value) {
  9400. return node.value;
  9401. }
  9402. if (node.nodes && node.ranges > 0) {
  9403. let args = utils.reduce(node.nodes);
  9404. let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
  9405. wrap: false,
  9406. toRegex: true
  9407. }));
  9408. if (range.length !== 0) {
  9409. return args.length > 1 && range.length > 1 ? `(${range})` : range;
  9410. }
  9411. }
  9412. if (node.nodes) {
  9413. for (let child of node.nodes) {
  9414. output += walk(child, node);
  9415. }
  9416. }
  9417. return output;
  9418. };
  9419. return walk(ast);
  9420. };
  9421. module2.exports = compile;
  9422. }
  9423. });
  9424. var require_expand = __commonJS2({
  9425. "node_modules/braces/lib/expand.js"(exports2, module2) {
  9426. "use strict";
  9427. var fill = require_fill_range();
  9428. var stringify = require_stringify();
  9429. var utils = require_utils2();
  9430. var append = (queue = "", stash = "", enclose = false) => {
  9431. let result = [];
  9432. queue = [].concat(queue);
  9433. stash = [].concat(stash);
  9434. if (!stash.length)
  9435. return queue;
  9436. if (!queue.length) {
  9437. return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
  9438. }
  9439. for (let item of queue) {
  9440. if (Array.isArray(item)) {
  9441. for (let value of item) {
  9442. result.push(append(value, stash, enclose));
  9443. }
  9444. } else {
  9445. for (let ele of stash) {
  9446. if (enclose === true && typeof ele === "string")
  9447. ele = `{${ele}}`;
  9448. result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
  9449. }
  9450. }
  9451. }
  9452. return utils.flatten(result);
  9453. };
  9454. var expand = (ast, options = {}) => {
  9455. let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
  9456. let walk = (node, parent = {}) => {
  9457. node.queue = [];
  9458. let p = parent;
  9459. let q = parent.queue;
  9460. while (p.type !== "brace" && p.type !== "root" && p.parent) {
  9461. p = p.parent;
  9462. q = p.queue;
  9463. }
  9464. if (node.invalid || node.dollar) {
  9465. q.push(append(q.pop(), stringify(node, options)));
  9466. return;
  9467. }
  9468. if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
  9469. q.push(append(q.pop(), ["{}"]));
  9470. return;
  9471. }
  9472. if (node.nodes && node.ranges > 0) {
  9473. let args = utils.reduce(node.nodes);
  9474. if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
  9475. throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
  9476. }
  9477. let range = fill(...args, options);
  9478. if (range.length === 0) {
  9479. range = stringify(node, options);
  9480. }
  9481. q.push(append(q.pop(), range));
  9482. node.nodes = [];
  9483. return;
  9484. }
  9485. let enclose = utils.encloseBrace(node);
  9486. let queue = node.queue;
  9487. let block = node;
  9488. while (block.type !== "brace" && block.type !== "root" && block.parent) {
  9489. block = block.parent;
  9490. queue = block.queue;
  9491. }
  9492. for (let i = 0; i < node.nodes.length; i++) {
  9493. let child = node.nodes[i];
  9494. if (child.type === "comma" && node.type === "brace") {
  9495. if (i === 1)
  9496. queue.push("");
  9497. queue.push("");
  9498. continue;
  9499. }
  9500. if (child.type === "close") {
  9501. q.push(append(q.pop(), queue, enclose));
  9502. continue;
  9503. }
  9504. if (child.value && child.type !== "open") {
  9505. queue.push(append(queue.pop(), child.value));
  9506. continue;
  9507. }
  9508. if (child.nodes) {
  9509. walk(child, node);
  9510. }
  9511. }
  9512. return queue;
  9513. };
  9514. return utils.flatten(walk(ast));
  9515. };
  9516. module2.exports = expand;
  9517. }
  9518. });
  9519. var require_constants2 = __commonJS2({
  9520. "node_modules/braces/lib/constants.js"(exports2, module2) {
  9521. "use strict";
  9522. module2.exports = {
  9523. MAX_LENGTH: 1024 * 64,
  9524. CHAR_0: "0",
  9525. CHAR_9: "9",
  9526. CHAR_UPPERCASE_A: "A",
  9527. CHAR_LOWERCASE_A: "a",
  9528. CHAR_UPPERCASE_Z: "Z",
  9529. CHAR_LOWERCASE_Z: "z",
  9530. CHAR_LEFT_PARENTHESES: "(",
  9531. CHAR_RIGHT_PARENTHESES: ")",
  9532. CHAR_ASTERISK: "*",
  9533. CHAR_AMPERSAND: "&",
  9534. CHAR_AT: "@",
  9535. CHAR_BACKSLASH: "\\",
  9536. CHAR_BACKTICK: "`",
  9537. CHAR_CARRIAGE_RETURN: "\r",
  9538. CHAR_CIRCUMFLEX_ACCENT: "^",
  9539. CHAR_COLON: ":",
  9540. CHAR_COMMA: ",",
  9541. CHAR_DOLLAR: "$",
  9542. CHAR_DOT: ".",
  9543. CHAR_DOUBLE_QUOTE: '"',
  9544. CHAR_EQUAL: "=",
  9545. CHAR_EXCLAMATION_MARK: "!",
  9546. CHAR_FORM_FEED: "\f",
  9547. CHAR_FORWARD_SLASH: "/",
  9548. CHAR_HASH: "#",
  9549. CHAR_HYPHEN_MINUS: "-",
  9550. CHAR_LEFT_ANGLE_BRACKET: "<",
  9551. CHAR_LEFT_CURLY_BRACE: "{",
  9552. CHAR_LEFT_SQUARE_BRACKET: "[",
  9553. CHAR_LINE_FEED: "\n",
  9554. CHAR_NO_BREAK_SPACE: "\xA0",
  9555. CHAR_PERCENT: "%",
  9556. CHAR_PLUS: "+",
  9557. CHAR_QUESTION_MARK: "?",
  9558. CHAR_RIGHT_ANGLE_BRACKET: ">",
  9559. CHAR_RIGHT_CURLY_BRACE: "}",
  9560. CHAR_RIGHT_SQUARE_BRACKET: "]",
  9561. CHAR_SEMICOLON: ";",
  9562. CHAR_SINGLE_QUOTE: "'",
  9563. CHAR_SPACE: " ",
  9564. CHAR_TAB: " ",
  9565. CHAR_UNDERSCORE: "_",
  9566. CHAR_VERTICAL_LINE: "|",
  9567. CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
  9568. };
  9569. }
  9570. });
  9571. var require_parse = __commonJS2({
  9572. "node_modules/braces/lib/parse.js"(exports2, module2) {
  9573. "use strict";
  9574. var stringify = require_stringify();
  9575. var {
  9576. MAX_LENGTH,
  9577. CHAR_BACKSLASH,
  9578. CHAR_BACKTICK,
  9579. CHAR_COMMA,
  9580. CHAR_DOT,
  9581. CHAR_LEFT_PARENTHESES,
  9582. CHAR_RIGHT_PARENTHESES,
  9583. CHAR_LEFT_CURLY_BRACE,
  9584. CHAR_RIGHT_CURLY_BRACE,
  9585. CHAR_LEFT_SQUARE_BRACKET,
  9586. CHAR_RIGHT_SQUARE_BRACKET,
  9587. CHAR_DOUBLE_QUOTE,
  9588. CHAR_SINGLE_QUOTE,
  9589. CHAR_NO_BREAK_SPACE,
  9590. CHAR_ZERO_WIDTH_NOBREAK_SPACE
  9591. } = require_constants2();
  9592. var parse = (input, options = {}) => {
  9593. if (typeof input !== "string") {
  9594. throw new TypeError("Expected a string");
  9595. }
  9596. let opts = options || {};
  9597. let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  9598. if (input.length > max) {
  9599. throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
  9600. }
  9601. let ast = {
  9602. type: "root",
  9603. input,
  9604. nodes: []
  9605. };
  9606. let stack = [ast];
  9607. let block = ast;
  9608. let prev = ast;
  9609. let brackets = 0;
  9610. let length = input.length;
  9611. let index = 0;
  9612. let depth = 0;
  9613. let value;
  9614. let memo = {};
  9615. const advance = () => input[index++];
  9616. const push = (node) => {
  9617. if (node.type === "text" && prev.type === "dot") {
  9618. prev.type = "text";
  9619. }
  9620. if (prev && prev.type === "text" && node.type === "text") {
  9621. prev.value += node.value;
  9622. return;
  9623. }
  9624. block.nodes.push(node);
  9625. node.parent = block;
  9626. node.prev = prev;
  9627. prev = node;
  9628. return node;
  9629. };
  9630. push({
  9631. type: "bos"
  9632. });
  9633. while (index < length) {
  9634. block = stack[stack.length - 1];
  9635. value = advance();
  9636. if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
  9637. continue;
  9638. }
  9639. if (value === CHAR_BACKSLASH) {
  9640. push({
  9641. type: "text",
  9642. value: (options.keepEscaping ? value : "") + advance()
  9643. });
  9644. continue;
  9645. }
  9646. if (value === CHAR_RIGHT_SQUARE_BRACKET) {
  9647. push({
  9648. type: "text",
  9649. value: "\\" + value
  9650. });
  9651. continue;
  9652. }
  9653. if (value === CHAR_LEFT_SQUARE_BRACKET) {
  9654. brackets++;
  9655. let closed = true;
  9656. let next;
  9657. while (index < length && (next = advance())) {
  9658. value += next;
  9659. if (next === CHAR_LEFT_SQUARE_BRACKET) {
  9660. brackets++;
  9661. continue;
  9662. }
  9663. if (next === CHAR_BACKSLASH) {
  9664. value += advance();
  9665. continue;
  9666. }
  9667. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  9668. brackets--;
  9669. if (brackets === 0) {
  9670. break;
  9671. }
  9672. }
  9673. }
  9674. push({
  9675. type: "text",
  9676. value
  9677. });
  9678. continue;
  9679. }
  9680. if (value === CHAR_LEFT_PARENTHESES) {
  9681. block = push({
  9682. type: "paren",
  9683. nodes: []
  9684. });
  9685. stack.push(block);
  9686. push({
  9687. type: "text",
  9688. value
  9689. });
  9690. continue;
  9691. }
  9692. if (value === CHAR_RIGHT_PARENTHESES) {
  9693. if (block.type !== "paren") {
  9694. push({
  9695. type: "text",
  9696. value
  9697. });
  9698. continue;
  9699. }
  9700. block = stack.pop();
  9701. push({
  9702. type: "text",
  9703. value
  9704. });
  9705. block = stack[stack.length - 1];
  9706. continue;
  9707. }
  9708. if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
  9709. let open = value;
  9710. let next;
  9711. if (options.keepQuotes !== true) {
  9712. value = "";
  9713. }
  9714. while (index < length && (next = advance())) {
  9715. if (next === CHAR_BACKSLASH) {
  9716. value += next + advance();
  9717. continue;
  9718. }
  9719. if (next === open) {
  9720. if (options.keepQuotes === true)
  9721. value += next;
  9722. break;
  9723. }
  9724. value += next;
  9725. }
  9726. push({
  9727. type: "text",
  9728. value
  9729. });
  9730. continue;
  9731. }
  9732. if (value === CHAR_LEFT_CURLY_BRACE) {
  9733. depth++;
  9734. let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
  9735. let brace = {
  9736. type: "brace",
  9737. open: true,
  9738. close: false,
  9739. dollar,
  9740. depth,
  9741. commas: 0,
  9742. ranges: 0,
  9743. nodes: []
  9744. };
  9745. block = push(brace);
  9746. stack.push(block);
  9747. push({
  9748. type: "open",
  9749. value
  9750. });
  9751. continue;
  9752. }
  9753. if (value === CHAR_RIGHT_CURLY_BRACE) {
  9754. if (block.type !== "brace") {
  9755. push({
  9756. type: "text",
  9757. value
  9758. });
  9759. continue;
  9760. }
  9761. let type = "close";
  9762. block = stack.pop();
  9763. block.close = true;
  9764. push({
  9765. type,
  9766. value
  9767. });
  9768. depth--;
  9769. block = stack[stack.length - 1];
  9770. continue;
  9771. }
  9772. if (value === CHAR_COMMA && depth > 0) {
  9773. if (block.ranges > 0) {
  9774. block.ranges = 0;
  9775. let open = block.nodes.shift();
  9776. block.nodes = [open, {
  9777. type: "text",
  9778. value: stringify(block)
  9779. }];
  9780. }
  9781. push({
  9782. type: "comma",
  9783. value
  9784. });
  9785. block.commas++;
  9786. continue;
  9787. }
  9788. if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
  9789. let siblings = block.nodes;
  9790. if (depth === 0 || siblings.length === 0) {
  9791. push({
  9792. type: "text",
  9793. value
  9794. });
  9795. continue;
  9796. }
  9797. if (prev.type === "dot") {
  9798. block.range = [];
  9799. prev.value += value;
  9800. prev.type = "range";
  9801. if (block.nodes.length !== 3 && block.nodes.length !== 5) {
  9802. block.invalid = true;
  9803. block.ranges = 0;
  9804. prev.type = "text";
  9805. continue;
  9806. }
  9807. block.ranges++;
  9808. block.args = [];
  9809. continue;
  9810. }
  9811. if (prev.type === "range") {
  9812. siblings.pop();
  9813. let before = siblings[siblings.length - 1];
  9814. before.value += prev.value + value;
  9815. prev = before;
  9816. block.ranges--;
  9817. continue;
  9818. }
  9819. push({
  9820. type: "dot",
  9821. value
  9822. });
  9823. continue;
  9824. }
  9825. push({
  9826. type: "text",
  9827. value
  9828. });
  9829. }
  9830. do {
  9831. block = stack.pop();
  9832. if (block.type !== "root") {
  9833. block.nodes.forEach((node) => {
  9834. if (!node.nodes) {
  9835. if (node.type === "open")
  9836. node.isOpen = true;
  9837. if (node.type === "close")
  9838. node.isClose = true;
  9839. if (!node.nodes)
  9840. node.type = "text";
  9841. node.invalid = true;
  9842. }
  9843. });
  9844. let parent = stack[stack.length - 1];
  9845. let index2 = parent.nodes.indexOf(block);
  9846. parent.nodes.splice(index2, 1, ...block.nodes);
  9847. }
  9848. } while (stack.length > 0);
  9849. push({
  9850. type: "eos"
  9851. });
  9852. return ast;
  9853. };
  9854. module2.exports = parse;
  9855. }
  9856. });
  9857. var require_braces = __commonJS2({
  9858. "node_modules/braces/index.js"(exports2, module2) {
  9859. "use strict";
  9860. var stringify = require_stringify();
  9861. var compile = require_compile();
  9862. var expand = require_expand();
  9863. var parse = require_parse();
  9864. var braces = (input, options = {}) => {
  9865. let output = [];
  9866. if (Array.isArray(input)) {
  9867. for (let pattern of input) {
  9868. let result = braces.create(pattern, options);
  9869. if (Array.isArray(result)) {
  9870. output.push(...result);
  9871. } else {
  9872. output.push(result);
  9873. }
  9874. }
  9875. } else {
  9876. output = [].concat(braces.create(input, options));
  9877. }
  9878. if (options && options.expand === true && options.nodupes === true) {
  9879. output = [...new Set(output)];
  9880. }
  9881. return output;
  9882. };
  9883. braces.parse = (input, options = {}) => parse(input, options);
  9884. braces.stringify = (input, options = {}) => {
  9885. if (typeof input === "string") {
  9886. return stringify(braces.parse(input, options), options);
  9887. }
  9888. return stringify(input, options);
  9889. };
  9890. braces.compile = (input, options = {}) => {
  9891. if (typeof input === "string") {
  9892. input = braces.parse(input, options);
  9893. }
  9894. return compile(input, options);
  9895. };
  9896. braces.expand = (input, options = {}) => {
  9897. if (typeof input === "string") {
  9898. input = braces.parse(input, options);
  9899. }
  9900. let result = expand(input, options);
  9901. if (options.noempty === true) {
  9902. result = result.filter(Boolean);
  9903. }
  9904. if (options.nodupes === true) {
  9905. result = [...new Set(result)];
  9906. }
  9907. return result;
  9908. };
  9909. braces.create = (input, options = {}) => {
  9910. if (input === "" || input.length < 3) {
  9911. return [input];
  9912. }
  9913. return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
  9914. };
  9915. module2.exports = braces;
  9916. }
  9917. });
  9918. var require_constants3 = __commonJS2({
  9919. "node_modules/picomatch/lib/constants.js"(exports2, module2) {
  9920. "use strict";
  9921. var path = require("path");
  9922. var WIN_SLASH = "\\\\/";
  9923. var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  9924. var DOT_LITERAL = "\\.";
  9925. var PLUS_LITERAL = "\\+";
  9926. var QMARK_LITERAL = "\\?";
  9927. var SLASH_LITERAL = "\\/";
  9928. var ONE_CHAR = "(?=.)";
  9929. var QMARK = "[^/]";
  9930. var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  9931. var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  9932. var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  9933. var NO_DOT = `(?!${DOT_LITERAL})`;
  9934. var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
  9935. var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
  9936. var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
  9937. var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
  9938. var STAR = `${QMARK}*?`;
  9939. var POSIX_CHARS = {
  9940. DOT_LITERAL,
  9941. PLUS_LITERAL,
  9942. QMARK_LITERAL,
  9943. SLASH_LITERAL,
  9944. ONE_CHAR,
  9945. QMARK,
  9946. END_ANCHOR,
  9947. DOTS_SLASH,
  9948. NO_DOT,
  9949. NO_DOTS,
  9950. NO_DOT_SLASH,
  9951. NO_DOTS_SLASH,
  9952. QMARK_NO_DOT,
  9953. STAR,
  9954. START_ANCHOR
  9955. };
  9956. var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
  9957. SLASH_LITERAL: `[${WIN_SLASH}]`,
  9958. QMARK: WIN_NO_SLASH,
  9959. STAR: `${WIN_NO_SLASH}*?`,
  9960. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  9961. NO_DOT: `(?!${DOT_LITERAL})`,
  9962. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  9963. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  9964. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  9965. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  9966. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  9967. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
  9968. });
  9969. var POSIX_REGEX_SOURCE = {
  9970. alnum: "a-zA-Z0-9",
  9971. alpha: "a-zA-Z",
  9972. ascii: "\\x00-\\x7F",
  9973. blank: " \\t",
  9974. cntrl: "\\x00-\\x1F\\x7F",
  9975. digit: "0-9",
  9976. graph: "\\x21-\\x7E",
  9977. lower: "a-z",
  9978. print: "\\x20-\\x7E ",
  9979. punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
  9980. space: " \\t\\r\\n\\v\\f",
  9981. upper: "A-Z",
  9982. word: "A-Za-z0-9_",
  9983. xdigit: "A-Fa-f0-9"
  9984. };
  9985. module2.exports = {
  9986. MAX_LENGTH: 1024 * 64,
  9987. POSIX_REGEX_SOURCE,
  9988. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  9989. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  9990. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  9991. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  9992. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  9993. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  9994. REPLACEMENTS: {
  9995. "***": "*",
  9996. "**/**": "**",
  9997. "**/**/**": "**"
  9998. },
  9999. CHAR_0: 48,
  10000. CHAR_9: 57,
  10001. CHAR_UPPERCASE_A: 65,
  10002. CHAR_LOWERCASE_A: 97,
  10003. CHAR_UPPERCASE_Z: 90,
  10004. CHAR_LOWERCASE_Z: 122,
  10005. CHAR_LEFT_PARENTHESES: 40,
  10006. CHAR_RIGHT_PARENTHESES: 41,
  10007. CHAR_ASTERISK: 42,
  10008. CHAR_AMPERSAND: 38,
  10009. CHAR_AT: 64,
  10010. CHAR_BACKWARD_SLASH: 92,
  10011. CHAR_CARRIAGE_RETURN: 13,
  10012. CHAR_CIRCUMFLEX_ACCENT: 94,
  10013. CHAR_COLON: 58,
  10014. CHAR_COMMA: 44,
  10015. CHAR_DOT: 46,
  10016. CHAR_DOUBLE_QUOTE: 34,
  10017. CHAR_EQUAL: 61,
  10018. CHAR_EXCLAMATION_MARK: 33,
  10019. CHAR_FORM_FEED: 12,
  10020. CHAR_FORWARD_SLASH: 47,
  10021. CHAR_GRAVE_ACCENT: 96,
  10022. CHAR_HASH: 35,
  10023. CHAR_HYPHEN_MINUS: 45,
  10024. CHAR_LEFT_ANGLE_BRACKET: 60,
  10025. CHAR_LEFT_CURLY_BRACE: 123,
  10026. CHAR_LEFT_SQUARE_BRACKET: 91,
  10027. CHAR_LINE_FEED: 10,
  10028. CHAR_NO_BREAK_SPACE: 160,
  10029. CHAR_PERCENT: 37,
  10030. CHAR_PLUS: 43,
  10031. CHAR_QUESTION_MARK: 63,
  10032. CHAR_RIGHT_ANGLE_BRACKET: 62,
  10033. CHAR_RIGHT_CURLY_BRACE: 125,
  10034. CHAR_RIGHT_SQUARE_BRACKET: 93,
  10035. CHAR_SEMICOLON: 59,
  10036. CHAR_SINGLE_QUOTE: 39,
  10037. CHAR_SPACE: 32,
  10038. CHAR_TAB: 9,
  10039. CHAR_UNDERSCORE: 95,
  10040. CHAR_VERTICAL_LINE: 124,
  10041. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
  10042. SEP: path.sep,
  10043. extglobChars(chars) {
  10044. return {
  10045. "!": {
  10046. type: "negate",
  10047. open: "(?:(?!(?:",
  10048. close: `))${chars.STAR})`
  10049. },
  10050. "?": {
  10051. type: "qmark",
  10052. open: "(?:",
  10053. close: ")?"
  10054. },
  10055. "+": {
  10056. type: "plus",
  10057. open: "(?:",
  10058. close: ")+"
  10059. },
  10060. "*": {
  10061. type: "star",
  10062. open: "(?:",
  10063. close: ")*"
  10064. },
  10065. "@": {
  10066. type: "at",
  10067. open: "(?:",
  10068. close: ")"
  10069. }
  10070. };
  10071. },
  10072. globChars(win32) {
  10073. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  10074. }
  10075. };
  10076. }
  10077. });
  10078. var require_utils3 = __commonJS2({
  10079. "node_modules/picomatch/lib/utils.js"(exports2) {
  10080. "use strict";
  10081. var path = require("path");
  10082. var win32 = process.platform === "win32";
  10083. var {
  10084. REGEX_BACKSLASH,
  10085. REGEX_REMOVE_BACKSLASH,
  10086. REGEX_SPECIAL_CHARS,
  10087. REGEX_SPECIAL_CHARS_GLOBAL
  10088. } = require_constants3();
  10089. exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  10090. exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
  10091. exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
  10092. exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
  10093. exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
  10094. exports2.removeBackslashes = (str) => {
  10095. return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
  10096. return match === "\\" ? "" : match;
  10097. });
  10098. };
  10099. exports2.supportsLookbehinds = () => {
  10100. const segs = process.version.slice(1).split(".").map(Number);
  10101. if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
  10102. return true;
  10103. }
  10104. return false;
  10105. };
  10106. exports2.isWindows = (options) => {
  10107. if (options && typeof options.windows === "boolean") {
  10108. return options.windows;
  10109. }
  10110. return win32 === true || path.sep === "\\";
  10111. };
  10112. exports2.escapeLast = (input, char, lastIdx) => {
  10113. const idx = input.lastIndexOf(char, lastIdx);
  10114. if (idx === -1)
  10115. return input;
  10116. if (input[idx - 1] === "\\")
  10117. return exports2.escapeLast(input, char, idx - 1);
  10118. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  10119. };
  10120. exports2.removePrefix = (input, state = {}) => {
  10121. let output = input;
  10122. if (output.startsWith("./")) {
  10123. output = output.slice(2);
  10124. state.prefix = "./";
  10125. }
  10126. return output;
  10127. };
  10128. exports2.wrapOutput = (input, state = {}, options = {}) => {
  10129. const prepend = options.contains ? "" : "^";
  10130. const append = options.contains ? "" : "$";
  10131. let output = `${prepend}(?:${input})${append}`;
  10132. if (state.negated === true) {
  10133. output = `(?:^(?!${output}).*$)`;
  10134. }
  10135. return output;
  10136. };
  10137. }
  10138. });
  10139. var require_scan = __commonJS2({
  10140. "node_modules/picomatch/lib/scan.js"(exports2, module2) {
  10141. "use strict";
  10142. var utils = require_utils3();
  10143. var {
  10144. CHAR_ASTERISK,
  10145. CHAR_AT,
  10146. CHAR_BACKWARD_SLASH,
  10147. CHAR_COMMA,
  10148. CHAR_DOT,
  10149. CHAR_EXCLAMATION_MARK,
  10150. CHAR_FORWARD_SLASH,
  10151. CHAR_LEFT_CURLY_BRACE,
  10152. CHAR_LEFT_PARENTHESES,
  10153. CHAR_LEFT_SQUARE_BRACKET,
  10154. CHAR_PLUS,
  10155. CHAR_QUESTION_MARK,
  10156. CHAR_RIGHT_CURLY_BRACE,
  10157. CHAR_RIGHT_PARENTHESES,
  10158. CHAR_RIGHT_SQUARE_BRACKET
  10159. } = require_constants3();
  10160. var isPathSeparator = (code) => {
  10161. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  10162. };
  10163. var depth = (token) => {
  10164. if (token.isPrefix !== true) {
  10165. token.depth = token.isGlobstar ? Infinity : 1;
  10166. }
  10167. };
  10168. var scan = (input, options) => {
  10169. const opts = options || {};
  10170. const length = input.length - 1;
  10171. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  10172. const slashes = [];
  10173. const tokens = [];
  10174. const parts = [];
  10175. let str = input;
  10176. let index = -1;
  10177. let start = 0;
  10178. let lastIndex = 0;
  10179. let isBrace = false;
  10180. let isBracket = false;
  10181. let isGlob = false;
  10182. let isExtglob = false;
  10183. let isGlobstar = false;
  10184. let braceEscaped = false;
  10185. let backslashes = false;
  10186. let negated = false;
  10187. let negatedExtglob = false;
  10188. let finished = false;
  10189. let braces = 0;
  10190. let prev;
  10191. let code;
  10192. let token = {
  10193. value: "",
  10194. depth: 0,
  10195. isGlob: false
  10196. };
  10197. const eos = () => index >= length;
  10198. const peek = () => str.charCodeAt(index + 1);
  10199. const advance = () => {
  10200. prev = code;
  10201. return str.charCodeAt(++index);
  10202. };
  10203. while (index < length) {
  10204. code = advance();
  10205. let next;
  10206. if (code === CHAR_BACKWARD_SLASH) {
  10207. backslashes = token.backslashes = true;
  10208. code = advance();
  10209. if (code === CHAR_LEFT_CURLY_BRACE) {
  10210. braceEscaped = true;
  10211. }
  10212. continue;
  10213. }
  10214. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  10215. braces++;
  10216. while (eos() !== true && (code = advance())) {
  10217. if (code === CHAR_BACKWARD_SLASH) {
  10218. backslashes = token.backslashes = true;
  10219. advance();
  10220. continue;
  10221. }
  10222. if (code === CHAR_LEFT_CURLY_BRACE) {
  10223. braces++;
  10224. continue;
  10225. }
  10226. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  10227. isBrace = token.isBrace = true;
  10228. isGlob = token.isGlob = true;
  10229. finished = true;
  10230. if (scanToEnd === true) {
  10231. continue;
  10232. }
  10233. break;
  10234. }
  10235. if (braceEscaped !== true && code === CHAR_COMMA) {
  10236. isBrace = token.isBrace = true;
  10237. isGlob = token.isGlob = true;
  10238. finished = true;
  10239. if (scanToEnd === true) {
  10240. continue;
  10241. }
  10242. break;
  10243. }
  10244. if (code === CHAR_RIGHT_CURLY_BRACE) {
  10245. braces--;
  10246. if (braces === 0) {
  10247. braceEscaped = false;
  10248. isBrace = token.isBrace = true;
  10249. finished = true;
  10250. break;
  10251. }
  10252. }
  10253. }
  10254. if (scanToEnd === true) {
  10255. continue;
  10256. }
  10257. break;
  10258. }
  10259. if (code === CHAR_FORWARD_SLASH) {
  10260. slashes.push(index);
  10261. tokens.push(token);
  10262. token = {
  10263. value: "",
  10264. depth: 0,
  10265. isGlob: false
  10266. };
  10267. if (finished === true)
  10268. continue;
  10269. if (prev === CHAR_DOT && index === start + 1) {
  10270. start += 2;
  10271. continue;
  10272. }
  10273. lastIndex = index + 1;
  10274. continue;
  10275. }
  10276. if (opts.noext !== true) {
  10277. const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
  10278. if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
  10279. isGlob = token.isGlob = true;
  10280. isExtglob = token.isExtglob = true;
  10281. finished = true;
  10282. if (code === CHAR_EXCLAMATION_MARK && index === start) {
  10283. negatedExtglob = true;
  10284. }
  10285. if (scanToEnd === true) {
  10286. while (eos() !== true && (code = advance())) {
  10287. if (code === CHAR_BACKWARD_SLASH) {
  10288. backslashes = token.backslashes = true;
  10289. code = advance();
  10290. continue;
  10291. }
  10292. if (code === CHAR_RIGHT_PARENTHESES) {
  10293. isGlob = token.isGlob = true;
  10294. finished = true;
  10295. break;
  10296. }
  10297. }
  10298. continue;
  10299. }
  10300. break;
  10301. }
  10302. }
  10303. if (code === CHAR_ASTERISK) {
  10304. if (prev === CHAR_ASTERISK)
  10305. isGlobstar = token.isGlobstar = true;
  10306. isGlob = token.isGlob = true;
  10307. finished = true;
  10308. if (scanToEnd === true) {
  10309. continue;
  10310. }
  10311. break;
  10312. }
  10313. if (code === CHAR_QUESTION_MARK) {
  10314. isGlob = token.isGlob = true;
  10315. finished = true;
  10316. if (scanToEnd === true) {
  10317. continue;
  10318. }
  10319. break;
  10320. }
  10321. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  10322. while (eos() !== true && (next = advance())) {
  10323. if (next === CHAR_BACKWARD_SLASH) {
  10324. backslashes = token.backslashes = true;
  10325. advance();
  10326. continue;
  10327. }
  10328. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  10329. isBracket = token.isBracket = true;
  10330. isGlob = token.isGlob = true;
  10331. finished = true;
  10332. break;
  10333. }
  10334. }
  10335. if (scanToEnd === true) {
  10336. continue;
  10337. }
  10338. break;
  10339. }
  10340. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  10341. negated = token.negated = true;
  10342. start++;
  10343. continue;
  10344. }
  10345. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  10346. isGlob = token.isGlob = true;
  10347. if (scanToEnd === true) {
  10348. while (eos() !== true && (code = advance())) {
  10349. if (code === CHAR_LEFT_PARENTHESES) {
  10350. backslashes = token.backslashes = true;
  10351. code = advance();
  10352. continue;
  10353. }
  10354. if (code === CHAR_RIGHT_PARENTHESES) {
  10355. finished = true;
  10356. break;
  10357. }
  10358. }
  10359. continue;
  10360. }
  10361. break;
  10362. }
  10363. if (isGlob === true) {
  10364. finished = true;
  10365. if (scanToEnd === true) {
  10366. continue;
  10367. }
  10368. break;
  10369. }
  10370. }
  10371. if (opts.noext === true) {
  10372. isExtglob = false;
  10373. isGlob = false;
  10374. }
  10375. let base = str;
  10376. let prefix = "";
  10377. let glob = "";
  10378. if (start > 0) {
  10379. prefix = str.slice(0, start);
  10380. str = str.slice(start);
  10381. lastIndex -= start;
  10382. }
  10383. if (base && isGlob === true && lastIndex > 0) {
  10384. base = str.slice(0, lastIndex);
  10385. glob = str.slice(lastIndex);
  10386. } else if (isGlob === true) {
  10387. base = "";
  10388. glob = str;
  10389. } else {
  10390. base = str;
  10391. }
  10392. if (base && base !== "" && base !== "/" && base !== str) {
  10393. if (isPathSeparator(base.charCodeAt(base.length - 1))) {
  10394. base = base.slice(0, -1);
  10395. }
  10396. }
  10397. if (opts.unescape === true) {
  10398. if (glob)
  10399. glob = utils.removeBackslashes(glob);
  10400. if (base && backslashes === true) {
  10401. base = utils.removeBackslashes(base);
  10402. }
  10403. }
  10404. const state = {
  10405. prefix,
  10406. input,
  10407. start,
  10408. base,
  10409. glob,
  10410. isBrace,
  10411. isBracket,
  10412. isGlob,
  10413. isExtglob,
  10414. isGlobstar,
  10415. negated,
  10416. negatedExtglob
  10417. };
  10418. if (opts.tokens === true) {
  10419. state.maxDepth = 0;
  10420. if (!isPathSeparator(code)) {
  10421. tokens.push(token);
  10422. }
  10423. state.tokens = tokens;
  10424. }
  10425. if (opts.parts === true || opts.tokens === true) {
  10426. let prevIndex;
  10427. for (let idx = 0; idx < slashes.length; idx++) {
  10428. const n = prevIndex ? prevIndex + 1 : start;
  10429. const i = slashes[idx];
  10430. const value = input.slice(n, i);
  10431. if (opts.tokens) {
  10432. if (idx === 0 && start !== 0) {
  10433. tokens[idx].isPrefix = true;
  10434. tokens[idx].value = prefix;
  10435. } else {
  10436. tokens[idx].value = value;
  10437. }
  10438. depth(tokens[idx]);
  10439. state.maxDepth += tokens[idx].depth;
  10440. }
  10441. if (idx !== 0 || value !== "") {
  10442. parts.push(value);
  10443. }
  10444. prevIndex = i;
  10445. }
  10446. if (prevIndex && prevIndex + 1 < input.length) {
  10447. const value = input.slice(prevIndex + 1);
  10448. parts.push(value);
  10449. if (opts.tokens) {
  10450. tokens[tokens.length - 1].value = value;
  10451. depth(tokens[tokens.length - 1]);
  10452. state.maxDepth += tokens[tokens.length - 1].depth;
  10453. }
  10454. }
  10455. state.slashes = slashes;
  10456. state.parts = parts;
  10457. }
  10458. return state;
  10459. };
  10460. module2.exports = scan;
  10461. }
  10462. });
  10463. var require_parse2 = __commonJS2({
  10464. "node_modules/picomatch/lib/parse.js"(exports2, module2) {
  10465. "use strict";
  10466. var constants = require_constants3();
  10467. var utils = require_utils3();
  10468. var {
  10469. MAX_LENGTH,
  10470. POSIX_REGEX_SOURCE,
  10471. REGEX_NON_SPECIAL_CHARS,
  10472. REGEX_SPECIAL_CHARS_BACKREF,
  10473. REPLACEMENTS
  10474. } = constants;
  10475. var expandRange = (args, options) => {
  10476. if (typeof options.expandRange === "function") {
  10477. return options.expandRange(...args, options);
  10478. }
  10479. args.sort();
  10480. const value = `[${args.join("-")}]`;
  10481. try {
  10482. new RegExp(value);
  10483. } catch (ex) {
  10484. return args.map((v) => utils.escapeRegex(v)).join("..");
  10485. }
  10486. return value;
  10487. };
  10488. var syntaxError = (type, char) => {
  10489. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  10490. };
  10491. var parse = (input, options) => {
  10492. if (typeof input !== "string") {
  10493. throw new TypeError("Expected a string");
  10494. }
  10495. input = REPLACEMENTS[input] || input;
  10496. const opts = Object.assign({}, options);
  10497. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  10498. let len = input.length;
  10499. if (len > max) {
  10500. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  10501. }
  10502. const bos = {
  10503. type: "bos",
  10504. value: "",
  10505. output: opts.prepend || ""
  10506. };
  10507. const tokens = [bos];
  10508. const capture = opts.capture ? "" : "?:";
  10509. const win32 = utils.isWindows(options);
  10510. const PLATFORM_CHARS = constants.globChars(win32);
  10511. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  10512. const {
  10513. DOT_LITERAL,
  10514. PLUS_LITERAL,
  10515. SLASH_LITERAL,
  10516. ONE_CHAR,
  10517. DOTS_SLASH,
  10518. NO_DOT,
  10519. NO_DOT_SLASH,
  10520. NO_DOTS_SLASH,
  10521. QMARK,
  10522. QMARK_NO_DOT,
  10523. STAR,
  10524. START_ANCHOR
  10525. } = PLATFORM_CHARS;
  10526. const globstar = (opts2) => {
  10527. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  10528. };
  10529. const nodot = opts.dot ? "" : NO_DOT;
  10530. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  10531. let star = opts.bash === true ? globstar(opts) : STAR;
  10532. if (opts.capture) {
  10533. star = `(${star})`;
  10534. }
  10535. if (typeof opts.noext === "boolean") {
  10536. opts.noextglob = opts.noext;
  10537. }
  10538. const state = {
  10539. input,
  10540. index: -1,
  10541. start: 0,
  10542. dot: opts.dot === true,
  10543. consumed: "",
  10544. output: "",
  10545. prefix: "",
  10546. backtrack: false,
  10547. negated: false,
  10548. brackets: 0,
  10549. braces: 0,
  10550. parens: 0,
  10551. quotes: 0,
  10552. globstar: false,
  10553. tokens
  10554. };
  10555. input = utils.removePrefix(input, state);
  10556. len = input.length;
  10557. const extglobs = [];
  10558. const braces = [];
  10559. const stack = [];
  10560. let prev = bos;
  10561. let value;
  10562. const eos = () => state.index === len - 1;
  10563. const peek = state.peek = (n = 1) => input[state.index + n];
  10564. const advance = state.advance = () => input[++state.index] || "";
  10565. const remaining = () => input.slice(state.index + 1);
  10566. const consume = (value2 = "", num = 0) => {
  10567. state.consumed += value2;
  10568. state.index += num;
  10569. };
  10570. const append = (token) => {
  10571. state.output += token.output != null ? token.output : token.value;
  10572. consume(token.value);
  10573. };
  10574. const negate = () => {
  10575. let count = 1;
  10576. while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
  10577. advance();
  10578. state.start++;
  10579. count++;
  10580. }
  10581. if (count % 2 === 0) {
  10582. return false;
  10583. }
  10584. state.negated = true;
  10585. state.start++;
  10586. return true;
  10587. };
  10588. const increment = (type) => {
  10589. state[type]++;
  10590. stack.push(type);
  10591. };
  10592. const decrement = (type) => {
  10593. state[type]--;
  10594. stack.pop();
  10595. };
  10596. const push = (tok) => {
  10597. if (prev.type === "globstar") {
  10598. const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
  10599. const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
  10600. if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
  10601. state.output = state.output.slice(0, -prev.output.length);
  10602. prev.type = "star";
  10603. prev.value = "*";
  10604. prev.output = star;
  10605. state.output += prev.output;
  10606. }
  10607. }
  10608. if (extglobs.length && tok.type !== "paren") {
  10609. extglobs[extglobs.length - 1].inner += tok.value;
  10610. }
  10611. if (tok.value || tok.output)
  10612. append(tok);
  10613. if (prev && prev.type === "text" && tok.type === "text") {
  10614. prev.value += tok.value;
  10615. prev.output = (prev.output || "") + tok.value;
  10616. return;
  10617. }
  10618. tok.prev = prev;
  10619. tokens.push(tok);
  10620. prev = tok;
  10621. };
  10622. const extglobOpen = (type, value2) => {
  10623. const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
  10624. conditions: 1,
  10625. inner: ""
  10626. });
  10627. token.prev = prev;
  10628. token.parens = state.parens;
  10629. token.output = state.output;
  10630. const output = (opts.capture ? "(" : "") + token.open;
  10631. increment("parens");
  10632. push({
  10633. type,
  10634. value: value2,
  10635. output: state.output ? "" : ONE_CHAR
  10636. });
  10637. push({
  10638. type: "paren",
  10639. extglob: true,
  10640. value: advance(),
  10641. output
  10642. });
  10643. extglobs.push(token);
  10644. };
  10645. const extglobClose = (token) => {
  10646. let output = token.close + (opts.capture ? ")" : "");
  10647. let rest;
  10648. if (token.type === "negate") {
  10649. let extglobStar = star;
  10650. if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
  10651. extglobStar = globstar(opts);
  10652. }
  10653. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
  10654. output = token.close = `)$))${extglobStar}`;
  10655. }
  10656. if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
  10657. const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
  10658. fastpaths: false
  10659. })).output;
  10660. output = token.close = `)${expression})${extglobStar})`;
  10661. }
  10662. if (token.prev.type === "bos") {
  10663. state.negatedExtglob = true;
  10664. }
  10665. }
  10666. push({
  10667. type: "paren",
  10668. extglob: true,
  10669. value,
  10670. output
  10671. });
  10672. decrement("parens");
  10673. };
  10674. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  10675. let backslashes = false;
  10676. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  10677. if (first === "\\") {
  10678. backslashes = true;
  10679. return m;
  10680. }
  10681. if (first === "?") {
  10682. if (esc) {
  10683. return esc + first + (rest ? QMARK.repeat(rest.length) : "");
  10684. }
  10685. if (index === 0) {
  10686. return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
  10687. }
  10688. return QMARK.repeat(chars.length);
  10689. }
  10690. if (first === ".") {
  10691. return DOT_LITERAL.repeat(chars.length);
  10692. }
  10693. if (first === "*") {
  10694. if (esc) {
  10695. return esc + first + (rest ? star : "");
  10696. }
  10697. return star;
  10698. }
  10699. return esc ? m : `\\${m}`;
  10700. });
  10701. if (backslashes === true) {
  10702. if (opts.unescape === true) {
  10703. output = output.replace(/\\/g, "");
  10704. } else {
  10705. output = output.replace(/\\+/g, (m) => {
  10706. return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
  10707. });
  10708. }
  10709. }
  10710. if (output === input && opts.contains === true) {
  10711. state.output = input;
  10712. return state;
  10713. }
  10714. state.output = utils.wrapOutput(output, state, options);
  10715. return state;
  10716. }
  10717. while (!eos()) {
  10718. value = advance();
  10719. if (value === "\0") {
  10720. continue;
  10721. }
  10722. if (value === "\\") {
  10723. const next = peek();
  10724. if (next === "/" && opts.bash !== true) {
  10725. continue;
  10726. }
  10727. if (next === "." || next === ";") {
  10728. continue;
  10729. }
  10730. if (!next) {
  10731. value += "\\";
  10732. push({
  10733. type: "text",
  10734. value
  10735. });
  10736. continue;
  10737. }
  10738. const match = /^\\+/.exec(remaining());
  10739. let slashes = 0;
  10740. if (match && match[0].length > 2) {
  10741. slashes = match[0].length;
  10742. state.index += slashes;
  10743. if (slashes % 2 !== 0) {
  10744. value += "\\";
  10745. }
  10746. }
  10747. if (opts.unescape === true) {
  10748. value = advance();
  10749. } else {
  10750. value += advance();
  10751. }
  10752. if (state.brackets === 0) {
  10753. push({
  10754. type: "text",
  10755. value
  10756. });
  10757. continue;
  10758. }
  10759. }
  10760. if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
  10761. if (opts.posix !== false && value === ":") {
  10762. const inner = prev.value.slice(1);
  10763. if (inner.includes("[")) {
  10764. prev.posix = true;
  10765. if (inner.includes(":")) {
  10766. const idx = prev.value.lastIndexOf("[");
  10767. const pre = prev.value.slice(0, idx);
  10768. const rest2 = prev.value.slice(idx + 2);
  10769. const posix = POSIX_REGEX_SOURCE[rest2];
  10770. if (posix) {
  10771. prev.value = pre + posix;
  10772. state.backtrack = true;
  10773. advance();
  10774. if (!bos.output && tokens.indexOf(prev) === 1) {
  10775. bos.output = ONE_CHAR;
  10776. }
  10777. continue;
  10778. }
  10779. }
  10780. }
  10781. }
  10782. if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
  10783. value = `\\${value}`;
  10784. }
  10785. if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
  10786. value = `\\${value}`;
  10787. }
  10788. if (opts.posix === true && value === "!" && prev.value === "[") {
  10789. value = "^";
  10790. }
  10791. prev.value += value;
  10792. append({
  10793. value
  10794. });
  10795. continue;
  10796. }
  10797. if (state.quotes === 1 && value !== '"') {
  10798. value = utils.escapeRegex(value);
  10799. prev.value += value;
  10800. append({
  10801. value
  10802. });
  10803. continue;
  10804. }
  10805. if (value === '"') {
  10806. state.quotes = state.quotes === 1 ? 0 : 1;
  10807. if (opts.keepQuotes === true) {
  10808. push({
  10809. type: "text",
  10810. value
  10811. });
  10812. }
  10813. continue;
  10814. }
  10815. if (value === "(") {
  10816. increment("parens");
  10817. push({
  10818. type: "paren",
  10819. value
  10820. });
  10821. continue;
  10822. }
  10823. if (value === ")") {
  10824. if (state.parens === 0 && opts.strictBrackets === true) {
  10825. throw new SyntaxError(syntaxError("opening", "("));
  10826. }
  10827. const extglob = extglobs[extglobs.length - 1];
  10828. if (extglob && state.parens === extglob.parens + 1) {
  10829. extglobClose(extglobs.pop());
  10830. continue;
  10831. }
  10832. push({
  10833. type: "paren",
  10834. value,
  10835. output: state.parens ? ")" : "\\)"
  10836. });
  10837. decrement("parens");
  10838. continue;
  10839. }
  10840. if (value === "[") {
  10841. if (opts.nobracket === true || !remaining().includes("]")) {
  10842. if (opts.nobracket !== true && opts.strictBrackets === true) {
  10843. throw new SyntaxError(syntaxError("closing", "]"));
  10844. }
  10845. value = `\\${value}`;
  10846. } else {
  10847. increment("brackets");
  10848. }
  10849. push({
  10850. type: "bracket",
  10851. value
  10852. });
  10853. continue;
  10854. }
  10855. if (value === "]") {
  10856. if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
  10857. push({
  10858. type: "text",
  10859. value,
  10860. output: `\\${value}`
  10861. });
  10862. continue;
  10863. }
  10864. if (state.brackets === 0) {
  10865. if (opts.strictBrackets === true) {
  10866. throw new SyntaxError(syntaxError("opening", "["));
  10867. }
  10868. push({
  10869. type: "text",
  10870. value,
  10871. output: `\\${value}`
  10872. });
  10873. continue;
  10874. }
  10875. decrement("brackets");
  10876. const prevValue = prev.value.slice(1);
  10877. if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
  10878. value = `/${value}`;
  10879. }
  10880. prev.value += value;
  10881. append({
  10882. value
  10883. });
  10884. if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
  10885. continue;
  10886. }
  10887. const escaped = utils.escapeRegex(prev.value);
  10888. state.output = state.output.slice(0, -prev.value.length);
  10889. if (opts.literalBrackets === true) {
  10890. state.output += escaped;
  10891. prev.value = escaped;
  10892. continue;
  10893. }
  10894. prev.value = `(${capture}${escaped}|${prev.value})`;
  10895. state.output += prev.value;
  10896. continue;
  10897. }
  10898. if (value === "{" && opts.nobrace !== true) {
  10899. increment("braces");
  10900. const open = {
  10901. type: "brace",
  10902. value,
  10903. output: "(",
  10904. outputIndex: state.output.length,
  10905. tokensIndex: state.tokens.length
  10906. };
  10907. braces.push(open);
  10908. push(open);
  10909. continue;
  10910. }
  10911. if (value === "}") {
  10912. const brace = braces[braces.length - 1];
  10913. if (opts.nobrace === true || !brace) {
  10914. push({
  10915. type: "text",
  10916. value,
  10917. output: value
  10918. });
  10919. continue;
  10920. }
  10921. let output = ")";
  10922. if (brace.dots === true) {
  10923. const arr = tokens.slice();
  10924. const range = [];
  10925. for (let i = arr.length - 1; i >= 0; i--) {
  10926. tokens.pop();
  10927. if (arr[i].type === "brace") {
  10928. break;
  10929. }
  10930. if (arr[i].type !== "dots") {
  10931. range.unshift(arr[i].value);
  10932. }
  10933. }
  10934. output = expandRange(range, opts);
  10935. state.backtrack = true;
  10936. }
  10937. if (brace.comma !== true && brace.dots !== true) {
  10938. const out = state.output.slice(0, brace.outputIndex);
  10939. const toks = state.tokens.slice(brace.tokensIndex);
  10940. brace.value = brace.output = "\\{";
  10941. value = output = "\\}";
  10942. state.output = out;
  10943. for (const t of toks) {
  10944. state.output += t.output || t.value;
  10945. }
  10946. }
  10947. push({
  10948. type: "brace",
  10949. value,
  10950. output
  10951. });
  10952. decrement("braces");
  10953. braces.pop();
  10954. continue;
  10955. }
  10956. if (value === "|") {
  10957. if (extglobs.length > 0) {
  10958. extglobs[extglobs.length - 1].conditions++;
  10959. }
  10960. push({
  10961. type: "text",
  10962. value
  10963. });
  10964. continue;
  10965. }
  10966. if (value === ",") {
  10967. let output = value;
  10968. const brace = braces[braces.length - 1];
  10969. if (brace && stack[stack.length - 1] === "braces") {
  10970. brace.comma = true;
  10971. output = "|";
  10972. }
  10973. push({
  10974. type: "comma",
  10975. value,
  10976. output
  10977. });
  10978. continue;
  10979. }
  10980. if (value === "/") {
  10981. if (prev.type === "dot" && state.index === state.start + 1) {
  10982. state.start = state.index + 1;
  10983. state.consumed = "";
  10984. state.output = "";
  10985. tokens.pop();
  10986. prev = bos;
  10987. continue;
  10988. }
  10989. push({
  10990. type: "slash",
  10991. value,
  10992. output: SLASH_LITERAL
  10993. });
  10994. continue;
  10995. }
  10996. if (value === ".") {
  10997. if (state.braces > 0 && prev.type === "dot") {
  10998. if (prev.value === ".")
  10999. prev.output = DOT_LITERAL;
  11000. const brace = braces[braces.length - 1];
  11001. prev.type = "dots";
  11002. prev.output += value;
  11003. prev.value += value;
  11004. brace.dots = true;
  11005. continue;
  11006. }
  11007. if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
  11008. push({
  11009. type: "text",
  11010. value,
  11011. output: DOT_LITERAL
  11012. });
  11013. continue;
  11014. }
  11015. push({
  11016. type: "dot",
  11017. value,
  11018. output: DOT_LITERAL
  11019. });
  11020. continue;
  11021. }
  11022. if (value === "?") {
  11023. const isGroup = prev && prev.value === "(";
  11024. if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11025. extglobOpen("qmark", value);
  11026. continue;
  11027. }
  11028. if (prev && prev.type === "paren") {
  11029. const next = peek();
  11030. let output = value;
  11031. if (next === "<" && !utils.supportsLookbehinds()) {
  11032. throw new Error("Node.js v10 or higher is required for regex lookbehinds");
  11033. }
  11034. if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
  11035. output = `\\${value}`;
  11036. }
  11037. push({
  11038. type: "text",
  11039. value,
  11040. output
  11041. });
  11042. continue;
  11043. }
  11044. if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
  11045. push({
  11046. type: "qmark",
  11047. value,
  11048. output: QMARK_NO_DOT
  11049. });
  11050. continue;
  11051. }
  11052. push({
  11053. type: "qmark",
  11054. value,
  11055. output: QMARK
  11056. });
  11057. continue;
  11058. }
  11059. if (value === "!") {
  11060. if (opts.noextglob !== true && peek() === "(") {
  11061. if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
  11062. extglobOpen("negate", value);
  11063. continue;
  11064. }
  11065. }
  11066. if (opts.nonegate !== true && state.index === 0) {
  11067. negate();
  11068. continue;
  11069. }
  11070. }
  11071. if (value === "+") {
  11072. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11073. extglobOpen("plus", value);
  11074. continue;
  11075. }
  11076. if (prev && prev.value === "(" || opts.regex === false) {
  11077. push({
  11078. type: "plus",
  11079. value,
  11080. output: PLUS_LITERAL
  11081. });
  11082. continue;
  11083. }
  11084. if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
  11085. push({
  11086. type: "plus",
  11087. value
  11088. });
  11089. continue;
  11090. }
  11091. push({
  11092. type: "plus",
  11093. value: PLUS_LITERAL
  11094. });
  11095. continue;
  11096. }
  11097. if (value === "@") {
  11098. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11099. push({
  11100. type: "at",
  11101. extglob: true,
  11102. value,
  11103. output: ""
  11104. });
  11105. continue;
  11106. }
  11107. push({
  11108. type: "text",
  11109. value
  11110. });
  11111. continue;
  11112. }
  11113. if (value !== "*") {
  11114. if (value === "$" || value === "^") {
  11115. value = `\\${value}`;
  11116. }
  11117. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  11118. if (match) {
  11119. value += match[0];
  11120. state.index += match[0].length;
  11121. }
  11122. push({
  11123. type: "text",
  11124. value
  11125. });
  11126. continue;
  11127. }
  11128. if (prev && (prev.type === "globstar" || prev.star === true)) {
  11129. prev.type = "star";
  11130. prev.star = true;
  11131. prev.value += value;
  11132. prev.output = star;
  11133. state.backtrack = true;
  11134. state.globstar = true;
  11135. consume(value);
  11136. continue;
  11137. }
  11138. let rest = remaining();
  11139. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  11140. extglobOpen("star", value);
  11141. continue;
  11142. }
  11143. if (prev.type === "star") {
  11144. if (opts.noglobstar === true) {
  11145. consume(value);
  11146. continue;
  11147. }
  11148. const prior = prev.prev;
  11149. const before = prior.prev;
  11150. const isStart = prior.type === "slash" || prior.type === "bos";
  11151. const afterStar = before && (before.type === "star" || before.type === "globstar");
  11152. if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
  11153. push({
  11154. type: "star",
  11155. value,
  11156. output: ""
  11157. });
  11158. continue;
  11159. }
  11160. const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
  11161. const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
  11162. if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
  11163. push({
  11164. type: "star",
  11165. value,
  11166. output: ""
  11167. });
  11168. continue;
  11169. }
  11170. while (rest.slice(0, 3) === "/**") {
  11171. const after = input[state.index + 4];
  11172. if (after && after !== "/") {
  11173. break;
  11174. }
  11175. rest = rest.slice(3);
  11176. consume("/**", 3);
  11177. }
  11178. if (prior.type === "bos" && eos()) {
  11179. prev.type = "globstar";
  11180. prev.value += value;
  11181. prev.output = globstar(opts);
  11182. state.output = prev.output;
  11183. state.globstar = true;
  11184. consume(value);
  11185. continue;
  11186. }
  11187. if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
  11188. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11189. prior.output = `(?:${prior.output}`;
  11190. prev.type = "globstar";
  11191. prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
  11192. prev.value += value;
  11193. state.globstar = true;
  11194. state.output += prior.output + prev.output;
  11195. consume(value);
  11196. continue;
  11197. }
  11198. if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
  11199. const end = rest[1] !== void 0 ? "|$" : "";
  11200. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11201. prior.output = `(?:${prior.output}`;
  11202. prev.type = "globstar";
  11203. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  11204. prev.value += value;
  11205. state.output += prior.output + prev.output;
  11206. state.globstar = true;
  11207. consume(value + advance());
  11208. push({
  11209. type: "slash",
  11210. value: "/",
  11211. output: ""
  11212. });
  11213. continue;
  11214. }
  11215. if (prior.type === "bos" && rest[0] === "/") {
  11216. prev.type = "globstar";
  11217. prev.value += value;
  11218. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  11219. state.output = prev.output;
  11220. state.globstar = true;
  11221. consume(value + advance());
  11222. push({
  11223. type: "slash",
  11224. value: "/",
  11225. output: ""
  11226. });
  11227. continue;
  11228. }
  11229. state.output = state.output.slice(0, -prev.output.length);
  11230. prev.type = "globstar";
  11231. prev.output = globstar(opts);
  11232. prev.value += value;
  11233. state.output += prev.output;
  11234. state.globstar = true;
  11235. consume(value);
  11236. continue;
  11237. }
  11238. const token = {
  11239. type: "star",
  11240. value,
  11241. output: star
  11242. };
  11243. if (opts.bash === true) {
  11244. token.output = ".*?";
  11245. if (prev.type === "bos" || prev.type === "slash") {
  11246. token.output = nodot + token.output;
  11247. }
  11248. push(token);
  11249. continue;
  11250. }
  11251. if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
  11252. token.output = value;
  11253. push(token);
  11254. continue;
  11255. }
  11256. if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
  11257. if (prev.type === "dot") {
  11258. state.output += NO_DOT_SLASH;
  11259. prev.output += NO_DOT_SLASH;
  11260. } else if (opts.dot === true) {
  11261. state.output += NO_DOTS_SLASH;
  11262. prev.output += NO_DOTS_SLASH;
  11263. } else {
  11264. state.output += nodot;
  11265. prev.output += nodot;
  11266. }
  11267. if (peek() !== "*") {
  11268. state.output += ONE_CHAR;
  11269. prev.output += ONE_CHAR;
  11270. }
  11271. }
  11272. push(token);
  11273. }
  11274. while (state.brackets > 0) {
  11275. if (opts.strictBrackets === true)
  11276. throw new SyntaxError(syntaxError("closing", "]"));
  11277. state.output = utils.escapeLast(state.output, "[");
  11278. decrement("brackets");
  11279. }
  11280. while (state.parens > 0) {
  11281. if (opts.strictBrackets === true)
  11282. throw new SyntaxError(syntaxError("closing", ")"));
  11283. state.output = utils.escapeLast(state.output, "(");
  11284. decrement("parens");
  11285. }
  11286. while (state.braces > 0) {
  11287. if (opts.strictBrackets === true)
  11288. throw new SyntaxError(syntaxError("closing", "}"));
  11289. state.output = utils.escapeLast(state.output, "{");
  11290. decrement("braces");
  11291. }
  11292. if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
  11293. push({
  11294. type: "maybe_slash",
  11295. value: "",
  11296. output: `${SLASH_LITERAL}?`
  11297. });
  11298. }
  11299. if (state.backtrack === true) {
  11300. state.output = "";
  11301. for (const token of state.tokens) {
  11302. state.output += token.output != null ? token.output : token.value;
  11303. if (token.suffix) {
  11304. state.output += token.suffix;
  11305. }
  11306. }
  11307. }
  11308. return state;
  11309. };
  11310. parse.fastpaths = (input, options) => {
  11311. const opts = Object.assign({}, options);
  11312. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  11313. const len = input.length;
  11314. if (len > max) {
  11315. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  11316. }
  11317. input = REPLACEMENTS[input] || input;
  11318. const win32 = utils.isWindows(options);
  11319. const {
  11320. DOT_LITERAL,
  11321. SLASH_LITERAL,
  11322. ONE_CHAR,
  11323. DOTS_SLASH,
  11324. NO_DOT,
  11325. NO_DOTS,
  11326. NO_DOTS_SLASH,
  11327. STAR,
  11328. START_ANCHOR
  11329. } = constants.globChars(win32);
  11330. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  11331. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  11332. const capture = opts.capture ? "" : "?:";
  11333. const state = {
  11334. negated: false,
  11335. prefix: ""
  11336. };
  11337. let star = opts.bash === true ? ".*?" : STAR;
  11338. if (opts.capture) {
  11339. star = `(${star})`;
  11340. }
  11341. const globstar = (opts2) => {
  11342. if (opts2.noglobstar === true)
  11343. return star;
  11344. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  11345. };
  11346. const create = (str) => {
  11347. switch (str) {
  11348. case "*":
  11349. return `${nodot}${ONE_CHAR}${star}`;
  11350. case ".*":
  11351. return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  11352. case "*.*":
  11353. return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11354. case "*/*":
  11355. return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  11356. case "**":
  11357. return nodot + globstar(opts);
  11358. case "**/*":
  11359. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  11360. case "**/*.*":
  11361. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11362. case "**/.*":
  11363. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  11364. default: {
  11365. const match = /^(.*?)\.(\w+)$/.exec(str);
  11366. if (!match)
  11367. return;
  11368. const source2 = create(match[1]);
  11369. if (!source2)
  11370. return;
  11371. return source2 + DOT_LITERAL + match[2];
  11372. }
  11373. }
  11374. };
  11375. const output = utils.removePrefix(input, state);
  11376. let source = create(output);
  11377. if (source && opts.strictSlashes !== true) {
  11378. source += `${SLASH_LITERAL}?`;
  11379. }
  11380. return source;
  11381. };
  11382. module2.exports = parse;
  11383. }
  11384. });
  11385. var require_picomatch = __commonJS2({
  11386. "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
  11387. "use strict";
  11388. var path = require("path");
  11389. var scan = require_scan();
  11390. var parse = require_parse2();
  11391. var utils = require_utils3();
  11392. var constants = require_constants3();
  11393. var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
  11394. var picomatch = (glob, options, returnState = false) => {
  11395. if (Array.isArray(glob)) {
  11396. const fns = glob.map((input) => picomatch(input, options, returnState));
  11397. const arrayMatcher = (str) => {
  11398. for (const isMatch of fns) {
  11399. const state2 = isMatch(str);
  11400. if (state2)
  11401. return state2;
  11402. }
  11403. return false;
  11404. };
  11405. return arrayMatcher;
  11406. }
  11407. const isState = isObject(glob) && glob.tokens && glob.input;
  11408. if (glob === "" || typeof glob !== "string" && !isState) {
  11409. throw new TypeError("Expected pattern to be a non-empty string");
  11410. }
  11411. const opts = options || {};
  11412. const posix = utils.isWindows(options);
  11413. const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
  11414. const state = regex.state;
  11415. delete regex.state;
  11416. let isIgnored = () => false;
  11417. if (opts.ignore) {
  11418. const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
  11419. ignore: null,
  11420. onMatch: null,
  11421. onResult: null
  11422. });
  11423. isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  11424. }
  11425. const matcher = (input, returnObject = false) => {
  11426. const {
  11427. isMatch,
  11428. match,
  11429. output
  11430. } = picomatch.test(input, regex, options, {
  11431. glob,
  11432. posix
  11433. });
  11434. const result = {
  11435. glob,
  11436. state,
  11437. regex,
  11438. posix,
  11439. input,
  11440. output,
  11441. match,
  11442. isMatch
  11443. };
  11444. if (typeof opts.onResult === "function") {
  11445. opts.onResult(result);
  11446. }
  11447. if (isMatch === false) {
  11448. result.isMatch = false;
  11449. return returnObject ? result : false;
  11450. }
  11451. if (isIgnored(input)) {
  11452. if (typeof opts.onIgnore === "function") {
  11453. opts.onIgnore(result);
  11454. }
  11455. result.isMatch = false;
  11456. return returnObject ? result : false;
  11457. }
  11458. if (typeof opts.onMatch === "function") {
  11459. opts.onMatch(result);
  11460. }
  11461. return returnObject ? result : true;
  11462. };
  11463. if (returnState) {
  11464. matcher.state = state;
  11465. }
  11466. return matcher;
  11467. };
  11468. picomatch.test = (input, regex, options, {
  11469. glob,
  11470. posix
  11471. } = {}) => {
  11472. if (typeof input !== "string") {
  11473. throw new TypeError("Expected input to be a string");
  11474. }
  11475. if (input === "") {
  11476. return {
  11477. isMatch: false,
  11478. output: ""
  11479. };
  11480. }
  11481. const opts = options || {};
  11482. const format = opts.format || (posix ? utils.toPosixSlashes : null);
  11483. let match = input === glob;
  11484. let output = match && format ? format(input) : input;
  11485. if (match === false) {
  11486. output = format ? format(input) : input;
  11487. match = output === glob;
  11488. }
  11489. if (match === false || opts.capture === true) {
  11490. if (opts.matchBase === true || opts.basename === true) {
  11491. match = picomatch.matchBase(input, regex, options, posix);
  11492. } else {
  11493. match = regex.exec(output);
  11494. }
  11495. }
  11496. return {
  11497. isMatch: Boolean(match),
  11498. match,
  11499. output
  11500. };
  11501. };
  11502. picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  11503. const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  11504. return regex.test(path.basename(input));
  11505. };
  11506. picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11507. picomatch.parse = (pattern, options) => {
  11508. if (Array.isArray(pattern))
  11509. return pattern.map((p) => picomatch.parse(p, options));
  11510. return parse(pattern, Object.assign(Object.assign({}, options), {}, {
  11511. fastpaths: false
  11512. }));
  11513. };
  11514. picomatch.scan = (input, options) => scan(input, options);
  11515. picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  11516. if (returnOutput === true) {
  11517. return state.output;
  11518. }
  11519. const opts = options || {};
  11520. const prepend = opts.contains ? "" : "^";
  11521. const append = opts.contains ? "" : "$";
  11522. let source = `${prepend}(?:${state.output})${append}`;
  11523. if (state && state.negated === true) {
  11524. source = `^(?!${source}).*$`;
  11525. }
  11526. const regex = picomatch.toRegex(source, options);
  11527. if (returnState === true) {
  11528. regex.state = state;
  11529. }
  11530. return regex;
  11531. };
  11532. picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  11533. if (!input || typeof input !== "string") {
  11534. throw new TypeError("Expected a non-empty string");
  11535. }
  11536. let parsed = {
  11537. negated: false,
  11538. fastpaths: true
  11539. };
  11540. if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
  11541. parsed.output = parse.fastpaths(input, options);
  11542. }
  11543. if (!parsed.output) {
  11544. parsed = parse(input, options);
  11545. }
  11546. return picomatch.compileRe(parsed, options, returnOutput, returnState);
  11547. };
  11548. picomatch.toRegex = (source, options) => {
  11549. try {
  11550. const opts = options || {};
  11551. return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
  11552. } catch (err) {
  11553. if (options && options.debug === true)
  11554. throw err;
  11555. return /$^/;
  11556. }
  11557. };
  11558. picomatch.constants = constants;
  11559. module2.exports = picomatch;
  11560. }
  11561. });
  11562. var require_picomatch2 = __commonJS2({
  11563. "node_modules/picomatch/index.js"(exports2, module2) {
  11564. "use strict";
  11565. module2.exports = require_picomatch();
  11566. }
  11567. });
  11568. var require_micromatch = __commonJS2({
  11569. "node_modules/micromatch/index.js"(exports2, module2) {
  11570. "use strict";
  11571. var util = require("util");
  11572. var braces = require_braces();
  11573. var picomatch = require_picomatch2();
  11574. var utils = require_utils3();
  11575. var isEmptyString = (val) => val === "" || val === "./";
  11576. var micromatch = (list, patterns, options) => {
  11577. patterns = [].concat(patterns);
  11578. list = [].concat(list);
  11579. let omit = /* @__PURE__ */ new Set();
  11580. let keep = /* @__PURE__ */ new Set();
  11581. let items = /* @__PURE__ */ new Set();
  11582. let negatives = 0;
  11583. let onResult = (state) => {
  11584. items.add(state.output);
  11585. if (options && options.onResult) {
  11586. options.onResult(state);
  11587. }
  11588. };
  11589. for (let i = 0; i < patterns.length; i++) {
  11590. let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
  11591. onResult
  11592. }), true);
  11593. let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
  11594. if (negated)
  11595. negatives++;
  11596. for (let item of list) {
  11597. let matched = isMatch(item, true);
  11598. let match = negated ? !matched.isMatch : matched.isMatch;
  11599. if (!match)
  11600. continue;
  11601. if (negated) {
  11602. omit.add(matched.output);
  11603. } else {
  11604. omit.delete(matched.output);
  11605. keep.add(matched.output);
  11606. }
  11607. }
  11608. }
  11609. let result = negatives === patterns.length ? [...items] : [...keep];
  11610. let matches = result.filter((item) => !omit.has(item));
  11611. if (options && matches.length === 0) {
  11612. if (options.failglob === true) {
  11613. throw new Error(`No matches found for "${patterns.join(", ")}"`);
  11614. }
  11615. if (options.nonull === true || options.nullglob === true) {
  11616. return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
  11617. }
  11618. }
  11619. return matches;
  11620. };
  11621. micromatch.match = micromatch;
  11622. micromatch.matcher = (pattern, options) => picomatch(pattern, options);
  11623. micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11624. micromatch.any = micromatch.isMatch;
  11625. micromatch.not = (list, patterns, options = {}) => {
  11626. patterns = [].concat(patterns).map(String);
  11627. let result = /* @__PURE__ */ new Set();
  11628. let items = [];
  11629. let onResult = (state) => {
  11630. if (options.onResult)
  11631. options.onResult(state);
  11632. items.push(state.output);
  11633. };
  11634. let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
  11635. onResult
  11636. })));
  11637. for (let item of items) {
  11638. if (!matches.has(item)) {
  11639. result.add(item);
  11640. }
  11641. }
  11642. return [...result];
  11643. };
  11644. micromatch.contains = (str, pattern, options) => {
  11645. if (typeof str !== "string") {
  11646. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11647. }
  11648. if (Array.isArray(pattern)) {
  11649. return pattern.some((p) => micromatch.contains(str, p, options));
  11650. }
  11651. if (typeof pattern === "string") {
  11652. if (isEmptyString(str) || isEmptyString(pattern)) {
  11653. return false;
  11654. }
  11655. if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
  11656. return true;
  11657. }
  11658. }
  11659. return micromatch.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
  11660. contains: true
  11661. }));
  11662. };
  11663. micromatch.matchKeys = (obj, patterns, options) => {
  11664. if (!utils.isObject(obj)) {
  11665. throw new TypeError("Expected the first argument to be an object");
  11666. }
  11667. let keys = micromatch(Object.keys(obj), patterns, options);
  11668. let res = {};
  11669. for (let key of keys)
  11670. res[key] = obj[key];
  11671. return res;
  11672. };
  11673. micromatch.some = (list, patterns, options) => {
  11674. let items = [].concat(list);
  11675. for (let pattern of [].concat(patterns)) {
  11676. let isMatch = picomatch(String(pattern), options);
  11677. if (items.some((item) => isMatch(item))) {
  11678. return true;
  11679. }
  11680. }
  11681. return false;
  11682. };
  11683. micromatch.every = (list, patterns, options) => {
  11684. let items = [].concat(list);
  11685. for (let pattern of [].concat(patterns)) {
  11686. let isMatch = picomatch(String(pattern), options);
  11687. if (!items.every((item) => isMatch(item))) {
  11688. return false;
  11689. }
  11690. }
  11691. return true;
  11692. };
  11693. micromatch.all = (str, patterns, options) => {
  11694. if (typeof str !== "string") {
  11695. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11696. }
  11697. return [].concat(patterns).every((p) => picomatch(p, options)(str));
  11698. };
  11699. micromatch.capture = (glob, input, options) => {
  11700. let posix = utils.isWindows(options);
  11701. let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
  11702. capture: true
  11703. }));
  11704. let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
  11705. if (match) {
  11706. return match.slice(1).map((v) => v === void 0 ? "" : v);
  11707. }
  11708. };
  11709. micromatch.makeRe = (...args) => picomatch.makeRe(...args);
  11710. micromatch.scan = (...args) => picomatch.scan(...args);
  11711. micromatch.parse = (patterns, options) => {
  11712. let res = [];
  11713. for (let pattern of [].concat(patterns || [])) {
  11714. for (let str of braces(String(pattern), options)) {
  11715. res.push(picomatch.parse(str, options));
  11716. }
  11717. }
  11718. return res;
  11719. };
  11720. micromatch.braces = (pattern, options) => {
  11721. if (typeof pattern !== "string")
  11722. throw new TypeError("Expected a string");
  11723. if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
  11724. return [pattern];
  11725. }
  11726. return braces(pattern, options);
  11727. };
  11728. micromatch.braceExpand = (pattern, options) => {
  11729. if (typeof pattern !== "string")
  11730. throw new TypeError("Expected a string");
  11731. return micromatch.braces(pattern, Object.assign(Object.assign({}, options), {}, {
  11732. expand: true
  11733. }));
  11734. };
  11735. module2.exports = micromatch;
  11736. }
  11737. });
  11738. var require_parser2 = __commonJS2({
  11739. "node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
  11740. "use strict";
  11741. var ParserEND = 1114112;
  11742. var ParserError = class extends Error {
  11743. constructor(msg, filename, linenumber) {
  11744. super("[ParserError] " + msg, filename, linenumber);
  11745. this.name = "ParserError";
  11746. this.code = "ParserError";
  11747. if (Error.captureStackTrace)
  11748. Error.captureStackTrace(this, ParserError);
  11749. }
  11750. };
  11751. var State = class {
  11752. constructor(parser) {
  11753. this.parser = parser;
  11754. this.buf = "";
  11755. this.returned = null;
  11756. this.result = null;
  11757. this.resultTable = null;
  11758. this.resultArr = null;
  11759. }
  11760. };
  11761. var Parser = class {
  11762. constructor() {
  11763. this.pos = 0;
  11764. this.col = 0;
  11765. this.line = 0;
  11766. this.obj = {};
  11767. this.ctx = this.obj;
  11768. this.stack = [];
  11769. this._buf = "";
  11770. this.char = null;
  11771. this.ii = 0;
  11772. this.state = new State(this.parseStart);
  11773. }
  11774. parse(str) {
  11775. if (str.length === 0 || str.length == null)
  11776. return;
  11777. this._buf = String(str);
  11778. this.ii = -1;
  11779. this.char = -1;
  11780. let getNext;
  11781. while (getNext === false || this.nextChar()) {
  11782. getNext = this.runOne();
  11783. }
  11784. this._buf = null;
  11785. }
  11786. nextChar() {
  11787. if (this.char === 10) {
  11788. ++this.line;
  11789. this.col = -1;
  11790. }
  11791. ++this.ii;
  11792. this.char = this._buf.codePointAt(this.ii);
  11793. ++this.pos;
  11794. ++this.col;
  11795. return this.haveBuffer();
  11796. }
  11797. haveBuffer() {
  11798. return this.ii < this._buf.length;
  11799. }
  11800. runOne() {
  11801. return this.state.parser.call(this, this.state.returned);
  11802. }
  11803. finish() {
  11804. this.char = ParserEND;
  11805. let last;
  11806. do {
  11807. last = this.state.parser;
  11808. this.runOne();
  11809. } while (this.state.parser !== last);
  11810. this.ctx = null;
  11811. this.state = null;
  11812. this._buf = null;
  11813. return this.obj;
  11814. }
  11815. next(fn) {
  11816. if (typeof fn !== "function")
  11817. throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
  11818. this.state.parser = fn;
  11819. }
  11820. goto(fn) {
  11821. this.next(fn);
  11822. return this.runOne();
  11823. }
  11824. call(fn, returnWith) {
  11825. if (returnWith)
  11826. this.next(returnWith);
  11827. this.stack.push(this.state);
  11828. this.state = new State(fn);
  11829. }
  11830. callNow(fn, returnWith) {
  11831. this.call(fn, returnWith);
  11832. return this.runOne();
  11833. }
  11834. return(value) {
  11835. if (this.stack.length === 0)
  11836. throw this.error(new ParserError("Stack underflow"));
  11837. if (value === void 0)
  11838. value = this.state.buf;
  11839. this.state = this.stack.pop();
  11840. this.state.returned = value;
  11841. }
  11842. returnNow(value) {
  11843. this.return(value);
  11844. return this.runOne();
  11845. }
  11846. consume() {
  11847. if (this.char === ParserEND)
  11848. throw this.error(new ParserError("Unexpected end-of-buffer"));
  11849. this.state.buf += this._buf[this.ii];
  11850. }
  11851. error(err) {
  11852. err.line = this.line;
  11853. err.col = this.col;
  11854. err.pos = this.pos;
  11855. return err;
  11856. }
  11857. parseStart() {
  11858. throw new ParserError("Must declare a parseStart method");
  11859. }
  11860. };
  11861. Parser.END = ParserEND;
  11862. Parser.Error = ParserError;
  11863. module2.exports = Parser;
  11864. }
  11865. });
  11866. var require_create_datetime = __commonJS2({
  11867. "node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
  11868. "use strict";
  11869. module2.exports = (value) => {
  11870. const date = new Date(value);
  11871. if (isNaN(date)) {
  11872. throw new TypeError("Invalid Datetime");
  11873. } else {
  11874. return date;
  11875. }
  11876. };
  11877. }
  11878. });
  11879. var require_format_num = __commonJS2({
  11880. "node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
  11881. "use strict";
  11882. module2.exports = (d, num) => {
  11883. num = String(num);
  11884. while (num.length < d)
  11885. num = "0" + num;
  11886. return num;
  11887. };
  11888. }
  11889. });
  11890. var require_create_datetime_float = __commonJS2({
  11891. "node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
  11892. "use strict";
  11893. var f = require_format_num();
  11894. var FloatingDateTime = class extends Date {
  11895. constructor(value) {
  11896. super(value + "Z");
  11897. this.isFloating = true;
  11898. }
  11899. toISOString() {
  11900. const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  11901. const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  11902. return `${date}T${time}`;
  11903. }
  11904. };
  11905. module2.exports = (value) => {
  11906. const date = new FloatingDateTime(value);
  11907. if (isNaN(date)) {
  11908. throw new TypeError("Invalid Datetime");
  11909. } else {
  11910. return date;
  11911. }
  11912. };
  11913. }
  11914. });
  11915. var require_create_date = __commonJS2({
  11916. "node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
  11917. "use strict";
  11918. var f = require_format_num();
  11919. var DateTime = global.Date;
  11920. var Date2 = class extends DateTime {
  11921. constructor(value) {
  11922. super(value);
  11923. this.isDate = true;
  11924. }
  11925. toISOString() {
  11926. return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  11927. }
  11928. };
  11929. module2.exports = (value) => {
  11930. const date = new Date2(value);
  11931. if (isNaN(date)) {
  11932. throw new TypeError("Invalid Datetime");
  11933. } else {
  11934. return date;
  11935. }
  11936. };
  11937. }
  11938. });
  11939. var require_create_time = __commonJS2({
  11940. "node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
  11941. "use strict";
  11942. var f = require_format_num();
  11943. var Time = class extends Date {
  11944. constructor(value) {
  11945. super(`0000-01-01T${value}Z`);
  11946. this.isTime = true;
  11947. }
  11948. toISOString() {
  11949. return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  11950. }
  11951. };
  11952. module2.exports = (value) => {
  11953. const date = new Time(value);
  11954. if (isNaN(date)) {
  11955. throw new TypeError("Invalid Datetime");
  11956. } else {
  11957. return date;
  11958. }
  11959. };
  11960. }
  11961. });
  11962. var require_toml_parser = __commonJS2({
  11963. "node_modules/@iarna/toml/lib/toml-parser.js"(exports2, module2) {
  11964. "use strict";
  11965. module2.exports = makeParserClass(require_parser2());
  11966. module2.exports.makeParserClass = makeParserClass;
  11967. var TomlError = class extends Error {
  11968. constructor(msg) {
  11969. super(msg);
  11970. this.name = "TomlError";
  11971. if (Error.captureStackTrace)
  11972. Error.captureStackTrace(this, TomlError);
  11973. this.fromTOML = true;
  11974. this.wrapped = null;
  11975. }
  11976. };
  11977. TomlError.wrap = (err) => {
  11978. const terr = new TomlError(err.message);
  11979. terr.code = err.code;
  11980. terr.wrapped = err;
  11981. return terr;
  11982. };
  11983. module2.exports.TomlError = TomlError;
  11984. var createDateTime = require_create_datetime();
  11985. var createDateTimeFloat = require_create_datetime_float();
  11986. var createDate = require_create_date();
  11987. var createTime = require_create_time();
  11988. var CTRL_I = 9;
  11989. var CTRL_J = 10;
  11990. var CTRL_M = 13;
  11991. var CTRL_CHAR_BOUNDARY = 31;
  11992. var CHAR_SP = 32;
  11993. var CHAR_QUOT = 34;
  11994. var CHAR_NUM = 35;
  11995. var CHAR_APOS = 39;
  11996. var CHAR_PLUS = 43;
  11997. var CHAR_COMMA = 44;
  11998. var CHAR_HYPHEN = 45;
  11999. var CHAR_PERIOD = 46;
  12000. var CHAR_0 = 48;
  12001. var CHAR_1 = 49;
  12002. var CHAR_7 = 55;
  12003. var CHAR_9 = 57;
  12004. var CHAR_COLON = 58;
  12005. var CHAR_EQUALS = 61;
  12006. var CHAR_A = 65;
  12007. var CHAR_E = 69;
  12008. var CHAR_F = 70;
  12009. var CHAR_T = 84;
  12010. var CHAR_U = 85;
  12011. var CHAR_Z = 90;
  12012. var CHAR_LOWBAR = 95;
  12013. var CHAR_a = 97;
  12014. var CHAR_b = 98;
  12015. var CHAR_e = 101;
  12016. var CHAR_f = 102;
  12017. var CHAR_i = 105;
  12018. var CHAR_l = 108;
  12019. var CHAR_n = 110;
  12020. var CHAR_o = 111;
  12021. var CHAR_r = 114;
  12022. var CHAR_s = 115;
  12023. var CHAR_t = 116;
  12024. var CHAR_u = 117;
  12025. var CHAR_x = 120;
  12026. var CHAR_z = 122;
  12027. var CHAR_LCUB = 123;
  12028. var CHAR_RCUB = 125;
  12029. var CHAR_LSQB = 91;
  12030. var CHAR_BSOL = 92;
  12031. var CHAR_RSQB = 93;
  12032. var CHAR_DEL = 127;
  12033. var SURROGATE_FIRST = 55296;
  12034. var SURROGATE_LAST = 57343;
  12035. var escapes = {
  12036. [CHAR_b]: "\b",
  12037. [CHAR_t]: " ",
  12038. [CHAR_n]: "\n",
  12039. [CHAR_f]: "\f",
  12040. [CHAR_r]: "\r",
  12041. [CHAR_QUOT]: '"',
  12042. [CHAR_BSOL]: "\\"
  12043. };
  12044. function isDigit(cp) {
  12045. return cp >= CHAR_0 && cp <= CHAR_9;
  12046. }
  12047. function isHexit(cp) {
  12048. return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
  12049. }
  12050. function isBit(cp) {
  12051. return cp === CHAR_1 || cp === CHAR_0;
  12052. }
  12053. function isOctit(cp) {
  12054. return cp >= CHAR_0 && cp <= CHAR_7;
  12055. }
  12056. function isAlphaNumQuoteHyphen(cp) {
  12057. return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
  12058. }
  12059. function isAlphaNumHyphen(cp) {
  12060. return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
  12061. }
  12062. var _type = Symbol("type");
  12063. var _declared = Symbol("declared");
  12064. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12065. var defineProperty = Object.defineProperty;
  12066. var descriptor = {
  12067. configurable: true,
  12068. enumerable: true,
  12069. writable: true,
  12070. value: void 0
  12071. };
  12072. function hasKey(obj, key) {
  12073. if (hasOwnProperty.call(obj, key))
  12074. return true;
  12075. if (key === "__proto__")
  12076. defineProperty(obj, "__proto__", descriptor);
  12077. return false;
  12078. }
  12079. var INLINE_TABLE = Symbol("inline-table");
  12080. function InlineTable() {
  12081. return Object.defineProperties({}, {
  12082. [_type]: {
  12083. value: INLINE_TABLE
  12084. }
  12085. });
  12086. }
  12087. function isInlineTable(obj) {
  12088. if (obj === null || typeof obj !== "object")
  12089. return false;
  12090. return obj[_type] === INLINE_TABLE;
  12091. }
  12092. var TABLE = Symbol("table");
  12093. function Table() {
  12094. return Object.defineProperties({}, {
  12095. [_type]: {
  12096. value: TABLE
  12097. },
  12098. [_declared]: {
  12099. value: false,
  12100. writable: true
  12101. }
  12102. });
  12103. }
  12104. function isTable(obj) {
  12105. if (obj === null || typeof obj !== "object")
  12106. return false;
  12107. return obj[_type] === TABLE;
  12108. }
  12109. var _contentType = Symbol("content-type");
  12110. var INLINE_LIST = Symbol("inline-list");
  12111. function InlineList(type) {
  12112. return Object.defineProperties([], {
  12113. [_type]: {
  12114. value: INLINE_LIST
  12115. },
  12116. [_contentType]: {
  12117. value: type
  12118. }
  12119. });
  12120. }
  12121. function isInlineList(obj) {
  12122. if (obj === null || typeof obj !== "object")
  12123. return false;
  12124. return obj[_type] === INLINE_LIST;
  12125. }
  12126. var LIST = Symbol("list");
  12127. function List() {
  12128. return Object.defineProperties([], {
  12129. [_type]: {
  12130. value: LIST
  12131. }
  12132. });
  12133. }
  12134. function isList(obj) {
  12135. if (obj === null || typeof obj !== "object")
  12136. return false;
  12137. return obj[_type] === LIST;
  12138. }
  12139. var _custom;
  12140. try {
  12141. const utilInspect = require("util").inspect;
  12142. _custom = utilInspect.custom;
  12143. } catch (_) {
  12144. }
  12145. var _inspect = _custom || "inspect";
  12146. var BoxedBigInt = class {
  12147. constructor(value) {
  12148. try {
  12149. this.value = global.BigInt.asIntN(64, value);
  12150. } catch (_) {
  12151. this.value = null;
  12152. }
  12153. Object.defineProperty(this, _type, {
  12154. value: INTEGER
  12155. });
  12156. }
  12157. isNaN() {
  12158. return this.value === null;
  12159. }
  12160. toString() {
  12161. return String(this.value);
  12162. }
  12163. [_inspect]() {
  12164. return `[BigInt: ${this.toString()}]}`;
  12165. }
  12166. valueOf() {
  12167. return this.value;
  12168. }
  12169. };
  12170. var INTEGER = Symbol("integer");
  12171. function Integer(value) {
  12172. let num = Number(value);
  12173. if (Object.is(num, -0))
  12174. num = 0;
  12175. if (global.BigInt && !Number.isSafeInteger(num)) {
  12176. return new BoxedBigInt(value);
  12177. } else {
  12178. return Object.defineProperties(new Number(num), {
  12179. isNaN: {
  12180. value: function() {
  12181. return isNaN(this);
  12182. }
  12183. },
  12184. [_type]: {
  12185. value: INTEGER
  12186. },
  12187. [_inspect]: {
  12188. value: () => `[Integer: ${value}]`
  12189. }
  12190. });
  12191. }
  12192. }
  12193. function isInteger(obj) {
  12194. if (obj === null || typeof obj !== "object")
  12195. return false;
  12196. return obj[_type] === INTEGER;
  12197. }
  12198. var FLOAT = Symbol("float");
  12199. function Float(value) {
  12200. return Object.defineProperties(new Number(value), {
  12201. [_type]: {
  12202. value: FLOAT
  12203. },
  12204. [_inspect]: {
  12205. value: () => `[Float: ${value}]`
  12206. }
  12207. });
  12208. }
  12209. function isFloat(obj) {
  12210. if (obj === null || typeof obj !== "object")
  12211. return false;
  12212. return obj[_type] === FLOAT;
  12213. }
  12214. function tomlType(value) {
  12215. const type = typeof value;
  12216. if (type === "object") {
  12217. if (value === null)
  12218. return "null";
  12219. if (value instanceof Date)
  12220. return "datetime";
  12221. if (_type in value) {
  12222. switch (value[_type]) {
  12223. case INLINE_TABLE:
  12224. return "inline-table";
  12225. case INLINE_LIST:
  12226. return "inline-list";
  12227. case TABLE:
  12228. return "table";
  12229. case LIST:
  12230. return "list";
  12231. case FLOAT:
  12232. return "float";
  12233. case INTEGER:
  12234. return "integer";
  12235. }
  12236. }
  12237. }
  12238. return type;
  12239. }
  12240. function makeParserClass(Parser) {
  12241. class TOMLParser extends Parser {
  12242. constructor() {
  12243. super();
  12244. this.ctx = this.obj = Table();
  12245. }
  12246. atEndOfWord() {
  12247. return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
  12248. }
  12249. atEndOfLine() {
  12250. return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
  12251. }
  12252. parseStart() {
  12253. if (this.char === Parser.END) {
  12254. return null;
  12255. } else if (this.char === CHAR_LSQB) {
  12256. return this.call(this.parseTableOrList);
  12257. } else if (this.char === CHAR_NUM) {
  12258. return this.call(this.parseComment);
  12259. } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12260. return null;
  12261. } else if (isAlphaNumQuoteHyphen(this.char)) {
  12262. return this.callNow(this.parseAssignStatement);
  12263. } else {
  12264. throw this.error(new TomlError(`Unknown character "${this.char}"`));
  12265. }
  12266. }
  12267. parseWhitespaceToEOL() {
  12268. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12269. return null;
  12270. } else if (this.char === CHAR_NUM) {
  12271. return this.goto(this.parseComment);
  12272. } else if (this.char === Parser.END || this.char === CTRL_J) {
  12273. return this.return();
  12274. } else {
  12275. throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
  12276. }
  12277. }
  12278. parseAssignStatement() {
  12279. return this.callNow(this.parseAssign, this.recordAssignStatement);
  12280. }
  12281. recordAssignStatement(kv) {
  12282. let target = this.ctx;
  12283. let finalKey = kv.key.pop();
  12284. for (let kw of kv.key) {
  12285. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  12286. throw this.error(new TomlError("Can't redefine existing key"));
  12287. }
  12288. target = target[kw] = target[kw] || Table();
  12289. }
  12290. if (hasKey(target, finalKey)) {
  12291. throw this.error(new TomlError("Can't redefine existing key"));
  12292. }
  12293. if (isInteger(kv.value) || isFloat(kv.value)) {
  12294. target[finalKey] = kv.value.valueOf();
  12295. } else {
  12296. target[finalKey] = kv.value;
  12297. }
  12298. return this.goto(this.parseWhitespaceToEOL);
  12299. }
  12300. parseAssign() {
  12301. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12302. }
  12303. recordAssignKeyword(key) {
  12304. if (this.state.resultTable) {
  12305. this.state.resultTable.push(key);
  12306. } else {
  12307. this.state.resultTable = [key];
  12308. }
  12309. return this.goto(this.parseAssignKeywordPreDot);
  12310. }
  12311. parseAssignKeywordPreDot() {
  12312. if (this.char === CHAR_PERIOD) {
  12313. return this.next(this.parseAssignKeywordPostDot);
  12314. } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12315. return this.goto(this.parseAssignEqual);
  12316. }
  12317. }
  12318. parseAssignKeywordPostDot() {
  12319. if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12320. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12321. }
  12322. }
  12323. parseAssignEqual() {
  12324. if (this.char === CHAR_EQUALS) {
  12325. return this.next(this.parseAssignPreValue);
  12326. } else {
  12327. throw this.error(new TomlError('Invalid character, expected "="'));
  12328. }
  12329. }
  12330. parseAssignPreValue() {
  12331. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12332. return null;
  12333. } else {
  12334. return this.callNow(this.parseValue, this.recordAssignValue);
  12335. }
  12336. }
  12337. recordAssignValue(value) {
  12338. return this.returnNow({
  12339. key: this.state.resultTable,
  12340. value
  12341. });
  12342. }
  12343. parseComment() {
  12344. do {
  12345. if (this.char === Parser.END || this.char === CTRL_J) {
  12346. return this.return();
  12347. }
  12348. } while (this.nextChar());
  12349. }
  12350. parseTableOrList() {
  12351. if (this.char === CHAR_LSQB) {
  12352. this.next(this.parseList);
  12353. } else {
  12354. return this.goto(this.parseTable);
  12355. }
  12356. }
  12357. parseTable() {
  12358. this.ctx = this.obj;
  12359. return this.goto(this.parseTableNext);
  12360. }
  12361. parseTableNext() {
  12362. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12363. return null;
  12364. } else {
  12365. return this.callNow(this.parseKeyword, this.parseTableMore);
  12366. }
  12367. }
  12368. parseTableMore(keyword) {
  12369. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12370. return null;
  12371. } else if (this.char === CHAR_RSQB) {
  12372. if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
  12373. throw this.error(new TomlError("Can't redefine existing key"));
  12374. } else {
  12375. this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
  12376. this.ctx[_declared] = true;
  12377. }
  12378. return this.next(this.parseWhitespaceToEOL);
  12379. } else if (this.char === CHAR_PERIOD) {
  12380. if (!hasKey(this.ctx, keyword)) {
  12381. this.ctx = this.ctx[keyword] = Table();
  12382. } else if (isTable(this.ctx[keyword])) {
  12383. this.ctx = this.ctx[keyword];
  12384. } else if (isList(this.ctx[keyword])) {
  12385. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12386. } else {
  12387. throw this.error(new TomlError("Can't redefine existing key"));
  12388. }
  12389. return this.next(this.parseTableNext);
  12390. } else {
  12391. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12392. }
  12393. }
  12394. parseList() {
  12395. this.ctx = this.obj;
  12396. return this.goto(this.parseListNext);
  12397. }
  12398. parseListNext() {
  12399. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12400. return null;
  12401. } else {
  12402. return this.callNow(this.parseKeyword, this.parseListMore);
  12403. }
  12404. }
  12405. parseListMore(keyword) {
  12406. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12407. return null;
  12408. } else if (this.char === CHAR_RSQB) {
  12409. if (!hasKey(this.ctx, keyword)) {
  12410. this.ctx[keyword] = List();
  12411. }
  12412. if (isInlineList(this.ctx[keyword])) {
  12413. throw this.error(new TomlError("Can't extend an inline array"));
  12414. } else if (isList(this.ctx[keyword])) {
  12415. const next = Table();
  12416. this.ctx[keyword].push(next);
  12417. this.ctx = next;
  12418. } else {
  12419. throw this.error(new TomlError("Can't redefine an existing key"));
  12420. }
  12421. return this.next(this.parseListEnd);
  12422. } else if (this.char === CHAR_PERIOD) {
  12423. if (!hasKey(this.ctx, keyword)) {
  12424. this.ctx = this.ctx[keyword] = Table();
  12425. } else if (isInlineList(this.ctx[keyword])) {
  12426. throw this.error(new TomlError("Can't extend an inline array"));
  12427. } else if (isInlineTable(this.ctx[keyword])) {
  12428. throw this.error(new TomlError("Can't extend an inline table"));
  12429. } else if (isList(this.ctx[keyword])) {
  12430. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12431. } else if (isTable(this.ctx[keyword])) {
  12432. this.ctx = this.ctx[keyword];
  12433. } else {
  12434. throw this.error(new TomlError("Can't redefine an existing key"));
  12435. }
  12436. return this.next(this.parseListNext);
  12437. } else {
  12438. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12439. }
  12440. }
  12441. parseListEnd(keyword) {
  12442. if (this.char === CHAR_RSQB) {
  12443. return this.next(this.parseWhitespaceToEOL);
  12444. } else {
  12445. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12446. }
  12447. }
  12448. parseValue() {
  12449. if (this.char === Parser.END) {
  12450. throw this.error(new TomlError("Key without value"));
  12451. } else if (this.char === CHAR_QUOT) {
  12452. return this.next(this.parseDoubleString);
  12453. }
  12454. if (this.char === CHAR_APOS) {
  12455. return this.next(this.parseSingleString);
  12456. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  12457. return this.goto(this.parseNumberSign);
  12458. } else if (this.char === CHAR_i) {
  12459. return this.next(this.parseInf);
  12460. } else if (this.char === CHAR_n) {
  12461. return this.next(this.parseNan);
  12462. } else if (isDigit(this.char)) {
  12463. return this.goto(this.parseNumberOrDateTime);
  12464. } else if (this.char === CHAR_t || this.char === CHAR_f) {
  12465. return this.goto(this.parseBoolean);
  12466. } else if (this.char === CHAR_LSQB) {
  12467. return this.call(this.parseInlineList, this.recordValue);
  12468. } else if (this.char === CHAR_LCUB) {
  12469. return this.call(this.parseInlineTable, this.recordValue);
  12470. } else {
  12471. throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
  12472. }
  12473. }
  12474. recordValue(value) {
  12475. return this.returnNow(value);
  12476. }
  12477. parseInf() {
  12478. if (this.char === CHAR_n) {
  12479. return this.next(this.parseInf2);
  12480. } else {
  12481. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12482. }
  12483. }
  12484. parseInf2() {
  12485. if (this.char === CHAR_f) {
  12486. if (this.state.buf === "-") {
  12487. return this.return(-Infinity);
  12488. } else {
  12489. return this.return(Infinity);
  12490. }
  12491. } else {
  12492. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12493. }
  12494. }
  12495. parseNan() {
  12496. if (this.char === CHAR_a) {
  12497. return this.next(this.parseNan2);
  12498. } else {
  12499. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12500. }
  12501. }
  12502. parseNan2() {
  12503. if (this.char === CHAR_n) {
  12504. return this.return(NaN);
  12505. } else {
  12506. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12507. }
  12508. }
  12509. parseKeyword() {
  12510. if (this.char === CHAR_QUOT) {
  12511. return this.next(this.parseBasicString);
  12512. } else if (this.char === CHAR_APOS) {
  12513. return this.next(this.parseLiteralString);
  12514. } else {
  12515. return this.goto(this.parseBareKey);
  12516. }
  12517. }
  12518. parseBareKey() {
  12519. do {
  12520. if (this.char === Parser.END) {
  12521. throw this.error(new TomlError("Key ended without value"));
  12522. } else if (isAlphaNumHyphen(this.char)) {
  12523. this.consume();
  12524. } else if (this.state.buf.length === 0) {
  12525. throw this.error(new TomlError("Empty bare keys are not allowed"));
  12526. } else {
  12527. return this.returnNow();
  12528. }
  12529. } while (this.nextChar());
  12530. }
  12531. parseSingleString() {
  12532. if (this.char === CHAR_APOS) {
  12533. return this.next(this.parseLiteralMultiStringMaybe);
  12534. } else {
  12535. return this.goto(this.parseLiteralString);
  12536. }
  12537. }
  12538. parseLiteralString() {
  12539. do {
  12540. if (this.char === CHAR_APOS) {
  12541. return this.return();
  12542. } else if (this.atEndOfLine()) {
  12543. throw this.error(new TomlError("Unterminated string"));
  12544. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12545. throw this.errorControlCharInString();
  12546. } else {
  12547. this.consume();
  12548. }
  12549. } while (this.nextChar());
  12550. }
  12551. parseLiteralMultiStringMaybe() {
  12552. if (this.char === CHAR_APOS) {
  12553. return this.next(this.parseLiteralMultiString);
  12554. } else {
  12555. return this.returnNow();
  12556. }
  12557. }
  12558. parseLiteralMultiString() {
  12559. if (this.char === CTRL_M) {
  12560. return null;
  12561. } else if (this.char === CTRL_J) {
  12562. return this.next(this.parseLiteralMultiStringContent);
  12563. } else {
  12564. return this.goto(this.parseLiteralMultiStringContent);
  12565. }
  12566. }
  12567. parseLiteralMultiStringContent() {
  12568. do {
  12569. if (this.char === CHAR_APOS) {
  12570. return this.next(this.parseLiteralMultiEnd);
  12571. } else if (this.char === Parser.END) {
  12572. throw this.error(new TomlError("Unterminated multi-line string"));
  12573. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12574. throw this.errorControlCharInString();
  12575. } else {
  12576. this.consume();
  12577. }
  12578. } while (this.nextChar());
  12579. }
  12580. parseLiteralMultiEnd() {
  12581. if (this.char === CHAR_APOS) {
  12582. return this.next(this.parseLiteralMultiEnd2);
  12583. } else {
  12584. this.state.buf += "'";
  12585. return this.goto(this.parseLiteralMultiStringContent);
  12586. }
  12587. }
  12588. parseLiteralMultiEnd2() {
  12589. if (this.char === CHAR_APOS) {
  12590. return this.return();
  12591. } else {
  12592. this.state.buf += "''";
  12593. return this.goto(this.parseLiteralMultiStringContent);
  12594. }
  12595. }
  12596. parseDoubleString() {
  12597. if (this.char === CHAR_QUOT) {
  12598. return this.next(this.parseMultiStringMaybe);
  12599. } else {
  12600. return this.goto(this.parseBasicString);
  12601. }
  12602. }
  12603. parseBasicString() {
  12604. do {
  12605. if (this.char === CHAR_BSOL) {
  12606. return this.call(this.parseEscape, this.recordEscapeReplacement);
  12607. } else if (this.char === CHAR_QUOT) {
  12608. return this.return();
  12609. } else if (this.atEndOfLine()) {
  12610. throw this.error(new TomlError("Unterminated string"));
  12611. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12612. throw this.errorControlCharInString();
  12613. } else {
  12614. this.consume();
  12615. }
  12616. } while (this.nextChar());
  12617. }
  12618. recordEscapeReplacement(replacement) {
  12619. this.state.buf += replacement;
  12620. return this.goto(this.parseBasicString);
  12621. }
  12622. parseMultiStringMaybe() {
  12623. if (this.char === CHAR_QUOT) {
  12624. return this.next(this.parseMultiString);
  12625. } else {
  12626. return this.returnNow();
  12627. }
  12628. }
  12629. parseMultiString() {
  12630. if (this.char === CTRL_M) {
  12631. return null;
  12632. } else if (this.char === CTRL_J) {
  12633. return this.next(this.parseMultiStringContent);
  12634. } else {
  12635. return this.goto(this.parseMultiStringContent);
  12636. }
  12637. }
  12638. parseMultiStringContent() {
  12639. do {
  12640. if (this.char === CHAR_BSOL) {
  12641. return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
  12642. } else if (this.char === CHAR_QUOT) {
  12643. return this.next(this.parseMultiEnd);
  12644. } else if (this.char === Parser.END) {
  12645. throw this.error(new TomlError("Unterminated multi-line string"));
  12646. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12647. throw this.errorControlCharInString();
  12648. } else {
  12649. this.consume();
  12650. }
  12651. } while (this.nextChar());
  12652. }
  12653. errorControlCharInString() {
  12654. let displayCode = "\\u00";
  12655. if (this.char < 16) {
  12656. displayCode += "0";
  12657. }
  12658. displayCode += this.char.toString(16);
  12659. return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
  12660. }
  12661. recordMultiEscapeReplacement(replacement) {
  12662. this.state.buf += replacement;
  12663. return this.goto(this.parseMultiStringContent);
  12664. }
  12665. parseMultiEnd() {
  12666. if (this.char === CHAR_QUOT) {
  12667. return this.next(this.parseMultiEnd2);
  12668. } else {
  12669. this.state.buf += '"';
  12670. return this.goto(this.parseMultiStringContent);
  12671. }
  12672. }
  12673. parseMultiEnd2() {
  12674. if (this.char === CHAR_QUOT) {
  12675. return this.return();
  12676. } else {
  12677. this.state.buf += '""';
  12678. return this.goto(this.parseMultiStringContent);
  12679. }
  12680. }
  12681. parseMultiEscape() {
  12682. if (this.char === CTRL_M || this.char === CTRL_J) {
  12683. return this.next(this.parseMultiTrim);
  12684. } else if (this.char === CHAR_SP || this.char === CTRL_I) {
  12685. return this.next(this.parsePreMultiTrim);
  12686. } else {
  12687. return this.goto(this.parseEscape);
  12688. }
  12689. }
  12690. parsePreMultiTrim() {
  12691. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12692. return null;
  12693. } else if (this.char === CTRL_M || this.char === CTRL_J) {
  12694. return this.next(this.parseMultiTrim);
  12695. } else {
  12696. throw this.error(new TomlError("Can't escape whitespace"));
  12697. }
  12698. }
  12699. parseMultiTrim() {
  12700. if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12701. return null;
  12702. } else {
  12703. return this.returnNow();
  12704. }
  12705. }
  12706. parseEscape() {
  12707. if (this.char in escapes) {
  12708. return this.return(escapes[this.char]);
  12709. } else if (this.char === CHAR_u) {
  12710. return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
  12711. } else if (this.char === CHAR_U) {
  12712. return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
  12713. } else {
  12714. throw this.error(new TomlError("Unknown escape character: " + this.char));
  12715. }
  12716. }
  12717. parseUnicodeReturn(char) {
  12718. try {
  12719. const codePoint = parseInt(char, 16);
  12720. if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
  12721. throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
  12722. }
  12723. return this.returnNow(String.fromCodePoint(codePoint));
  12724. } catch (err) {
  12725. throw this.error(TomlError.wrap(err));
  12726. }
  12727. }
  12728. parseSmallUnicode() {
  12729. if (!isHexit(this.char)) {
  12730. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12731. } else {
  12732. this.consume();
  12733. if (this.state.buf.length >= 4)
  12734. return this.return();
  12735. }
  12736. }
  12737. parseLargeUnicode() {
  12738. if (!isHexit(this.char)) {
  12739. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12740. } else {
  12741. this.consume();
  12742. if (this.state.buf.length >= 8)
  12743. return this.return();
  12744. }
  12745. }
  12746. parseNumberSign() {
  12747. this.consume();
  12748. return this.next(this.parseMaybeSignedInfOrNan);
  12749. }
  12750. parseMaybeSignedInfOrNan() {
  12751. if (this.char === CHAR_i) {
  12752. return this.next(this.parseInf);
  12753. } else if (this.char === CHAR_n) {
  12754. return this.next(this.parseNan);
  12755. } else {
  12756. return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
  12757. }
  12758. }
  12759. parseNumberIntegerStart() {
  12760. if (this.char === CHAR_0) {
  12761. this.consume();
  12762. return this.next(this.parseNumberIntegerExponentOrDecimal);
  12763. } else {
  12764. return this.goto(this.parseNumberInteger);
  12765. }
  12766. }
  12767. parseNumberIntegerExponentOrDecimal() {
  12768. if (this.char === CHAR_PERIOD) {
  12769. this.consume();
  12770. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12771. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12772. this.consume();
  12773. return this.next(this.parseNumberExponentSign);
  12774. } else {
  12775. return this.returnNow(Integer(this.state.buf));
  12776. }
  12777. }
  12778. parseNumberInteger() {
  12779. if (isDigit(this.char)) {
  12780. this.consume();
  12781. } else if (this.char === CHAR_LOWBAR) {
  12782. return this.call(this.parseNoUnder);
  12783. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12784. this.consume();
  12785. return this.next(this.parseNumberExponentSign);
  12786. } else if (this.char === CHAR_PERIOD) {
  12787. this.consume();
  12788. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12789. } else {
  12790. const result = Integer(this.state.buf);
  12791. if (result.isNaN()) {
  12792. throw this.error(new TomlError("Invalid number"));
  12793. } else {
  12794. return this.returnNow(result);
  12795. }
  12796. }
  12797. }
  12798. parseNoUnder() {
  12799. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
  12800. throw this.error(new TomlError("Unexpected character, expected digit"));
  12801. } else if (this.atEndOfWord()) {
  12802. throw this.error(new TomlError("Incomplete number"));
  12803. }
  12804. return this.returnNow();
  12805. }
  12806. parseNoUnderHexOctBinLiteral() {
  12807. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
  12808. throw this.error(new TomlError("Unexpected character, expected digit"));
  12809. } else if (this.atEndOfWord()) {
  12810. throw this.error(new TomlError("Incomplete number"));
  12811. }
  12812. return this.returnNow();
  12813. }
  12814. parseNumberFloat() {
  12815. if (this.char === CHAR_LOWBAR) {
  12816. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12817. } else if (isDigit(this.char)) {
  12818. this.consume();
  12819. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12820. this.consume();
  12821. return this.next(this.parseNumberExponentSign);
  12822. } else {
  12823. return this.returnNow(Float(this.state.buf));
  12824. }
  12825. }
  12826. parseNumberExponentSign() {
  12827. if (isDigit(this.char)) {
  12828. return this.goto(this.parseNumberExponent);
  12829. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  12830. this.consume();
  12831. this.call(this.parseNoUnder, this.parseNumberExponent);
  12832. } else {
  12833. throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
  12834. }
  12835. }
  12836. parseNumberExponent() {
  12837. if (isDigit(this.char)) {
  12838. this.consume();
  12839. } else if (this.char === CHAR_LOWBAR) {
  12840. return this.call(this.parseNoUnder);
  12841. } else {
  12842. return this.returnNow(Float(this.state.buf));
  12843. }
  12844. }
  12845. parseNumberOrDateTime() {
  12846. if (this.char === CHAR_0) {
  12847. this.consume();
  12848. return this.next(this.parseNumberBaseOrDateTime);
  12849. } else {
  12850. return this.goto(this.parseNumberOrDateTimeOnly);
  12851. }
  12852. }
  12853. parseNumberOrDateTimeOnly() {
  12854. if (this.char === CHAR_LOWBAR) {
  12855. return this.call(this.parseNoUnder, this.parseNumberInteger);
  12856. } else if (isDigit(this.char)) {
  12857. this.consume();
  12858. if (this.state.buf.length > 4)
  12859. this.next(this.parseNumberInteger);
  12860. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12861. this.consume();
  12862. return this.next(this.parseNumberExponentSign);
  12863. } else if (this.char === CHAR_PERIOD) {
  12864. this.consume();
  12865. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12866. } else if (this.char === CHAR_HYPHEN) {
  12867. return this.goto(this.parseDateTime);
  12868. } else if (this.char === CHAR_COLON) {
  12869. return this.goto(this.parseOnlyTimeHour);
  12870. } else {
  12871. return this.returnNow(Integer(this.state.buf));
  12872. }
  12873. }
  12874. parseDateTimeOnly() {
  12875. if (this.state.buf.length < 4) {
  12876. if (isDigit(this.char)) {
  12877. return this.consume();
  12878. } else if (this.char === CHAR_COLON) {
  12879. return this.goto(this.parseOnlyTimeHour);
  12880. } else {
  12881. throw this.error(new TomlError("Expected digit while parsing year part of a date"));
  12882. }
  12883. } else {
  12884. if (this.char === CHAR_HYPHEN) {
  12885. return this.goto(this.parseDateTime);
  12886. } else {
  12887. throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
  12888. }
  12889. }
  12890. }
  12891. parseNumberBaseOrDateTime() {
  12892. if (this.char === CHAR_b) {
  12893. this.consume();
  12894. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
  12895. } else if (this.char === CHAR_o) {
  12896. this.consume();
  12897. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
  12898. } else if (this.char === CHAR_x) {
  12899. this.consume();
  12900. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
  12901. } else if (this.char === CHAR_PERIOD) {
  12902. return this.goto(this.parseNumberInteger);
  12903. } else if (isDigit(this.char)) {
  12904. return this.goto(this.parseDateTimeOnly);
  12905. } else {
  12906. return this.returnNow(Integer(this.state.buf));
  12907. }
  12908. }
  12909. parseIntegerHex() {
  12910. if (isHexit(this.char)) {
  12911. this.consume();
  12912. } else if (this.char === CHAR_LOWBAR) {
  12913. return this.call(this.parseNoUnderHexOctBinLiteral);
  12914. } else {
  12915. const result = Integer(this.state.buf);
  12916. if (result.isNaN()) {
  12917. throw this.error(new TomlError("Invalid number"));
  12918. } else {
  12919. return this.returnNow(result);
  12920. }
  12921. }
  12922. }
  12923. parseIntegerOct() {
  12924. if (isOctit(this.char)) {
  12925. this.consume();
  12926. } else if (this.char === CHAR_LOWBAR) {
  12927. return this.call(this.parseNoUnderHexOctBinLiteral);
  12928. } else {
  12929. const result = Integer(this.state.buf);
  12930. if (result.isNaN()) {
  12931. throw this.error(new TomlError("Invalid number"));
  12932. } else {
  12933. return this.returnNow(result);
  12934. }
  12935. }
  12936. }
  12937. parseIntegerBin() {
  12938. if (isBit(this.char)) {
  12939. this.consume();
  12940. } else if (this.char === CHAR_LOWBAR) {
  12941. return this.call(this.parseNoUnderHexOctBinLiteral);
  12942. } else {
  12943. const result = Integer(this.state.buf);
  12944. if (result.isNaN()) {
  12945. throw this.error(new TomlError("Invalid number"));
  12946. } else {
  12947. return this.returnNow(result);
  12948. }
  12949. }
  12950. }
  12951. parseDateTime() {
  12952. if (this.state.buf.length < 4) {
  12953. throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
  12954. }
  12955. this.state.result = this.state.buf;
  12956. this.state.buf = "";
  12957. return this.next(this.parseDateMonth);
  12958. }
  12959. parseDateMonth() {
  12960. if (this.char === CHAR_HYPHEN) {
  12961. if (this.state.buf.length < 2) {
  12962. throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
  12963. }
  12964. this.state.result += "-" + this.state.buf;
  12965. this.state.buf = "";
  12966. return this.next(this.parseDateDay);
  12967. } else if (isDigit(this.char)) {
  12968. this.consume();
  12969. } else {
  12970. throw this.error(new TomlError("Incomplete datetime"));
  12971. }
  12972. }
  12973. parseDateDay() {
  12974. if (this.char === CHAR_T || this.char === CHAR_SP) {
  12975. if (this.state.buf.length < 2) {
  12976. throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
  12977. }
  12978. this.state.result += "-" + this.state.buf;
  12979. this.state.buf = "";
  12980. return this.next(this.parseStartTimeHour);
  12981. } else if (this.atEndOfWord()) {
  12982. return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
  12983. } else if (isDigit(this.char)) {
  12984. this.consume();
  12985. } else {
  12986. throw this.error(new TomlError("Incomplete datetime"));
  12987. }
  12988. }
  12989. parseStartTimeHour() {
  12990. if (this.atEndOfWord()) {
  12991. return this.returnNow(createDate(this.state.result));
  12992. } else {
  12993. return this.goto(this.parseTimeHour);
  12994. }
  12995. }
  12996. parseTimeHour() {
  12997. if (this.char === CHAR_COLON) {
  12998. if (this.state.buf.length < 2) {
  12999. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13000. }
  13001. this.state.result += "T" + this.state.buf;
  13002. this.state.buf = "";
  13003. return this.next(this.parseTimeMin);
  13004. } else if (isDigit(this.char)) {
  13005. this.consume();
  13006. } else {
  13007. throw this.error(new TomlError("Incomplete datetime"));
  13008. }
  13009. }
  13010. parseTimeMin() {
  13011. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13012. this.consume();
  13013. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13014. this.state.result += ":" + this.state.buf;
  13015. this.state.buf = "";
  13016. return this.next(this.parseTimeSec);
  13017. } else {
  13018. throw this.error(new TomlError("Incomplete datetime"));
  13019. }
  13020. }
  13021. parseTimeSec() {
  13022. if (isDigit(this.char)) {
  13023. this.consume();
  13024. if (this.state.buf.length === 2) {
  13025. this.state.result += ":" + this.state.buf;
  13026. this.state.buf = "";
  13027. return this.next(this.parseTimeZoneOrFraction);
  13028. }
  13029. } else {
  13030. throw this.error(new TomlError("Incomplete datetime"));
  13031. }
  13032. }
  13033. parseOnlyTimeHour() {
  13034. if (this.char === CHAR_COLON) {
  13035. if (this.state.buf.length < 2) {
  13036. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13037. }
  13038. this.state.result = this.state.buf;
  13039. this.state.buf = "";
  13040. return this.next(this.parseOnlyTimeMin);
  13041. } else {
  13042. throw this.error(new TomlError("Incomplete time"));
  13043. }
  13044. }
  13045. parseOnlyTimeMin() {
  13046. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13047. this.consume();
  13048. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13049. this.state.result += ":" + this.state.buf;
  13050. this.state.buf = "";
  13051. return this.next(this.parseOnlyTimeSec);
  13052. } else {
  13053. throw this.error(new TomlError("Incomplete time"));
  13054. }
  13055. }
  13056. parseOnlyTimeSec() {
  13057. if (isDigit(this.char)) {
  13058. this.consume();
  13059. if (this.state.buf.length === 2) {
  13060. return this.next(this.parseOnlyTimeFractionMaybe);
  13061. }
  13062. } else {
  13063. throw this.error(new TomlError("Incomplete time"));
  13064. }
  13065. }
  13066. parseOnlyTimeFractionMaybe() {
  13067. this.state.result += ":" + this.state.buf;
  13068. if (this.char === CHAR_PERIOD) {
  13069. this.state.buf = "";
  13070. this.next(this.parseOnlyTimeFraction);
  13071. } else {
  13072. return this.return(createTime(this.state.result));
  13073. }
  13074. }
  13075. parseOnlyTimeFraction() {
  13076. if (isDigit(this.char)) {
  13077. this.consume();
  13078. } else if (this.atEndOfWord()) {
  13079. if (this.state.buf.length === 0)
  13080. throw this.error(new TomlError("Expected digit in milliseconds"));
  13081. return this.returnNow(createTime(this.state.result + "." + this.state.buf));
  13082. } else {
  13083. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13084. }
  13085. }
  13086. parseTimeZoneOrFraction() {
  13087. if (this.char === CHAR_PERIOD) {
  13088. this.consume();
  13089. this.next(this.parseDateTimeFraction);
  13090. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13091. this.consume();
  13092. this.next(this.parseTimeZoneHour);
  13093. } else if (this.char === CHAR_Z) {
  13094. this.consume();
  13095. return this.return(createDateTime(this.state.result + this.state.buf));
  13096. } else if (this.atEndOfWord()) {
  13097. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13098. } else {
  13099. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13100. }
  13101. }
  13102. parseDateTimeFraction() {
  13103. if (isDigit(this.char)) {
  13104. this.consume();
  13105. } else if (this.state.buf.length === 1) {
  13106. throw this.error(new TomlError("Expected digit in milliseconds"));
  13107. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13108. this.consume();
  13109. this.next(this.parseTimeZoneHour);
  13110. } else if (this.char === CHAR_Z) {
  13111. this.consume();
  13112. return this.return(createDateTime(this.state.result + this.state.buf));
  13113. } else if (this.atEndOfWord()) {
  13114. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13115. } else {
  13116. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13117. }
  13118. }
  13119. parseTimeZoneHour() {
  13120. if (isDigit(this.char)) {
  13121. this.consume();
  13122. if (/\d\d$/.test(this.state.buf))
  13123. return this.next(this.parseTimeZoneSep);
  13124. } else {
  13125. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13126. }
  13127. }
  13128. parseTimeZoneSep() {
  13129. if (this.char === CHAR_COLON) {
  13130. this.consume();
  13131. this.next(this.parseTimeZoneMin);
  13132. } else {
  13133. throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
  13134. }
  13135. }
  13136. parseTimeZoneMin() {
  13137. if (isDigit(this.char)) {
  13138. this.consume();
  13139. if (/\d\d$/.test(this.state.buf))
  13140. return this.return(createDateTime(this.state.result + this.state.buf));
  13141. } else {
  13142. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13143. }
  13144. }
  13145. parseBoolean() {
  13146. if (this.char === CHAR_t) {
  13147. this.consume();
  13148. return this.next(this.parseTrue_r);
  13149. } else if (this.char === CHAR_f) {
  13150. this.consume();
  13151. return this.next(this.parseFalse_a);
  13152. }
  13153. }
  13154. parseTrue_r() {
  13155. if (this.char === CHAR_r) {
  13156. this.consume();
  13157. return this.next(this.parseTrue_u);
  13158. } else {
  13159. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13160. }
  13161. }
  13162. parseTrue_u() {
  13163. if (this.char === CHAR_u) {
  13164. this.consume();
  13165. return this.next(this.parseTrue_e);
  13166. } else {
  13167. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13168. }
  13169. }
  13170. parseTrue_e() {
  13171. if (this.char === CHAR_e) {
  13172. return this.return(true);
  13173. } else {
  13174. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13175. }
  13176. }
  13177. parseFalse_a() {
  13178. if (this.char === CHAR_a) {
  13179. this.consume();
  13180. return this.next(this.parseFalse_l);
  13181. } else {
  13182. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13183. }
  13184. }
  13185. parseFalse_l() {
  13186. if (this.char === CHAR_l) {
  13187. this.consume();
  13188. return this.next(this.parseFalse_s);
  13189. } else {
  13190. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13191. }
  13192. }
  13193. parseFalse_s() {
  13194. if (this.char === CHAR_s) {
  13195. this.consume();
  13196. return this.next(this.parseFalse_e);
  13197. } else {
  13198. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13199. }
  13200. }
  13201. parseFalse_e() {
  13202. if (this.char === CHAR_e) {
  13203. return this.return(false);
  13204. } else {
  13205. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13206. }
  13207. }
  13208. parseInlineList() {
  13209. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13210. return null;
  13211. } else if (this.char === Parser.END) {
  13212. throw this.error(new TomlError("Unterminated inline array"));
  13213. } else if (this.char === CHAR_NUM) {
  13214. return this.call(this.parseComment);
  13215. } else if (this.char === CHAR_RSQB) {
  13216. return this.return(this.state.resultArr || InlineList());
  13217. } else {
  13218. return this.callNow(this.parseValue, this.recordInlineListValue);
  13219. }
  13220. }
  13221. recordInlineListValue(value) {
  13222. if (this.state.resultArr) {
  13223. const listType = this.state.resultArr[_contentType];
  13224. const valueType = tomlType(value);
  13225. if (listType !== valueType) {
  13226. throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
  13227. }
  13228. } else {
  13229. this.state.resultArr = InlineList(tomlType(value));
  13230. }
  13231. if (isFloat(value) || isInteger(value)) {
  13232. this.state.resultArr.push(value.valueOf());
  13233. } else {
  13234. this.state.resultArr.push(value);
  13235. }
  13236. return this.goto(this.parseInlineListNext);
  13237. }
  13238. parseInlineListNext() {
  13239. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13240. return null;
  13241. } else if (this.char === CHAR_NUM) {
  13242. return this.call(this.parseComment);
  13243. } else if (this.char === CHAR_COMMA) {
  13244. return this.next(this.parseInlineList);
  13245. } else if (this.char === CHAR_RSQB) {
  13246. return this.goto(this.parseInlineList);
  13247. } else {
  13248. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13249. }
  13250. }
  13251. parseInlineTable() {
  13252. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13253. return null;
  13254. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13255. throw this.error(new TomlError("Unterminated inline array"));
  13256. } else if (this.char === CHAR_RCUB) {
  13257. return this.return(this.state.resultTable || InlineTable());
  13258. } else {
  13259. if (!this.state.resultTable)
  13260. this.state.resultTable = InlineTable();
  13261. return this.callNow(this.parseAssign, this.recordInlineTableValue);
  13262. }
  13263. }
  13264. recordInlineTableValue(kv) {
  13265. let target = this.state.resultTable;
  13266. let finalKey = kv.key.pop();
  13267. for (let kw of kv.key) {
  13268. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  13269. throw this.error(new TomlError("Can't redefine existing key"));
  13270. }
  13271. target = target[kw] = target[kw] || Table();
  13272. }
  13273. if (hasKey(target, finalKey)) {
  13274. throw this.error(new TomlError("Can't redefine existing key"));
  13275. }
  13276. if (isInteger(kv.value) || isFloat(kv.value)) {
  13277. target[finalKey] = kv.value.valueOf();
  13278. } else {
  13279. target[finalKey] = kv.value;
  13280. }
  13281. return this.goto(this.parseInlineTableNext);
  13282. }
  13283. parseInlineTableNext() {
  13284. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13285. return null;
  13286. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13287. throw this.error(new TomlError("Unterminated inline array"));
  13288. } else if (this.char === CHAR_COMMA) {
  13289. return this.next(this.parseInlineTable);
  13290. } else if (this.char === CHAR_RCUB) {
  13291. return this.goto(this.parseInlineTable);
  13292. } else {
  13293. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13294. }
  13295. }
  13296. }
  13297. return TOMLParser;
  13298. }
  13299. }
  13300. });
  13301. var require_parse_pretty_error = __commonJS2({
  13302. "node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
  13303. "use strict";
  13304. module2.exports = prettyError;
  13305. function prettyError(err, buf) {
  13306. if (err.pos == null || err.line == null)
  13307. return err;
  13308. let msg = err.message;
  13309. msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
  13310. `;
  13311. if (buf && buf.split) {
  13312. const lines = buf.split(/\n/);
  13313. const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
  13314. let linePadding = " ";
  13315. while (linePadding.length < lineNumWidth)
  13316. linePadding += " ";
  13317. for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
  13318. let lineNum = String(ii + 1);
  13319. if (lineNum.length < lineNumWidth)
  13320. lineNum = " " + lineNum;
  13321. if (err.line === ii) {
  13322. msg += lineNum + "> " + lines[ii] + "\n";
  13323. msg += linePadding + " ";
  13324. for (let hh = 0; hh < err.col; ++hh) {
  13325. msg += " ";
  13326. }
  13327. msg += "^\n";
  13328. } else {
  13329. msg += lineNum + ": " + lines[ii] + "\n";
  13330. }
  13331. }
  13332. }
  13333. err.message = msg + "\n";
  13334. return err;
  13335. }
  13336. }
  13337. });
  13338. var require_parse_string = __commonJS2({
  13339. "node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
  13340. "use strict";
  13341. module2.exports = parseString;
  13342. var TOMLParser = require_toml_parser();
  13343. var prettyError = require_parse_pretty_error();
  13344. function parseString(str) {
  13345. if (global.Buffer && global.Buffer.isBuffer(str)) {
  13346. str = str.toString("utf8");
  13347. }
  13348. const parser = new TOMLParser();
  13349. try {
  13350. parser.parse(str);
  13351. return parser.finish();
  13352. } catch (err) {
  13353. throw prettyError(err, str);
  13354. }
  13355. }
  13356. }
  13357. });
  13358. var require_load_toml = __commonJS2({
  13359. "src/utils/load-toml.js"(exports2, module2) {
  13360. "use strict";
  13361. var parse = require_parse_string();
  13362. module2.exports = function(filePath, content) {
  13363. try {
  13364. return parse(content);
  13365. } catch (error) {
  13366. error.message = `TOML Error in ${filePath}:
  13367. ${error.message}`;
  13368. throw error;
  13369. }
  13370. };
  13371. }
  13372. });
  13373. var require_unicode = __commonJS2({
  13374. "node_modules/json5/lib/unicode.js"(exports2, module2) {
  13375. module2.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  13376. module2.exports.ID_Start = /[\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\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\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\u0D05-\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\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-\u1884\u1887-\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\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\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\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\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[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\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\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\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\uDD00-\uDD43]|\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\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  13377. module2.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\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\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\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\u09FC\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-\u0AFF\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\u0C80-\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\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\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\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-\u19D9\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\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\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\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\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\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\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\uDE3E\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[\uDC00-\uDC4A\uDC50-\uDC59\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\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\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\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\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]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\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\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  13378. }
  13379. });
  13380. var require_util2 = __commonJS2({
  13381. "node_modules/json5/lib/util.js"(exports2, module2) {
  13382. var unicode = require_unicode();
  13383. module2.exports = {
  13384. isSpaceSeparator(c) {
  13385. return typeof c === "string" && unicode.Space_Separator.test(c);
  13386. },
  13387. isIdStartChar(c) {
  13388. return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
  13389. },
  13390. isIdContinueChar(c) {
  13391. return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c));
  13392. },
  13393. isDigit(c) {
  13394. return typeof c === "string" && /[0-9]/.test(c);
  13395. },
  13396. isHexDigit(c) {
  13397. return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
  13398. }
  13399. };
  13400. }
  13401. });
  13402. var require_parse3 = __commonJS2({
  13403. "node_modules/json5/lib/parse.js"(exports2, module2) {
  13404. var util = require_util2();
  13405. var source;
  13406. var parseState;
  13407. var stack;
  13408. var pos;
  13409. var line;
  13410. var column;
  13411. var token;
  13412. var key;
  13413. var root;
  13414. module2.exports = function parse(text, reviver) {
  13415. source = String(text);
  13416. parseState = "start";
  13417. stack = [];
  13418. pos = 0;
  13419. line = 1;
  13420. column = 0;
  13421. token = void 0;
  13422. key = void 0;
  13423. root = void 0;
  13424. do {
  13425. token = lex();
  13426. parseStates[parseState]();
  13427. } while (token.type !== "eof");
  13428. if (typeof reviver === "function") {
  13429. return internalize({
  13430. "": root
  13431. }, "", reviver);
  13432. }
  13433. return root;
  13434. };
  13435. function internalize(holder, name, reviver) {
  13436. const value = holder[name];
  13437. if (value != null && typeof value === "object") {
  13438. for (const key2 in value) {
  13439. const replacement = internalize(value, key2, reviver);
  13440. if (replacement === void 0) {
  13441. delete value[key2];
  13442. } else {
  13443. value[key2] = replacement;
  13444. }
  13445. }
  13446. }
  13447. return reviver.call(holder, name, value);
  13448. }
  13449. var lexState;
  13450. var buffer;
  13451. var doubleQuote;
  13452. var sign;
  13453. var c;
  13454. function lex() {
  13455. lexState = "default";
  13456. buffer = "";
  13457. doubleQuote = false;
  13458. sign = 1;
  13459. for (; ; ) {
  13460. c = peek();
  13461. const token2 = lexStates[lexState]();
  13462. if (token2) {
  13463. return token2;
  13464. }
  13465. }
  13466. }
  13467. function peek() {
  13468. if (source[pos]) {
  13469. return String.fromCodePoint(source.codePointAt(pos));
  13470. }
  13471. }
  13472. function read() {
  13473. const c2 = peek();
  13474. if (c2 === "\n") {
  13475. line++;
  13476. column = 0;
  13477. } else if (c2) {
  13478. column += c2.length;
  13479. } else {
  13480. column++;
  13481. }
  13482. if (c2) {
  13483. pos += c2.length;
  13484. }
  13485. return c2;
  13486. }
  13487. var lexStates = {
  13488. default() {
  13489. switch (c) {
  13490. case " ":
  13491. case "\v":
  13492. case "\f":
  13493. case " ":
  13494. case "\xA0":
  13495. case "\uFEFF":
  13496. case "\n":
  13497. case "\r":
  13498. case "\u2028":
  13499. case "\u2029":
  13500. read();
  13501. return;
  13502. case "/":
  13503. read();
  13504. lexState = "comment";
  13505. return;
  13506. case void 0:
  13507. read();
  13508. return newToken("eof");
  13509. }
  13510. if (util.isSpaceSeparator(c)) {
  13511. read();
  13512. return;
  13513. }
  13514. return lexStates[parseState]();
  13515. },
  13516. comment() {
  13517. switch (c) {
  13518. case "*":
  13519. read();
  13520. lexState = "multiLineComment";
  13521. return;
  13522. case "/":
  13523. read();
  13524. lexState = "singleLineComment";
  13525. return;
  13526. }
  13527. throw invalidChar(read());
  13528. },
  13529. multiLineComment() {
  13530. switch (c) {
  13531. case "*":
  13532. read();
  13533. lexState = "multiLineCommentAsterisk";
  13534. return;
  13535. case void 0:
  13536. throw invalidChar(read());
  13537. }
  13538. read();
  13539. },
  13540. multiLineCommentAsterisk() {
  13541. switch (c) {
  13542. case "*":
  13543. read();
  13544. return;
  13545. case "/":
  13546. read();
  13547. lexState = "default";
  13548. return;
  13549. case void 0:
  13550. throw invalidChar(read());
  13551. }
  13552. read();
  13553. lexState = "multiLineComment";
  13554. },
  13555. singleLineComment() {
  13556. switch (c) {
  13557. case "\n":
  13558. case "\r":
  13559. case "\u2028":
  13560. case "\u2029":
  13561. read();
  13562. lexState = "default";
  13563. return;
  13564. case void 0:
  13565. read();
  13566. return newToken("eof");
  13567. }
  13568. read();
  13569. },
  13570. value() {
  13571. switch (c) {
  13572. case "{":
  13573. case "[":
  13574. return newToken("punctuator", read());
  13575. case "n":
  13576. read();
  13577. literal("ull");
  13578. return newToken("null", null);
  13579. case "t":
  13580. read();
  13581. literal("rue");
  13582. return newToken("boolean", true);
  13583. case "f":
  13584. read();
  13585. literal("alse");
  13586. return newToken("boolean", false);
  13587. case "-":
  13588. case "+":
  13589. if (read() === "-") {
  13590. sign = -1;
  13591. }
  13592. lexState = "sign";
  13593. return;
  13594. case ".":
  13595. buffer = read();
  13596. lexState = "decimalPointLeading";
  13597. return;
  13598. case "0":
  13599. buffer = read();
  13600. lexState = "zero";
  13601. return;
  13602. case "1":
  13603. case "2":
  13604. case "3":
  13605. case "4":
  13606. case "5":
  13607. case "6":
  13608. case "7":
  13609. case "8":
  13610. case "9":
  13611. buffer = read();
  13612. lexState = "decimalInteger";
  13613. return;
  13614. case "I":
  13615. read();
  13616. literal("nfinity");
  13617. return newToken("numeric", Infinity);
  13618. case "N":
  13619. read();
  13620. literal("aN");
  13621. return newToken("numeric", NaN);
  13622. case '"':
  13623. case "'":
  13624. doubleQuote = read() === '"';
  13625. buffer = "";
  13626. lexState = "string";
  13627. return;
  13628. }
  13629. throw invalidChar(read());
  13630. },
  13631. identifierNameStartEscape() {
  13632. if (c !== "u") {
  13633. throw invalidChar(read());
  13634. }
  13635. read();
  13636. const u = unicodeEscape();
  13637. switch (u) {
  13638. case "$":
  13639. case "_":
  13640. break;
  13641. default:
  13642. if (!util.isIdStartChar(u)) {
  13643. throw invalidIdentifier();
  13644. }
  13645. break;
  13646. }
  13647. buffer += u;
  13648. lexState = "identifierName";
  13649. },
  13650. identifierName() {
  13651. switch (c) {
  13652. case "$":
  13653. case "_":
  13654. case "\u200C":
  13655. case "\u200D":
  13656. buffer += read();
  13657. return;
  13658. case "\\":
  13659. read();
  13660. lexState = "identifierNameEscape";
  13661. return;
  13662. }
  13663. if (util.isIdContinueChar(c)) {
  13664. buffer += read();
  13665. return;
  13666. }
  13667. return newToken("identifier", buffer);
  13668. },
  13669. identifierNameEscape() {
  13670. if (c !== "u") {
  13671. throw invalidChar(read());
  13672. }
  13673. read();
  13674. const u = unicodeEscape();
  13675. switch (u) {
  13676. case "$":
  13677. case "_":
  13678. case "\u200C":
  13679. case "\u200D":
  13680. break;
  13681. default:
  13682. if (!util.isIdContinueChar(u)) {
  13683. throw invalidIdentifier();
  13684. }
  13685. break;
  13686. }
  13687. buffer += u;
  13688. lexState = "identifierName";
  13689. },
  13690. sign() {
  13691. switch (c) {
  13692. case ".":
  13693. buffer = read();
  13694. lexState = "decimalPointLeading";
  13695. return;
  13696. case "0":
  13697. buffer = read();
  13698. lexState = "zero";
  13699. return;
  13700. case "1":
  13701. case "2":
  13702. case "3":
  13703. case "4":
  13704. case "5":
  13705. case "6":
  13706. case "7":
  13707. case "8":
  13708. case "9":
  13709. buffer = read();
  13710. lexState = "decimalInteger";
  13711. return;
  13712. case "I":
  13713. read();
  13714. literal("nfinity");
  13715. return newToken("numeric", sign * Infinity);
  13716. case "N":
  13717. read();
  13718. literal("aN");
  13719. return newToken("numeric", NaN);
  13720. }
  13721. throw invalidChar(read());
  13722. },
  13723. zero() {
  13724. switch (c) {
  13725. case ".":
  13726. buffer += read();
  13727. lexState = "decimalPoint";
  13728. return;
  13729. case "e":
  13730. case "E":
  13731. buffer += read();
  13732. lexState = "decimalExponent";
  13733. return;
  13734. case "x":
  13735. case "X":
  13736. buffer += read();
  13737. lexState = "hexadecimal";
  13738. return;
  13739. }
  13740. return newToken("numeric", sign * 0);
  13741. },
  13742. decimalInteger() {
  13743. switch (c) {
  13744. case ".":
  13745. buffer += read();
  13746. lexState = "decimalPoint";
  13747. return;
  13748. case "e":
  13749. case "E":
  13750. buffer += read();
  13751. lexState = "decimalExponent";
  13752. return;
  13753. }
  13754. if (util.isDigit(c)) {
  13755. buffer += read();
  13756. return;
  13757. }
  13758. return newToken("numeric", sign * Number(buffer));
  13759. },
  13760. decimalPointLeading() {
  13761. if (util.isDigit(c)) {
  13762. buffer += read();
  13763. lexState = "decimalFraction";
  13764. return;
  13765. }
  13766. throw invalidChar(read());
  13767. },
  13768. decimalPoint() {
  13769. switch (c) {
  13770. case "e":
  13771. case "E":
  13772. buffer += read();
  13773. lexState = "decimalExponent";
  13774. return;
  13775. }
  13776. if (util.isDigit(c)) {
  13777. buffer += read();
  13778. lexState = "decimalFraction";
  13779. return;
  13780. }
  13781. return newToken("numeric", sign * Number(buffer));
  13782. },
  13783. decimalFraction() {
  13784. switch (c) {
  13785. case "e":
  13786. case "E":
  13787. buffer += read();
  13788. lexState = "decimalExponent";
  13789. return;
  13790. }
  13791. if (util.isDigit(c)) {
  13792. buffer += read();
  13793. return;
  13794. }
  13795. return newToken("numeric", sign * Number(buffer));
  13796. },
  13797. decimalExponent() {
  13798. switch (c) {
  13799. case "+":
  13800. case "-":
  13801. buffer += read();
  13802. lexState = "decimalExponentSign";
  13803. return;
  13804. }
  13805. if (util.isDigit(c)) {
  13806. buffer += read();
  13807. lexState = "decimalExponentInteger";
  13808. return;
  13809. }
  13810. throw invalidChar(read());
  13811. },
  13812. decimalExponentSign() {
  13813. if (util.isDigit(c)) {
  13814. buffer += read();
  13815. lexState = "decimalExponentInteger";
  13816. return;
  13817. }
  13818. throw invalidChar(read());
  13819. },
  13820. decimalExponentInteger() {
  13821. if (util.isDigit(c)) {
  13822. buffer += read();
  13823. return;
  13824. }
  13825. return newToken("numeric", sign * Number(buffer));
  13826. },
  13827. hexadecimal() {
  13828. if (util.isHexDigit(c)) {
  13829. buffer += read();
  13830. lexState = "hexadecimalInteger";
  13831. return;
  13832. }
  13833. throw invalidChar(read());
  13834. },
  13835. hexadecimalInteger() {
  13836. if (util.isHexDigit(c)) {
  13837. buffer += read();
  13838. return;
  13839. }
  13840. return newToken("numeric", sign * Number(buffer));
  13841. },
  13842. string() {
  13843. switch (c) {
  13844. case "\\":
  13845. read();
  13846. buffer += escape();
  13847. return;
  13848. case '"':
  13849. if (doubleQuote) {
  13850. read();
  13851. return newToken("string", buffer);
  13852. }
  13853. buffer += read();
  13854. return;
  13855. case "'":
  13856. if (!doubleQuote) {
  13857. read();
  13858. return newToken("string", buffer);
  13859. }
  13860. buffer += read();
  13861. return;
  13862. case "\n":
  13863. case "\r":
  13864. throw invalidChar(read());
  13865. case "\u2028":
  13866. case "\u2029":
  13867. separatorChar(c);
  13868. break;
  13869. case void 0:
  13870. throw invalidChar(read());
  13871. }
  13872. buffer += read();
  13873. },
  13874. start() {
  13875. switch (c) {
  13876. case "{":
  13877. case "[":
  13878. return newToken("punctuator", read());
  13879. }
  13880. lexState = "value";
  13881. },
  13882. beforePropertyName() {
  13883. switch (c) {
  13884. case "$":
  13885. case "_":
  13886. buffer = read();
  13887. lexState = "identifierName";
  13888. return;
  13889. case "\\":
  13890. read();
  13891. lexState = "identifierNameStartEscape";
  13892. return;
  13893. case "}":
  13894. return newToken("punctuator", read());
  13895. case '"':
  13896. case "'":
  13897. doubleQuote = read() === '"';
  13898. lexState = "string";
  13899. return;
  13900. }
  13901. if (util.isIdStartChar(c)) {
  13902. buffer += read();
  13903. lexState = "identifierName";
  13904. return;
  13905. }
  13906. throw invalidChar(read());
  13907. },
  13908. afterPropertyName() {
  13909. if (c === ":") {
  13910. return newToken("punctuator", read());
  13911. }
  13912. throw invalidChar(read());
  13913. },
  13914. beforePropertyValue() {
  13915. lexState = "value";
  13916. },
  13917. afterPropertyValue() {
  13918. switch (c) {
  13919. case ",":
  13920. case "}":
  13921. return newToken("punctuator", read());
  13922. }
  13923. throw invalidChar(read());
  13924. },
  13925. beforeArrayValue() {
  13926. if (c === "]") {
  13927. return newToken("punctuator", read());
  13928. }
  13929. lexState = "value";
  13930. },
  13931. afterArrayValue() {
  13932. switch (c) {
  13933. case ",":
  13934. case "]":
  13935. return newToken("punctuator", read());
  13936. }
  13937. throw invalidChar(read());
  13938. },
  13939. end() {
  13940. throw invalidChar(read());
  13941. }
  13942. };
  13943. function newToken(type, value) {
  13944. return {
  13945. type,
  13946. value,
  13947. line,
  13948. column
  13949. };
  13950. }
  13951. function literal(s) {
  13952. for (const c2 of s) {
  13953. const p = peek();
  13954. if (p !== c2) {
  13955. throw invalidChar(read());
  13956. }
  13957. read();
  13958. }
  13959. }
  13960. function escape() {
  13961. const c2 = peek();
  13962. switch (c2) {
  13963. case "b":
  13964. read();
  13965. return "\b";
  13966. case "f":
  13967. read();
  13968. return "\f";
  13969. case "n":
  13970. read();
  13971. return "\n";
  13972. case "r":
  13973. read();
  13974. return "\r";
  13975. case "t":
  13976. read();
  13977. return " ";
  13978. case "v":
  13979. read();
  13980. return "\v";
  13981. case "0":
  13982. read();
  13983. if (util.isDigit(peek())) {
  13984. throw invalidChar(read());
  13985. }
  13986. return "\0";
  13987. case "x":
  13988. read();
  13989. return hexEscape();
  13990. case "u":
  13991. read();
  13992. return unicodeEscape();
  13993. case "\n":
  13994. case "\u2028":
  13995. case "\u2029":
  13996. read();
  13997. return "";
  13998. case "\r":
  13999. read();
  14000. if (peek() === "\n") {
  14001. read();
  14002. }
  14003. return "";
  14004. case "1":
  14005. case "2":
  14006. case "3":
  14007. case "4":
  14008. case "5":
  14009. case "6":
  14010. case "7":
  14011. case "8":
  14012. case "9":
  14013. throw invalidChar(read());
  14014. case void 0:
  14015. throw invalidChar(read());
  14016. }
  14017. return read();
  14018. }
  14019. function hexEscape() {
  14020. let buffer2 = "";
  14021. let c2 = peek();
  14022. if (!util.isHexDigit(c2)) {
  14023. throw invalidChar(read());
  14024. }
  14025. buffer2 += read();
  14026. c2 = peek();
  14027. if (!util.isHexDigit(c2)) {
  14028. throw invalidChar(read());
  14029. }
  14030. buffer2 += read();
  14031. return String.fromCodePoint(parseInt(buffer2, 16));
  14032. }
  14033. function unicodeEscape() {
  14034. let buffer2 = "";
  14035. let count = 4;
  14036. while (count-- > 0) {
  14037. const c2 = peek();
  14038. if (!util.isHexDigit(c2)) {
  14039. throw invalidChar(read());
  14040. }
  14041. buffer2 += read();
  14042. }
  14043. return String.fromCodePoint(parseInt(buffer2, 16));
  14044. }
  14045. var parseStates = {
  14046. start() {
  14047. if (token.type === "eof") {
  14048. throw invalidEOF();
  14049. }
  14050. push();
  14051. },
  14052. beforePropertyName() {
  14053. switch (token.type) {
  14054. case "identifier":
  14055. case "string":
  14056. key = token.value;
  14057. parseState = "afterPropertyName";
  14058. return;
  14059. case "punctuator":
  14060. pop();
  14061. return;
  14062. case "eof":
  14063. throw invalidEOF();
  14064. }
  14065. },
  14066. afterPropertyName() {
  14067. if (token.type === "eof") {
  14068. throw invalidEOF();
  14069. }
  14070. parseState = "beforePropertyValue";
  14071. },
  14072. beforePropertyValue() {
  14073. if (token.type === "eof") {
  14074. throw invalidEOF();
  14075. }
  14076. push();
  14077. },
  14078. beforeArrayValue() {
  14079. if (token.type === "eof") {
  14080. throw invalidEOF();
  14081. }
  14082. if (token.type === "punctuator" && token.value === "]") {
  14083. pop();
  14084. return;
  14085. }
  14086. push();
  14087. },
  14088. afterPropertyValue() {
  14089. if (token.type === "eof") {
  14090. throw invalidEOF();
  14091. }
  14092. switch (token.value) {
  14093. case ",":
  14094. parseState = "beforePropertyName";
  14095. return;
  14096. case "}":
  14097. pop();
  14098. }
  14099. },
  14100. afterArrayValue() {
  14101. if (token.type === "eof") {
  14102. throw invalidEOF();
  14103. }
  14104. switch (token.value) {
  14105. case ",":
  14106. parseState = "beforeArrayValue";
  14107. return;
  14108. case "]":
  14109. pop();
  14110. }
  14111. },
  14112. end() {
  14113. }
  14114. };
  14115. function push() {
  14116. let value;
  14117. switch (token.type) {
  14118. case "punctuator":
  14119. switch (token.value) {
  14120. case "{":
  14121. value = {};
  14122. break;
  14123. case "[":
  14124. value = [];
  14125. break;
  14126. }
  14127. break;
  14128. case "null":
  14129. case "boolean":
  14130. case "numeric":
  14131. case "string":
  14132. value = token.value;
  14133. break;
  14134. }
  14135. if (root === void 0) {
  14136. root = value;
  14137. } else {
  14138. const parent = stack[stack.length - 1];
  14139. if (Array.isArray(parent)) {
  14140. parent.push(value);
  14141. } else {
  14142. parent[key] = value;
  14143. }
  14144. }
  14145. if (value !== null && typeof value === "object") {
  14146. stack.push(value);
  14147. if (Array.isArray(value)) {
  14148. parseState = "beforeArrayValue";
  14149. } else {
  14150. parseState = "beforePropertyName";
  14151. }
  14152. } else {
  14153. const current = stack[stack.length - 1];
  14154. if (current == null) {
  14155. parseState = "end";
  14156. } else if (Array.isArray(current)) {
  14157. parseState = "afterArrayValue";
  14158. } else {
  14159. parseState = "afterPropertyValue";
  14160. }
  14161. }
  14162. }
  14163. function pop() {
  14164. stack.pop();
  14165. const current = stack[stack.length - 1];
  14166. if (current == null) {
  14167. parseState = "end";
  14168. } else if (Array.isArray(current)) {
  14169. parseState = "afterArrayValue";
  14170. } else {
  14171. parseState = "afterPropertyValue";
  14172. }
  14173. }
  14174. function invalidChar(c2) {
  14175. if (c2 === void 0) {
  14176. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14177. }
  14178. return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
  14179. }
  14180. function invalidEOF() {
  14181. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14182. }
  14183. function invalidIdentifier() {
  14184. column -= 5;
  14185. return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
  14186. }
  14187. function separatorChar(c2) {
  14188. console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
  14189. }
  14190. function formatChar(c2) {
  14191. const replacements = {
  14192. "'": "\\'",
  14193. '"': '\\"',
  14194. "\\": "\\\\",
  14195. "\b": "\\b",
  14196. "\f": "\\f",
  14197. "\n": "\\n",
  14198. "\r": "\\r",
  14199. " ": "\\t",
  14200. "\v": "\\v",
  14201. "\0": "\\0",
  14202. "\u2028": "\\u2028",
  14203. "\u2029": "\\u2029"
  14204. };
  14205. if (replacements[c2]) {
  14206. return replacements[c2];
  14207. }
  14208. if (c2 < " ") {
  14209. const hexString = c2.charCodeAt(0).toString(16);
  14210. return "\\x" + ("00" + hexString).substring(hexString.length);
  14211. }
  14212. return c2;
  14213. }
  14214. function syntaxError(message) {
  14215. const err = new SyntaxError(message);
  14216. err.lineNumber = line;
  14217. err.columnNumber = column;
  14218. return err;
  14219. }
  14220. }
  14221. });
  14222. var require_stringify2 = __commonJS2({
  14223. "node_modules/json5/lib/stringify.js"(exports2, module2) {
  14224. var util = require_util2();
  14225. module2.exports = function stringify(value, replacer, space) {
  14226. const stack = [];
  14227. let indent = "";
  14228. let propertyList;
  14229. let replacerFunc;
  14230. let gap = "";
  14231. let quote;
  14232. if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
  14233. space = replacer.space;
  14234. quote = replacer.quote;
  14235. replacer = replacer.replacer;
  14236. }
  14237. if (typeof replacer === "function") {
  14238. replacerFunc = replacer;
  14239. } else if (Array.isArray(replacer)) {
  14240. propertyList = [];
  14241. for (const v of replacer) {
  14242. let item;
  14243. if (typeof v === "string") {
  14244. item = v;
  14245. } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
  14246. item = String(v);
  14247. }
  14248. if (item !== void 0 && propertyList.indexOf(item) < 0) {
  14249. propertyList.push(item);
  14250. }
  14251. }
  14252. }
  14253. if (space instanceof Number) {
  14254. space = Number(space);
  14255. } else if (space instanceof String) {
  14256. space = String(space);
  14257. }
  14258. if (typeof space === "number") {
  14259. if (space > 0) {
  14260. space = Math.min(10, Math.floor(space));
  14261. gap = " ".substr(0, space);
  14262. }
  14263. } else if (typeof space === "string") {
  14264. gap = space.substr(0, 10);
  14265. }
  14266. return serializeProperty("", {
  14267. "": value
  14268. });
  14269. function serializeProperty(key, holder) {
  14270. let value2 = holder[key];
  14271. if (value2 != null) {
  14272. if (typeof value2.toJSON5 === "function") {
  14273. value2 = value2.toJSON5(key);
  14274. } else if (typeof value2.toJSON === "function") {
  14275. value2 = value2.toJSON(key);
  14276. }
  14277. }
  14278. if (replacerFunc) {
  14279. value2 = replacerFunc.call(holder, key, value2);
  14280. }
  14281. if (value2 instanceof Number) {
  14282. value2 = Number(value2);
  14283. } else if (value2 instanceof String) {
  14284. value2 = String(value2);
  14285. } else if (value2 instanceof Boolean) {
  14286. value2 = value2.valueOf();
  14287. }
  14288. switch (value2) {
  14289. case null:
  14290. return "null";
  14291. case true:
  14292. return "true";
  14293. case false:
  14294. return "false";
  14295. }
  14296. if (typeof value2 === "string") {
  14297. return quoteString(value2, false);
  14298. }
  14299. if (typeof value2 === "number") {
  14300. return String(value2);
  14301. }
  14302. if (typeof value2 === "object") {
  14303. return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
  14304. }
  14305. return void 0;
  14306. }
  14307. function quoteString(value2) {
  14308. const quotes = {
  14309. "'": 0.1,
  14310. '"': 0.2
  14311. };
  14312. const replacements = {
  14313. "'": "\\'",
  14314. '"': '\\"',
  14315. "\\": "\\\\",
  14316. "\b": "\\b",
  14317. "\f": "\\f",
  14318. "\n": "\\n",
  14319. "\r": "\\r",
  14320. " ": "\\t",
  14321. "\v": "\\v",
  14322. "\0": "\\0",
  14323. "\u2028": "\\u2028",
  14324. "\u2029": "\\u2029"
  14325. };
  14326. let product = "";
  14327. for (let i = 0; i < value2.length; i++) {
  14328. const c = value2[i];
  14329. switch (c) {
  14330. case "'":
  14331. case '"':
  14332. quotes[c]++;
  14333. product += c;
  14334. continue;
  14335. case "\0":
  14336. if (util.isDigit(value2[i + 1])) {
  14337. product += "\\x00";
  14338. continue;
  14339. }
  14340. }
  14341. if (replacements[c]) {
  14342. product += replacements[c];
  14343. continue;
  14344. }
  14345. if (c < " ") {
  14346. let hexString = c.charCodeAt(0).toString(16);
  14347. product += "\\x" + ("00" + hexString).substring(hexString.length);
  14348. continue;
  14349. }
  14350. product += c;
  14351. }
  14352. const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
  14353. product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
  14354. return quoteChar + product + quoteChar;
  14355. }
  14356. function serializeObject(value2) {
  14357. if (stack.indexOf(value2) >= 0) {
  14358. throw TypeError("Converting circular structure to JSON5");
  14359. }
  14360. stack.push(value2);
  14361. let stepback = indent;
  14362. indent = indent + gap;
  14363. let keys = propertyList || Object.keys(value2);
  14364. let partial = [];
  14365. for (const key of keys) {
  14366. const propertyString = serializeProperty(key, value2);
  14367. if (propertyString !== void 0) {
  14368. let member = serializeKey(key) + ":";
  14369. if (gap !== "") {
  14370. member += " ";
  14371. }
  14372. member += propertyString;
  14373. partial.push(member);
  14374. }
  14375. }
  14376. let final;
  14377. if (partial.length === 0) {
  14378. final = "{}";
  14379. } else {
  14380. let properties;
  14381. if (gap === "") {
  14382. properties = partial.join(",");
  14383. final = "{" + properties + "}";
  14384. } else {
  14385. let separator = ",\n" + indent;
  14386. properties = partial.join(separator);
  14387. final = "{\n" + indent + properties + ",\n" + stepback + "}";
  14388. }
  14389. }
  14390. stack.pop();
  14391. indent = stepback;
  14392. return final;
  14393. }
  14394. function serializeKey(key) {
  14395. if (key.length === 0) {
  14396. return quoteString(key, true);
  14397. }
  14398. const firstChar = String.fromCodePoint(key.codePointAt(0));
  14399. if (!util.isIdStartChar(firstChar)) {
  14400. return quoteString(key, true);
  14401. }
  14402. for (let i = firstChar.length; i < key.length; i++) {
  14403. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  14404. return quoteString(key, true);
  14405. }
  14406. }
  14407. return key;
  14408. }
  14409. function serializeArray(value2) {
  14410. if (stack.indexOf(value2) >= 0) {
  14411. throw TypeError("Converting circular structure to JSON5");
  14412. }
  14413. stack.push(value2);
  14414. let stepback = indent;
  14415. indent = indent + gap;
  14416. let partial = [];
  14417. for (let i = 0; i < value2.length; i++) {
  14418. const propertyString = serializeProperty(String(i), value2);
  14419. partial.push(propertyString !== void 0 ? propertyString : "null");
  14420. }
  14421. let final;
  14422. if (partial.length === 0) {
  14423. final = "[]";
  14424. } else {
  14425. if (gap === "") {
  14426. let properties = partial.join(",");
  14427. final = "[" + properties + "]";
  14428. } else {
  14429. let separator = ",\n" + indent;
  14430. let properties = partial.join(separator);
  14431. final = "[\n" + indent + properties + ",\n" + stepback + "]";
  14432. }
  14433. }
  14434. stack.pop();
  14435. indent = stepback;
  14436. return final;
  14437. }
  14438. };
  14439. }
  14440. });
  14441. var require_lib6 = __commonJS2({
  14442. "node_modules/json5/lib/index.js"(exports2, module2) {
  14443. var parse = require_parse3();
  14444. var stringify = require_stringify2();
  14445. var JSON5 = {
  14446. parse,
  14447. stringify
  14448. };
  14449. module2.exports = JSON5;
  14450. }
  14451. });
  14452. var require_load_json5 = __commonJS2({
  14453. "src/utils/load-json5.js"(exports2, module2) {
  14454. "use strict";
  14455. var {
  14456. parse
  14457. } = require_lib6();
  14458. module2.exports = function(filePath, content) {
  14459. try {
  14460. return parse(content);
  14461. } catch (error) {
  14462. error.message = `JSON5 Error in ${filePath}:
  14463. ${error.message}`;
  14464. throw error;
  14465. }
  14466. };
  14467. }
  14468. });
  14469. var require_partition = __commonJS2({
  14470. "src/utils/partition.js"(exports2, module2) {
  14471. "use strict";
  14472. function partition(array, predicate) {
  14473. const result = [[], []];
  14474. for (const value of array) {
  14475. result[predicate(value) ? 0 : 1].push(value);
  14476. }
  14477. return result;
  14478. }
  14479. module2.exports = partition;
  14480. }
  14481. });
  14482. var require_homedir = __commonJS2({
  14483. "node_modules/resolve/lib/homedir.js"(exports2, module2) {
  14484. "use strict";
  14485. var os = require("os");
  14486. module2.exports = os.homedir || function homedir() {
  14487. var home = process.env.HOME;
  14488. var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
  14489. if (process.platform === "win32") {
  14490. return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
  14491. }
  14492. if (process.platform === "darwin") {
  14493. return home || (user ? "/Users/" + user : null);
  14494. }
  14495. if (process.platform === "linux") {
  14496. return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
  14497. }
  14498. return home || null;
  14499. };
  14500. }
  14501. });
  14502. var require_caller = __commonJS2({
  14503. "node_modules/resolve/lib/caller.js"(exports2, module2) {
  14504. module2.exports = function() {
  14505. var origPrepareStackTrace = Error.prepareStackTrace;
  14506. Error.prepareStackTrace = function(_, stack2) {
  14507. return stack2;
  14508. };
  14509. var stack = new Error().stack;
  14510. Error.prepareStackTrace = origPrepareStackTrace;
  14511. return stack[2].getFileName();
  14512. };
  14513. }
  14514. });
  14515. var require_path_parse = __commonJS2({
  14516. "node_modules/path-parse/index.js"(exports2, module2) {
  14517. "use strict";
  14518. var isWindows = process.platform === "win32";
  14519. var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
  14520. var win32 = {};
  14521. function win32SplitPath(filename) {
  14522. return splitWindowsRe.exec(filename).slice(1);
  14523. }
  14524. win32.parse = function(pathString) {
  14525. if (typeof pathString !== "string") {
  14526. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14527. }
  14528. var allParts = win32SplitPath(pathString);
  14529. if (!allParts || allParts.length !== 5) {
  14530. throw new TypeError("Invalid path '" + pathString + "'");
  14531. }
  14532. return {
  14533. root: allParts[1],
  14534. dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
  14535. base: allParts[2],
  14536. ext: allParts[4],
  14537. name: allParts[3]
  14538. };
  14539. };
  14540. var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
  14541. var posix = {};
  14542. function posixSplitPath(filename) {
  14543. return splitPathRe.exec(filename).slice(1);
  14544. }
  14545. posix.parse = function(pathString) {
  14546. if (typeof pathString !== "string") {
  14547. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14548. }
  14549. var allParts = posixSplitPath(pathString);
  14550. if (!allParts || allParts.length !== 5) {
  14551. throw new TypeError("Invalid path '" + pathString + "'");
  14552. }
  14553. return {
  14554. root: allParts[1],
  14555. dir: allParts[0].slice(0, -1),
  14556. base: allParts[2],
  14557. ext: allParts[4],
  14558. name: allParts[3]
  14559. };
  14560. };
  14561. if (isWindows)
  14562. module2.exports = win32.parse;
  14563. else
  14564. module2.exports = posix.parse;
  14565. module2.exports.posix = posix.parse;
  14566. module2.exports.win32 = win32.parse;
  14567. }
  14568. });
  14569. var require_node_modules_paths = __commonJS2({
  14570. "node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
  14571. var path = require("path");
  14572. var parse = path.parse || require_path_parse();
  14573. var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
  14574. var prefix = "/";
  14575. if (/^([A-Za-z]:)/.test(absoluteStart)) {
  14576. prefix = "";
  14577. } else if (/^\\\\/.test(absoluteStart)) {
  14578. prefix = "\\\\";
  14579. }
  14580. var paths = [absoluteStart];
  14581. var parsed = parse(absoluteStart);
  14582. while (parsed.dir !== paths[paths.length - 1]) {
  14583. paths.push(parsed.dir);
  14584. parsed = parse(parsed.dir);
  14585. }
  14586. return paths.reduce(function(dirs, aPath) {
  14587. return dirs.concat(modules.map(function(moduleDir) {
  14588. return path.resolve(prefix, aPath, moduleDir);
  14589. }));
  14590. }, []);
  14591. };
  14592. module2.exports = function nodeModulesPaths(start, opts, request) {
  14593. var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
  14594. if (opts && typeof opts.paths === "function") {
  14595. return opts.paths(request, start, function() {
  14596. return getNodeModulesDirs(start, modules);
  14597. }, opts);
  14598. }
  14599. var dirs = getNodeModulesDirs(start, modules);
  14600. return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
  14601. };
  14602. }
  14603. });
  14604. var require_normalize_options = __commonJS2({
  14605. "node_modules/resolve/lib/normalize-options.js"(exports2, module2) {
  14606. module2.exports = function(x, opts) {
  14607. return opts || {};
  14608. };
  14609. }
  14610. });
  14611. var require_implementation = __commonJS2({
  14612. "node_modules/function-bind/implementation.js"(exports2, module2) {
  14613. "use strict";
  14614. var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
  14615. var slice = Array.prototype.slice;
  14616. var toStr = Object.prototype.toString;
  14617. var funcType = "[object Function]";
  14618. module2.exports = function bind(that) {
  14619. var target = this;
  14620. if (typeof target !== "function" || toStr.call(target) !== funcType) {
  14621. throw new TypeError(ERROR_MESSAGE + target);
  14622. }
  14623. var args = slice.call(arguments, 1);
  14624. var bound;
  14625. var binder = function() {
  14626. if (this instanceof bound) {
  14627. var result = target.apply(this, args.concat(slice.call(arguments)));
  14628. if (Object(result) === result) {
  14629. return result;
  14630. }
  14631. return this;
  14632. } else {
  14633. return target.apply(that, args.concat(slice.call(arguments)));
  14634. }
  14635. };
  14636. var boundLength = Math.max(0, target.length - args.length);
  14637. var boundArgs = [];
  14638. for (var i = 0; i < boundLength; i++) {
  14639. boundArgs.push("$" + i);
  14640. }
  14641. bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
  14642. if (target.prototype) {
  14643. var Empty = function Empty2() {
  14644. };
  14645. Empty.prototype = target.prototype;
  14646. bound.prototype = new Empty();
  14647. Empty.prototype = null;
  14648. }
  14649. return bound;
  14650. };
  14651. }
  14652. });
  14653. var require_function_bind = __commonJS2({
  14654. "node_modules/function-bind/index.js"(exports2, module2) {
  14655. "use strict";
  14656. var implementation = require_implementation();
  14657. module2.exports = Function.prototype.bind || implementation;
  14658. }
  14659. });
  14660. var require_src = __commonJS2({
  14661. "node_modules/has/src/index.js"(exports2, module2) {
  14662. "use strict";
  14663. var bind = require_function_bind();
  14664. module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  14665. }
  14666. });
  14667. var require_core2 = __commonJS2({
  14668. "node_modules/is-core-module/core.json"(exports2, module2) {
  14669. module2.exports = {
  14670. assert: true,
  14671. "node:assert": [">= 14.18 && < 15", ">= 16"],
  14672. "assert/strict": ">= 15",
  14673. "node:assert/strict": ">= 16",
  14674. async_hooks: ">= 8",
  14675. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  14676. buffer_ieee754: ">= 0.5 && < 0.9.7",
  14677. buffer: true,
  14678. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  14679. child_process: true,
  14680. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  14681. cluster: ">= 0.5",
  14682. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  14683. console: true,
  14684. "node:console": [">= 14.18 && < 15", ">= 16"],
  14685. constants: true,
  14686. "node:constants": [">= 14.18 && < 15", ">= 16"],
  14687. crypto: true,
  14688. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  14689. _debug_agent: ">= 1 && < 8",
  14690. _debugger: "< 8",
  14691. dgram: true,
  14692. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  14693. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  14694. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  14695. dns: true,
  14696. "node:dns": [">= 14.18 && < 15", ">= 16"],
  14697. "dns/promises": ">= 15",
  14698. "node:dns/promises": ">= 16",
  14699. domain: ">= 0.7.12",
  14700. "node:domain": [">= 14.18 && < 15", ">= 16"],
  14701. events: true,
  14702. "node:events": [">= 14.18 && < 15", ">= 16"],
  14703. freelist: "< 6",
  14704. fs: true,
  14705. "node:fs": [">= 14.18 && < 15", ">= 16"],
  14706. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  14707. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  14708. _http_agent: ">= 0.11.1",
  14709. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  14710. _http_client: ">= 0.11.1",
  14711. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  14712. _http_common: ">= 0.11.1",
  14713. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  14714. _http_incoming: ">= 0.11.1",
  14715. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  14716. _http_outgoing: ">= 0.11.1",
  14717. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  14718. _http_server: ">= 0.11.1",
  14719. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  14720. http: true,
  14721. "node:http": [">= 14.18 && < 15", ">= 16"],
  14722. http2: ">= 8.8",
  14723. "node:http2": [">= 14.18 && < 15", ">= 16"],
  14724. https: true,
  14725. "node:https": [">= 14.18 && < 15", ">= 16"],
  14726. inspector: ">= 8",
  14727. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  14728. _linklist: "< 8",
  14729. module: true,
  14730. "node:module": [">= 14.18 && < 15", ">= 16"],
  14731. net: true,
  14732. "node:net": [">= 14.18 && < 15", ">= 16"],
  14733. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  14734. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  14735. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  14736. os: true,
  14737. "node:os": [">= 14.18 && < 15", ">= 16"],
  14738. path: true,
  14739. "node:path": [">= 14.18 && < 15", ">= 16"],
  14740. "path/posix": ">= 15.3",
  14741. "node:path/posix": ">= 16",
  14742. "path/win32": ">= 15.3",
  14743. "node:path/win32": ">= 16",
  14744. perf_hooks: ">= 8.5",
  14745. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  14746. process: ">= 1",
  14747. "node:process": [">= 14.18 && < 15", ">= 16"],
  14748. punycode: ">= 0.5",
  14749. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  14750. querystring: true,
  14751. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  14752. readline: true,
  14753. "node:readline": [">= 14.18 && < 15", ">= 16"],
  14754. "readline/promises": ">= 17",
  14755. "node:readline/promises": ">= 17",
  14756. repl: true,
  14757. "node:repl": [">= 14.18 && < 15", ">= 16"],
  14758. smalloc: ">= 0.11.5 && < 3",
  14759. _stream_duplex: ">= 0.9.4",
  14760. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  14761. _stream_transform: ">= 0.9.4",
  14762. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  14763. _stream_wrap: ">= 1.4.1",
  14764. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  14765. _stream_passthrough: ">= 0.9.4",
  14766. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  14767. _stream_readable: ">= 0.9.4",
  14768. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  14769. _stream_writable: ">= 0.9.4",
  14770. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  14771. stream: true,
  14772. "node:stream": [">= 14.18 && < 15", ">= 16"],
  14773. "stream/consumers": ">= 16.7",
  14774. "node:stream/consumers": ">= 16.7",
  14775. "stream/promises": ">= 15",
  14776. "node:stream/promises": ">= 16",
  14777. "stream/web": ">= 16.5",
  14778. "node:stream/web": ">= 16.5",
  14779. string_decoder: true,
  14780. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  14781. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  14782. "node:sys": [">= 14.18 && < 15", ">= 16"],
  14783. timers: true,
  14784. "node:timers": [">= 14.18 && < 15", ">= 16"],
  14785. "timers/promises": ">= 15",
  14786. "node:timers/promises": ">= 16",
  14787. _tls_common: ">= 0.11.13",
  14788. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  14789. _tls_legacy: ">= 0.11.3 && < 10",
  14790. _tls_wrap: ">= 0.11.3",
  14791. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  14792. tls: true,
  14793. "node:tls": [">= 14.18 && < 15", ">= 16"],
  14794. trace_events: ">= 10",
  14795. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  14796. tty: true,
  14797. "node:tty": [">= 14.18 && < 15", ">= 16"],
  14798. url: true,
  14799. "node:url": [">= 14.18 && < 15", ">= 16"],
  14800. util: true,
  14801. "node:util": [">= 14.18 && < 15", ">= 16"],
  14802. "util/types": ">= 15.3",
  14803. "node:util/types": ">= 16",
  14804. "v8/tools/arguments": ">= 10 && < 12",
  14805. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14806. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14807. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14808. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14809. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14810. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14811. v8: ">= 1",
  14812. "node:v8": [">= 14.18 && < 15", ">= 16"],
  14813. vm: true,
  14814. "node:vm": [">= 14.18 && < 15", ">= 16"],
  14815. wasi: ">= 13.4 && < 13.5",
  14816. worker_threads: ">= 11.7",
  14817. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  14818. zlib: ">= 0.5",
  14819. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  14820. };
  14821. }
  14822. });
  14823. var require_is_core_module = __commonJS2({
  14824. "node_modules/is-core-module/index.js"(exports2, module2) {
  14825. "use strict";
  14826. var has = require_src();
  14827. function specifierIncluded(current, specifier) {
  14828. var nodeParts = current.split(".");
  14829. var parts = specifier.split(" ");
  14830. var op = parts.length > 1 ? parts[0] : "=";
  14831. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  14832. for (var i = 0; i < 3; ++i) {
  14833. var cur = parseInt(nodeParts[i] || 0, 10);
  14834. var ver = parseInt(versionParts[i] || 0, 10);
  14835. if (cur === ver) {
  14836. continue;
  14837. }
  14838. if (op === "<") {
  14839. return cur < ver;
  14840. }
  14841. if (op === ">=") {
  14842. return cur >= ver;
  14843. }
  14844. return false;
  14845. }
  14846. return op === ">=";
  14847. }
  14848. function matchesRange(current, range) {
  14849. var specifiers = range.split(/ ?&& ?/);
  14850. if (specifiers.length === 0) {
  14851. return false;
  14852. }
  14853. for (var i = 0; i < specifiers.length; ++i) {
  14854. if (!specifierIncluded(current, specifiers[i])) {
  14855. return false;
  14856. }
  14857. }
  14858. return true;
  14859. }
  14860. function versionIncluded(nodeVersion, specifierValue) {
  14861. if (typeof specifierValue === "boolean") {
  14862. return specifierValue;
  14863. }
  14864. var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
  14865. if (typeof current !== "string") {
  14866. throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
  14867. }
  14868. if (specifierValue && typeof specifierValue === "object") {
  14869. for (var i = 0; i < specifierValue.length; ++i) {
  14870. if (matchesRange(current, specifierValue[i])) {
  14871. return true;
  14872. }
  14873. }
  14874. return false;
  14875. }
  14876. return matchesRange(current, specifierValue);
  14877. }
  14878. var data = require_core2();
  14879. module2.exports = function isCore(x, nodeVersion) {
  14880. return has(data, x) && versionIncluded(nodeVersion, data[x]);
  14881. };
  14882. }
  14883. });
  14884. var require_async = __commonJS2({
  14885. "node_modules/resolve/lib/async.js"(exports2, module2) {
  14886. var fs = require("fs");
  14887. var getHomedir = require_homedir();
  14888. var path = require("path");
  14889. var caller = require_caller();
  14890. var nodeModulesPaths = require_node_modules_paths();
  14891. var normalizeOptions = require_normalize_options();
  14892. var isCore = require_is_core_module();
  14893. var realpathFS = fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
  14894. var homedir = getHomedir();
  14895. var defaultPaths = function() {
  14896. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  14897. };
  14898. var defaultIsFile = function isFile(file, cb) {
  14899. fs.stat(file, function(err, stat) {
  14900. if (!err) {
  14901. return cb(null, stat.isFile() || stat.isFIFO());
  14902. }
  14903. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  14904. return cb(null, false);
  14905. return cb(err);
  14906. });
  14907. };
  14908. var defaultIsDir = function isDirectory(dir, cb) {
  14909. fs.stat(dir, function(err, stat) {
  14910. if (!err) {
  14911. return cb(null, stat.isDirectory());
  14912. }
  14913. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  14914. return cb(null, false);
  14915. return cb(err);
  14916. });
  14917. };
  14918. var defaultRealpath = function realpath(x, cb) {
  14919. realpathFS(x, function(realpathErr, realPath) {
  14920. if (realpathErr && realpathErr.code !== "ENOENT")
  14921. cb(realpathErr);
  14922. else
  14923. cb(null, realpathErr ? x : realPath);
  14924. });
  14925. };
  14926. var maybeRealpath = function maybeRealpath2(realpath, x, opts, cb) {
  14927. if (opts && opts.preserveSymlinks === false) {
  14928. realpath(x, cb);
  14929. } else {
  14930. cb(null, x);
  14931. }
  14932. };
  14933. var defaultReadPackage = function defaultReadPackage2(readFile, pkgfile, cb) {
  14934. readFile(pkgfile, function(readFileErr, body) {
  14935. if (readFileErr)
  14936. cb(readFileErr);
  14937. else {
  14938. try {
  14939. var pkg = JSON.parse(body);
  14940. cb(null, pkg);
  14941. } catch (jsonErr) {
  14942. cb(null);
  14943. }
  14944. }
  14945. });
  14946. };
  14947. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  14948. var dirs = nodeModulesPaths(start, opts, x);
  14949. for (var i = 0; i < dirs.length; i++) {
  14950. dirs[i] = path.join(dirs[i], x);
  14951. }
  14952. return dirs;
  14953. };
  14954. module2.exports = function resolve(x, options, callback) {
  14955. var cb = callback;
  14956. var opts = options;
  14957. if (typeof options === "function") {
  14958. cb = opts;
  14959. opts = {};
  14960. }
  14961. if (typeof x !== "string") {
  14962. var err = new TypeError("Path must be a string.");
  14963. return process.nextTick(function() {
  14964. cb(err);
  14965. });
  14966. }
  14967. opts = normalizeOptions(x, opts);
  14968. var isFile = opts.isFile || defaultIsFile;
  14969. var isDirectory = opts.isDirectory || defaultIsDir;
  14970. var readFile = opts.readFile || fs.readFile;
  14971. var realpath = opts.realpath || defaultRealpath;
  14972. var readPackage = opts.readPackage || defaultReadPackage;
  14973. if (opts.readFile && opts.readPackage) {
  14974. var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
  14975. return process.nextTick(function() {
  14976. cb(conflictErr);
  14977. });
  14978. }
  14979. var packageIterator = opts.packageIterator;
  14980. var extensions = opts.extensions || [".js"];
  14981. var includeCoreModules = opts.includeCoreModules !== false;
  14982. var basedir = opts.basedir || path.dirname(caller());
  14983. var parent = opts.filename || basedir;
  14984. opts.paths = opts.paths || defaultPaths();
  14985. var absoluteStart = path.resolve(basedir);
  14986. maybeRealpath(realpath, absoluteStart, opts, function(err2, realStart) {
  14987. if (err2)
  14988. cb(err2);
  14989. else
  14990. init(realStart);
  14991. });
  14992. var res;
  14993. function init(basedir2) {
  14994. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  14995. res = path.resolve(basedir2, x);
  14996. if (x === "." || x === ".." || x.slice(-1) === "/")
  14997. res += "/";
  14998. if (/\/$/.test(x) && res === basedir2) {
  14999. loadAsDirectory(res, opts.package, onfile);
  15000. } else
  15001. loadAsFile(res, opts.package, onfile);
  15002. } else if (includeCoreModules && isCore(x)) {
  15003. return cb(null, x);
  15004. } else
  15005. loadNodeModules(x, basedir2, function(err2, n, pkg) {
  15006. if (err2)
  15007. cb(err2);
  15008. else if (n) {
  15009. return maybeRealpath(realpath, n, opts, function(err3, realN) {
  15010. if (err3) {
  15011. cb(err3);
  15012. } else {
  15013. cb(null, realN, pkg);
  15014. }
  15015. });
  15016. } else {
  15017. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15018. moduleError.code = "MODULE_NOT_FOUND";
  15019. cb(moduleError);
  15020. }
  15021. });
  15022. }
  15023. function onfile(err2, m, pkg) {
  15024. if (err2)
  15025. cb(err2);
  15026. else if (m)
  15027. cb(null, m, pkg);
  15028. else
  15029. loadAsDirectory(res, function(err3, d, pkg2) {
  15030. if (err3)
  15031. cb(err3);
  15032. else if (d) {
  15033. maybeRealpath(realpath, d, opts, function(err4, realD) {
  15034. if (err4) {
  15035. cb(err4);
  15036. } else {
  15037. cb(null, realD, pkg2);
  15038. }
  15039. });
  15040. } else {
  15041. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15042. moduleError.code = "MODULE_NOT_FOUND";
  15043. cb(moduleError);
  15044. }
  15045. });
  15046. }
  15047. function loadAsFile(x2, thePackage, callback2) {
  15048. var loadAsFilePackage = thePackage;
  15049. var cb2 = callback2;
  15050. if (typeof loadAsFilePackage === "function") {
  15051. cb2 = loadAsFilePackage;
  15052. loadAsFilePackage = void 0;
  15053. }
  15054. var exts = [""].concat(extensions);
  15055. load(exts, x2, loadAsFilePackage);
  15056. function load(exts2, x3, loadPackage) {
  15057. if (exts2.length === 0)
  15058. return cb2(null, void 0, loadPackage);
  15059. var file = x3 + exts2[0];
  15060. var pkg = loadPackage;
  15061. if (pkg)
  15062. onpkg(null, pkg);
  15063. else
  15064. loadpkg(path.dirname(file), onpkg);
  15065. function onpkg(err2, pkg_, dir) {
  15066. pkg = pkg_;
  15067. if (err2)
  15068. return cb2(err2);
  15069. if (dir && pkg && opts.pathFilter) {
  15070. var rfile = path.relative(dir, file);
  15071. var rel = rfile.slice(0, rfile.length - exts2[0].length);
  15072. var r = opts.pathFilter(pkg, x3, rel);
  15073. if (r)
  15074. return load([""].concat(extensions.slice()), path.resolve(dir, r), pkg);
  15075. }
  15076. isFile(file, onex);
  15077. }
  15078. function onex(err2, ex) {
  15079. if (err2)
  15080. return cb2(err2);
  15081. if (ex)
  15082. return cb2(null, file, pkg);
  15083. load(exts2.slice(1), x3, pkg);
  15084. }
  15085. }
  15086. }
  15087. function loadpkg(dir, cb2) {
  15088. if (dir === "" || dir === "/")
  15089. return cb2(null);
  15090. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15091. return cb2(null);
  15092. }
  15093. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15094. return cb2(null);
  15095. maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
  15096. if (unwrapErr)
  15097. return loadpkg(path.dirname(dir), cb2);
  15098. var pkgfile = path.join(pkgdir, "package.json");
  15099. isFile(pkgfile, function(err2, ex) {
  15100. if (!ex)
  15101. return loadpkg(path.dirname(dir), cb2);
  15102. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15103. if (err3)
  15104. cb2(err3);
  15105. var pkg = pkgParam;
  15106. if (pkg && opts.packageFilter) {
  15107. pkg = opts.packageFilter(pkg, pkgfile);
  15108. }
  15109. cb2(null, pkg, dir);
  15110. });
  15111. });
  15112. });
  15113. }
  15114. function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
  15115. var cb2 = callback2;
  15116. var fpkg = loadAsDirectoryPackage;
  15117. if (typeof fpkg === "function") {
  15118. cb2 = fpkg;
  15119. fpkg = opts.package;
  15120. }
  15121. maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
  15122. if (unwrapErr)
  15123. return cb2(unwrapErr);
  15124. var pkgfile = path.join(pkgdir, "package.json");
  15125. isFile(pkgfile, function(err2, ex) {
  15126. if (err2)
  15127. return cb2(err2);
  15128. if (!ex)
  15129. return loadAsFile(path.join(x2, "index"), fpkg, cb2);
  15130. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15131. if (err3)
  15132. return cb2(err3);
  15133. var pkg = pkgParam;
  15134. if (pkg && opts.packageFilter) {
  15135. pkg = opts.packageFilter(pkg, pkgfile);
  15136. }
  15137. if (pkg && pkg.main) {
  15138. if (typeof pkg.main !== "string") {
  15139. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15140. mainError.code = "INVALID_PACKAGE_MAIN";
  15141. return cb2(mainError);
  15142. }
  15143. if (pkg.main === "." || pkg.main === "./") {
  15144. pkg.main = "index";
  15145. }
  15146. loadAsFile(path.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
  15147. if (err4)
  15148. return cb2(err4);
  15149. if (m)
  15150. return cb2(null, m, pkg2);
  15151. if (!pkg2)
  15152. return loadAsFile(path.join(x2, "index"), pkg2, cb2);
  15153. var dir = path.resolve(x2, pkg2.main);
  15154. loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
  15155. if (err5)
  15156. return cb2(err5);
  15157. if (n)
  15158. return cb2(null, n, pkg3);
  15159. loadAsFile(path.join(x2, "index"), pkg3, cb2);
  15160. });
  15161. });
  15162. return;
  15163. }
  15164. loadAsFile(path.join(x2, "/index"), pkg, cb2);
  15165. });
  15166. });
  15167. });
  15168. }
  15169. function processDirs(cb2, dirs) {
  15170. if (dirs.length === 0)
  15171. return cb2(null, void 0);
  15172. var dir = dirs[0];
  15173. isDirectory(path.dirname(dir), isdir);
  15174. function isdir(err2, isdir2) {
  15175. if (err2)
  15176. return cb2(err2);
  15177. if (!isdir2)
  15178. return processDirs(cb2, dirs.slice(1));
  15179. loadAsFile(dir, opts.package, onfile2);
  15180. }
  15181. function onfile2(err2, m, pkg) {
  15182. if (err2)
  15183. return cb2(err2);
  15184. if (m)
  15185. return cb2(null, m, pkg);
  15186. loadAsDirectory(dir, opts.package, ondir);
  15187. }
  15188. function ondir(err2, n, pkg) {
  15189. if (err2)
  15190. return cb2(err2);
  15191. if (n)
  15192. return cb2(null, n, pkg);
  15193. processDirs(cb2, dirs.slice(1));
  15194. }
  15195. }
  15196. function loadNodeModules(x2, start, cb2) {
  15197. var thunk = function() {
  15198. return getPackageCandidates(x2, start, opts);
  15199. };
  15200. processDirs(cb2, packageIterator ? packageIterator(x2, start, thunk, opts) : thunk());
  15201. }
  15202. };
  15203. }
  15204. });
  15205. var require_core3 = __commonJS2({
  15206. "node_modules/resolve/lib/core.json"(exports2, module2) {
  15207. module2.exports = {
  15208. assert: true,
  15209. "node:assert": [">= 14.18 && < 15", ">= 16"],
  15210. "assert/strict": ">= 15",
  15211. "node:assert/strict": ">= 16",
  15212. async_hooks: ">= 8",
  15213. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  15214. buffer_ieee754: ">= 0.5 && < 0.9.7",
  15215. buffer: true,
  15216. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  15217. child_process: true,
  15218. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  15219. cluster: ">= 0.5",
  15220. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  15221. console: true,
  15222. "node:console": [">= 14.18 && < 15", ">= 16"],
  15223. constants: true,
  15224. "node:constants": [">= 14.18 && < 15", ">= 16"],
  15225. crypto: true,
  15226. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  15227. _debug_agent: ">= 1 && < 8",
  15228. _debugger: "< 8",
  15229. dgram: true,
  15230. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  15231. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  15232. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  15233. dns: true,
  15234. "node:dns": [">= 14.18 && < 15", ">= 16"],
  15235. "dns/promises": ">= 15",
  15236. "node:dns/promises": ">= 16",
  15237. domain: ">= 0.7.12",
  15238. "node:domain": [">= 14.18 && < 15", ">= 16"],
  15239. events: true,
  15240. "node:events": [">= 14.18 && < 15", ">= 16"],
  15241. freelist: "< 6",
  15242. fs: true,
  15243. "node:fs": [">= 14.18 && < 15", ">= 16"],
  15244. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  15245. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  15246. _http_agent: ">= 0.11.1",
  15247. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  15248. _http_client: ">= 0.11.1",
  15249. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  15250. _http_common: ">= 0.11.1",
  15251. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  15252. _http_incoming: ">= 0.11.1",
  15253. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  15254. _http_outgoing: ">= 0.11.1",
  15255. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  15256. _http_server: ">= 0.11.1",
  15257. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  15258. http: true,
  15259. "node:http": [">= 14.18 && < 15", ">= 16"],
  15260. http2: ">= 8.8",
  15261. "node:http2": [">= 14.18 && < 15", ">= 16"],
  15262. https: true,
  15263. "node:https": [">= 14.18 && < 15", ">= 16"],
  15264. inspector: ">= 8",
  15265. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  15266. _linklist: "< 8",
  15267. module: true,
  15268. "node:module": [">= 14.18 && < 15", ">= 16"],
  15269. net: true,
  15270. "node:net": [">= 14.18 && < 15", ">= 16"],
  15271. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  15272. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  15273. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  15274. os: true,
  15275. "node:os": [">= 14.18 && < 15", ">= 16"],
  15276. path: true,
  15277. "node:path": [">= 14.18 && < 15", ">= 16"],
  15278. "path/posix": ">= 15.3",
  15279. "node:path/posix": ">= 16",
  15280. "path/win32": ">= 15.3",
  15281. "node:path/win32": ">= 16",
  15282. perf_hooks: ">= 8.5",
  15283. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  15284. process: ">= 1",
  15285. "node:process": [">= 14.18 && < 15", ">= 16"],
  15286. punycode: ">= 0.5",
  15287. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  15288. querystring: true,
  15289. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  15290. readline: true,
  15291. "node:readline": [">= 14.18 && < 15", ">= 16"],
  15292. "readline/promises": ">= 17",
  15293. "node:readline/promises": ">= 17",
  15294. repl: true,
  15295. "node:repl": [">= 14.18 && < 15", ">= 16"],
  15296. smalloc: ">= 0.11.5 && < 3",
  15297. _stream_duplex: ">= 0.9.4",
  15298. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  15299. _stream_transform: ">= 0.9.4",
  15300. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  15301. _stream_wrap: ">= 1.4.1",
  15302. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  15303. _stream_passthrough: ">= 0.9.4",
  15304. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  15305. _stream_readable: ">= 0.9.4",
  15306. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  15307. _stream_writable: ">= 0.9.4",
  15308. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  15309. stream: true,
  15310. "node:stream": [">= 14.18 && < 15", ">= 16"],
  15311. "stream/consumers": ">= 16.7",
  15312. "node:stream/consumers": ">= 16.7",
  15313. "stream/promises": ">= 15",
  15314. "node:stream/promises": ">= 16",
  15315. "stream/web": ">= 16.5",
  15316. "node:stream/web": ">= 16.5",
  15317. string_decoder: true,
  15318. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  15319. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  15320. "node:sys": [">= 14.18 && < 15", ">= 16"],
  15321. timers: true,
  15322. "node:timers": [">= 14.18 && < 15", ">= 16"],
  15323. "timers/promises": ">= 15",
  15324. "node:timers/promises": ">= 16",
  15325. _tls_common: ">= 0.11.13",
  15326. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  15327. _tls_legacy: ">= 0.11.3 && < 10",
  15328. _tls_wrap: ">= 0.11.3",
  15329. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  15330. tls: true,
  15331. "node:tls": [">= 14.18 && < 15", ">= 16"],
  15332. trace_events: ">= 10",
  15333. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  15334. tty: true,
  15335. "node:tty": [">= 14.18 && < 15", ">= 16"],
  15336. url: true,
  15337. "node:url": [">= 14.18 && < 15", ">= 16"],
  15338. util: true,
  15339. "node:util": [">= 14.18 && < 15", ">= 16"],
  15340. "util/types": ">= 15.3",
  15341. "node:util/types": ">= 16",
  15342. "v8/tools/arguments": ">= 10 && < 12",
  15343. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15344. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15345. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15346. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15347. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15348. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15349. v8: ">= 1",
  15350. "node:v8": [">= 14.18 && < 15", ">= 16"],
  15351. vm: true,
  15352. "node:vm": [">= 14.18 && < 15", ">= 16"],
  15353. wasi: ">= 13.4 && < 13.5",
  15354. worker_threads: ">= 11.7",
  15355. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  15356. zlib: ">= 0.5",
  15357. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  15358. };
  15359. }
  15360. });
  15361. var require_core4 = __commonJS2({
  15362. "node_modules/resolve/lib/core.js"(exports2, module2) {
  15363. var current = process.versions && process.versions.node && process.versions.node.split(".") || [];
  15364. function specifierIncluded(specifier) {
  15365. var parts = specifier.split(" ");
  15366. var op = parts.length > 1 ? parts[0] : "=";
  15367. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  15368. for (var i = 0; i < 3; ++i) {
  15369. var cur = parseInt(current[i] || 0, 10);
  15370. var ver = parseInt(versionParts[i] || 0, 10);
  15371. if (cur === ver) {
  15372. continue;
  15373. }
  15374. if (op === "<") {
  15375. return cur < ver;
  15376. } else if (op === ">=") {
  15377. return cur >= ver;
  15378. }
  15379. return false;
  15380. }
  15381. return op === ">=";
  15382. }
  15383. function matchesRange(range) {
  15384. var specifiers = range.split(/ ?&& ?/);
  15385. if (specifiers.length === 0) {
  15386. return false;
  15387. }
  15388. for (var i = 0; i < specifiers.length; ++i) {
  15389. if (!specifierIncluded(specifiers[i])) {
  15390. return false;
  15391. }
  15392. }
  15393. return true;
  15394. }
  15395. function versionIncluded(specifierValue) {
  15396. if (typeof specifierValue === "boolean") {
  15397. return specifierValue;
  15398. }
  15399. if (specifierValue && typeof specifierValue === "object") {
  15400. for (var i = 0; i < specifierValue.length; ++i) {
  15401. if (matchesRange(specifierValue[i])) {
  15402. return true;
  15403. }
  15404. }
  15405. return false;
  15406. }
  15407. return matchesRange(specifierValue);
  15408. }
  15409. var data = require_core3();
  15410. var core2 = {};
  15411. for (mod in data) {
  15412. if (Object.prototype.hasOwnProperty.call(data, mod)) {
  15413. core2[mod] = versionIncluded(data[mod]);
  15414. }
  15415. }
  15416. var mod;
  15417. module2.exports = core2;
  15418. }
  15419. });
  15420. var require_is_core = __commonJS2({
  15421. "node_modules/resolve/lib/is-core.js"(exports2, module2) {
  15422. var isCoreModule = require_is_core_module();
  15423. module2.exports = function isCore(x) {
  15424. return isCoreModule(x);
  15425. };
  15426. }
  15427. });
  15428. var require_sync = __commonJS2({
  15429. "node_modules/resolve/lib/sync.js"(exports2, module2) {
  15430. var isCore = require_is_core_module();
  15431. var fs = require("fs");
  15432. var path = require("path");
  15433. var getHomedir = require_homedir();
  15434. var caller = require_caller();
  15435. var nodeModulesPaths = require_node_modules_paths();
  15436. var normalizeOptions = require_normalize_options();
  15437. var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
  15438. var homedir = getHomedir();
  15439. var defaultPaths = function() {
  15440. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  15441. };
  15442. var defaultIsFile = function isFile(file) {
  15443. try {
  15444. var stat = fs.statSync(file, {
  15445. throwIfNoEntry: false
  15446. });
  15447. } catch (e) {
  15448. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15449. return false;
  15450. throw e;
  15451. }
  15452. return !!stat && (stat.isFile() || stat.isFIFO());
  15453. };
  15454. var defaultIsDir = function isDirectory(dir) {
  15455. try {
  15456. var stat = fs.statSync(dir, {
  15457. throwIfNoEntry: false
  15458. });
  15459. } catch (e) {
  15460. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15461. return false;
  15462. throw e;
  15463. }
  15464. return !!stat && stat.isDirectory();
  15465. };
  15466. var defaultRealpathSync = function realpathSync(x) {
  15467. try {
  15468. return realpathFS(x);
  15469. } catch (realpathErr) {
  15470. if (realpathErr.code !== "ENOENT") {
  15471. throw realpathErr;
  15472. }
  15473. }
  15474. return x;
  15475. };
  15476. var maybeRealpathSync = function maybeRealpathSync2(realpathSync, x, opts) {
  15477. if (opts && opts.preserveSymlinks === false) {
  15478. return realpathSync(x);
  15479. }
  15480. return x;
  15481. };
  15482. var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync, pkgfile) {
  15483. var body = readFileSync(pkgfile);
  15484. try {
  15485. var pkg = JSON.parse(body);
  15486. return pkg;
  15487. } catch (jsonErr) {
  15488. }
  15489. };
  15490. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  15491. var dirs = nodeModulesPaths(start, opts, x);
  15492. for (var i = 0; i < dirs.length; i++) {
  15493. dirs[i] = path.join(dirs[i], x);
  15494. }
  15495. return dirs;
  15496. };
  15497. module2.exports = function resolveSync(x, options) {
  15498. if (typeof x !== "string") {
  15499. throw new TypeError("Path must be a string.");
  15500. }
  15501. var opts = normalizeOptions(x, options);
  15502. var isFile = opts.isFile || defaultIsFile;
  15503. var readFileSync = opts.readFileSync || fs.readFileSync;
  15504. var isDirectory = opts.isDirectory || defaultIsDir;
  15505. var realpathSync = opts.realpathSync || defaultRealpathSync;
  15506. var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
  15507. if (opts.readFileSync && opts.readPackageSync) {
  15508. throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
  15509. }
  15510. var packageIterator = opts.packageIterator;
  15511. var extensions = opts.extensions || [".js"];
  15512. var includeCoreModules = opts.includeCoreModules !== false;
  15513. var basedir = opts.basedir || path.dirname(caller());
  15514. var parent = opts.filename || basedir;
  15515. opts.paths = opts.paths || defaultPaths();
  15516. var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
  15517. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  15518. var res = path.resolve(absoluteStart, x);
  15519. if (x === "." || x === ".." || x.slice(-1) === "/")
  15520. res += "/";
  15521. var m = loadAsFileSync(res) || loadAsDirectorySync(res);
  15522. if (m)
  15523. return maybeRealpathSync(realpathSync, m, opts);
  15524. } else if (includeCoreModules && isCore(x)) {
  15525. return x;
  15526. } else {
  15527. var n = loadNodeModulesSync(x, absoluteStart);
  15528. if (n)
  15529. return maybeRealpathSync(realpathSync, n, opts);
  15530. }
  15531. var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15532. err.code = "MODULE_NOT_FOUND";
  15533. throw err;
  15534. function loadAsFileSync(x2) {
  15535. var pkg = loadpkg(path.dirname(x2));
  15536. if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
  15537. var rfile = path.relative(pkg.dir, x2);
  15538. var r = opts.pathFilter(pkg.pkg, x2, rfile);
  15539. if (r) {
  15540. x2 = path.resolve(pkg.dir, r);
  15541. }
  15542. }
  15543. if (isFile(x2)) {
  15544. return x2;
  15545. }
  15546. for (var i = 0; i < extensions.length; i++) {
  15547. var file = x2 + extensions[i];
  15548. if (isFile(file)) {
  15549. return file;
  15550. }
  15551. }
  15552. }
  15553. function loadpkg(dir) {
  15554. if (dir === "" || dir === "/")
  15555. return;
  15556. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15557. return;
  15558. }
  15559. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15560. return;
  15561. var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
  15562. if (!isFile(pkgfile)) {
  15563. return loadpkg(path.dirname(dir));
  15564. }
  15565. var pkg = readPackageSync(readFileSync, pkgfile);
  15566. if (pkg && opts.packageFilter) {
  15567. pkg = opts.packageFilter(pkg, dir);
  15568. }
  15569. return {
  15570. pkg,
  15571. dir
  15572. };
  15573. }
  15574. function loadAsDirectorySync(x2) {
  15575. var pkgfile = path.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
  15576. if (isFile(pkgfile)) {
  15577. try {
  15578. var pkg = readPackageSync(readFileSync, pkgfile);
  15579. } catch (e) {
  15580. }
  15581. if (pkg && opts.packageFilter) {
  15582. pkg = opts.packageFilter(pkg, x2);
  15583. }
  15584. if (pkg && pkg.main) {
  15585. if (typeof pkg.main !== "string") {
  15586. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15587. mainError.code = "INVALID_PACKAGE_MAIN";
  15588. throw mainError;
  15589. }
  15590. if (pkg.main === "." || pkg.main === "./") {
  15591. pkg.main = "index";
  15592. }
  15593. try {
  15594. var m2 = loadAsFileSync(path.resolve(x2, pkg.main));
  15595. if (m2)
  15596. return m2;
  15597. var n2 = loadAsDirectorySync(path.resolve(x2, pkg.main));
  15598. if (n2)
  15599. return n2;
  15600. } catch (e) {
  15601. }
  15602. }
  15603. }
  15604. return loadAsFileSync(path.join(x2, "/index"));
  15605. }
  15606. function loadNodeModulesSync(x2, start) {
  15607. var thunk = function() {
  15608. return getPackageCandidates(x2, start, opts);
  15609. };
  15610. var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
  15611. for (var i = 0; i < dirs.length; i++) {
  15612. var dir = dirs[i];
  15613. if (isDirectory(path.dirname(dir))) {
  15614. var m2 = loadAsFileSync(dir);
  15615. if (m2)
  15616. return m2;
  15617. var n2 = loadAsDirectorySync(dir);
  15618. if (n2)
  15619. return n2;
  15620. }
  15621. }
  15622. }
  15623. };
  15624. }
  15625. });
  15626. var require_resolve = __commonJS2({
  15627. "node_modules/resolve/index.js"(exports2, module2) {
  15628. var async = require_async();
  15629. async.core = require_core4();
  15630. async.isCore = require_is_core();
  15631. async.sync = require_sync();
  15632. module2.exports = async;
  15633. }
  15634. });
  15635. var require_resolve2 = __commonJS2({
  15636. "src/common/resolve.js"(exports2, module2) {
  15637. "use strict";
  15638. var {
  15639. resolve
  15640. } = require;
  15641. if (resolve.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) {
  15642. resolve = (id, options) => {
  15643. let basedir;
  15644. if (options && options.paths && options.paths.length === 1) {
  15645. basedir = options.paths[0];
  15646. }
  15647. return require_resolve().sync(id, {
  15648. basedir
  15649. });
  15650. };
  15651. }
  15652. module2.exports = resolve;
  15653. }
  15654. });
  15655. function mimicFunction(to, from, {
  15656. ignoreNonConfigurable = false
  15657. } = {}) {
  15658. const {
  15659. name
  15660. } = to;
  15661. for (const property of Reflect.ownKeys(from)) {
  15662. copyProperty(to, from, property, ignoreNonConfigurable);
  15663. }
  15664. changePrototype(to, from);
  15665. changeToString(to, from, name);
  15666. return to;
  15667. }
  15668. var copyProperty;
  15669. var canCopyProperty;
  15670. var changePrototype;
  15671. var wrappedToString;
  15672. var toStringDescriptor;
  15673. var toStringName;
  15674. var changeToString;
  15675. var init_mimic_fn = __esm({
  15676. "node_modules/mimic-fn/index.js"() {
  15677. copyProperty = (to, from, property, ignoreNonConfigurable) => {
  15678. if (property === "length" || property === "prototype") {
  15679. return;
  15680. }
  15681. if (property === "arguments" || property === "caller") {
  15682. return;
  15683. }
  15684. const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
  15685. const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
  15686. if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
  15687. return;
  15688. }
  15689. Object.defineProperty(to, property, fromDescriptor);
  15690. };
  15691. canCopyProperty = function(toDescriptor, fromDescriptor) {
  15692. return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
  15693. };
  15694. changePrototype = (to, from) => {
  15695. const fromPrototype = Object.getPrototypeOf(from);
  15696. if (fromPrototype === Object.getPrototypeOf(to)) {
  15697. return;
  15698. }
  15699. Object.setPrototypeOf(to, fromPrototype);
  15700. };
  15701. wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
  15702. ${fromBody}`;
  15703. toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
  15704. toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
  15705. changeToString = (to, from, name) => {
  15706. const withName = name === "" ? "" : `with ${name.trim()}() `;
  15707. const newToString = wrappedToString.bind(null, withName, from.toString());
  15708. Object.defineProperty(newToString, "name", toStringName);
  15709. Object.defineProperty(to, "toString", Object.assign(Object.assign({}, toStringDescriptor), {}, {
  15710. value: newToString
  15711. }));
  15712. };
  15713. }
  15714. });
  15715. var require_p_defer = __commonJS2({
  15716. "node_modules/p-defer/index.js"(exports2, module2) {
  15717. "use strict";
  15718. module2.exports = () => {
  15719. const ret = {};
  15720. ret.promise = new Promise((resolve, reject) => {
  15721. ret.resolve = resolve;
  15722. ret.reject = reject;
  15723. });
  15724. return ret;
  15725. };
  15726. }
  15727. });
  15728. var require_dist = __commonJS2({
  15729. "node_modules/map-age-cleaner/dist/index.js"(exports2, module2) {
  15730. "use strict";
  15731. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  15732. return new (P || (P = Promise))(function(resolve, reject) {
  15733. function fulfilled(value) {
  15734. try {
  15735. step(generator.next(value));
  15736. } catch (e) {
  15737. reject(e);
  15738. }
  15739. }
  15740. function rejected(value) {
  15741. try {
  15742. step(generator["throw"](value));
  15743. } catch (e) {
  15744. reject(e);
  15745. }
  15746. }
  15747. function step(result) {
  15748. result.done ? resolve(result.value) : new P(function(resolve2) {
  15749. resolve2(result.value);
  15750. }).then(fulfilled, rejected);
  15751. }
  15752. step((generator = generator.apply(thisArg, _arguments || [])).next());
  15753. });
  15754. };
  15755. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  15756. return mod && mod.__esModule ? mod : {
  15757. "default": mod
  15758. };
  15759. };
  15760. Object.defineProperty(exports2, "__esModule", {
  15761. value: true
  15762. });
  15763. var p_defer_1 = __importDefault2(require_p_defer());
  15764. function mapAgeCleaner2(map, property = "maxAge") {
  15765. let processingKey;
  15766. let processingTimer;
  15767. let processingDeferred;
  15768. const cleanup = () => __awaiter2(this, void 0, void 0, function* () {
  15769. if (processingKey !== void 0) {
  15770. return;
  15771. }
  15772. const setupTimer = (item) => __awaiter2(this, void 0, void 0, function* () {
  15773. processingDeferred = p_defer_1.default();
  15774. const delay = item[1][property] - Date.now();
  15775. if (delay <= 0) {
  15776. map.delete(item[0]);
  15777. processingDeferred.resolve();
  15778. return;
  15779. }
  15780. processingKey = item[0];
  15781. processingTimer = setTimeout(() => {
  15782. map.delete(item[0]);
  15783. if (processingDeferred) {
  15784. processingDeferred.resolve();
  15785. }
  15786. }, delay);
  15787. if (typeof processingTimer.unref === "function") {
  15788. processingTimer.unref();
  15789. }
  15790. return processingDeferred.promise;
  15791. });
  15792. try {
  15793. for (const entry of map) {
  15794. yield setupTimer(entry);
  15795. }
  15796. } catch (_a) {
  15797. }
  15798. processingKey = void 0;
  15799. });
  15800. const reset = () => {
  15801. processingKey = void 0;
  15802. if (processingTimer !== void 0) {
  15803. clearTimeout(processingTimer);
  15804. processingTimer = void 0;
  15805. }
  15806. if (processingDeferred !== void 0) {
  15807. processingDeferred.reject(void 0);
  15808. processingDeferred = void 0;
  15809. }
  15810. };
  15811. const originalSet = map.set.bind(map);
  15812. map.set = (key, value) => {
  15813. if (map.has(key)) {
  15814. map.delete(key);
  15815. }
  15816. const result = originalSet(key, value);
  15817. if (processingKey && processingKey === key) {
  15818. reset();
  15819. }
  15820. cleanup();
  15821. return result;
  15822. };
  15823. cleanup();
  15824. return map;
  15825. }
  15826. exports2.default = mapAgeCleaner2;
  15827. module2.exports = mapAgeCleaner2;
  15828. module2.exports.default = mapAgeCleaner2;
  15829. }
  15830. });
  15831. var dist_exports = {};
  15832. __export(dist_exports, {
  15833. default: () => mem,
  15834. memClear: () => memClear,
  15835. memDecorator: () => memDecorator
  15836. });
  15837. function mem(fn, {
  15838. cacheKey,
  15839. cache = /* @__PURE__ */ new Map(),
  15840. maxAge
  15841. } = {}) {
  15842. if (typeof maxAge === "number") {
  15843. (0, import_map_age_cleaner.default)(cache);
  15844. }
  15845. const memoized = function(...arguments_) {
  15846. const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
  15847. const cacheItem = cache.get(key);
  15848. if (cacheItem) {
  15849. return cacheItem.data;
  15850. }
  15851. const result = fn.apply(this, arguments_);
  15852. cache.set(key, {
  15853. data: result,
  15854. maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
  15855. });
  15856. return result;
  15857. };
  15858. mimicFunction(memoized, fn, {
  15859. ignoreNonConfigurable: true
  15860. });
  15861. cacheStore.set(memoized, cache);
  15862. return memoized;
  15863. }
  15864. function memDecorator(options = {}) {
  15865. const instanceMap = /* @__PURE__ */ new WeakMap();
  15866. return (target, propertyKey, descriptor) => {
  15867. const input = target[propertyKey];
  15868. if (typeof input !== "function") {
  15869. throw new TypeError("The decorated value must be a function");
  15870. }
  15871. delete descriptor.value;
  15872. delete descriptor.writable;
  15873. descriptor.get = function() {
  15874. if (!instanceMap.has(this)) {
  15875. const value = mem(input, options);
  15876. instanceMap.set(this, value);
  15877. return value;
  15878. }
  15879. return instanceMap.get(this);
  15880. };
  15881. };
  15882. }
  15883. function memClear(fn) {
  15884. const cache = cacheStore.get(fn);
  15885. if (!cache) {
  15886. throw new TypeError("Can't clear a function that was not memoized!");
  15887. }
  15888. if (typeof cache.clear !== "function") {
  15889. throw new TypeError("The cache Map can't be cleared!");
  15890. }
  15891. cache.clear();
  15892. }
  15893. var import_map_age_cleaner;
  15894. var cacheStore;
  15895. var init_dist = __esm({
  15896. "node_modules/mem/dist/index.js"() {
  15897. init_mimic_fn();
  15898. import_map_age_cleaner = __toESM(require_dist());
  15899. cacheStore = /* @__PURE__ */ new WeakMap();
  15900. }
  15901. });
  15902. var require_pseudomap = __commonJS2({
  15903. "node_modules/pseudomap/pseudomap.js"(exports2, module2) {
  15904. var hasOwnProperty = Object.prototype.hasOwnProperty;
  15905. module2.exports = PseudoMap;
  15906. function PseudoMap(set2) {
  15907. if (!(this instanceof PseudoMap))
  15908. throw new TypeError("Constructor PseudoMap requires 'new'");
  15909. this.clear();
  15910. if (set2) {
  15911. if (set2 instanceof PseudoMap || typeof Map === "function" && set2 instanceof Map)
  15912. set2.forEach(function(value, key) {
  15913. this.set(key, value);
  15914. }, this);
  15915. else if (Array.isArray(set2))
  15916. set2.forEach(function(kv) {
  15917. this.set(kv[0], kv[1]);
  15918. }, this);
  15919. else
  15920. throw new TypeError("invalid argument");
  15921. }
  15922. }
  15923. PseudoMap.prototype.forEach = function(fn, thisp) {
  15924. thisp = thisp || this;
  15925. Object.keys(this._data).forEach(function(k) {
  15926. if (k !== "size")
  15927. fn.call(thisp, this._data[k].value, this._data[k].key);
  15928. }, this);
  15929. };
  15930. PseudoMap.prototype.has = function(k) {
  15931. return !!find(this._data, k);
  15932. };
  15933. PseudoMap.prototype.get = function(k) {
  15934. var res = find(this._data, k);
  15935. return res && res.value;
  15936. };
  15937. PseudoMap.prototype.set = function(k, v) {
  15938. set(this._data, k, v);
  15939. };
  15940. PseudoMap.prototype.delete = function(k) {
  15941. var res = find(this._data, k);
  15942. if (res) {
  15943. delete this._data[res._index];
  15944. this._data.size--;
  15945. }
  15946. };
  15947. PseudoMap.prototype.clear = function() {
  15948. var data = /* @__PURE__ */ Object.create(null);
  15949. data.size = 0;
  15950. Object.defineProperty(this, "_data", {
  15951. value: data,
  15952. enumerable: false,
  15953. configurable: true,
  15954. writable: false
  15955. });
  15956. };
  15957. Object.defineProperty(PseudoMap.prototype, "size", {
  15958. get: function() {
  15959. return this._data.size;
  15960. },
  15961. set: function(n) {
  15962. },
  15963. enumerable: true,
  15964. configurable: true
  15965. });
  15966. PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
  15967. throw new Error("iterators are not implemented in this version");
  15968. };
  15969. function same(a, b) {
  15970. return a === b || a !== a && b !== b;
  15971. }
  15972. function Entry(k, v, i) {
  15973. this.key = k;
  15974. this.value = v;
  15975. this._index = i;
  15976. }
  15977. function find(data, k) {
  15978. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  15979. if (same(data[key].key, k))
  15980. return data[key];
  15981. }
  15982. }
  15983. function set(data, k, v) {
  15984. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  15985. if (same(data[key].key, k)) {
  15986. data[key].value = v;
  15987. return;
  15988. }
  15989. }
  15990. data.size++;
  15991. data[key] = new Entry(k, v, key);
  15992. }
  15993. }
  15994. });
  15995. var require_map = __commonJS2({
  15996. "node_modules/pseudomap/map.js"(exports2, module2) {
  15997. if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
  15998. process.env.TEST_PSEUDOMAP = "true";
  15999. if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
  16000. module2.exports = Map;
  16001. } else {
  16002. module2.exports = require_pseudomap();
  16003. }
  16004. }
  16005. });
  16006. var require_yallist = __commonJS2({
  16007. "node_modules/editorconfig/node_modules/yallist/yallist.js"(exports2, module2) {
  16008. module2.exports = Yallist;
  16009. Yallist.Node = Node;
  16010. Yallist.create = Yallist;
  16011. function Yallist(list) {
  16012. var self2 = this;
  16013. if (!(self2 instanceof Yallist)) {
  16014. self2 = new Yallist();
  16015. }
  16016. self2.tail = null;
  16017. self2.head = null;
  16018. self2.length = 0;
  16019. if (list && typeof list.forEach === "function") {
  16020. list.forEach(function(item) {
  16021. self2.push(item);
  16022. });
  16023. } else if (arguments.length > 0) {
  16024. for (var i = 0, l = arguments.length; i < l; i++) {
  16025. self2.push(arguments[i]);
  16026. }
  16027. }
  16028. return self2;
  16029. }
  16030. Yallist.prototype.removeNode = function(node) {
  16031. if (node.list !== this) {
  16032. throw new Error("removing node which does not belong to this list");
  16033. }
  16034. var next = node.next;
  16035. var prev = node.prev;
  16036. if (next) {
  16037. next.prev = prev;
  16038. }
  16039. if (prev) {
  16040. prev.next = next;
  16041. }
  16042. if (node === this.head) {
  16043. this.head = next;
  16044. }
  16045. if (node === this.tail) {
  16046. this.tail = prev;
  16047. }
  16048. node.list.length--;
  16049. node.next = null;
  16050. node.prev = null;
  16051. node.list = null;
  16052. };
  16053. Yallist.prototype.unshiftNode = function(node) {
  16054. if (node === this.head) {
  16055. return;
  16056. }
  16057. if (node.list) {
  16058. node.list.removeNode(node);
  16059. }
  16060. var head = this.head;
  16061. node.list = this;
  16062. node.next = head;
  16063. if (head) {
  16064. head.prev = node;
  16065. }
  16066. this.head = node;
  16067. if (!this.tail) {
  16068. this.tail = node;
  16069. }
  16070. this.length++;
  16071. };
  16072. Yallist.prototype.pushNode = function(node) {
  16073. if (node === this.tail) {
  16074. return;
  16075. }
  16076. if (node.list) {
  16077. node.list.removeNode(node);
  16078. }
  16079. var tail = this.tail;
  16080. node.list = this;
  16081. node.prev = tail;
  16082. if (tail) {
  16083. tail.next = node;
  16084. }
  16085. this.tail = node;
  16086. if (!this.head) {
  16087. this.head = node;
  16088. }
  16089. this.length++;
  16090. };
  16091. Yallist.prototype.push = function() {
  16092. for (var i = 0, l = arguments.length; i < l; i++) {
  16093. push(this, arguments[i]);
  16094. }
  16095. return this.length;
  16096. };
  16097. Yallist.prototype.unshift = function() {
  16098. for (var i = 0, l = arguments.length; i < l; i++) {
  16099. unshift(this, arguments[i]);
  16100. }
  16101. return this.length;
  16102. };
  16103. Yallist.prototype.pop = function() {
  16104. if (!this.tail) {
  16105. return void 0;
  16106. }
  16107. var res = this.tail.value;
  16108. this.tail = this.tail.prev;
  16109. if (this.tail) {
  16110. this.tail.next = null;
  16111. } else {
  16112. this.head = null;
  16113. }
  16114. this.length--;
  16115. return res;
  16116. };
  16117. Yallist.prototype.shift = function() {
  16118. if (!this.head) {
  16119. return void 0;
  16120. }
  16121. var res = this.head.value;
  16122. this.head = this.head.next;
  16123. if (this.head) {
  16124. this.head.prev = null;
  16125. } else {
  16126. this.tail = null;
  16127. }
  16128. this.length--;
  16129. return res;
  16130. };
  16131. Yallist.prototype.forEach = function(fn, thisp) {
  16132. thisp = thisp || this;
  16133. for (var walker = this.head, i = 0; walker !== null; i++) {
  16134. fn.call(thisp, walker.value, i, this);
  16135. walker = walker.next;
  16136. }
  16137. };
  16138. Yallist.prototype.forEachReverse = function(fn, thisp) {
  16139. thisp = thisp || this;
  16140. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  16141. fn.call(thisp, walker.value, i, this);
  16142. walker = walker.prev;
  16143. }
  16144. };
  16145. Yallist.prototype.get = function(n) {
  16146. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  16147. walker = walker.next;
  16148. }
  16149. if (i === n && walker !== null) {
  16150. return walker.value;
  16151. }
  16152. };
  16153. Yallist.prototype.getReverse = function(n) {
  16154. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  16155. walker = walker.prev;
  16156. }
  16157. if (i === n && walker !== null) {
  16158. return walker.value;
  16159. }
  16160. };
  16161. Yallist.prototype.map = function(fn, thisp) {
  16162. thisp = thisp || this;
  16163. var res = new Yallist();
  16164. for (var walker = this.head; walker !== null; ) {
  16165. res.push(fn.call(thisp, walker.value, this));
  16166. walker = walker.next;
  16167. }
  16168. return res;
  16169. };
  16170. Yallist.prototype.mapReverse = function(fn, thisp) {
  16171. thisp = thisp || this;
  16172. var res = new Yallist();
  16173. for (var walker = this.tail; walker !== null; ) {
  16174. res.push(fn.call(thisp, walker.value, this));
  16175. walker = walker.prev;
  16176. }
  16177. return res;
  16178. };
  16179. Yallist.prototype.reduce = function(fn, initial) {
  16180. var acc;
  16181. var walker = this.head;
  16182. if (arguments.length > 1) {
  16183. acc = initial;
  16184. } else if (this.head) {
  16185. walker = this.head.next;
  16186. acc = this.head.value;
  16187. } else {
  16188. throw new TypeError("Reduce of empty list with no initial value");
  16189. }
  16190. for (var i = 0; walker !== null; i++) {
  16191. acc = fn(acc, walker.value, i);
  16192. walker = walker.next;
  16193. }
  16194. return acc;
  16195. };
  16196. Yallist.prototype.reduceReverse = function(fn, initial) {
  16197. var acc;
  16198. var walker = this.tail;
  16199. if (arguments.length > 1) {
  16200. acc = initial;
  16201. } else if (this.tail) {
  16202. walker = this.tail.prev;
  16203. acc = this.tail.value;
  16204. } else {
  16205. throw new TypeError("Reduce of empty list with no initial value");
  16206. }
  16207. for (var i = this.length - 1; walker !== null; i--) {
  16208. acc = fn(acc, walker.value, i);
  16209. walker = walker.prev;
  16210. }
  16211. return acc;
  16212. };
  16213. Yallist.prototype.toArray = function() {
  16214. var arr = new Array(this.length);
  16215. for (var i = 0, walker = this.head; walker !== null; i++) {
  16216. arr[i] = walker.value;
  16217. walker = walker.next;
  16218. }
  16219. return arr;
  16220. };
  16221. Yallist.prototype.toArrayReverse = function() {
  16222. var arr = new Array(this.length);
  16223. for (var i = 0, walker = this.tail; walker !== null; i++) {
  16224. arr[i] = walker.value;
  16225. walker = walker.prev;
  16226. }
  16227. return arr;
  16228. };
  16229. Yallist.prototype.slice = function(from, to) {
  16230. to = to || this.length;
  16231. if (to < 0) {
  16232. to += this.length;
  16233. }
  16234. from = from || 0;
  16235. if (from < 0) {
  16236. from += this.length;
  16237. }
  16238. var ret = new Yallist();
  16239. if (to < from || to < 0) {
  16240. return ret;
  16241. }
  16242. if (from < 0) {
  16243. from = 0;
  16244. }
  16245. if (to > this.length) {
  16246. to = this.length;
  16247. }
  16248. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  16249. walker = walker.next;
  16250. }
  16251. for (; walker !== null && i < to; i++, walker = walker.next) {
  16252. ret.push(walker.value);
  16253. }
  16254. return ret;
  16255. };
  16256. Yallist.prototype.sliceReverse = function(from, to) {
  16257. to = to || this.length;
  16258. if (to < 0) {
  16259. to += this.length;
  16260. }
  16261. from = from || 0;
  16262. if (from < 0) {
  16263. from += this.length;
  16264. }
  16265. var ret = new Yallist();
  16266. if (to < from || to < 0) {
  16267. return ret;
  16268. }
  16269. if (from < 0) {
  16270. from = 0;
  16271. }
  16272. if (to > this.length) {
  16273. to = this.length;
  16274. }
  16275. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  16276. walker = walker.prev;
  16277. }
  16278. for (; walker !== null && i > from; i--, walker = walker.prev) {
  16279. ret.push(walker.value);
  16280. }
  16281. return ret;
  16282. };
  16283. Yallist.prototype.reverse = function() {
  16284. var head = this.head;
  16285. var tail = this.tail;
  16286. for (var walker = head; walker !== null; walker = walker.prev) {
  16287. var p = walker.prev;
  16288. walker.prev = walker.next;
  16289. walker.next = p;
  16290. }
  16291. this.head = tail;
  16292. this.tail = head;
  16293. return this;
  16294. };
  16295. function push(self2, item) {
  16296. self2.tail = new Node(item, self2.tail, null, self2);
  16297. if (!self2.head) {
  16298. self2.head = self2.tail;
  16299. }
  16300. self2.length++;
  16301. }
  16302. function unshift(self2, item) {
  16303. self2.head = new Node(item, null, self2.head, self2);
  16304. if (!self2.tail) {
  16305. self2.tail = self2.head;
  16306. }
  16307. self2.length++;
  16308. }
  16309. function Node(value, prev, next, list) {
  16310. if (!(this instanceof Node)) {
  16311. return new Node(value, prev, next, list);
  16312. }
  16313. this.list = list;
  16314. this.value = value;
  16315. if (prev) {
  16316. prev.next = this;
  16317. this.prev = prev;
  16318. } else {
  16319. this.prev = null;
  16320. }
  16321. if (next) {
  16322. next.prev = this;
  16323. this.next = next;
  16324. } else {
  16325. this.next = null;
  16326. }
  16327. }
  16328. }
  16329. });
  16330. var require_lru_cache = __commonJS2({
  16331. "node_modules/editorconfig/node_modules/lru-cache/index.js"(exports2, module2) {
  16332. "use strict";
  16333. module2.exports = LRUCache;
  16334. var Map2 = require_map();
  16335. var util = require("util");
  16336. var Yallist = require_yallist();
  16337. var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
  16338. var makeSymbol;
  16339. if (hasSymbol) {
  16340. makeSymbol = function(key) {
  16341. return Symbol(key);
  16342. };
  16343. } else {
  16344. makeSymbol = function(key) {
  16345. return "_" + key;
  16346. };
  16347. }
  16348. var MAX = makeSymbol("max");
  16349. var LENGTH = makeSymbol("length");
  16350. var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
  16351. var ALLOW_STALE = makeSymbol("allowStale");
  16352. var MAX_AGE = makeSymbol("maxAge");
  16353. var DISPOSE = makeSymbol("dispose");
  16354. var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
  16355. var LRU_LIST = makeSymbol("lruList");
  16356. var CACHE = makeSymbol("cache");
  16357. function naiveLength() {
  16358. return 1;
  16359. }
  16360. function LRUCache(options) {
  16361. if (!(this instanceof LRUCache)) {
  16362. return new LRUCache(options);
  16363. }
  16364. if (typeof options === "number") {
  16365. options = {
  16366. max: options
  16367. };
  16368. }
  16369. if (!options) {
  16370. options = {};
  16371. }
  16372. var max = this[MAX] = options.max;
  16373. if (!max || !(typeof max === "number") || max <= 0) {
  16374. this[MAX] = Infinity;
  16375. }
  16376. var lc = options.length || naiveLength;
  16377. if (typeof lc !== "function") {
  16378. lc = naiveLength;
  16379. }
  16380. this[LENGTH_CALCULATOR] = lc;
  16381. this[ALLOW_STALE] = options.stale || false;
  16382. this[MAX_AGE] = options.maxAge || 0;
  16383. this[DISPOSE] = options.dispose;
  16384. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  16385. this.reset();
  16386. }
  16387. Object.defineProperty(LRUCache.prototype, "max", {
  16388. set: function(mL) {
  16389. if (!mL || !(typeof mL === "number") || mL <= 0) {
  16390. mL = Infinity;
  16391. }
  16392. this[MAX] = mL;
  16393. trim(this);
  16394. },
  16395. get: function() {
  16396. return this[MAX];
  16397. },
  16398. enumerable: true
  16399. });
  16400. Object.defineProperty(LRUCache.prototype, "allowStale", {
  16401. set: function(allowStale) {
  16402. this[ALLOW_STALE] = !!allowStale;
  16403. },
  16404. get: function() {
  16405. return this[ALLOW_STALE];
  16406. },
  16407. enumerable: true
  16408. });
  16409. Object.defineProperty(LRUCache.prototype, "maxAge", {
  16410. set: function(mA) {
  16411. if (!mA || !(typeof mA === "number") || mA < 0) {
  16412. mA = 0;
  16413. }
  16414. this[MAX_AGE] = mA;
  16415. trim(this);
  16416. },
  16417. get: function() {
  16418. return this[MAX_AGE];
  16419. },
  16420. enumerable: true
  16421. });
  16422. Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
  16423. set: function(lC) {
  16424. if (typeof lC !== "function") {
  16425. lC = naiveLength;
  16426. }
  16427. if (lC !== this[LENGTH_CALCULATOR]) {
  16428. this[LENGTH_CALCULATOR] = lC;
  16429. this[LENGTH] = 0;
  16430. this[LRU_LIST].forEach(function(hit) {
  16431. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  16432. this[LENGTH] += hit.length;
  16433. }, this);
  16434. }
  16435. trim(this);
  16436. },
  16437. get: function() {
  16438. return this[LENGTH_CALCULATOR];
  16439. },
  16440. enumerable: true
  16441. });
  16442. Object.defineProperty(LRUCache.prototype, "length", {
  16443. get: function() {
  16444. return this[LENGTH];
  16445. },
  16446. enumerable: true
  16447. });
  16448. Object.defineProperty(LRUCache.prototype, "itemCount", {
  16449. get: function() {
  16450. return this[LRU_LIST].length;
  16451. },
  16452. enumerable: true
  16453. });
  16454. LRUCache.prototype.rforEach = function(fn, thisp) {
  16455. thisp = thisp || this;
  16456. for (var walker = this[LRU_LIST].tail; walker !== null; ) {
  16457. var prev = walker.prev;
  16458. forEachStep(this, fn, walker, thisp);
  16459. walker = prev;
  16460. }
  16461. };
  16462. function forEachStep(self2, fn, node, thisp) {
  16463. var hit = node.value;
  16464. if (isStale(self2, hit)) {
  16465. del(self2, node);
  16466. if (!self2[ALLOW_STALE]) {
  16467. hit = void 0;
  16468. }
  16469. }
  16470. if (hit) {
  16471. fn.call(thisp, hit.value, hit.key, self2);
  16472. }
  16473. }
  16474. LRUCache.prototype.forEach = function(fn, thisp) {
  16475. thisp = thisp || this;
  16476. for (var walker = this[LRU_LIST].head; walker !== null; ) {
  16477. var next = walker.next;
  16478. forEachStep(this, fn, walker, thisp);
  16479. walker = next;
  16480. }
  16481. };
  16482. LRUCache.prototype.keys = function() {
  16483. return this[LRU_LIST].toArray().map(function(k) {
  16484. return k.key;
  16485. }, this);
  16486. };
  16487. LRUCache.prototype.values = function() {
  16488. return this[LRU_LIST].toArray().map(function(k) {
  16489. return k.value;
  16490. }, this);
  16491. };
  16492. LRUCache.prototype.reset = function() {
  16493. if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
  16494. this[LRU_LIST].forEach(function(hit) {
  16495. this[DISPOSE](hit.key, hit.value);
  16496. }, this);
  16497. }
  16498. this[CACHE] = new Map2();
  16499. this[LRU_LIST] = new Yallist();
  16500. this[LENGTH] = 0;
  16501. };
  16502. LRUCache.prototype.dump = function() {
  16503. return this[LRU_LIST].map(function(hit) {
  16504. if (!isStale(this, hit)) {
  16505. return {
  16506. k: hit.key,
  16507. v: hit.value,
  16508. e: hit.now + (hit.maxAge || 0)
  16509. };
  16510. }
  16511. }, this).toArray().filter(function(h) {
  16512. return h;
  16513. });
  16514. };
  16515. LRUCache.prototype.dumpLru = function() {
  16516. return this[LRU_LIST];
  16517. };
  16518. LRUCache.prototype.inspect = function(n, opts) {
  16519. var str = "LRUCache {";
  16520. var extras = false;
  16521. var as = this[ALLOW_STALE];
  16522. if (as) {
  16523. str += "\n allowStale: true";
  16524. extras = true;
  16525. }
  16526. var max = this[MAX];
  16527. if (max && max !== Infinity) {
  16528. if (extras) {
  16529. str += ",";
  16530. }
  16531. str += "\n max: " + util.inspect(max, opts);
  16532. extras = true;
  16533. }
  16534. var maxAge = this[MAX_AGE];
  16535. if (maxAge) {
  16536. if (extras) {
  16537. str += ",";
  16538. }
  16539. str += "\n maxAge: " + util.inspect(maxAge, opts);
  16540. extras = true;
  16541. }
  16542. var lc = this[LENGTH_CALCULATOR];
  16543. if (lc && lc !== naiveLength) {
  16544. if (extras) {
  16545. str += ",";
  16546. }
  16547. str += "\n length: " + util.inspect(this[LENGTH], opts);
  16548. extras = true;
  16549. }
  16550. var didFirst = false;
  16551. this[LRU_LIST].forEach(function(item) {
  16552. if (didFirst) {
  16553. str += ",\n ";
  16554. } else {
  16555. if (extras) {
  16556. str += ",\n";
  16557. }
  16558. didFirst = true;
  16559. str += "\n ";
  16560. }
  16561. var key = util.inspect(item.key).split("\n").join("\n ");
  16562. var val = {
  16563. value: item.value
  16564. };
  16565. if (item.maxAge !== maxAge) {
  16566. val.maxAge = item.maxAge;
  16567. }
  16568. if (lc !== naiveLength) {
  16569. val.length = item.length;
  16570. }
  16571. if (isStale(this, item)) {
  16572. val.stale = true;
  16573. }
  16574. val = util.inspect(val, opts).split("\n").join("\n ");
  16575. str += key + " => " + val;
  16576. });
  16577. if (didFirst || extras) {
  16578. str += "\n";
  16579. }
  16580. str += "}";
  16581. return str;
  16582. };
  16583. LRUCache.prototype.set = function(key, value, maxAge) {
  16584. maxAge = maxAge || this[MAX_AGE];
  16585. var now = maxAge ? Date.now() : 0;
  16586. var len = this[LENGTH_CALCULATOR](value, key);
  16587. if (this[CACHE].has(key)) {
  16588. if (len > this[MAX]) {
  16589. del(this, this[CACHE].get(key));
  16590. return false;
  16591. }
  16592. var node = this[CACHE].get(key);
  16593. var item = node.value;
  16594. if (this[DISPOSE]) {
  16595. if (!this[NO_DISPOSE_ON_SET]) {
  16596. this[DISPOSE](key, item.value);
  16597. }
  16598. }
  16599. item.now = now;
  16600. item.maxAge = maxAge;
  16601. item.value = value;
  16602. this[LENGTH] += len - item.length;
  16603. item.length = len;
  16604. this.get(key);
  16605. trim(this);
  16606. return true;
  16607. }
  16608. var hit = new Entry(key, value, len, now, maxAge);
  16609. if (hit.length > this[MAX]) {
  16610. if (this[DISPOSE]) {
  16611. this[DISPOSE](key, value);
  16612. }
  16613. return false;
  16614. }
  16615. this[LENGTH] += hit.length;
  16616. this[LRU_LIST].unshift(hit);
  16617. this[CACHE].set(key, this[LRU_LIST].head);
  16618. trim(this);
  16619. return true;
  16620. };
  16621. LRUCache.prototype.has = function(key) {
  16622. if (!this[CACHE].has(key))
  16623. return false;
  16624. var hit = this[CACHE].get(key).value;
  16625. if (isStale(this, hit)) {
  16626. return false;
  16627. }
  16628. return true;
  16629. };
  16630. LRUCache.prototype.get = function(key) {
  16631. return get(this, key, true);
  16632. };
  16633. LRUCache.prototype.peek = function(key) {
  16634. return get(this, key, false);
  16635. };
  16636. LRUCache.prototype.pop = function() {
  16637. var node = this[LRU_LIST].tail;
  16638. if (!node)
  16639. return null;
  16640. del(this, node);
  16641. return node.value;
  16642. };
  16643. LRUCache.prototype.del = function(key) {
  16644. del(this, this[CACHE].get(key));
  16645. };
  16646. LRUCache.prototype.load = function(arr) {
  16647. this.reset();
  16648. var now = Date.now();
  16649. for (var l = arr.length - 1; l >= 0; l--) {
  16650. var hit = arr[l];
  16651. var expiresAt = hit.e || 0;
  16652. if (expiresAt === 0) {
  16653. this.set(hit.k, hit.v);
  16654. } else {
  16655. var maxAge = expiresAt - now;
  16656. if (maxAge > 0) {
  16657. this.set(hit.k, hit.v, maxAge);
  16658. }
  16659. }
  16660. }
  16661. };
  16662. LRUCache.prototype.prune = function() {
  16663. var self2 = this;
  16664. this[CACHE].forEach(function(value, key) {
  16665. get(self2, key, false);
  16666. });
  16667. };
  16668. function get(self2, key, doUse) {
  16669. var node = self2[CACHE].get(key);
  16670. if (node) {
  16671. var hit = node.value;
  16672. if (isStale(self2, hit)) {
  16673. del(self2, node);
  16674. if (!self2[ALLOW_STALE])
  16675. hit = void 0;
  16676. } else {
  16677. if (doUse) {
  16678. self2[LRU_LIST].unshiftNode(node);
  16679. }
  16680. }
  16681. if (hit)
  16682. hit = hit.value;
  16683. }
  16684. return hit;
  16685. }
  16686. function isStale(self2, hit) {
  16687. if (!hit || !hit.maxAge && !self2[MAX_AGE]) {
  16688. return false;
  16689. }
  16690. var stale = false;
  16691. var diff = Date.now() - hit.now;
  16692. if (hit.maxAge) {
  16693. stale = diff > hit.maxAge;
  16694. } else {
  16695. stale = self2[MAX_AGE] && diff > self2[MAX_AGE];
  16696. }
  16697. return stale;
  16698. }
  16699. function trim(self2) {
  16700. if (self2[LENGTH] > self2[MAX]) {
  16701. for (var walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
  16702. var prev = walker.prev;
  16703. del(self2, walker);
  16704. walker = prev;
  16705. }
  16706. }
  16707. }
  16708. function del(self2, node) {
  16709. if (node) {
  16710. var hit = node.value;
  16711. if (self2[DISPOSE]) {
  16712. self2[DISPOSE](hit.key, hit.value);
  16713. }
  16714. self2[LENGTH] -= hit.length;
  16715. self2[CACHE].delete(hit.key);
  16716. self2[LRU_LIST].removeNode(node);
  16717. }
  16718. }
  16719. function Entry(key, value, length, now, maxAge) {
  16720. this.key = key;
  16721. this.value = value;
  16722. this.length = length;
  16723. this.now = now;
  16724. this.maxAge = maxAge || 0;
  16725. }
  16726. }
  16727. });
  16728. var require_sigmund = __commonJS2({
  16729. "node_modules/sigmund/sigmund.js"(exports2, module2) {
  16730. module2.exports = sigmund;
  16731. function sigmund(subject, maxSessions) {
  16732. maxSessions = maxSessions || 10;
  16733. var notes = [];
  16734. var analysis = "";
  16735. var RE = RegExp;
  16736. function psychoAnalyze(subject2, session) {
  16737. if (session > maxSessions)
  16738. return;
  16739. if (typeof subject2 === "function" || typeof subject2 === "undefined") {
  16740. return;
  16741. }
  16742. if (typeof subject2 !== "object" || !subject2 || subject2 instanceof RE) {
  16743. analysis += subject2;
  16744. return;
  16745. }
  16746. if (notes.indexOf(subject2) !== -1 || session === maxSessions)
  16747. return;
  16748. notes.push(subject2);
  16749. analysis += "{";
  16750. Object.keys(subject2).forEach(function(issue, _, __) {
  16751. if (issue.charAt(0) === "_")
  16752. return;
  16753. var to = typeof subject2[issue];
  16754. if (to === "function" || to === "undefined")
  16755. return;
  16756. analysis += issue;
  16757. psychoAnalyze(subject2[issue], session + 1);
  16758. });
  16759. }
  16760. psychoAnalyze(subject, 0);
  16761. return analysis;
  16762. }
  16763. }
  16764. });
  16765. var require_fnmatch = __commonJS2({
  16766. "node_modules/editorconfig/src/lib/fnmatch.js"(exports2, module2) {
  16767. var platform = typeof process === "object" ? process.platform : "win32";
  16768. if (module2)
  16769. module2.exports = minimatch;
  16770. else
  16771. exports2.minimatch = minimatch;
  16772. minimatch.Minimatch = Minimatch;
  16773. var LRU = require_lru_cache();
  16774. var cache = minimatch.cache = new LRU({
  16775. max: 100
  16776. });
  16777. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
  16778. var sigmund = require_sigmund();
  16779. var path = require("path");
  16780. var qmark = "[^/]";
  16781. var star = qmark + "*?";
  16782. var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
  16783. var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
  16784. var reSpecials = charSet("().*{}+?[]^$\\!");
  16785. function charSet(s) {
  16786. return s.split("").reduce(function(set, c) {
  16787. set[c] = true;
  16788. return set;
  16789. }, {});
  16790. }
  16791. var slashSplit = /\/+/;
  16792. minimatch.monkeyPatch = monkeyPatch;
  16793. function monkeyPatch() {
  16794. var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
  16795. var orig = desc.value;
  16796. desc.value = function(p) {
  16797. if (p instanceof Minimatch)
  16798. return p.match(this);
  16799. return orig.call(this, p);
  16800. };
  16801. Object.defineProperty(String.prototype, desc);
  16802. }
  16803. minimatch.filter = filter;
  16804. function filter(pattern, options) {
  16805. options = options || {};
  16806. return function(p, i, list) {
  16807. return minimatch(p, pattern, options);
  16808. };
  16809. }
  16810. function ext(a, b) {
  16811. a = a || {};
  16812. b = b || {};
  16813. var t = {};
  16814. Object.keys(b).forEach(function(k) {
  16815. t[k] = b[k];
  16816. });
  16817. Object.keys(a).forEach(function(k) {
  16818. t[k] = a[k];
  16819. });
  16820. return t;
  16821. }
  16822. minimatch.defaults = function(def) {
  16823. if (!def || !Object.keys(def).length)
  16824. return minimatch;
  16825. var orig = minimatch;
  16826. var m = function minimatch2(p, pattern, options) {
  16827. return orig.minimatch(p, pattern, ext(def, options));
  16828. };
  16829. m.Minimatch = function Minimatch2(pattern, options) {
  16830. return new orig.Minimatch(pattern, ext(def, options));
  16831. };
  16832. return m;
  16833. };
  16834. Minimatch.defaults = function(def) {
  16835. if (!def || !Object.keys(def).length)
  16836. return Minimatch;
  16837. return minimatch.defaults(def).Minimatch;
  16838. };
  16839. function minimatch(p, pattern, options) {
  16840. if (typeof pattern !== "string") {
  16841. throw new TypeError("glob pattern string required");
  16842. }
  16843. if (!options)
  16844. options = {};
  16845. if (!options.nocomment && pattern.charAt(0) === "#") {
  16846. return false;
  16847. }
  16848. if (pattern.trim() === "")
  16849. return p === "";
  16850. return new Minimatch(pattern, options).match(p);
  16851. }
  16852. function Minimatch(pattern, options) {
  16853. if (!(this instanceof Minimatch)) {
  16854. return new Minimatch(pattern, options, cache);
  16855. }
  16856. if (typeof pattern !== "string") {
  16857. throw new TypeError("glob pattern string required");
  16858. }
  16859. if (!options)
  16860. options = {};
  16861. if (platform === "win32") {
  16862. pattern = pattern.split("\\").join("/");
  16863. }
  16864. var cacheKey = pattern + "\n" + sigmund(options);
  16865. var cached = minimatch.cache.get(cacheKey);
  16866. if (cached)
  16867. return cached;
  16868. minimatch.cache.set(cacheKey, this);
  16869. this.options = options;
  16870. this.set = [];
  16871. this.pattern = pattern;
  16872. this.regexp = null;
  16873. this.negate = false;
  16874. this.comment = false;
  16875. this.empty = false;
  16876. this.make();
  16877. }
  16878. Minimatch.prototype.make = make;
  16879. function make() {
  16880. if (this._made)
  16881. return;
  16882. var pattern = this.pattern;
  16883. var options = this.options;
  16884. if (!options.nocomment && pattern.charAt(0) === "#") {
  16885. this.comment = true;
  16886. return;
  16887. }
  16888. if (!pattern) {
  16889. this.empty = true;
  16890. return;
  16891. }
  16892. this.parseNegate();
  16893. var set = this.globSet = this.braceExpand();
  16894. if (options.debug)
  16895. console.error(this.pattern, set);
  16896. set = this.globParts = set.map(function(s) {
  16897. return s.split(slashSplit);
  16898. });
  16899. if (options.debug)
  16900. console.error(this.pattern, set);
  16901. set = set.map(function(s, si, set2) {
  16902. return s.map(this.parse, this);
  16903. }, this);
  16904. if (options.debug)
  16905. console.error(this.pattern, set);
  16906. set = set.filter(function(s) {
  16907. return s.indexOf(false) === -1;
  16908. });
  16909. if (options.debug)
  16910. console.error(this.pattern, set);
  16911. this.set = set;
  16912. }
  16913. Minimatch.prototype.parseNegate = parseNegate;
  16914. function parseNegate() {
  16915. var pattern = this.pattern, negate = false, options = this.options, negateOffset = 0;
  16916. if (options.nonegate)
  16917. return;
  16918. for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
  16919. negate = !negate;
  16920. negateOffset++;
  16921. }
  16922. if (negateOffset)
  16923. this.pattern = pattern.substr(negateOffset);
  16924. this.negate = negate;
  16925. }
  16926. minimatch.braceExpand = function(pattern, options) {
  16927. return new Minimatch(pattern, options).braceExpand();
  16928. };
  16929. Minimatch.prototype.braceExpand = braceExpand;
  16930. function braceExpand(pattern, options) {
  16931. options = options || this.options;
  16932. pattern = typeof pattern === "undefined" ? this.pattern : pattern;
  16933. if (typeof pattern === "undefined") {
  16934. throw new Error("undefined pattern");
  16935. }
  16936. if (options.nobrace || !pattern.match(/\{.*\}/)) {
  16937. return [pattern];
  16938. }
  16939. var escaping = false;
  16940. if (pattern.charAt(0) !== "{") {
  16941. var prefix = null;
  16942. for (var i = 0, l = pattern.length; i < l; i++) {
  16943. var c = pattern.charAt(i);
  16944. if (c === "\\") {
  16945. escaping = !escaping;
  16946. } else if (c === "{" && !escaping) {
  16947. prefix = pattern.substr(0, i);
  16948. break;
  16949. }
  16950. }
  16951. if (prefix === null) {
  16952. return [pattern];
  16953. }
  16954. var tail = braceExpand(pattern.substr(i), options);
  16955. return tail.map(function(t) {
  16956. return prefix + t;
  16957. });
  16958. }
  16959. var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
  16960. if (numset) {
  16961. var suf = braceExpand(pattern.substr(numset[0].length), options), start = +numset[1], end = +numset[2], inc = start > end ? -1 : 1, set = [];
  16962. for (var i = start; i != end + inc; i += inc) {
  16963. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  16964. set.push(i + suf[ii]);
  16965. }
  16966. }
  16967. return set;
  16968. }
  16969. var i = 1, depth = 1, set = [], member = "", sawEnd = false, escaping = false;
  16970. function addMember() {
  16971. set.push(member);
  16972. member = "";
  16973. }
  16974. FOR:
  16975. for (i = 1, l = pattern.length; i < l; i++) {
  16976. var c = pattern.charAt(i);
  16977. if (escaping) {
  16978. escaping = false;
  16979. member += "\\" + c;
  16980. } else {
  16981. switch (c) {
  16982. case "\\":
  16983. escaping = true;
  16984. continue;
  16985. case "{":
  16986. depth++;
  16987. member += "{";
  16988. continue;
  16989. case "}":
  16990. depth--;
  16991. if (depth === 0) {
  16992. addMember();
  16993. i++;
  16994. break FOR;
  16995. } else {
  16996. member += c;
  16997. continue;
  16998. }
  16999. case ",":
  17000. if (depth === 1) {
  17001. addMember();
  17002. } else {
  17003. member += c;
  17004. }
  17005. continue;
  17006. default:
  17007. member += c;
  17008. continue;
  17009. }
  17010. }
  17011. }
  17012. if (depth !== 0) {
  17013. return braceExpand("\\" + pattern, options);
  17014. }
  17015. var suf = braceExpand(pattern.substr(i), options);
  17016. var addBraces = set.length === 1;
  17017. set = set.map(function(p) {
  17018. return braceExpand(p, options);
  17019. });
  17020. set = set.reduce(function(l2, r) {
  17021. return l2.concat(r);
  17022. });
  17023. if (addBraces) {
  17024. set = set.map(function(s) {
  17025. return "{" + s + "}";
  17026. });
  17027. }
  17028. var ret = [];
  17029. for (var i = 0, l = set.length; i < l; i++) {
  17030. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  17031. ret.push(set[i] + suf[ii]);
  17032. }
  17033. }
  17034. return ret;
  17035. }
  17036. Minimatch.prototype.parse = parse;
  17037. var SUBPARSE = {};
  17038. function parse(pattern, isSub) {
  17039. var options = this.options;
  17040. if (!options.noglobstar && pattern === "**")
  17041. return GLOBSTAR;
  17042. if (pattern === "")
  17043. return "";
  17044. var re = "", hasMagic = !!options.nocase, escaping = false, patternListStack = [], plType, stateChar, inClass = false, reClassStart = -1, classStart = -1, patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
  17045. function clearStateChar() {
  17046. if (stateChar) {
  17047. switch (stateChar) {
  17048. case "*":
  17049. re += star;
  17050. hasMagic = true;
  17051. break;
  17052. case "?":
  17053. re += qmark;
  17054. hasMagic = true;
  17055. break;
  17056. default:
  17057. re += "\\" + stateChar;
  17058. break;
  17059. }
  17060. stateChar = false;
  17061. }
  17062. }
  17063. for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
  17064. if (options.debug) {
  17065. console.error("%s %s %s %j", pattern, i, re, c);
  17066. }
  17067. if (escaping && reSpecials[c]) {
  17068. re += "\\" + c;
  17069. escaping = false;
  17070. continue;
  17071. }
  17072. SWITCH:
  17073. switch (c) {
  17074. case "/":
  17075. return false;
  17076. case "\\":
  17077. clearStateChar();
  17078. escaping = true;
  17079. continue;
  17080. case "?":
  17081. case "*":
  17082. case "+":
  17083. case "@":
  17084. case "!":
  17085. if (options.debug) {
  17086. console.error("%s %s %s %j <-- stateChar", pattern, i, re, c);
  17087. }
  17088. if (inClass) {
  17089. if (c === "!" && i === classStart + 1)
  17090. c = "^";
  17091. re += c;
  17092. continue;
  17093. }
  17094. clearStateChar();
  17095. stateChar = c;
  17096. if (options.noext)
  17097. clearStateChar();
  17098. continue;
  17099. case "(":
  17100. if (inClass) {
  17101. re += "(";
  17102. continue;
  17103. }
  17104. if (!stateChar) {
  17105. re += "\\(";
  17106. continue;
  17107. }
  17108. plType = stateChar;
  17109. patternListStack.push({
  17110. type: plType,
  17111. start: i - 1,
  17112. reStart: re.length
  17113. });
  17114. re += stateChar === "!" ? "(?:(?!" : "(?:";
  17115. stateChar = false;
  17116. continue;
  17117. case ")":
  17118. if (inClass || !patternListStack.length) {
  17119. re += "\\)";
  17120. continue;
  17121. }
  17122. hasMagic = true;
  17123. re += ")";
  17124. plType = patternListStack.pop().type;
  17125. switch (plType) {
  17126. case "!":
  17127. re += "[^/]*?)";
  17128. break;
  17129. case "?":
  17130. case "+":
  17131. case "*":
  17132. re += plType;
  17133. case "@":
  17134. break;
  17135. }
  17136. continue;
  17137. case "|":
  17138. if (inClass || !patternListStack.length || escaping) {
  17139. re += "\\|";
  17140. escaping = false;
  17141. continue;
  17142. }
  17143. re += "|";
  17144. continue;
  17145. case "[":
  17146. clearStateChar();
  17147. if (inClass) {
  17148. re += "\\" + c;
  17149. continue;
  17150. }
  17151. inClass = true;
  17152. classStart = i;
  17153. reClassStart = re.length;
  17154. re += c;
  17155. continue;
  17156. case "]":
  17157. if (i === classStart + 1 || !inClass) {
  17158. re += "\\" + c;
  17159. escaping = false;
  17160. continue;
  17161. }
  17162. hasMagic = true;
  17163. inClass = false;
  17164. re += c;
  17165. continue;
  17166. default:
  17167. clearStateChar();
  17168. if (escaping) {
  17169. escaping = false;
  17170. } else if (reSpecials[c] && !(c === "^" && inClass)) {
  17171. re += "\\";
  17172. }
  17173. re += c;
  17174. }
  17175. }
  17176. if (inClass) {
  17177. var cs = pattern.substr(classStart + 1), sp = this.parse(cs, SUBPARSE);
  17178. re = re.substr(0, reClassStart) + "\\[" + sp[0];
  17179. hasMagic = hasMagic || sp[1];
  17180. }
  17181. var pl;
  17182. while (pl = patternListStack.pop()) {
  17183. var tail = re.slice(pl.reStart + 3);
  17184. tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function(_, $1, $2) {
  17185. if (!$2) {
  17186. $2 = "\\";
  17187. }
  17188. return $1 + $1 + $2 + "|";
  17189. });
  17190. var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
  17191. hasMagic = true;
  17192. re = re.slice(0, pl.reStart) + t + "\\(" + tail;
  17193. }
  17194. clearStateChar();
  17195. if (escaping) {
  17196. re += "\\\\";
  17197. }
  17198. var addPatternStart = false;
  17199. switch (re.charAt(0)) {
  17200. case ".":
  17201. case "[":
  17202. case "(":
  17203. addPatternStart = true;
  17204. }
  17205. if (re !== "" && hasMagic)
  17206. re = "(?=.)" + re;
  17207. if (addPatternStart)
  17208. re = patternStart + re;
  17209. if (isSub === SUBPARSE) {
  17210. return [re, hasMagic];
  17211. }
  17212. if (!hasMagic) {
  17213. return globUnescape(pattern);
  17214. }
  17215. var flags = options.nocase ? "i" : "", regExp = new RegExp("^" + re + "$", flags);
  17216. regExp._glob = pattern;
  17217. regExp._src = re;
  17218. return regExp;
  17219. }
  17220. minimatch.makeRe = function(pattern, options) {
  17221. return new Minimatch(pattern, options || {}).makeRe();
  17222. };
  17223. Minimatch.prototype.makeRe = makeRe;
  17224. function makeRe() {
  17225. if (this.regexp || this.regexp === false)
  17226. return this.regexp;
  17227. var set = this.set;
  17228. if (!set.length)
  17229. return this.regexp = false;
  17230. var options = this.options;
  17231. var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot, flags = options.nocase ? "i" : "";
  17232. var re = set.map(function(pattern) {
  17233. return pattern.map(function(p) {
  17234. return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
  17235. }).join("\\/");
  17236. }).join("|");
  17237. re = "^(?:" + re + ")$";
  17238. if (this.negate)
  17239. re = "^(?!" + re + ").*$";
  17240. try {
  17241. return this.regexp = new RegExp(re, flags);
  17242. } catch (ex) {
  17243. return this.regexp = false;
  17244. }
  17245. }
  17246. minimatch.match = function(list, pattern, options) {
  17247. var mm = new Minimatch(pattern, options);
  17248. list = list.filter(function(f) {
  17249. return mm.match(f);
  17250. });
  17251. if (options.nonull && !list.length) {
  17252. list.push(pattern);
  17253. }
  17254. return list;
  17255. };
  17256. Minimatch.prototype.match = match;
  17257. function match(f, partial) {
  17258. if (this.comment)
  17259. return false;
  17260. if (this.empty)
  17261. return f === "";
  17262. if (f === "/" && partial)
  17263. return true;
  17264. var options = this.options;
  17265. if (platform === "win32") {
  17266. f = f.split("\\").join("/");
  17267. }
  17268. f = f.split(slashSplit);
  17269. if (options.debug) {
  17270. console.error(this.pattern, "split", f);
  17271. }
  17272. var set = this.set;
  17273. for (var i = 0, l = set.length; i < l; i++) {
  17274. var pattern = set[i];
  17275. var hit = this.matchOne(f, pattern, partial);
  17276. if (hit) {
  17277. if (options.flipNegate)
  17278. return true;
  17279. return !this.negate;
  17280. }
  17281. }
  17282. if (options.flipNegate)
  17283. return false;
  17284. return this.negate;
  17285. }
  17286. Minimatch.prototype.matchOne = function(file, pattern, partial) {
  17287. var options = this.options;
  17288. if (options.debug) {
  17289. console.error("matchOne", {
  17290. "this": this,
  17291. file,
  17292. pattern
  17293. });
  17294. }
  17295. if (options.matchBase && pattern.length === 1) {
  17296. file = path.basename(file.join("/")).split("/");
  17297. }
  17298. if (options.debug) {
  17299. console.error("matchOne", file.length, pattern.length);
  17300. }
  17301. for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
  17302. if (options.debug) {
  17303. console.error("matchOne loop");
  17304. }
  17305. var p = pattern[pi], f = file[fi];
  17306. if (options.debug) {
  17307. console.error(pattern, p, f);
  17308. }
  17309. if (p === false)
  17310. return false;
  17311. if (p === GLOBSTAR) {
  17312. if (options.debug)
  17313. console.error("GLOBSTAR", [pattern, p, f]);
  17314. var fr = fi, pr = pi + 1;
  17315. if (pr === pl) {
  17316. if (options.debug)
  17317. console.error("** at the end");
  17318. for (; fi < fl; fi++) {
  17319. if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
  17320. return false;
  17321. }
  17322. return true;
  17323. }
  17324. WHILE:
  17325. while (fr < fl) {
  17326. var swallowee = file[fr];
  17327. if (options.debug) {
  17328. console.error("\nglobstar while", file, fr, pattern, pr, swallowee);
  17329. }
  17330. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  17331. if (options.debug)
  17332. console.error("globstar found match!", fr, fl, swallowee);
  17333. return true;
  17334. } else {
  17335. if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
  17336. if (options.debug)
  17337. console.error("dot detected!", file, fr, pattern, pr);
  17338. break WHILE;
  17339. }
  17340. if (options.debug)
  17341. console.error("globstar swallow a segment, and continue");
  17342. fr++;
  17343. }
  17344. }
  17345. if (partial) {
  17346. if (fr === fl)
  17347. return true;
  17348. }
  17349. return false;
  17350. }
  17351. var hit;
  17352. if (typeof p === "string") {
  17353. if (options.nocase) {
  17354. hit = f.toLowerCase() === p.toLowerCase();
  17355. } else {
  17356. hit = f === p;
  17357. }
  17358. if (options.debug) {
  17359. console.error("string match", p, f, hit);
  17360. }
  17361. } else {
  17362. hit = f.match(p);
  17363. if (options.debug) {
  17364. console.error("pattern match", p, f, hit);
  17365. }
  17366. }
  17367. if (!hit)
  17368. return false;
  17369. }
  17370. if (fi === fl && pi === pl) {
  17371. return true;
  17372. } else if (fi === fl) {
  17373. return partial;
  17374. } else if (pi === pl) {
  17375. var emptyFileEnd = fi === fl - 1 && file[fi] === "";
  17376. return emptyFileEnd;
  17377. }
  17378. throw new Error("wtf?");
  17379. };
  17380. function globUnescape(s) {
  17381. return s.replace(/\\(.)/g, "$1");
  17382. }
  17383. function regExpEscape(s) {
  17384. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  17385. }
  17386. }
  17387. });
  17388. var require_ini = __commonJS2({
  17389. "node_modules/editorconfig/src/lib/ini.js"(exports2) {
  17390. "use strict";
  17391. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17392. return new (P || (P = Promise))(function(resolve, reject) {
  17393. function fulfilled(value) {
  17394. try {
  17395. step(generator.next(value));
  17396. } catch (e) {
  17397. reject(e);
  17398. }
  17399. }
  17400. function rejected(value) {
  17401. try {
  17402. step(generator["throw"](value));
  17403. } catch (e) {
  17404. reject(e);
  17405. }
  17406. }
  17407. function step(result) {
  17408. result.done ? resolve(result.value) : new P(function(resolve2) {
  17409. resolve2(result.value);
  17410. }).then(fulfilled, rejected);
  17411. }
  17412. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17413. });
  17414. };
  17415. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17416. var _ = {
  17417. label: 0,
  17418. sent: function() {
  17419. if (t[0] & 1)
  17420. throw t[1];
  17421. return t[1];
  17422. },
  17423. trys: [],
  17424. ops: []
  17425. }, f, y, t, g;
  17426. return g = {
  17427. next: verb(0),
  17428. "throw": verb(1),
  17429. "return": verb(2)
  17430. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17431. return this;
  17432. }), g;
  17433. function verb(n) {
  17434. return function(v) {
  17435. return step([n, v]);
  17436. };
  17437. }
  17438. function step(op) {
  17439. if (f)
  17440. throw new TypeError("Generator is already executing.");
  17441. while (_)
  17442. try {
  17443. 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)
  17444. return t;
  17445. if (y = 0, t)
  17446. op = [op[0] & 2, t.value];
  17447. switch (op[0]) {
  17448. case 0:
  17449. case 1:
  17450. t = op;
  17451. break;
  17452. case 4:
  17453. _.label++;
  17454. return {
  17455. value: op[1],
  17456. done: false
  17457. };
  17458. case 5:
  17459. _.label++;
  17460. y = op[1];
  17461. op = [0];
  17462. continue;
  17463. case 7:
  17464. op = _.ops.pop();
  17465. _.trys.pop();
  17466. continue;
  17467. default:
  17468. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17469. _ = 0;
  17470. continue;
  17471. }
  17472. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17473. _.label = op[1];
  17474. break;
  17475. }
  17476. if (op[0] === 6 && _.label < t[1]) {
  17477. _.label = t[1];
  17478. t = op;
  17479. break;
  17480. }
  17481. if (t && _.label < t[2]) {
  17482. _.label = t[2];
  17483. _.ops.push(op);
  17484. break;
  17485. }
  17486. if (t[2])
  17487. _.ops.pop();
  17488. _.trys.pop();
  17489. continue;
  17490. }
  17491. op = body.call(thisArg, _);
  17492. } catch (e) {
  17493. op = [6, e];
  17494. y = 0;
  17495. } finally {
  17496. f = t = 0;
  17497. }
  17498. if (op[0] & 5)
  17499. throw op[1];
  17500. return {
  17501. value: op[0] ? op[1] : void 0,
  17502. done: true
  17503. };
  17504. }
  17505. };
  17506. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17507. if (mod && mod.__esModule)
  17508. return mod;
  17509. var result = {};
  17510. if (mod != null) {
  17511. for (var k in mod)
  17512. if (Object.hasOwnProperty.call(mod, k))
  17513. result[k] = mod[k];
  17514. }
  17515. result["default"] = mod;
  17516. return result;
  17517. };
  17518. Object.defineProperty(exports2, "__esModule", {
  17519. value: true
  17520. });
  17521. var fs = __importStar2(require("fs"));
  17522. var regex = {
  17523. section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
  17524. param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
  17525. comment: /^\s*[#;].*$/
  17526. };
  17527. function parse(file) {
  17528. return __awaiter2(this, void 0, void 0, function() {
  17529. return __generator2(this, function(_a) {
  17530. return [2, new Promise(function(resolve, reject) {
  17531. fs.readFile(file, "utf8", function(err, data) {
  17532. if (err) {
  17533. reject(err);
  17534. return;
  17535. }
  17536. resolve(parseString(data));
  17537. });
  17538. })];
  17539. });
  17540. });
  17541. }
  17542. exports2.parse = parse;
  17543. function parseSync(file) {
  17544. return parseString(fs.readFileSync(file, "utf8"));
  17545. }
  17546. exports2.parseSync = parseSync;
  17547. function parseString(data) {
  17548. var sectionBody = {};
  17549. var sectionName = null;
  17550. var value = [[sectionName, sectionBody]];
  17551. var lines = data.split(/\r\n|\r|\n/);
  17552. lines.forEach(function(line) {
  17553. var match;
  17554. if (regex.comment.test(line)) {
  17555. return;
  17556. }
  17557. if (regex.param.test(line)) {
  17558. match = line.match(regex.param);
  17559. sectionBody[match[1]] = match[2];
  17560. } else if (regex.section.test(line)) {
  17561. match = line.match(regex.section);
  17562. sectionName = match[1];
  17563. sectionBody = {};
  17564. value.push([sectionName, sectionBody]);
  17565. }
  17566. });
  17567. return value;
  17568. }
  17569. exports2.parseString = parseString;
  17570. }
  17571. });
  17572. var require_package = __commonJS2({
  17573. "node_modules/editorconfig/package.json"(exports2, module2) {
  17574. module2.exports = {
  17575. name: "editorconfig",
  17576. version: "0.15.3",
  17577. description: "EditorConfig File Locator and Interpreter for Node.js",
  17578. keywords: ["editorconfig", "core"],
  17579. main: "src/index.js",
  17580. contributors: ["Hong Xu (topbug.net)", "Jed Mao (https://github.com/jedmao/)", "Trey Hunner (http://treyhunner.com)"],
  17581. directories: {
  17582. bin: "./bin",
  17583. lib: "./lib"
  17584. },
  17585. scripts: {
  17586. clean: "rimraf dist",
  17587. prebuild: "npm run clean",
  17588. build: "tsc",
  17589. pretest: "npm run lint && npm run build && npm run copy && cmake .",
  17590. test: "ctest .",
  17591. "pretest:ci": "npm run pretest",
  17592. "test:ci": "ctest -VV --output-on-failure .",
  17593. lint: "npm run eclint && npm run tslint",
  17594. eclint: 'eclint check --indent_size ignore "src/**"',
  17595. tslint: "tslint --project tsconfig.json --exclude package.json",
  17596. copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
  17597. prepub: "npm run lint && npm run build && npm run copy",
  17598. pub: "npm publish ./dist"
  17599. },
  17600. repository: {
  17601. type: "git",
  17602. url: "git://github.com/editorconfig/editorconfig-core-js.git"
  17603. },
  17604. bugs: "https://github.com/editorconfig/editorconfig-core-js/issues",
  17605. author: "EditorConfig Team",
  17606. license: "MIT",
  17607. dependencies: {
  17608. commander: "^2.19.0",
  17609. "lru-cache": "^4.1.5",
  17610. semver: "^5.6.0",
  17611. sigmund: "^1.0.1"
  17612. },
  17613. devDependencies: {
  17614. "@types/mocha": "^5.2.6",
  17615. "@types/node": "^10.12.29",
  17616. "@types/semver": "^5.5.0",
  17617. "cpy-cli": "^2.0.0",
  17618. eclint: "^2.8.1",
  17619. mocha: "^5.2.0",
  17620. rimraf: "^2.6.3",
  17621. should: "^13.2.3",
  17622. tslint: "^5.13.1",
  17623. typescript: "^3.3.3333"
  17624. }
  17625. };
  17626. }
  17627. });
  17628. var require_src2 = __commonJS2({
  17629. "node_modules/editorconfig/src/index.js"(exports2) {
  17630. "use strict";
  17631. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17632. return new (P || (P = Promise))(function(resolve, reject) {
  17633. function fulfilled(value) {
  17634. try {
  17635. step(generator.next(value));
  17636. } catch (e) {
  17637. reject(e);
  17638. }
  17639. }
  17640. function rejected(value) {
  17641. try {
  17642. step(generator["throw"](value));
  17643. } catch (e) {
  17644. reject(e);
  17645. }
  17646. }
  17647. function step(result) {
  17648. result.done ? resolve(result.value) : new P(function(resolve2) {
  17649. resolve2(result.value);
  17650. }).then(fulfilled, rejected);
  17651. }
  17652. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17653. });
  17654. };
  17655. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17656. var _ = {
  17657. label: 0,
  17658. sent: function() {
  17659. if (t[0] & 1)
  17660. throw t[1];
  17661. return t[1];
  17662. },
  17663. trys: [],
  17664. ops: []
  17665. }, f, y, t, g;
  17666. return g = {
  17667. next: verb(0),
  17668. "throw": verb(1),
  17669. "return": verb(2)
  17670. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17671. return this;
  17672. }), g;
  17673. function verb(n) {
  17674. return function(v) {
  17675. return step([n, v]);
  17676. };
  17677. }
  17678. function step(op) {
  17679. if (f)
  17680. throw new TypeError("Generator is already executing.");
  17681. while (_)
  17682. try {
  17683. 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)
  17684. return t;
  17685. if (y = 0, t)
  17686. op = [op[0] & 2, t.value];
  17687. switch (op[0]) {
  17688. case 0:
  17689. case 1:
  17690. t = op;
  17691. break;
  17692. case 4:
  17693. _.label++;
  17694. return {
  17695. value: op[1],
  17696. done: false
  17697. };
  17698. case 5:
  17699. _.label++;
  17700. y = op[1];
  17701. op = [0];
  17702. continue;
  17703. case 7:
  17704. op = _.ops.pop();
  17705. _.trys.pop();
  17706. continue;
  17707. default:
  17708. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17709. _ = 0;
  17710. continue;
  17711. }
  17712. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17713. _.label = op[1];
  17714. break;
  17715. }
  17716. if (op[0] === 6 && _.label < t[1]) {
  17717. _.label = t[1];
  17718. t = op;
  17719. break;
  17720. }
  17721. if (t && _.label < t[2]) {
  17722. _.label = t[2];
  17723. _.ops.push(op);
  17724. break;
  17725. }
  17726. if (t[2])
  17727. _.ops.pop();
  17728. _.trys.pop();
  17729. continue;
  17730. }
  17731. op = body.call(thisArg, _);
  17732. } catch (e) {
  17733. op = [6, e];
  17734. y = 0;
  17735. } finally {
  17736. f = t = 0;
  17737. }
  17738. if (op[0] & 5)
  17739. throw op[1];
  17740. return {
  17741. value: op[0] ? op[1] : void 0,
  17742. done: true
  17743. };
  17744. }
  17745. };
  17746. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17747. if (mod && mod.__esModule)
  17748. return mod;
  17749. var result = {};
  17750. if (mod != null) {
  17751. for (var k in mod)
  17752. if (Object.hasOwnProperty.call(mod, k))
  17753. result[k] = mod[k];
  17754. }
  17755. result["default"] = mod;
  17756. return result;
  17757. };
  17758. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  17759. return mod && mod.__esModule ? mod : {
  17760. "default": mod
  17761. };
  17762. };
  17763. Object.defineProperty(exports2, "__esModule", {
  17764. value: true
  17765. });
  17766. var fs = __importStar2(require("fs"));
  17767. var path = __importStar2(require("path"));
  17768. var semver = {
  17769. gte: require_gte()
  17770. };
  17771. var fnmatch_1 = __importDefault2(require_fnmatch());
  17772. var ini_1 = require_ini();
  17773. exports2.parseString = ini_1.parseString;
  17774. var package_json_1 = __importDefault2(require_package());
  17775. var knownProps = {
  17776. end_of_line: true,
  17777. indent_style: true,
  17778. indent_size: true,
  17779. insert_final_newline: true,
  17780. trim_trailing_whitespace: true,
  17781. charset: true
  17782. };
  17783. function fnmatch(filepath, glob) {
  17784. var matchOptions = {
  17785. matchBase: true,
  17786. dot: true,
  17787. noext: true
  17788. };
  17789. glob = glob.replace(/\*\*/g, "{*,**/**/**}");
  17790. return fnmatch_1.default(filepath, glob, matchOptions);
  17791. }
  17792. function getConfigFileNames(filepath, options) {
  17793. var paths = [];
  17794. do {
  17795. filepath = path.dirname(filepath);
  17796. paths.push(path.join(filepath, options.config));
  17797. } while (filepath !== options.root);
  17798. return paths;
  17799. }
  17800. function processMatches(matches, version2) {
  17801. if ("indent_style" in matches && matches.indent_style === "tab" && !("indent_size" in matches) && semver.gte(version2, "0.10.0")) {
  17802. matches.indent_size = "tab";
  17803. }
  17804. if ("indent_size" in matches && !("tab_width" in matches) && matches.indent_size !== "tab") {
  17805. matches.tab_width = matches.indent_size;
  17806. }
  17807. if ("indent_size" in matches && "tab_width" in matches && matches.indent_size === "tab") {
  17808. matches.indent_size = matches.tab_width;
  17809. }
  17810. return matches;
  17811. }
  17812. function processOptions(options, filepath) {
  17813. if (options === void 0) {
  17814. options = {};
  17815. }
  17816. return {
  17817. config: options.config || ".editorconfig",
  17818. version: options.version || package_json_1.default.version,
  17819. root: path.resolve(options.root || path.parse(filepath).root)
  17820. };
  17821. }
  17822. function buildFullGlob(pathPrefix, glob) {
  17823. switch (glob.indexOf("/")) {
  17824. case -1:
  17825. glob = "**/" + glob;
  17826. break;
  17827. case 0:
  17828. glob = glob.substring(1);
  17829. break;
  17830. default:
  17831. break;
  17832. }
  17833. return path.join(pathPrefix, glob);
  17834. }
  17835. function extendProps(props, options) {
  17836. if (props === void 0) {
  17837. props = {};
  17838. }
  17839. if (options === void 0) {
  17840. options = {};
  17841. }
  17842. for (var key in options) {
  17843. if (options.hasOwnProperty(key)) {
  17844. var value = options[key];
  17845. var key2 = key.toLowerCase();
  17846. var value2 = value;
  17847. if (knownProps[key2]) {
  17848. value2 = value.toLowerCase();
  17849. }
  17850. try {
  17851. value2 = JSON.parse(value);
  17852. } catch (e) {
  17853. }
  17854. if (typeof value === "undefined" || value === null) {
  17855. value2 = String(value);
  17856. }
  17857. props[key2] = value2;
  17858. }
  17859. }
  17860. return props;
  17861. }
  17862. function parseFromConfigs(configs, filepath, options) {
  17863. return processMatches(configs.reverse().reduce(function(matches, file) {
  17864. var pathPrefix = path.dirname(file.name);
  17865. file.contents.forEach(function(section) {
  17866. var glob = section[0];
  17867. var options2 = section[1];
  17868. if (!glob) {
  17869. return;
  17870. }
  17871. var fullGlob = buildFullGlob(pathPrefix, glob);
  17872. if (!fnmatch(filepath, fullGlob)) {
  17873. return;
  17874. }
  17875. matches = extendProps(matches, options2);
  17876. });
  17877. return matches;
  17878. }, {}), options.version);
  17879. }
  17880. function getConfigsForFiles(files) {
  17881. var configs = [];
  17882. for (var i in files) {
  17883. if (files.hasOwnProperty(i)) {
  17884. var file = files[i];
  17885. var contents = ini_1.parseString(file.contents);
  17886. configs.push({
  17887. name: file.name,
  17888. contents
  17889. });
  17890. if ((contents[0][1].root || "").toLowerCase() === "true") {
  17891. break;
  17892. }
  17893. }
  17894. }
  17895. return configs;
  17896. }
  17897. function readConfigFiles(filepaths) {
  17898. return __awaiter2(this, void 0, void 0, function() {
  17899. return __generator2(this, function(_a) {
  17900. return [2, Promise.all(filepaths.map(function(name) {
  17901. return new Promise(function(resolve) {
  17902. fs.readFile(name, "utf8", function(err, data) {
  17903. resolve({
  17904. name,
  17905. contents: err ? "" : data
  17906. });
  17907. });
  17908. });
  17909. }))];
  17910. });
  17911. });
  17912. }
  17913. function readConfigFilesSync(filepaths) {
  17914. var files = [];
  17915. var file;
  17916. filepaths.forEach(function(filepath) {
  17917. try {
  17918. file = fs.readFileSync(filepath, "utf8");
  17919. } catch (e) {
  17920. file = "";
  17921. }
  17922. files.push({
  17923. name: filepath,
  17924. contents: file
  17925. });
  17926. });
  17927. return files;
  17928. }
  17929. function opts(filepath, options) {
  17930. if (options === void 0) {
  17931. options = {};
  17932. }
  17933. var resolvedFilePath = path.resolve(filepath);
  17934. return [resolvedFilePath, processOptions(options, resolvedFilePath)];
  17935. }
  17936. function parseFromFiles(filepath, files, options) {
  17937. if (options === void 0) {
  17938. options = {};
  17939. }
  17940. return __awaiter2(this, void 0, void 0, function() {
  17941. var _a, resolvedFilePath, processedOptions;
  17942. return __generator2(this, function(_b) {
  17943. _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17944. return [2, files.then(getConfigsForFiles).then(function(configs) {
  17945. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  17946. })];
  17947. });
  17948. });
  17949. }
  17950. exports2.parseFromFiles = parseFromFiles;
  17951. function parseFromFilesSync(filepath, files, options) {
  17952. if (options === void 0) {
  17953. options = {};
  17954. }
  17955. var _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17956. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  17957. }
  17958. exports2.parseFromFilesSync = parseFromFilesSync;
  17959. function parse(_filepath, _options) {
  17960. if (_options === void 0) {
  17961. _options = {};
  17962. }
  17963. return __awaiter2(this, void 0, void 0, function() {
  17964. var _a, resolvedFilePath, processedOptions, filepaths;
  17965. return __generator2(this, function(_b) {
  17966. _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17967. filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  17968. return [2, readConfigFiles(filepaths).then(getConfigsForFiles).then(function(configs) {
  17969. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  17970. })];
  17971. });
  17972. });
  17973. }
  17974. exports2.parse = parse;
  17975. function parseSync(_filepath, _options) {
  17976. if (_options === void 0) {
  17977. _options = {};
  17978. }
  17979. var _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17980. var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  17981. var files = readConfigFilesSync(filepaths);
  17982. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  17983. }
  17984. exports2.parseSync = parseSync;
  17985. }
  17986. });
  17987. var require_editorconfig_to_prettier = __commonJS2({
  17988. "node_modules/editorconfig-to-prettier/index.js"(exports2, module2) {
  17989. module2.exports = editorConfigToPrettier;
  17990. function removeUnset(editorConfig) {
  17991. const result = {};
  17992. const keys = Object.keys(editorConfig);
  17993. for (let i = 0; i < keys.length; i++) {
  17994. const key = keys[i];
  17995. if (editorConfig[key] === "unset") {
  17996. continue;
  17997. }
  17998. result[key] = editorConfig[key];
  17999. }
  18000. return result;
  18001. }
  18002. function editorConfigToPrettier(editorConfig) {
  18003. if (!editorConfig) {
  18004. return null;
  18005. }
  18006. editorConfig = removeUnset(editorConfig);
  18007. if (Object.keys(editorConfig).length === 0) {
  18008. return null;
  18009. }
  18010. const result = {};
  18011. if (editorConfig.indent_style) {
  18012. result.useTabs = editorConfig.indent_style === "tab";
  18013. }
  18014. if (editorConfig.indent_size === "tab") {
  18015. result.useTabs = true;
  18016. }
  18017. if (result.useTabs && editorConfig.tab_width) {
  18018. result.tabWidth = editorConfig.tab_width;
  18019. } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
  18020. result.tabWidth = editorConfig.indent_size;
  18021. } else if (editorConfig.tab_width !== void 0) {
  18022. result.tabWidth = editorConfig.tab_width;
  18023. }
  18024. if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") {
  18025. result.printWidth = editorConfig.max_line_length;
  18026. }
  18027. if (editorConfig.quote_type === "single") {
  18028. result.singleQuote = true;
  18029. } else if (editorConfig.quote_type === "double") {
  18030. result.singleQuote = false;
  18031. }
  18032. if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) {
  18033. result.endOfLine = editorConfig.end_of_line;
  18034. }
  18035. if (editorConfig.insert_final_newline === false || editorConfig.insert_final_newline === true) {
  18036. result.insertFinalNewline = editorConfig.insert_final_newline;
  18037. }
  18038. return result;
  18039. }
  18040. }
  18041. });
  18042. var require_find_project_root = __commonJS2({
  18043. "src/config/find-project-root.js"(exports2, module2) {
  18044. "use strict";
  18045. var fs = require("fs");
  18046. var path = require("path");
  18047. var MARKERS = [".git", ".hg"];
  18048. var markerExists = (directory) => MARKERS.some((mark) => fs.existsSync(path.join(directory, mark)));
  18049. function findProjectRoot(directory) {
  18050. while (!markerExists(directory)) {
  18051. const parentDirectory = path.resolve(directory, "..");
  18052. if (parentDirectory === directory) {
  18053. break;
  18054. }
  18055. directory = parentDirectory;
  18056. }
  18057. return directory;
  18058. }
  18059. module2.exports = findProjectRoot;
  18060. }
  18061. });
  18062. var require_resolve_config_editorconfig = __commonJS2({
  18063. "src/config/resolve-config-editorconfig.js"(exports2, module2) {
  18064. "use strict";
  18065. var path = require("path");
  18066. var editorconfig = require_src2();
  18067. var editorConfigToPrettier = require_editorconfig_to_prettier();
  18068. var {
  18069. default: mem2,
  18070. memClear: memClear2
  18071. } = (init_dist(), __toCommonJS(dist_exports));
  18072. var findProjectRoot = require_find_project_root();
  18073. var jsonStringifyMem = (fn) => mem2(fn, {
  18074. cacheKey: JSON.stringify
  18075. });
  18076. var maybeParse = (filePath, parse) => filePath && parse(filePath, {
  18077. root: findProjectRoot(path.dirname(path.resolve(filePath)))
  18078. });
  18079. var editorconfigAsyncNoCache = async (filePath) => editorConfigToPrettier(await maybeParse(filePath, editorconfig.parse));
  18080. var editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache);
  18081. var editorconfigSyncNoCache = (filePath) => editorConfigToPrettier(maybeParse(filePath, editorconfig.parseSync));
  18082. var editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache);
  18083. function getLoadFunction(opts) {
  18084. if (!opts.editorconfig) {
  18085. return () => null;
  18086. }
  18087. if (opts.sync) {
  18088. return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache;
  18089. }
  18090. return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache;
  18091. }
  18092. function clearCache() {
  18093. memClear2(editorconfigSyncWithCache);
  18094. memClear2(editorconfigAsyncWithCache);
  18095. }
  18096. module2.exports = {
  18097. getLoadFunction,
  18098. clearCache
  18099. };
  18100. }
  18101. });
  18102. var require_resolve_config = __commonJS2({
  18103. "src/config/resolve-config.js"(exports2, module2) {
  18104. "use strict";
  18105. var path = require("path");
  18106. var micromatch = require_micromatch();
  18107. var thirdParty = require("./third-party.js");
  18108. var loadToml = require_load_toml();
  18109. var loadJson5 = require_load_json5();
  18110. var partition = require_partition();
  18111. var resolve = require_resolve2();
  18112. var {
  18113. default: mem2,
  18114. memClear: memClear2
  18115. } = (init_dist(), __toCommonJS(dist_exports));
  18116. var resolveEditorConfig = require_resolve_config_editorconfig();
  18117. var getExplorerMemoized = mem2((opts) => {
  18118. const cosmiconfig = thirdParty["cosmiconfig" + (opts.sync ? "Sync" : "")];
  18119. const explorer = cosmiconfig("prettier", {
  18120. cache: opts.cache,
  18121. transform: (result) => {
  18122. if (result && result.config) {
  18123. if (typeof result.config === "string") {
  18124. const dir = path.dirname(result.filepath);
  18125. const modulePath = resolve(result.config, {
  18126. paths: [dir]
  18127. });
  18128. result.config = require(modulePath);
  18129. }
  18130. if (typeof result.config !== "object") {
  18131. throw new TypeError(`Config is only allowed to be an object, but received ${typeof result.config} in "${result.filepath}"`);
  18132. }
  18133. delete result.config.$schema;
  18134. }
  18135. return result;
  18136. },
  18137. searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.json5", ".prettierrc.js", ".prettierrc.cjs", "prettier.config.js", "prettier.config.cjs", ".prettierrc.toml"],
  18138. loaders: {
  18139. ".toml": loadToml,
  18140. ".json5": loadJson5
  18141. }
  18142. });
  18143. return explorer;
  18144. }, {
  18145. cacheKey: JSON.stringify
  18146. });
  18147. function getExplorer(opts) {
  18148. opts = Object.assign({
  18149. sync: false,
  18150. cache: false
  18151. }, opts);
  18152. return getExplorerMemoized(opts);
  18153. }
  18154. function _resolveConfig(filePath, opts, sync) {
  18155. opts = Object.assign({
  18156. useCache: true
  18157. }, opts);
  18158. const loadOpts = {
  18159. cache: Boolean(opts.useCache),
  18160. sync: Boolean(sync),
  18161. editorconfig: Boolean(opts.editorconfig)
  18162. };
  18163. const {
  18164. load,
  18165. search
  18166. } = getExplorer(loadOpts);
  18167. const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
  18168. const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)];
  18169. const unwrapAndMerge = ([result, editorConfigured]) => {
  18170. const merged = Object.assign(Object.assign({}, editorConfigured), mergeOverrides(result, filePath));
  18171. for (const optionName of ["plugins", "pluginSearchDirs"]) {
  18172. if (Array.isArray(merged[optionName])) {
  18173. merged[optionName] = merged[optionName].map((value) => typeof value === "string" && value.startsWith(".") ? path.resolve(path.dirname(result.filepath), value) : value);
  18174. }
  18175. }
  18176. if (!result && !editorConfigured) {
  18177. return null;
  18178. }
  18179. delete merged.insertFinalNewline;
  18180. return merged;
  18181. };
  18182. if (loadOpts.sync) {
  18183. return unwrapAndMerge(arr);
  18184. }
  18185. return Promise.all(arr).then(unwrapAndMerge);
  18186. }
  18187. var resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false);
  18188. resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true);
  18189. function clearCache() {
  18190. memClear2(getExplorerMemoized);
  18191. resolveEditorConfig.clearCache();
  18192. }
  18193. async function resolveConfigFile(filePath) {
  18194. const {
  18195. search
  18196. } = getExplorer({
  18197. sync: false
  18198. });
  18199. const result = await search(filePath);
  18200. return result ? result.filepath : null;
  18201. }
  18202. resolveConfigFile.sync = (filePath) => {
  18203. const {
  18204. search
  18205. } = getExplorer({
  18206. sync: true
  18207. });
  18208. const result = search(filePath);
  18209. return result ? result.filepath : null;
  18210. };
  18211. function mergeOverrides(configResult, filePath) {
  18212. const {
  18213. config: config2,
  18214. filepath: configPath
  18215. } = configResult || {};
  18216. const _ref = config2 || {}, {
  18217. overrides
  18218. } = _ref, options = _objectWithoutProperties(_ref, _excluded3);
  18219. if (filePath && overrides) {
  18220. const relativeFilePath = path.relative(path.dirname(configPath), filePath);
  18221. for (const override of overrides) {
  18222. if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) {
  18223. Object.assign(options, override.options);
  18224. }
  18225. }
  18226. }
  18227. return options;
  18228. }
  18229. function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
  18230. const patternList = Array.isArray(patterns) ? patterns : [patterns];
  18231. const [withSlashes, withoutSlashes] = partition(patternList, (pattern) => pattern.includes("/"));
  18232. return micromatch.isMatch(filePath, withoutSlashes, {
  18233. ignore: excludedPatterns,
  18234. basename: true,
  18235. dot: true
  18236. }) || micromatch.isMatch(filePath, withSlashes, {
  18237. ignore: excludedPatterns,
  18238. basename: false,
  18239. dot: true
  18240. });
  18241. }
  18242. module2.exports = {
  18243. resolveConfig,
  18244. resolveConfigFile,
  18245. clearCache
  18246. };
  18247. }
  18248. });
  18249. var require_ignore = __commonJS2({
  18250. "node_modules/ignore/index.js"(exports2, module2) {
  18251. function makeArray(subject) {
  18252. return Array.isArray(subject) ? subject : [subject];
  18253. }
  18254. var EMPTY = "";
  18255. var SPACE = " ";
  18256. var ESCAPE = "\\";
  18257. var REGEX_TEST_BLANK_LINE = /^\s+$/;
  18258. var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
  18259. var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
  18260. var REGEX_SPLITALL_CRLF = /\r?\n/g;
  18261. var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
  18262. var SLASH = "/";
  18263. var KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("node-ignore") : "node-ignore";
  18264. var define2 = (object, key, value) => Object.defineProperty(object, key, {
  18265. value
  18266. });
  18267. var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
  18268. var RETURN_FALSE = () => false;
  18269. var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
  18270. var cleanRangeBackSlash = (slashes) => {
  18271. const {
  18272. length
  18273. } = slashes;
  18274. return slashes.slice(0, length - length % 2);
  18275. };
  18276. var REPLACERS = [[/\\?\s+$/, (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY], [/\\\s/g, () => SPACE], [/[\\$.|*+(){^]/g, (match) => `\\${match}`], [/(?!\\)\?/g, () => "[^/]"], [/^\//, () => "^"], [/\//g, () => "\\/"], [/^\^*\\\*\\\*\\\//, () => "^(?:.*\\/)?"], [/^(?=[^^])/, function startingReplacer() {
  18277. return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
  18278. }], [/\\\/\\\*\\\*(?=\\\/|$)/g, (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"], [/(^|[^\\]+)\\\*(?=.+)/g, (_, p1) => `${p1}[^\\/]*`], [/\\\\\\(?=[$.|*+(){^])/g, () => ESCAPE], [/\\\\/g, () => ESCAPE], [/(\\)?\[([^\]/]*?)(\\*)($|\])/g, (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"], [/(?:[^*])$/, (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`], [/(\^|\\\/)?\\\*$/, (_, p1) => {
  18279. const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
  18280. return `${prefix}(?=$|\\/$)`;
  18281. }]];
  18282. var regexCache = /* @__PURE__ */ Object.create(null);
  18283. var makeRegex = (pattern, ignoreCase) => {
  18284. let source = regexCache[pattern];
  18285. if (!source) {
  18286. source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
  18287. regexCache[pattern] = source;
  18288. }
  18289. return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
  18290. };
  18291. var isString = (subject) => typeof subject === "string";
  18292. var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && pattern.indexOf("#") !== 0;
  18293. var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
  18294. var IgnoreRule = class {
  18295. constructor(origin, pattern, negative, regex) {
  18296. this.origin = origin;
  18297. this.pattern = pattern;
  18298. this.negative = negative;
  18299. this.regex = regex;
  18300. }
  18301. };
  18302. var createRule = (pattern, ignoreCase) => {
  18303. const origin = pattern;
  18304. let negative = false;
  18305. if (pattern.indexOf("!") === 0) {
  18306. negative = true;
  18307. pattern = pattern.substr(1);
  18308. }
  18309. pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
  18310. const regex = makeRegex(pattern, ignoreCase);
  18311. return new IgnoreRule(origin, pattern, negative, regex);
  18312. };
  18313. var throwError = (message, Ctor) => {
  18314. throw new Ctor(message);
  18315. };
  18316. var checkPath = (path, originalPath, doThrow) => {
  18317. if (!isString(path)) {
  18318. return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
  18319. }
  18320. if (!path) {
  18321. return doThrow(`path must not be empty`, TypeError);
  18322. }
  18323. if (checkPath.isNotRelative(path)) {
  18324. const r = "`path.relative()`d";
  18325. return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
  18326. }
  18327. return true;
  18328. };
  18329. var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
  18330. checkPath.isNotRelative = isNotRelative;
  18331. checkPath.convert = (p) => p;
  18332. var Ignore = class {
  18333. constructor({
  18334. ignorecase = true,
  18335. ignoreCase = ignorecase,
  18336. allowRelativePaths = false
  18337. } = {}) {
  18338. define2(this, KEY_IGNORE, true);
  18339. this._rules = [];
  18340. this._ignoreCase = ignoreCase;
  18341. this._allowRelativePaths = allowRelativePaths;
  18342. this._initCache();
  18343. }
  18344. _initCache() {
  18345. this._ignoreCache = /* @__PURE__ */ Object.create(null);
  18346. this._testCache = /* @__PURE__ */ Object.create(null);
  18347. }
  18348. _addPattern(pattern) {
  18349. if (pattern && pattern[KEY_IGNORE]) {
  18350. this._rules = this._rules.concat(pattern._rules);
  18351. this._added = true;
  18352. return;
  18353. }
  18354. if (checkPattern(pattern)) {
  18355. const rule = createRule(pattern, this._ignoreCase);
  18356. this._added = true;
  18357. this._rules.push(rule);
  18358. }
  18359. }
  18360. add(pattern) {
  18361. this._added = false;
  18362. makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
  18363. if (this._added) {
  18364. this._initCache();
  18365. }
  18366. return this;
  18367. }
  18368. addPattern(pattern) {
  18369. return this.add(pattern);
  18370. }
  18371. _testOne(path, checkUnignored) {
  18372. let ignored = false;
  18373. let unignored = false;
  18374. this._rules.forEach((rule) => {
  18375. const {
  18376. negative
  18377. } = rule;
  18378. if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
  18379. return;
  18380. }
  18381. const matched = rule.regex.test(path);
  18382. if (matched) {
  18383. ignored = !negative;
  18384. unignored = negative;
  18385. }
  18386. });
  18387. return {
  18388. ignored,
  18389. unignored
  18390. };
  18391. }
  18392. _test(originalPath, cache, checkUnignored, slices) {
  18393. const path = originalPath && checkPath.convert(originalPath);
  18394. checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
  18395. return this._t(path, cache, checkUnignored, slices);
  18396. }
  18397. _t(path, cache, checkUnignored, slices) {
  18398. if (path in cache) {
  18399. return cache[path];
  18400. }
  18401. if (!slices) {
  18402. slices = path.split(SLASH);
  18403. }
  18404. slices.pop();
  18405. if (!slices.length) {
  18406. return cache[path] = this._testOne(path, checkUnignored);
  18407. }
  18408. const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
  18409. return cache[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
  18410. }
  18411. ignores(path) {
  18412. return this._test(path, this._ignoreCache, false).ignored;
  18413. }
  18414. createFilter() {
  18415. return (path) => !this.ignores(path);
  18416. }
  18417. filter(paths) {
  18418. return makeArray(paths).filter(this.createFilter());
  18419. }
  18420. test(path) {
  18421. return this._test(path, this._testCache, true);
  18422. }
  18423. };
  18424. var factory = (options) => new Ignore(options);
  18425. var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
  18426. factory.isPathValid = isPathValid;
  18427. factory.default = factory;
  18428. module2.exports = factory;
  18429. if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
  18430. const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
  18431. checkPath.convert = makePosix;
  18432. const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
  18433. checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
  18434. }
  18435. }
  18436. });
  18437. var require_get_file_content_or_null = __commonJS2({
  18438. "src/utils/get-file-content-or-null.js"(exports2, module2) {
  18439. "use strict";
  18440. var fs = require("fs");
  18441. var fsAsync = fs.promises;
  18442. async function getFileContentOrNull(filename) {
  18443. try {
  18444. return await fsAsync.readFile(filename, "utf8");
  18445. } catch (error) {
  18446. return handleError(filename, error);
  18447. }
  18448. }
  18449. getFileContentOrNull.sync = function(filename) {
  18450. try {
  18451. return fs.readFileSync(filename, "utf8");
  18452. } catch (error) {
  18453. return handleError(filename, error);
  18454. }
  18455. };
  18456. function handleError(filename, error) {
  18457. if (error && error.code === "ENOENT") {
  18458. return null;
  18459. }
  18460. throw new Error(`Unable to read ${filename}: ${error.message}`);
  18461. }
  18462. module2.exports = getFileContentOrNull;
  18463. }
  18464. });
  18465. var require_create_ignorer = __commonJS2({
  18466. "src/common/create-ignorer.js"(exports2, module2) {
  18467. "use strict";
  18468. var path = require("path");
  18469. var ignore = require_ignore().default;
  18470. var getFileContentOrNull = require_get_file_content_or_null();
  18471. async function createIgnorer(ignorePath, withNodeModules) {
  18472. const ignoreContent = ignorePath ? await getFileContentOrNull(path.resolve(ignorePath)) : null;
  18473. return _createIgnorer(ignoreContent, withNodeModules);
  18474. }
  18475. createIgnorer.sync = function(ignorePath, withNodeModules) {
  18476. const ignoreContent = !ignorePath ? null : getFileContentOrNull.sync(path.resolve(ignorePath));
  18477. return _createIgnorer(ignoreContent, withNodeModules);
  18478. };
  18479. function _createIgnorer(ignoreContent, withNodeModules) {
  18480. const ignorer = ignore({
  18481. allowRelativePaths: true
  18482. }).add(ignoreContent || "");
  18483. if (!withNodeModules) {
  18484. ignorer.add("node_modules");
  18485. }
  18486. return ignorer;
  18487. }
  18488. module2.exports = createIgnorer;
  18489. }
  18490. });
  18491. var require_get_file_info = __commonJS2({
  18492. "src/common/get-file-info.js"(exports2, module2) {
  18493. "use strict";
  18494. var path = require("path");
  18495. var options = require_options();
  18496. var config2 = require_resolve_config();
  18497. var createIgnorer = require_create_ignorer();
  18498. async function getFileInfo2(filePath, opts) {
  18499. if (typeof filePath !== "string") {
  18500. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18501. }
  18502. const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
  18503. return _getFileInfo({
  18504. ignorer,
  18505. filePath,
  18506. plugins: opts.plugins,
  18507. resolveConfig: opts.resolveConfig,
  18508. ignorePath: opts.ignorePath,
  18509. sync: false
  18510. });
  18511. }
  18512. getFileInfo2.sync = function(filePath, opts) {
  18513. if (typeof filePath !== "string") {
  18514. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18515. }
  18516. const ignorer = createIgnorer.sync(opts.ignorePath, opts.withNodeModules);
  18517. return _getFileInfo({
  18518. ignorer,
  18519. filePath,
  18520. plugins: opts.plugins,
  18521. resolveConfig: opts.resolveConfig,
  18522. ignorePath: opts.ignorePath,
  18523. sync: true
  18524. });
  18525. };
  18526. function getFileParser(resolvedConfig, filePath, plugins2) {
  18527. if (resolvedConfig && resolvedConfig.parser) {
  18528. return resolvedConfig.parser;
  18529. }
  18530. const inferredParser = options.inferParser(filePath, plugins2);
  18531. if (inferredParser) {
  18532. return inferredParser;
  18533. }
  18534. return null;
  18535. }
  18536. function _getFileInfo({
  18537. ignorer,
  18538. filePath,
  18539. plugins: plugins2,
  18540. resolveConfig = false,
  18541. ignorePath,
  18542. sync = false
  18543. }) {
  18544. const normalizedFilePath = normalizeFilePath(filePath, ignorePath);
  18545. const fileInfo = {
  18546. ignored: ignorer.ignores(normalizedFilePath),
  18547. inferredParser: null
  18548. };
  18549. if (fileInfo.ignored) {
  18550. return fileInfo;
  18551. }
  18552. let resolvedConfig;
  18553. if (resolveConfig) {
  18554. if (sync) {
  18555. resolvedConfig = config2.resolveConfig.sync(filePath);
  18556. } else {
  18557. return config2.resolveConfig(filePath).then((resolvedConfig2) => {
  18558. fileInfo.inferredParser = getFileParser(resolvedConfig2, filePath, plugins2);
  18559. return fileInfo;
  18560. });
  18561. }
  18562. }
  18563. fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins2);
  18564. return fileInfo;
  18565. }
  18566. function normalizeFilePath(filePath, ignorePath) {
  18567. return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
  18568. }
  18569. module2.exports = getFileInfo2;
  18570. }
  18571. });
  18572. var require_util_shared = __commonJS2({
  18573. "src/common/util-shared.js"(exports2, module2) {
  18574. "use strict";
  18575. var {
  18576. getMaxContinuousCount,
  18577. getStringWidth,
  18578. getAlignmentSize,
  18579. getIndentSize,
  18580. skip,
  18581. skipWhitespace,
  18582. skipSpaces,
  18583. skipNewline,
  18584. skipToLineEnd,
  18585. skipEverythingButNewLine,
  18586. skipInlineComment,
  18587. skipTrailingComment,
  18588. hasNewline,
  18589. hasNewlineInRange,
  18590. hasSpaces,
  18591. isNextLineEmpty,
  18592. isNextLineEmptyAfterIndex,
  18593. isPreviousLineEmpty,
  18594. getNextNonSpaceNonCommentCharacterIndex,
  18595. makeString,
  18596. addLeadingComment,
  18597. addDanglingComment,
  18598. addTrailingComment
  18599. } = require_util();
  18600. module2.exports = {
  18601. getMaxContinuousCount,
  18602. getStringWidth,
  18603. getAlignmentSize,
  18604. getIndentSize,
  18605. skip,
  18606. skipWhitespace,
  18607. skipSpaces,
  18608. skipNewline,
  18609. skipToLineEnd,
  18610. skipEverythingButNewLine,
  18611. skipInlineComment,
  18612. skipTrailingComment,
  18613. hasNewline,
  18614. hasNewlineInRange,
  18615. hasSpaces,
  18616. isNextLineEmpty,
  18617. isNextLineEmptyAfterIndex,
  18618. isPreviousLineEmpty,
  18619. getNextNonSpaceNonCommentCharacterIndex,
  18620. makeString,
  18621. addLeadingComment,
  18622. addDanglingComment,
  18623. addTrailingComment
  18624. };
  18625. }
  18626. });
  18627. var require_array3 = __commonJS2({
  18628. "node_modules/fast-glob/out/utils/array.js"(exports2) {
  18629. "use strict";
  18630. Object.defineProperty(exports2, "__esModule", {
  18631. value: true
  18632. });
  18633. exports2.splitWhen = exports2.flatten = void 0;
  18634. function flatten(items) {
  18635. return items.reduce((collection, item) => [].concat(collection, item), []);
  18636. }
  18637. exports2.flatten = flatten;
  18638. function splitWhen(items, predicate) {
  18639. const result = [[]];
  18640. let groupIndex = 0;
  18641. for (const item of items) {
  18642. if (predicate(item)) {
  18643. groupIndex++;
  18644. result[groupIndex] = [];
  18645. } else {
  18646. result[groupIndex].push(item);
  18647. }
  18648. }
  18649. return result;
  18650. }
  18651. exports2.splitWhen = splitWhen;
  18652. }
  18653. });
  18654. var require_errno = __commonJS2({
  18655. "node_modules/fast-glob/out/utils/errno.js"(exports2) {
  18656. "use strict";
  18657. Object.defineProperty(exports2, "__esModule", {
  18658. value: true
  18659. });
  18660. exports2.isEnoentCodeError = void 0;
  18661. function isEnoentCodeError(error) {
  18662. return error.code === "ENOENT";
  18663. }
  18664. exports2.isEnoentCodeError = isEnoentCodeError;
  18665. }
  18666. });
  18667. var require_fs = __commonJS2({
  18668. "node_modules/fast-glob/out/utils/fs.js"(exports2) {
  18669. "use strict";
  18670. Object.defineProperty(exports2, "__esModule", {
  18671. value: true
  18672. });
  18673. exports2.createDirentFromStats = void 0;
  18674. var DirentFromStats = class {
  18675. constructor(name, stats) {
  18676. this.name = name;
  18677. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  18678. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  18679. this.isDirectory = stats.isDirectory.bind(stats);
  18680. this.isFIFO = stats.isFIFO.bind(stats);
  18681. this.isFile = stats.isFile.bind(stats);
  18682. this.isSocket = stats.isSocket.bind(stats);
  18683. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  18684. }
  18685. };
  18686. function createDirentFromStats(name, stats) {
  18687. return new DirentFromStats(name, stats);
  18688. }
  18689. exports2.createDirentFromStats = createDirentFromStats;
  18690. }
  18691. });
  18692. var require_path = __commonJS2({
  18693. "node_modules/fast-glob/out/utils/path.js"(exports2) {
  18694. "use strict";
  18695. Object.defineProperty(exports2, "__esModule", {
  18696. value: true
  18697. });
  18698. exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
  18699. var path = require("path");
  18700. var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
  18701. var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
  18702. function unixify(filepath) {
  18703. return filepath.replace(/\\/g, "/");
  18704. }
  18705. exports2.unixify = unixify;
  18706. function makeAbsolute(cwd, filepath) {
  18707. return path.resolve(cwd, filepath);
  18708. }
  18709. exports2.makeAbsolute = makeAbsolute;
  18710. function escape(pattern) {
  18711. return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
  18712. }
  18713. exports2.escape = escape;
  18714. function removeLeadingDotSegment(entry) {
  18715. if (entry.charAt(0) === ".") {
  18716. const secondCharactery = entry.charAt(1);
  18717. if (secondCharactery === "/" || secondCharactery === "\\") {
  18718. return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
  18719. }
  18720. }
  18721. return entry;
  18722. }
  18723. exports2.removeLeadingDotSegment = removeLeadingDotSegment;
  18724. }
  18725. });
  18726. var require_is_extglob = __commonJS2({
  18727. "node_modules/is-extglob/index.js"(exports2, module2) {
  18728. module2.exports = function isExtglob(str) {
  18729. if (typeof str !== "string" || str === "") {
  18730. return false;
  18731. }
  18732. var match;
  18733. while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
  18734. if (match[2])
  18735. return true;
  18736. str = str.slice(match.index + match[0].length);
  18737. }
  18738. return false;
  18739. };
  18740. }
  18741. });
  18742. var require_is_glob = __commonJS2({
  18743. "node_modules/is-glob/index.js"(exports2, module2) {
  18744. var isExtglob = require_is_extglob();
  18745. var chars = {
  18746. "{": "}",
  18747. "(": ")",
  18748. "[": "]"
  18749. };
  18750. var strictCheck = function(str) {
  18751. if (str[0] === "!") {
  18752. return true;
  18753. }
  18754. var index = 0;
  18755. var pipeIndex = -2;
  18756. var closeSquareIndex = -2;
  18757. var closeCurlyIndex = -2;
  18758. var closeParenIndex = -2;
  18759. var backSlashIndex = -2;
  18760. while (index < str.length) {
  18761. if (str[index] === "*") {
  18762. return true;
  18763. }
  18764. if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
  18765. return true;
  18766. }
  18767. if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
  18768. if (closeSquareIndex < index) {
  18769. closeSquareIndex = str.indexOf("]", index);
  18770. }
  18771. if (closeSquareIndex > index) {
  18772. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18773. return true;
  18774. }
  18775. backSlashIndex = str.indexOf("\\", index);
  18776. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18777. return true;
  18778. }
  18779. }
  18780. }
  18781. if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
  18782. closeCurlyIndex = str.indexOf("}", index);
  18783. if (closeCurlyIndex > index) {
  18784. backSlashIndex = str.indexOf("\\", index);
  18785. if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
  18786. return true;
  18787. }
  18788. }
  18789. }
  18790. if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
  18791. closeParenIndex = str.indexOf(")", index);
  18792. if (closeParenIndex > index) {
  18793. backSlashIndex = str.indexOf("\\", index);
  18794. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  18795. return true;
  18796. }
  18797. }
  18798. }
  18799. if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
  18800. if (pipeIndex < index) {
  18801. pipeIndex = str.indexOf("|", index);
  18802. }
  18803. if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
  18804. closeParenIndex = str.indexOf(")", pipeIndex);
  18805. if (closeParenIndex > pipeIndex) {
  18806. backSlashIndex = str.indexOf("\\", pipeIndex);
  18807. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  18808. return true;
  18809. }
  18810. }
  18811. }
  18812. }
  18813. if (str[index] === "\\") {
  18814. var open = str[index + 1];
  18815. index += 2;
  18816. var close = chars[open];
  18817. if (close) {
  18818. var n = str.indexOf(close, index);
  18819. if (n !== -1) {
  18820. index = n + 1;
  18821. }
  18822. }
  18823. if (str[index] === "!") {
  18824. return true;
  18825. }
  18826. } else {
  18827. index++;
  18828. }
  18829. }
  18830. return false;
  18831. };
  18832. var relaxedCheck = function(str) {
  18833. if (str[0] === "!") {
  18834. return true;
  18835. }
  18836. var index = 0;
  18837. while (index < str.length) {
  18838. if (/[*?{}()[\]]/.test(str[index])) {
  18839. return true;
  18840. }
  18841. if (str[index] === "\\") {
  18842. var open = str[index + 1];
  18843. index += 2;
  18844. var close = chars[open];
  18845. if (close) {
  18846. var n = str.indexOf(close, index);
  18847. if (n !== -1) {
  18848. index = n + 1;
  18849. }
  18850. }
  18851. if (str[index] === "!") {
  18852. return true;
  18853. }
  18854. } else {
  18855. index++;
  18856. }
  18857. }
  18858. return false;
  18859. };
  18860. module2.exports = function isGlob(str, options) {
  18861. if (typeof str !== "string" || str === "") {
  18862. return false;
  18863. }
  18864. if (isExtglob(str)) {
  18865. return true;
  18866. }
  18867. var check = strictCheck;
  18868. if (options && options.strict === false) {
  18869. check = relaxedCheck;
  18870. }
  18871. return check(str);
  18872. };
  18873. }
  18874. });
  18875. var require_glob_parent = __commonJS2({
  18876. "node_modules/glob-parent/index.js"(exports2, module2) {
  18877. "use strict";
  18878. var isGlob = require_is_glob();
  18879. var pathPosixDirname = require("path").posix.dirname;
  18880. var isWin32 = require("os").platform() === "win32";
  18881. var slash = "/";
  18882. var backslash = /\\/g;
  18883. var enclosure = /[\{\[].*[\}\]]$/;
  18884. var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
  18885. var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
  18886. module2.exports = function globParent(str, opts) {
  18887. var options = Object.assign({
  18888. flipBackslashes: true
  18889. }, opts);
  18890. if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
  18891. str = str.replace(backslash, slash);
  18892. }
  18893. if (enclosure.test(str)) {
  18894. str += slash;
  18895. }
  18896. str += "a";
  18897. do {
  18898. str = pathPosixDirname(str);
  18899. } while (isGlob(str) || globby.test(str));
  18900. return str.replace(escaped, "$1");
  18901. };
  18902. }
  18903. });
  18904. var require_pattern = __commonJS2({
  18905. "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
  18906. "use strict";
  18907. Object.defineProperty(exports2, "__esModule", {
  18908. value: true
  18909. });
  18910. exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
  18911. var path = require("path");
  18912. var globParent = require_glob_parent();
  18913. var micromatch = require_micromatch();
  18914. var GLOBSTAR = "**";
  18915. var ESCAPE_SYMBOL = "\\";
  18916. var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
  18917. var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
  18918. var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
  18919. var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
  18920. var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
  18921. function isStaticPattern(pattern, options = {}) {
  18922. return !isDynamicPattern(pattern, options);
  18923. }
  18924. exports2.isStaticPattern = isStaticPattern;
  18925. function isDynamicPattern(pattern, options = {}) {
  18926. if (pattern === "") {
  18927. return false;
  18928. }
  18929. if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
  18930. return true;
  18931. }
  18932. if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
  18933. return true;
  18934. }
  18935. if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
  18936. return true;
  18937. }
  18938. if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
  18939. return true;
  18940. }
  18941. return false;
  18942. }
  18943. exports2.isDynamicPattern = isDynamicPattern;
  18944. function hasBraceExpansion(pattern) {
  18945. const openingBraceIndex = pattern.indexOf("{");
  18946. if (openingBraceIndex === -1) {
  18947. return false;
  18948. }
  18949. const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
  18950. if (closingBraceIndex === -1) {
  18951. return false;
  18952. }
  18953. const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
  18954. return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
  18955. }
  18956. function convertToPositivePattern(pattern) {
  18957. return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
  18958. }
  18959. exports2.convertToPositivePattern = convertToPositivePattern;
  18960. function convertToNegativePattern(pattern) {
  18961. return "!" + pattern;
  18962. }
  18963. exports2.convertToNegativePattern = convertToNegativePattern;
  18964. function isNegativePattern(pattern) {
  18965. return pattern.startsWith("!") && pattern[1] !== "(";
  18966. }
  18967. exports2.isNegativePattern = isNegativePattern;
  18968. function isPositivePattern(pattern) {
  18969. return !isNegativePattern(pattern);
  18970. }
  18971. exports2.isPositivePattern = isPositivePattern;
  18972. function getNegativePatterns(patterns) {
  18973. return patterns.filter(isNegativePattern);
  18974. }
  18975. exports2.getNegativePatterns = getNegativePatterns;
  18976. function getPositivePatterns(patterns) {
  18977. return patterns.filter(isPositivePattern);
  18978. }
  18979. exports2.getPositivePatterns = getPositivePatterns;
  18980. function getPatternsInsideCurrentDirectory(patterns) {
  18981. return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
  18982. }
  18983. exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
  18984. function getPatternsOutsideCurrentDirectory(patterns) {
  18985. return patterns.filter(isPatternRelatedToParentDirectory);
  18986. }
  18987. exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
  18988. function isPatternRelatedToParentDirectory(pattern) {
  18989. return pattern.startsWith("..") || pattern.startsWith("./..");
  18990. }
  18991. exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
  18992. function getBaseDirectory(pattern) {
  18993. return globParent(pattern, {
  18994. flipBackslashes: false
  18995. });
  18996. }
  18997. exports2.getBaseDirectory = getBaseDirectory;
  18998. function hasGlobStar(pattern) {
  18999. return pattern.includes(GLOBSTAR);
  19000. }
  19001. exports2.hasGlobStar = hasGlobStar;
  19002. function endsWithSlashGlobStar(pattern) {
  19003. return pattern.endsWith("/" + GLOBSTAR);
  19004. }
  19005. exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
  19006. function isAffectDepthOfReadingPattern(pattern) {
  19007. const basename = path.basename(pattern);
  19008. return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
  19009. }
  19010. exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
  19011. function expandPatternsWithBraceExpansion(patterns) {
  19012. return patterns.reduce((collection, pattern) => {
  19013. return collection.concat(expandBraceExpansion(pattern));
  19014. }, []);
  19015. }
  19016. exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
  19017. function expandBraceExpansion(pattern) {
  19018. return micromatch.braces(pattern, {
  19019. expand: true,
  19020. nodupes: true
  19021. });
  19022. }
  19023. exports2.expandBraceExpansion = expandBraceExpansion;
  19024. function getPatternParts(pattern, options) {
  19025. let {
  19026. parts
  19027. } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
  19028. parts: true
  19029. }));
  19030. if (parts.length === 0) {
  19031. parts = [pattern];
  19032. }
  19033. if (parts[0].startsWith("/")) {
  19034. parts[0] = parts[0].slice(1);
  19035. parts.unshift("");
  19036. }
  19037. return parts;
  19038. }
  19039. exports2.getPatternParts = getPatternParts;
  19040. function makeRe(pattern, options) {
  19041. return micromatch.makeRe(pattern, options);
  19042. }
  19043. exports2.makeRe = makeRe;
  19044. function convertPatternsToRe(patterns, options) {
  19045. return patterns.map((pattern) => makeRe(pattern, options));
  19046. }
  19047. exports2.convertPatternsToRe = convertPatternsToRe;
  19048. function matchAny(entry, patternsRe) {
  19049. return patternsRe.some((patternRe) => patternRe.test(entry));
  19050. }
  19051. exports2.matchAny = matchAny;
  19052. }
  19053. });
  19054. var require_merge2 = __commonJS2({
  19055. "node_modules/merge2/index.js"(exports2, module2) {
  19056. "use strict";
  19057. var Stream = require("stream");
  19058. var PassThrough = Stream.PassThrough;
  19059. var slice = Array.prototype.slice;
  19060. module2.exports = merge2;
  19061. function merge2() {
  19062. const streamsQueue = [];
  19063. const args = slice.call(arguments);
  19064. let merging = false;
  19065. let options = args[args.length - 1];
  19066. if (options && !Array.isArray(options) && options.pipe == null) {
  19067. args.pop();
  19068. } else {
  19069. options = {};
  19070. }
  19071. const doEnd = options.end !== false;
  19072. const doPipeError = options.pipeError === true;
  19073. if (options.objectMode == null) {
  19074. options.objectMode = true;
  19075. }
  19076. if (options.highWaterMark == null) {
  19077. options.highWaterMark = 64 * 1024;
  19078. }
  19079. const mergedStream = PassThrough(options);
  19080. function addStream() {
  19081. for (let i = 0, len = arguments.length; i < len; i++) {
  19082. streamsQueue.push(pauseStreams(arguments[i], options));
  19083. }
  19084. mergeStream();
  19085. return this;
  19086. }
  19087. function mergeStream() {
  19088. if (merging) {
  19089. return;
  19090. }
  19091. merging = true;
  19092. let streams = streamsQueue.shift();
  19093. if (!streams) {
  19094. process.nextTick(endStream);
  19095. return;
  19096. }
  19097. if (!Array.isArray(streams)) {
  19098. streams = [streams];
  19099. }
  19100. let pipesCount = streams.length + 1;
  19101. function next() {
  19102. if (--pipesCount > 0) {
  19103. return;
  19104. }
  19105. merging = false;
  19106. mergeStream();
  19107. }
  19108. function pipe(stream) {
  19109. function onend() {
  19110. stream.removeListener("merge2UnpipeEnd", onend);
  19111. stream.removeListener("end", onend);
  19112. if (doPipeError) {
  19113. stream.removeListener("error", onerror);
  19114. }
  19115. next();
  19116. }
  19117. function onerror(err) {
  19118. mergedStream.emit("error", err);
  19119. }
  19120. if (stream._readableState.endEmitted) {
  19121. return next();
  19122. }
  19123. stream.on("merge2UnpipeEnd", onend);
  19124. stream.on("end", onend);
  19125. if (doPipeError) {
  19126. stream.on("error", onerror);
  19127. }
  19128. stream.pipe(mergedStream, {
  19129. end: false
  19130. });
  19131. stream.resume();
  19132. }
  19133. for (let i = 0; i < streams.length; i++) {
  19134. pipe(streams[i]);
  19135. }
  19136. next();
  19137. }
  19138. function endStream() {
  19139. merging = false;
  19140. mergedStream.emit("queueDrain");
  19141. if (doEnd) {
  19142. mergedStream.end();
  19143. }
  19144. }
  19145. mergedStream.setMaxListeners(0);
  19146. mergedStream.add = addStream;
  19147. mergedStream.on("unpipe", function(stream) {
  19148. stream.emit("merge2UnpipeEnd");
  19149. });
  19150. if (args.length) {
  19151. addStream.apply(null, args);
  19152. }
  19153. return mergedStream;
  19154. }
  19155. function pauseStreams(streams, options) {
  19156. if (!Array.isArray(streams)) {
  19157. if (!streams._readableState && streams.pipe) {
  19158. streams = streams.pipe(PassThrough(options));
  19159. }
  19160. if (!streams._readableState || !streams.pause || !streams.pipe) {
  19161. throw new Error("Only readable stream can be merged.");
  19162. }
  19163. streams.pause();
  19164. } else {
  19165. for (let i = 0, len = streams.length; i < len; i++) {
  19166. streams[i] = pauseStreams(streams[i], options);
  19167. }
  19168. }
  19169. return streams;
  19170. }
  19171. }
  19172. });
  19173. var require_stream = __commonJS2({
  19174. "node_modules/fast-glob/out/utils/stream.js"(exports2) {
  19175. "use strict";
  19176. Object.defineProperty(exports2, "__esModule", {
  19177. value: true
  19178. });
  19179. exports2.merge = void 0;
  19180. var merge2 = require_merge2();
  19181. function merge(streams) {
  19182. const mergedStream = merge2(streams);
  19183. streams.forEach((stream) => {
  19184. stream.once("error", (error) => mergedStream.emit("error", error));
  19185. });
  19186. mergedStream.once("close", () => propagateCloseEventToSources(streams));
  19187. mergedStream.once("end", () => propagateCloseEventToSources(streams));
  19188. return mergedStream;
  19189. }
  19190. exports2.merge = merge;
  19191. function propagateCloseEventToSources(streams) {
  19192. streams.forEach((stream) => stream.emit("close"));
  19193. }
  19194. }
  19195. });
  19196. var require_string2 = __commonJS2({
  19197. "node_modules/fast-glob/out/utils/string.js"(exports2) {
  19198. "use strict";
  19199. Object.defineProperty(exports2, "__esModule", {
  19200. value: true
  19201. });
  19202. exports2.isEmpty = exports2.isString = void 0;
  19203. function isString(input) {
  19204. return typeof input === "string";
  19205. }
  19206. exports2.isString = isString;
  19207. function isEmpty(input) {
  19208. return input === "";
  19209. }
  19210. exports2.isEmpty = isEmpty;
  19211. }
  19212. });
  19213. var require_utils4 = __commonJS2({
  19214. "node_modules/fast-glob/out/utils/index.js"(exports2) {
  19215. "use strict";
  19216. Object.defineProperty(exports2, "__esModule", {
  19217. value: true
  19218. });
  19219. exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
  19220. var array = require_array3();
  19221. exports2.array = array;
  19222. var errno = require_errno();
  19223. exports2.errno = errno;
  19224. var fs = require_fs();
  19225. exports2.fs = fs;
  19226. var path = require_path();
  19227. exports2.path = path;
  19228. var pattern = require_pattern();
  19229. exports2.pattern = pattern;
  19230. var stream = require_stream();
  19231. exports2.stream = stream;
  19232. var string = require_string2();
  19233. exports2.string = string;
  19234. }
  19235. });
  19236. var require_tasks = __commonJS2({
  19237. "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
  19238. "use strict";
  19239. Object.defineProperty(exports2, "__esModule", {
  19240. value: true
  19241. });
  19242. exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
  19243. var utils = require_utils4();
  19244. function generate(patterns, settings) {
  19245. const positivePatterns = getPositivePatterns(patterns);
  19246. const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
  19247. const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
  19248. const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
  19249. const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
  19250. const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
  19251. return staticTasks.concat(dynamicTasks);
  19252. }
  19253. exports2.generate = generate;
  19254. function convertPatternsToTasks(positive, negative, dynamic) {
  19255. const tasks = [];
  19256. const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
  19257. const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
  19258. const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
  19259. const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
  19260. tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
  19261. if ("." in insideCurrentDirectoryGroup) {
  19262. tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
  19263. } else {
  19264. tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
  19265. }
  19266. return tasks;
  19267. }
  19268. exports2.convertPatternsToTasks = convertPatternsToTasks;
  19269. function getPositivePatterns(patterns) {
  19270. return utils.pattern.getPositivePatterns(patterns);
  19271. }
  19272. exports2.getPositivePatterns = getPositivePatterns;
  19273. function getNegativePatternsAsPositive(patterns, ignore) {
  19274. const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
  19275. const positive = negative.map(utils.pattern.convertToPositivePattern);
  19276. return positive;
  19277. }
  19278. exports2.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
  19279. function groupPatternsByBaseDirectory(patterns) {
  19280. const group = {};
  19281. return patterns.reduce((collection, pattern) => {
  19282. const base = utils.pattern.getBaseDirectory(pattern);
  19283. if (base in collection) {
  19284. collection[base].push(pattern);
  19285. } else {
  19286. collection[base] = [pattern];
  19287. }
  19288. return collection;
  19289. }, group);
  19290. }
  19291. exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
  19292. function convertPatternGroupsToTasks(positive, negative, dynamic) {
  19293. return Object.keys(positive).map((base) => {
  19294. return convertPatternGroupToTask(base, positive[base], negative, dynamic);
  19295. });
  19296. }
  19297. exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
  19298. function convertPatternGroupToTask(base, positive, negative, dynamic) {
  19299. return {
  19300. dynamic,
  19301. positive,
  19302. negative,
  19303. base,
  19304. patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
  19305. };
  19306. }
  19307. exports2.convertPatternGroupToTask = convertPatternGroupToTask;
  19308. }
  19309. });
  19310. var require_patterns = __commonJS2({
  19311. "node_modules/fast-glob/out/managers/patterns.js"(exports2) {
  19312. "use strict";
  19313. Object.defineProperty(exports2, "__esModule", {
  19314. value: true
  19315. });
  19316. exports2.removeDuplicateSlashes = exports2.transform = void 0;
  19317. var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
  19318. function transform(patterns) {
  19319. return patterns.map((pattern) => removeDuplicateSlashes(pattern));
  19320. }
  19321. exports2.transform = transform;
  19322. function removeDuplicateSlashes(pattern) {
  19323. return pattern.replace(DOUBLE_SLASH_RE, "/");
  19324. }
  19325. exports2.removeDuplicateSlashes = removeDuplicateSlashes;
  19326. }
  19327. });
  19328. var require_async2 = __commonJS2({
  19329. "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
  19330. "use strict";
  19331. Object.defineProperty(exports2, "__esModule", {
  19332. value: true
  19333. });
  19334. exports2.read = void 0;
  19335. function read(path, settings, callback) {
  19336. settings.fs.lstat(path, (lstatError, lstat) => {
  19337. if (lstatError !== null) {
  19338. callFailureCallback(callback, lstatError);
  19339. return;
  19340. }
  19341. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19342. callSuccessCallback(callback, lstat);
  19343. return;
  19344. }
  19345. settings.fs.stat(path, (statError, stat) => {
  19346. if (statError !== null) {
  19347. if (settings.throwErrorOnBrokenSymbolicLink) {
  19348. callFailureCallback(callback, statError);
  19349. return;
  19350. }
  19351. callSuccessCallback(callback, lstat);
  19352. return;
  19353. }
  19354. if (settings.markSymbolicLink) {
  19355. stat.isSymbolicLink = () => true;
  19356. }
  19357. callSuccessCallback(callback, stat);
  19358. });
  19359. });
  19360. }
  19361. exports2.read = read;
  19362. function callFailureCallback(callback, error) {
  19363. callback(error);
  19364. }
  19365. function callSuccessCallback(callback, result) {
  19366. callback(null, result);
  19367. }
  19368. }
  19369. });
  19370. var require_sync2 = __commonJS2({
  19371. "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
  19372. "use strict";
  19373. Object.defineProperty(exports2, "__esModule", {
  19374. value: true
  19375. });
  19376. exports2.read = void 0;
  19377. function read(path, settings) {
  19378. const lstat = settings.fs.lstatSync(path);
  19379. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19380. return lstat;
  19381. }
  19382. try {
  19383. const stat = settings.fs.statSync(path);
  19384. if (settings.markSymbolicLink) {
  19385. stat.isSymbolicLink = () => true;
  19386. }
  19387. return stat;
  19388. } catch (error) {
  19389. if (!settings.throwErrorOnBrokenSymbolicLink) {
  19390. return lstat;
  19391. }
  19392. throw error;
  19393. }
  19394. }
  19395. exports2.read = read;
  19396. }
  19397. });
  19398. var require_fs2 = __commonJS2({
  19399. "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
  19400. "use strict";
  19401. Object.defineProperty(exports2, "__esModule", {
  19402. value: true
  19403. });
  19404. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19405. var fs = require("fs");
  19406. exports2.FILE_SYSTEM_ADAPTER = {
  19407. lstat: fs.lstat,
  19408. stat: fs.stat,
  19409. lstatSync: fs.lstatSync,
  19410. statSync: fs.statSync
  19411. };
  19412. function createFileSystemAdapter(fsMethods) {
  19413. if (fsMethods === void 0) {
  19414. return exports2.FILE_SYSTEM_ADAPTER;
  19415. }
  19416. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  19417. }
  19418. exports2.createFileSystemAdapter = createFileSystemAdapter;
  19419. }
  19420. });
  19421. var require_settings = __commonJS2({
  19422. "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
  19423. "use strict";
  19424. Object.defineProperty(exports2, "__esModule", {
  19425. value: true
  19426. });
  19427. var fs = require_fs2();
  19428. var Settings = class {
  19429. constructor(_options = {}) {
  19430. this._options = _options;
  19431. this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
  19432. this.fs = fs.createFileSystemAdapter(this._options.fs);
  19433. this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
  19434. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  19435. }
  19436. _getValue(option, value) {
  19437. return option !== null && option !== void 0 ? option : value;
  19438. }
  19439. };
  19440. exports2.default = Settings;
  19441. }
  19442. });
  19443. var require_out = __commonJS2({
  19444. "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
  19445. "use strict";
  19446. Object.defineProperty(exports2, "__esModule", {
  19447. value: true
  19448. });
  19449. exports2.statSync = exports2.stat = exports2.Settings = void 0;
  19450. var async = require_async2();
  19451. var sync = require_sync2();
  19452. var settings_1 = require_settings();
  19453. exports2.Settings = settings_1.default;
  19454. function stat(path, optionsOrSettingsOrCallback, callback) {
  19455. if (typeof optionsOrSettingsOrCallback === "function") {
  19456. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  19457. return;
  19458. }
  19459. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  19460. }
  19461. exports2.stat = stat;
  19462. function statSync(path, optionsOrSettings) {
  19463. const settings = getSettings(optionsOrSettings);
  19464. return sync.read(path, settings);
  19465. }
  19466. exports2.statSync = statSync;
  19467. function getSettings(settingsOrOptions = {}) {
  19468. if (settingsOrOptions instanceof settings_1.default) {
  19469. return settingsOrOptions;
  19470. }
  19471. return new settings_1.default(settingsOrOptions);
  19472. }
  19473. }
  19474. });
  19475. var require_queue_microtask = __commonJS2({
  19476. "node_modules/queue-microtask/index.js"(exports2, module2) {
  19477. var promise;
  19478. module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
  19479. throw err;
  19480. }, 0));
  19481. }
  19482. });
  19483. var require_run_parallel = __commonJS2({
  19484. "node_modules/run-parallel/index.js"(exports2, module2) {
  19485. module2.exports = runParallel;
  19486. var queueMicrotask2 = require_queue_microtask();
  19487. function runParallel(tasks, cb) {
  19488. let results, pending, keys;
  19489. let isSync = true;
  19490. if (Array.isArray(tasks)) {
  19491. results = [];
  19492. pending = tasks.length;
  19493. } else {
  19494. keys = Object.keys(tasks);
  19495. results = {};
  19496. pending = keys.length;
  19497. }
  19498. function done(err) {
  19499. function end() {
  19500. if (cb)
  19501. cb(err, results);
  19502. cb = null;
  19503. }
  19504. if (isSync)
  19505. queueMicrotask2(end);
  19506. else
  19507. end();
  19508. }
  19509. function each(i, err, result) {
  19510. results[i] = result;
  19511. if (--pending === 0 || err) {
  19512. done(err);
  19513. }
  19514. }
  19515. if (!pending) {
  19516. done(null);
  19517. } else if (keys) {
  19518. keys.forEach(function(key) {
  19519. tasks[key](function(err, result) {
  19520. each(key, err, result);
  19521. });
  19522. });
  19523. } else {
  19524. tasks.forEach(function(task, i) {
  19525. task(function(err, result) {
  19526. each(i, err, result);
  19527. });
  19528. });
  19529. }
  19530. isSync = false;
  19531. }
  19532. }
  19533. });
  19534. var require_constants4 = __commonJS2({
  19535. "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
  19536. "use strict";
  19537. Object.defineProperty(exports2, "__esModule", {
  19538. value: true
  19539. });
  19540. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
  19541. var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
  19542. if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
  19543. throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
  19544. }
  19545. var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
  19546. var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
  19547. var SUPPORTED_MAJOR_VERSION = 10;
  19548. var SUPPORTED_MINOR_VERSION = 10;
  19549. var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
  19550. var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
  19551. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
  19552. }
  19553. });
  19554. var require_fs3 = __commonJS2({
  19555. "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
  19556. "use strict";
  19557. Object.defineProperty(exports2, "__esModule", {
  19558. value: true
  19559. });
  19560. exports2.createDirentFromStats = void 0;
  19561. var DirentFromStats = class {
  19562. constructor(name, stats) {
  19563. this.name = name;
  19564. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  19565. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  19566. this.isDirectory = stats.isDirectory.bind(stats);
  19567. this.isFIFO = stats.isFIFO.bind(stats);
  19568. this.isFile = stats.isFile.bind(stats);
  19569. this.isSocket = stats.isSocket.bind(stats);
  19570. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  19571. }
  19572. };
  19573. function createDirentFromStats(name, stats) {
  19574. return new DirentFromStats(name, stats);
  19575. }
  19576. exports2.createDirentFromStats = createDirentFromStats;
  19577. }
  19578. });
  19579. var require_utils5 = __commonJS2({
  19580. "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
  19581. "use strict";
  19582. Object.defineProperty(exports2, "__esModule", {
  19583. value: true
  19584. });
  19585. exports2.fs = void 0;
  19586. var fs = require_fs3();
  19587. exports2.fs = fs;
  19588. }
  19589. });
  19590. var require_common3 = __commonJS2({
  19591. "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
  19592. "use strict";
  19593. Object.defineProperty(exports2, "__esModule", {
  19594. value: true
  19595. });
  19596. exports2.joinPathSegments = void 0;
  19597. function joinPathSegments(a, b, separator) {
  19598. if (a.endsWith(separator)) {
  19599. return a + b;
  19600. }
  19601. return a + separator + b;
  19602. }
  19603. exports2.joinPathSegments = joinPathSegments;
  19604. }
  19605. });
  19606. var require_async3 = __commonJS2({
  19607. "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
  19608. "use strict";
  19609. Object.defineProperty(exports2, "__esModule", {
  19610. value: true
  19611. });
  19612. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19613. var fsStat = require_out();
  19614. var rpl = require_run_parallel();
  19615. var constants_1 = require_constants4();
  19616. var utils = require_utils5();
  19617. var common = require_common3();
  19618. function read(directory, settings, callback) {
  19619. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19620. readdirWithFileTypes(directory, settings, callback);
  19621. return;
  19622. }
  19623. readdir(directory, settings, callback);
  19624. }
  19625. exports2.read = read;
  19626. function readdirWithFileTypes(directory, settings, callback) {
  19627. settings.fs.readdir(directory, {
  19628. withFileTypes: true
  19629. }, (readdirError, dirents) => {
  19630. if (readdirError !== null) {
  19631. callFailureCallback(callback, readdirError);
  19632. return;
  19633. }
  19634. const entries = dirents.map((dirent) => ({
  19635. dirent,
  19636. name: dirent.name,
  19637. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19638. }));
  19639. if (!settings.followSymbolicLinks) {
  19640. callSuccessCallback(callback, entries);
  19641. return;
  19642. }
  19643. const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
  19644. rpl(tasks, (rplError, rplEntries) => {
  19645. if (rplError !== null) {
  19646. callFailureCallback(callback, rplError);
  19647. return;
  19648. }
  19649. callSuccessCallback(callback, rplEntries);
  19650. });
  19651. });
  19652. }
  19653. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19654. function makeRplTaskEntry(entry, settings) {
  19655. return (done) => {
  19656. if (!entry.dirent.isSymbolicLink()) {
  19657. done(null, entry);
  19658. return;
  19659. }
  19660. settings.fs.stat(entry.path, (statError, stats) => {
  19661. if (statError !== null) {
  19662. if (settings.throwErrorOnBrokenSymbolicLink) {
  19663. done(statError);
  19664. return;
  19665. }
  19666. done(null, entry);
  19667. return;
  19668. }
  19669. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19670. done(null, entry);
  19671. });
  19672. };
  19673. }
  19674. function readdir(directory, settings, callback) {
  19675. settings.fs.readdir(directory, (readdirError, names) => {
  19676. if (readdirError !== null) {
  19677. callFailureCallback(callback, readdirError);
  19678. return;
  19679. }
  19680. const tasks = names.map((name) => {
  19681. const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19682. return (done) => {
  19683. fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
  19684. if (error !== null) {
  19685. done(error);
  19686. return;
  19687. }
  19688. const entry = {
  19689. name,
  19690. path,
  19691. dirent: utils.fs.createDirentFromStats(name, stats)
  19692. };
  19693. if (settings.stats) {
  19694. entry.stats = stats;
  19695. }
  19696. done(null, entry);
  19697. });
  19698. };
  19699. });
  19700. rpl(tasks, (rplError, entries) => {
  19701. if (rplError !== null) {
  19702. callFailureCallback(callback, rplError);
  19703. return;
  19704. }
  19705. callSuccessCallback(callback, entries);
  19706. });
  19707. });
  19708. }
  19709. exports2.readdir = readdir;
  19710. function callFailureCallback(callback, error) {
  19711. callback(error);
  19712. }
  19713. function callSuccessCallback(callback, result) {
  19714. callback(null, result);
  19715. }
  19716. }
  19717. });
  19718. var require_sync3 = __commonJS2({
  19719. "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
  19720. "use strict";
  19721. Object.defineProperty(exports2, "__esModule", {
  19722. value: true
  19723. });
  19724. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19725. var fsStat = require_out();
  19726. var constants_1 = require_constants4();
  19727. var utils = require_utils5();
  19728. var common = require_common3();
  19729. function read(directory, settings) {
  19730. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19731. return readdirWithFileTypes(directory, settings);
  19732. }
  19733. return readdir(directory, settings);
  19734. }
  19735. exports2.read = read;
  19736. function readdirWithFileTypes(directory, settings) {
  19737. const dirents = settings.fs.readdirSync(directory, {
  19738. withFileTypes: true
  19739. });
  19740. return dirents.map((dirent) => {
  19741. const entry = {
  19742. dirent,
  19743. name: dirent.name,
  19744. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19745. };
  19746. if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
  19747. try {
  19748. const stats = settings.fs.statSync(entry.path);
  19749. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19750. } catch (error) {
  19751. if (settings.throwErrorOnBrokenSymbolicLink) {
  19752. throw error;
  19753. }
  19754. }
  19755. }
  19756. return entry;
  19757. });
  19758. }
  19759. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19760. function readdir(directory, settings) {
  19761. const names = settings.fs.readdirSync(directory);
  19762. return names.map((name) => {
  19763. const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19764. const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
  19765. const entry = {
  19766. name,
  19767. path: entryPath,
  19768. dirent: utils.fs.createDirentFromStats(name, stats)
  19769. };
  19770. if (settings.stats) {
  19771. entry.stats = stats;
  19772. }
  19773. return entry;
  19774. });
  19775. }
  19776. exports2.readdir = readdir;
  19777. }
  19778. });
  19779. var require_fs4 = __commonJS2({
  19780. "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
  19781. "use strict";
  19782. Object.defineProperty(exports2, "__esModule", {
  19783. value: true
  19784. });
  19785. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19786. var fs = require("fs");
  19787. exports2.FILE_SYSTEM_ADAPTER = {
  19788. lstat: fs.lstat,
  19789. stat: fs.stat,
  19790. lstatSync: fs.lstatSync,
  19791. statSync: fs.statSync,
  19792. readdir: fs.readdir,
  19793. readdirSync: fs.readdirSync
  19794. };
  19795. function createFileSystemAdapter(fsMethods) {
  19796. if (fsMethods === void 0) {
  19797. return exports2.FILE_SYSTEM_ADAPTER;
  19798. }
  19799. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  19800. }
  19801. exports2.createFileSystemAdapter = createFileSystemAdapter;
  19802. }
  19803. });
  19804. var require_settings2 = __commonJS2({
  19805. "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
  19806. "use strict";
  19807. Object.defineProperty(exports2, "__esModule", {
  19808. value: true
  19809. });
  19810. var path = require("path");
  19811. var fsStat = require_out();
  19812. var fs = require_fs4();
  19813. var Settings = class {
  19814. constructor(_options = {}) {
  19815. this._options = _options;
  19816. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
  19817. this.fs = fs.createFileSystemAdapter(this._options.fs);
  19818. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  19819. this.stats = this._getValue(this._options.stats, false);
  19820. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  19821. this.fsStatSettings = new fsStat.Settings({
  19822. followSymbolicLink: this.followSymbolicLinks,
  19823. fs: this.fs,
  19824. throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
  19825. });
  19826. }
  19827. _getValue(option, value) {
  19828. return option !== null && option !== void 0 ? option : value;
  19829. }
  19830. };
  19831. exports2.default = Settings;
  19832. }
  19833. });
  19834. var require_out2 = __commonJS2({
  19835. "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
  19836. "use strict";
  19837. Object.defineProperty(exports2, "__esModule", {
  19838. value: true
  19839. });
  19840. exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
  19841. var async = require_async3();
  19842. var sync = require_sync3();
  19843. var settings_1 = require_settings2();
  19844. exports2.Settings = settings_1.default;
  19845. function scandir(path, optionsOrSettingsOrCallback, callback) {
  19846. if (typeof optionsOrSettingsOrCallback === "function") {
  19847. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  19848. return;
  19849. }
  19850. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  19851. }
  19852. exports2.scandir = scandir;
  19853. function scandirSync(path, optionsOrSettings) {
  19854. const settings = getSettings(optionsOrSettings);
  19855. return sync.read(path, settings);
  19856. }
  19857. exports2.scandirSync = scandirSync;
  19858. function getSettings(settingsOrOptions = {}) {
  19859. if (settingsOrOptions instanceof settings_1.default) {
  19860. return settingsOrOptions;
  19861. }
  19862. return new settings_1.default(settingsOrOptions);
  19863. }
  19864. }
  19865. });
  19866. var require_reusify = __commonJS2({
  19867. "node_modules/reusify/reusify.js"(exports2, module2) {
  19868. "use strict";
  19869. function reusify(Constructor) {
  19870. var head = new Constructor();
  19871. var tail = head;
  19872. function get() {
  19873. var current = head;
  19874. if (current.next) {
  19875. head = current.next;
  19876. } else {
  19877. head = new Constructor();
  19878. tail = head;
  19879. }
  19880. current.next = null;
  19881. return current;
  19882. }
  19883. function release(obj) {
  19884. tail.next = obj;
  19885. tail = obj;
  19886. }
  19887. return {
  19888. get,
  19889. release
  19890. };
  19891. }
  19892. module2.exports = reusify;
  19893. }
  19894. });
  19895. var require_queue = __commonJS2({
  19896. "node_modules/fastq/queue.js"(exports2, module2) {
  19897. "use strict";
  19898. var reusify = require_reusify();
  19899. function fastqueue(context, worker, concurrency) {
  19900. if (typeof context === "function") {
  19901. concurrency = worker;
  19902. worker = context;
  19903. context = null;
  19904. }
  19905. if (concurrency < 1) {
  19906. throw new Error("fastqueue concurrency must be greater than 1");
  19907. }
  19908. var cache = reusify(Task);
  19909. var queueHead = null;
  19910. var queueTail = null;
  19911. var _running = 0;
  19912. var errorHandler = null;
  19913. var self2 = {
  19914. push,
  19915. drain: noop,
  19916. saturated: noop,
  19917. pause,
  19918. paused: false,
  19919. concurrency,
  19920. running,
  19921. resume,
  19922. idle,
  19923. length,
  19924. getQueue,
  19925. unshift,
  19926. empty: noop,
  19927. kill,
  19928. killAndDrain,
  19929. error
  19930. };
  19931. return self2;
  19932. function running() {
  19933. return _running;
  19934. }
  19935. function pause() {
  19936. self2.paused = true;
  19937. }
  19938. function length() {
  19939. var current = queueHead;
  19940. var counter = 0;
  19941. while (current) {
  19942. current = current.next;
  19943. counter++;
  19944. }
  19945. return counter;
  19946. }
  19947. function getQueue() {
  19948. var current = queueHead;
  19949. var tasks = [];
  19950. while (current) {
  19951. tasks.push(current.value);
  19952. current = current.next;
  19953. }
  19954. return tasks;
  19955. }
  19956. function resume() {
  19957. if (!self2.paused)
  19958. return;
  19959. self2.paused = false;
  19960. for (var i = 0; i < self2.concurrency; i++) {
  19961. _running++;
  19962. release();
  19963. }
  19964. }
  19965. function idle() {
  19966. return _running === 0 && self2.length() === 0;
  19967. }
  19968. function push(value, done) {
  19969. var current = cache.get();
  19970. current.context = context;
  19971. current.release = release;
  19972. current.value = value;
  19973. current.callback = done || noop;
  19974. current.errorHandler = errorHandler;
  19975. if (_running === self2.concurrency || self2.paused) {
  19976. if (queueTail) {
  19977. queueTail.next = current;
  19978. queueTail = current;
  19979. } else {
  19980. queueHead = current;
  19981. queueTail = current;
  19982. self2.saturated();
  19983. }
  19984. } else {
  19985. _running++;
  19986. worker.call(context, current.value, current.worked);
  19987. }
  19988. }
  19989. function unshift(value, done) {
  19990. var current = cache.get();
  19991. current.context = context;
  19992. current.release = release;
  19993. current.value = value;
  19994. current.callback = done || noop;
  19995. if (_running === self2.concurrency || self2.paused) {
  19996. if (queueHead) {
  19997. current.next = queueHead;
  19998. queueHead = current;
  19999. } else {
  20000. queueHead = current;
  20001. queueTail = current;
  20002. self2.saturated();
  20003. }
  20004. } else {
  20005. _running++;
  20006. worker.call(context, current.value, current.worked);
  20007. }
  20008. }
  20009. function release(holder) {
  20010. if (holder) {
  20011. cache.release(holder);
  20012. }
  20013. var next = queueHead;
  20014. if (next) {
  20015. if (!self2.paused) {
  20016. if (queueTail === queueHead) {
  20017. queueTail = null;
  20018. }
  20019. queueHead = next.next;
  20020. next.next = null;
  20021. worker.call(context, next.value, next.worked);
  20022. if (queueTail === null) {
  20023. self2.empty();
  20024. }
  20025. } else {
  20026. _running--;
  20027. }
  20028. } else if (--_running === 0) {
  20029. self2.drain();
  20030. }
  20031. }
  20032. function kill() {
  20033. queueHead = null;
  20034. queueTail = null;
  20035. self2.drain = noop;
  20036. }
  20037. function killAndDrain() {
  20038. queueHead = null;
  20039. queueTail = null;
  20040. self2.drain();
  20041. self2.drain = noop;
  20042. }
  20043. function error(handler) {
  20044. errorHandler = handler;
  20045. }
  20046. }
  20047. function noop() {
  20048. }
  20049. function Task() {
  20050. this.value = null;
  20051. this.callback = noop;
  20052. this.next = null;
  20053. this.release = noop;
  20054. this.context = null;
  20055. this.errorHandler = null;
  20056. var self2 = this;
  20057. this.worked = function worked(err, result) {
  20058. var callback = self2.callback;
  20059. var errorHandler = self2.errorHandler;
  20060. var val = self2.value;
  20061. self2.value = null;
  20062. self2.callback = noop;
  20063. if (self2.errorHandler) {
  20064. errorHandler(err, val);
  20065. }
  20066. callback.call(self2.context, err, result);
  20067. self2.release(self2);
  20068. };
  20069. }
  20070. function queueAsPromised(context, worker, concurrency) {
  20071. if (typeof context === "function") {
  20072. concurrency = worker;
  20073. worker = context;
  20074. context = null;
  20075. }
  20076. function asyncWrapper(arg, cb) {
  20077. worker.call(this, arg).then(function(res) {
  20078. cb(null, res);
  20079. }, cb);
  20080. }
  20081. var queue = fastqueue(context, asyncWrapper, concurrency);
  20082. var pushCb = queue.push;
  20083. var unshiftCb = queue.unshift;
  20084. queue.push = push;
  20085. queue.unshift = unshift;
  20086. queue.drained = drained;
  20087. return queue;
  20088. function push(value) {
  20089. var p = new Promise(function(resolve, reject) {
  20090. pushCb(value, function(err, result) {
  20091. if (err) {
  20092. reject(err);
  20093. return;
  20094. }
  20095. resolve(result);
  20096. });
  20097. });
  20098. p.catch(noop);
  20099. return p;
  20100. }
  20101. function unshift(value) {
  20102. var p = new Promise(function(resolve, reject) {
  20103. unshiftCb(value, function(err, result) {
  20104. if (err) {
  20105. reject(err);
  20106. return;
  20107. }
  20108. resolve(result);
  20109. });
  20110. });
  20111. p.catch(noop);
  20112. return p;
  20113. }
  20114. function drained() {
  20115. var previousDrain = queue.drain;
  20116. var p = new Promise(function(resolve) {
  20117. queue.drain = function() {
  20118. previousDrain();
  20119. resolve();
  20120. };
  20121. });
  20122. return p;
  20123. }
  20124. }
  20125. module2.exports = fastqueue;
  20126. module2.exports.promise = queueAsPromised;
  20127. }
  20128. });
  20129. var require_common4 = __commonJS2({
  20130. "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
  20131. "use strict";
  20132. Object.defineProperty(exports2, "__esModule", {
  20133. value: true
  20134. });
  20135. exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
  20136. function isFatalError(settings, error) {
  20137. if (settings.errorFilter === null) {
  20138. return true;
  20139. }
  20140. return !settings.errorFilter(error);
  20141. }
  20142. exports2.isFatalError = isFatalError;
  20143. function isAppliedFilter(filter, value) {
  20144. return filter === null || filter(value);
  20145. }
  20146. exports2.isAppliedFilter = isAppliedFilter;
  20147. function replacePathSegmentSeparator(filepath, separator) {
  20148. return filepath.split(/[/\\]/).join(separator);
  20149. }
  20150. exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
  20151. function joinPathSegments(a, b, separator) {
  20152. if (a === "") {
  20153. return b;
  20154. }
  20155. if (a.endsWith(separator)) {
  20156. return a + b;
  20157. }
  20158. return a + separator + b;
  20159. }
  20160. exports2.joinPathSegments = joinPathSegments;
  20161. }
  20162. });
  20163. var require_reader = __commonJS2({
  20164. "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
  20165. "use strict";
  20166. Object.defineProperty(exports2, "__esModule", {
  20167. value: true
  20168. });
  20169. var common = require_common4();
  20170. var Reader = class {
  20171. constructor(_root, _settings) {
  20172. this._root = _root;
  20173. this._settings = _settings;
  20174. this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
  20175. }
  20176. };
  20177. exports2.default = Reader;
  20178. }
  20179. });
  20180. var require_async4 = __commonJS2({
  20181. "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
  20182. "use strict";
  20183. Object.defineProperty(exports2, "__esModule", {
  20184. value: true
  20185. });
  20186. var events_1 = require("events");
  20187. var fsScandir = require_out2();
  20188. var fastq = require_queue();
  20189. var common = require_common4();
  20190. var reader_1 = require_reader();
  20191. var AsyncReader = class extends reader_1.default {
  20192. constructor(_root, _settings) {
  20193. super(_root, _settings);
  20194. this._settings = _settings;
  20195. this._scandir = fsScandir.scandir;
  20196. this._emitter = new events_1.EventEmitter();
  20197. this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
  20198. this._isFatalError = false;
  20199. this._isDestroyed = false;
  20200. this._queue.drain = () => {
  20201. if (!this._isFatalError) {
  20202. this._emitter.emit("end");
  20203. }
  20204. };
  20205. }
  20206. read() {
  20207. this._isFatalError = false;
  20208. this._isDestroyed = false;
  20209. setImmediate(() => {
  20210. this._pushToQueue(this._root, this._settings.basePath);
  20211. });
  20212. return this._emitter;
  20213. }
  20214. get isDestroyed() {
  20215. return this._isDestroyed;
  20216. }
  20217. destroy() {
  20218. if (this._isDestroyed) {
  20219. throw new Error("The reader is already destroyed");
  20220. }
  20221. this._isDestroyed = true;
  20222. this._queue.killAndDrain();
  20223. }
  20224. onEntry(callback) {
  20225. this._emitter.on("entry", callback);
  20226. }
  20227. onError(callback) {
  20228. this._emitter.once("error", callback);
  20229. }
  20230. onEnd(callback) {
  20231. this._emitter.once("end", callback);
  20232. }
  20233. _pushToQueue(directory, base) {
  20234. const queueItem = {
  20235. directory,
  20236. base
  20237. };
  20238. this._queue.push(queueItem, (error) => {
  20239. if (error !== null) {
  20240. this._handleError(error);
  20241. }
  20242. });
  20243. }
  20244. _worker(item, done) {
  20245. this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
  20246. if (error !== null) {
  20247. done(error, void 0);
  20248. return;
  20249. }
  20250. for (const entry of entries) {
  20251. this._handleEntry(entry, item.base);
  20252. }
  20253. done(null, void 0);
  20254. });
  20255. }
  20256. _handleError(error) {
  20257. if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
  20258. return;
  20259. }
  20260. this._isFatalError = true;
  20261. this._isDestroyed = true;
  20262. this._emitter.emit("error", error);
  20263. }
  20264. _handleEntry(entry, base) {
  20265. if (this._isDestroyed || this._isFatalError) {
  20266. return;
  20267. }
  20268. const fullpath = entry.path;
  20269. if (base !== void 0) {
  20270. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20271. }
  20272. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20273. this._emitEntry(entry);
  20274. }
  20275. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20276. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20277. }
  20278. }
  20279. _emitEntry(entry) {
  20280. this._emitter.emit("entry", entry);
  20281. }
  20282. };
  20283. exports2.default = AsyncReader;
  20284. }
  20285. });
  20286. var require_async5 = __commonJS2({
  20287. "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
  20288. "use strict";
  20289. Object.defineProperty(exports2, "__esModule", {
  20290. value: true
  20291. });
  20292. var async_1 = require_async4();
  20293. var AsyncProvider = class {
  20294. constructor(_root, _settings) {
  20295. this._root = _root;
  20296. this._settings = _settings;
  20297. this._reader = new async_1.default(this._root, this._settings);
  20298. this._storage = [];
  20299. }
  20300. read(callback) {
  20301. this._reader.onError((error) => {
  20302. callFailureCallback(callback, error);
  20303. });
  20304. this._reader.onEntry((entry) => {
  20305. this._storage.push(entry);
  20306. });
  20307. this._reader.onEnd(() => {
  20308. callSuccessCallback(callback, this._storage);
  20309. });
  20310. this._reader.read();
  20311. }
  20312. };
  20313. exports2.default = AsyncProvider;
  20314. function callFailureCallback(callback, error) {
  20315. callback(error);
  20316. }
  20317. function callSuccessCallback(callback, entries) {
  20318. callback(null, entries);
  20319. }
  20320. }
  20321. });
  20322. var require_stream2 = __commonJS2({
  20323. "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
  20324. "use strict";
  20325. Object.defineProperty(exports2, "__esModule", {
  20326. value: true
  20327. });
  20328. var stream_1 = require("stream");
  20329. var async_1 = require_async4();
  20330. var StreamProvider = class {
  20331. constructor(_root, _settings) {
  20332. this._root = _root;
  20333. this._settings = _settings;
  20334. this._reader = new async_1.default(this._root, this._settings);
  20335. this._stream = new stream_1.Readable({
  20336. objectMode: true,
  20337. read: () => {
  20338. },
  20339. destroy: () => {
  20340. if (!this._reader.isDestroyed) {
  20341. this._reader.destroy();
  20342. }
  20343. }
  20344. });
  20345. }
  20346. read() {
  20347. this._reader.onError((error) => {
  20348. this._stream.emit("error", error);
  20349. });
  20350. this._reader.onEntry((entry) => {
  20351. this._stream.push(entry);
  20352. });
  20353. this._reader.onEnd(() => {
  20354. this._stream.push(null);
  20355. });
  20356. this._reader.read();
  20357. return this._stream;
  20358. }
  20359. };
  20360. exports2.default = StreamProvider;
  20361. }
  20362. });
  20363. var require_sync4 = __commonJS2({
  20364. "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
  20365. "use strict";
  20366. Object.defineProperty(exports2, "__esModule", {
  20367. value: true
  20368. });
  20369. var fsScandir = require_out2();
  20370. var common = require_common4();
  20371. var reader_1 = require_reader();
  20372. var SyncReader = class extends reader_1.default {
  20373. constructor() {
  20374. super(...arguments);
  20375. this._scandir = fsScandir.scandirSync;
  20376. this._storage = [];
  20377. this._queue = /* @__PURE__ */ new Set();
  20378. }
  20379. read() {
  20380. this._pushToQueue(this._root, this._settings.basePath);
  20381. this._handleQueue();
  20382. return this._storage;
  20383. }
  20384. _pushToQueue(directory, base) {
  20385. this._queue.add({
  20386. directory,
  20387. base
  20388. });
  20389. }
  20390. _handleQueue() {
  20391. for (const item of this._queue.values()) {
  20392. this._handleDirectory(item.directory, item.base);
  20393. }
  20394. }
  20395. _handleDirectory(directory, base) {
  20396. try {
  20397. const entries = this._scandir(directory, this._settings.fsScandirSettings);
  20398. for (const entry of entries) {
  20399. this._handleEntry(entry, base);
  20400. }
  20401. } catch (error) {
  20402. this._handleError(error);
  20403. }
  20404. }
  20405. _handleError(error) {
  20406. if (!common.isFatalError(this._settings, error)) {
  20407. return;
  20408. }
  20409. throw error;
  20410. }
  20411. _handleEntry(entry, base) {
  20412. const fullpath = entry.path;
  20413. if (base !== void 0) {
  20414. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20415. }
  20416. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20417. this._pushToStorage(entry);
  20418. }
  20419. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20420. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20421. }
  20422. }
  20423. _pushToStorage(entry) {
  20424. this._storage.push(entry);
  20425. }
  20426. };
  20427. exports2.default = SyncReader;
  20428. }
  20429. });
  20430. var require_sync5 = __commonJS2({
  20431. "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
  20432. "use strict";
  20433. Object.defineProperty(exports2, "__esModule", {
  20434. value: true
  20435. });
  20436. var sync_1 = require_sync4();
  20437. var SyncProvider = class {
  20438. constructor(_root, _settings) {
  20439. this._root = _root;
  20440. this._settings = _settings;
  20441. this._reader = new sync_1.default(this._root, this._settings);
  20442. }
  20443. read() {
  20444. return this._reader.read();
  20445. }
  20446. };
  20447. exports2.default = SyncProvider;
  20448. }
  20449. });
  20450. var require_settings3 = __commonJS2({
  20451. "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
  20452. "use strict";
  20453. Object.defineProperty(exports2, "__esModule", {
  20454. value: true
  20455. });
  20456. var path = require("path");
  20457. var fsScandir = require_out2();
  20458. var Settings = class {
  20459. constructor(_options = {}) {
  20460. this._options = _options;
  20461. this.basePath = this._getValue(this._options.basePath, void 0);
  20462. this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
  20463. this.deepFilter = this._getValue(this._options.deepFilter, null);
  20464. this.entryFilter = this._getValue(this._options.entryFilter, null);
  20465. this.errorFilter = this._getValue(this._options.errorFilter, null);
  20466. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  20467. this.fsScandirSettings = new fsScandir.Settings({
  20468. followSymbolicLinks: this._options.followSymbolicLinks,
  20469. fs: this._options.fs,
  20470. pathSegmentSeparator: this._options.pathSegmentSeparator,
  20471. stats: this._options.stats,
  20472. throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
  20473. });
  20474. }
  20475. _getValue(option, value) {
  20476. return option !== null && option !== void 0 ? option : value;
  20477. }
  20478. };
  20479. exports2.default = Settings;
  20480. }
  20481. });
  20482. var require_out3 = __commonJS2({
  20483. "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
  20484. "use strict";
  20485. Object.defineProperty(exports2, "__esModule", {
  20486. value: true
  20487. });
  20488. exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
  20489. var async_1 = require_async5();
  20490. var stream_1 = require_stream2();
  20491. var sync_1 = require_sync5();
  20492. var settings_1 = require_settings3();
  20493. exports2.Settings = settings_1.default;
  20494. function walk(directory, optionsOrSettingsOrCallback, callback) {
  20495. if (typeof optionsOrSettingsOrCallback === "function") {
  20496. new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
  20497. return;
  20498. }
  20499. new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
  20500. }
  20501. exports2.walk = walk;
  20502. function walkSync(directory, optionsOrSettings) {
  20503. const settings = getSettings(optionsOrSettings);
  20504. const provider = new sync_1.default(directory, settings);
  20505. return provider.read();
  20506. }
  20507. exports2.walkSync = walkSync;
  20508. function walkStream(directory, optionsOrSettings) {
  20509. const settings = getSettings(optionsOrSettings);
  20510. const provider = new stream_1.default(directory, settings);
  20511. return provider.read();
  20512. }
  20513. exports2.walkStream = walkStream;
  20514. function getSettings(settingsOrOptions = {}) {
  20515. if (settingsOrOptions instanceof settings_1.default) {
  20516. return settingsOrOptions;
  20517. }
  20518. return new settings_1.default(settingsOrOptions);
  20519. }
  20520. }
  20521. });
  20522. var require_reader2 = __commonJS2({
  20523. "node_modules/fast-glob/out/readers/reader.js"(exports2) {
  20524. "use strict";
  20525. Object.defineProperty(exports2, "__esModule", {
  20526. value: true
  20527. });
  20528. var path = require("path");
  20529. var fsStat = require_out();
  20530. var utils = require_utils4();
  20531. var Reader = class {
  20532. constructor(_settings) {
  20533. this._settings = _settings;
  20534. this._fsStatSettings = new fsStat.Settings({
  20535. followSymbolicLink: this._settings.followSymbolicLinks,
  20536. fs: this._settings.fs,
  20537. throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
  20538. });
  20539. }
  20540. _getFullEntryPath(filepath) {
  20541. return path.resolve(this._settings.cwd, filepath);
  20542. }
  20543. _makeEntry(stats, pattern) {
  20544. const entry = {
  20545. name: pattern,
  20546. path: pattern,
  20547. dirent: utils.fs.createDirentFromStats(pattern, stats)
  20548. };
  20549. if (this._settings.stats) {
  20550. entry.stats = stats;
  20551. }
  20552. return entry;
  20553. }
  20554. _isFatalError(error) {
  20555. return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
  20556. }
  20557. };
  20558. exports2.default = Reader;
  20559. }
  20560. });
  20561. var require_stream3 = __commonJS2({
  20562. "node_modules/fast-glob/out/readers/stream.js"(exports2) {
  20563. "use strict";
  20564. Object.defineProperty(exports2, "__esModule", {
  20565. value: true
  20566. });
  20567. var stream_1 = require("stream");
  20568. var fsStat = require_out();
  20569. var fsWalk = require_out3();
  20570. var reader_1 = require_reader2();
  20571. var ReaderStream = class extends reader_1.default {
  20572. constructor() {
  20573. super(...arguments);
  20574. this._walkStream = fsWalk.walkStream;
  20575. this._stat = fsStat.stat;
  20576. }
  20577. dynamic(root, options) {
  20578. return this._walkStream(root, options);
  20579. }
  20580. static(patterns, options) {
  20581. const filepaths = patterns.map(this._getFullEntryPath, this);
  20582. const stream = new stream_1.PassThrough({
  20583. objectMode: true
  20584. });
  20585. stream._write = (index, _enc, done) => {
  20586. return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
  20587. if (entry !== null && options.entryFilter(entry)) {
  20588. stream.push(entry);
  20589. }
  20590. if (index === filepaths.length - 1) {
  20591. stream.end();
  20592. }
  20593. done();
  20594. }).catch(done);
  20595. };
  20596. for (let i = 0; i < filepaths.length; i++) {
  20597. stream.write(i);
  20598. }
  20599. return stream;
  20600. }
  20601. _getEntry(filepath, pattern, options) {
  20602. return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
  20603. if (options.errorFilter(error)) {
  20604. return null;
  20605. }
  20606. throw error;
  20607. });
  20608. }
  20609. _getStat(filepath) {
  20610. return new Promise((resolve, reject) => {
  20611. this._stat(filepath, this._fsStatSettings, (error, stats) => {
  20612. return error === null ? resolve(stats) : reject(error);
  20613. });
  20614. });
  20615. }
  20616. };
  20617. exports2.default = ReaderStream;
  20618. }
  20619. });
  20620. var require_matcher = __commonJS2({
  20621. "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
  20622. "use strict";
  20623. Object.defineProperty(exports2, "__esModule", {
  20624. value: true
  20625. });
  20626. var utils = require_utils4();
  20627. var Matcher = class {
  20628. constructor(_patterns, _settings, _micromatchOptions) {
  20629. this._patterns = _patterns;
  20630. this._settings = _settings;
  20631. this._micromatchOptions = _micromatchOptions;
  20632. this._storage = [];
  20633. this._fillStorage();
  20634. }
  20635. _fillStorage() {
  20636. const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
  20637. for (const pattern of patterns) {
  20638. const segments = this._getPatternSegments(pattern);
  20639. const sections = this._splitSegmentsIntoSections(segments);
  20640. this._storage.push({
  20641. complete: sections.length <= 1,
  20642. pattern,
  20643. segments,
  20644. sections
  20645. });
  20646. }
  20647. }
  20648. _getPatternSegments(pattern) {
  20649. const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
  20650. return parts.map((part) => {
  20651. const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
  20652. if (!dynamic) {
  20653. return {
  20654. dynamic: false,
  20655. pattern: part
  20656. };
  20657. }
  20658. return {
  20659. dynamic: true,
  20660. pattern: part,
  20661. patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
  20662. };
  20663. });
  20664. }
  20665. _splitSegmentsIntoSections(segments) {
  20666. return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
  20667. }
  20668. };
  20669. exports2.default = Matcher;
  20670. }
  20671. });
  20672. var require_partial = __commonJS2({
  20673. "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
  20674. "use strict";
  20675. Object.defineProperty(exports2, "__esModule", {
  20676. value: true
  20677. });
  20678. var matcher_1 = require_matcher();
  20679. var PartialMatcher = class extends matcher_1.default {
  20680. match(filepath) {
  20681. const parts = filepath.split("/");
  20682. const levels = parts.length;
  20683. const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
  20684. for (const pattern of patterns) {
  20685. const section = pattern.sections[0];
  20686. if (!pattern.complete && levels > section.length) {
  20687. return true;
  20688. }
  20689. const match = parts.every((part, index) => {
  20690. const segment = pattern.segments[index];
  20691. if (segment.dynamic && segment.patternRe.test(part)) {
  20692. return true;
  20693. }
  20694. if (!segment.dynamic && segment.pattern === part) {
  20695. return true;
  20696. }
  20697. return false;
  20698. });
  20699. if (match) {
  20700. return true;
  20701. }
  20702. }
  20703. return false;
  20704. }
  20705. };
  20706. exports2.default = PartialMatcher;
  20707. }
  20708. });
  20709. var require_deep = __commonJS2({
  20710. "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
  20711. "use strict";
  20712. Object.defineProperty(exports2, "__esModule", {
  20713. value: true
  20714. });
  20715. var utils = require_utils4();
  20716. var partial_1 = require_partial();
  20717. var DeepFilter = class {
  20718. constructor(_settings, _micromatchOptions) {
  20719. this._settings = _settings;
  20720. this._micromatchOptions = _micromatchOptions;
  20721. }
  20722. getFilter(basePath, positive, negative) {
  20723. const matcher = this._getMatcher(positive);
  20724. const negativeRe = this._getNegativePatternsRe(negative);
  20725. return (entry) => this._filter(basePath, entry, matcher, negativeRe);
  20726. }
  20727. _getMatcher(patterns) {
  20728. return new partial_1.default(patterns, this._settings, this._micromatchOptions);
  20729. }
  20730. _getNegativePatternsRe(patterns) {
  20731. const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
  20732. return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
  20733. }
  20734. _filter(basePath, entry, matcher, negativeRe) {
  20735. if (this._isSkippedByDeep(basePath, entry.path)) {
  20736. return false;
  20737. }
  20738. if (this._isSkippedSymbolicLink(entry)) {
  20739. return false;
  20740. }
  20741. const filepath = utils.path.removeLeadingDotSegment(entry.path);
  20742. if (this._isSkippedByPositivePatterns(filepath, matcher)) {
  20743. return false;
  20744. }
  20745. return this._isSkippedByNegativePatterns(filepath, negativeRe);
  20746. }
  20747. _isSkippedByDeep(basePath, entryPath) {
  20748. if (this._settings.deep === Infinity) {
  20749. return false;
  20750. }
  20751. return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
  20752. }
  20753. _getEntryLevel(basePath, entryPath) {
  20754. const entryPathDepth = entryPath.split("/").length;
  20755. if (basePath === "") {
  20756. return entryPathDepth;
  20757. }
  20758. const basePathDepth = basePath.split("/").length;
  20759. return entryPathDepth - basePathDepth;
  20760. }
  20761. _isSkippedSymbolicLink(entry) {
  20762. return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
  20763. }
  20764. _isSkippedByPositivePatterns(entryPath, matcher) {
  20765. return !this._settings.baseNameMatch && !matcher.match(entryPath);
  20766. }
  20767. _isSkippedByNegativePatterns(entryPath, patternsRe) {
  20768. return !utils.pattern.matchAny(entryPath, patternsRe);
  20769. }
  20770. };
  20771. exports2.default = DeepFilter;
  20772. }
  20773. });
  20774. var require_entry = __commonJS2({
  20775. "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
  20776. "use strict";
  20777. Object.defineProperty(exports2, "__esModule", {
  20778. value: true
  20779. });
  20780. var utils = require_utils4();
  20781. var EntryFilter = class {
  20782. constructor(_settings, _micromatchOptions) {
  20783. this._settings = _settings;
  20784. this._micromatchOptions = _micromatchOptions;
  20785. this.index = /* @__PURE__ */ new Map();
  20786. }
  20787. getFilter(positive, negative) {
  20788. const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
  20789. const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
  20790. return (entry) => this._filter(entry, positiveRe, negativeRe);
  20791. }
  20792. _filter(entry, positiveRe, negativeRe) {
  20793. if (this._settings.unique && this._isDuplicateEntry(entry)) {
  20794. return false;
  20795. }
  20796. if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
  20797. return false;
  20798. }
  20799. if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
  20800. return false;
  20801. }
  20802. const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
  20803. const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
  20804. if (this._settings.unique && isMatched) {
  20805. this._createIndexRecord(entry);
  20806. }
  20807. return isMatched;
  20808. }
  20809. _isDuplicateEntry(entry) {
  20810. return this.index.has(entry.path);
  20811. }
  20812. _createIndexRecord(entry) {
  20813. this.index.set(entry.path, void 0);
  20814. }
  20815. _onlyFileFilter(entry) {
  20816. return this._settings.onlyFiles && !entry.dirent.isFile();
  20817. }
  20818. _onlyDirectoryFilter(entry) {
  20819. return this._settings.onlyDirectories && !entry.dirent.isDirectory();
  20820. }
  20821. _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
  20822. if (!this._settings.absolute) {
  20823. return false;
  20824. }
  20825. const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
  20826. return utils.pattern.matchAny(fullpath, patternsRe);
  20827. }
  20828. _isMatchToPatterns(entryPath, patternsRe) {
  20829. const filepath = utils.path.removeLeadingDotSegment(entryPath);
  20830. return utils.pattern.matchAny(filepath, patternsRe) || utils.pattern.matchAny(filepath + "/", patternsRe);
  20831. }
  20832. };
  20833. exports2.default = EntryFilter;
  20834. }
  20835. });
  20836. var require_error = __commonJS2({
  20837. "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
  20838. "use strict";
  20839. Object.defineProperty(exports2, "__esModule", {
  20840. value: true
  20841. });
  20842. var utils = require_utils4();
  20843. var ErrorFilter = class {
  20844. constructor(_settings) {
  20845. this._settings = _settings;
  20846. }
  20847. getFilter() {
  20848. return (error) => this._isNonFatalError(error);
  20849. }
  20850. _isNonFatalError(error) {
  20851. return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
  20852. }
  20853. };
  20854. exports2.default = ErrorFilter;
  20855. }
  20856. });
  20857. var require_entry2 = __commonJS2({
  20858. "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
  20859. "use strict";
  20860. Object.defineProperty(exports2, "__esModule", {
  20861. value: true
  20862. });
  20863. var utils = require_utils4();
  20864. var EntryTransformer = class {
  20865. constructor(_settings) {
  20866. this._settings = _settings;
  20867. }
  20868. getTransformer() {
  20869. return (entry) => this._transform(entry);
  20870. }
  20871. _transform(entry) {
  20872. let filepath = entry.path;
  20873. if (this._settings.absolute) {
  20874. filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  20875. filepath = utils.path.unixify(filepath);
  20876. }
  20877. if (this._settings.markDirectories && entry.dirent.isDirectory()) {
  20878. filepath += "/";
  20879. }
  20880. if (!this._settings.objectMode) {
  20881. return filepath;
  20882. }
  20883. return Object.assign(Object.assign({}, entry), {
  20884. path: filepath
  20885. });
  20886. }
  20887. };
  20888. exports2.default = EntryTransformer;
  20889. }
  20890. });
  20891. var require_provider = __commonJS2({
  20892. "node_modules/fast-glob/out/providers/provider.js"(exports2) {
  20893. "use strict";
  20894. Object.defineProperty(exports2, "__esModule", {
  20895. value: true
  20896. });
  20897. var path = require("path");
  20898. var deep_1 = require_deep();
  20899. var entry_1 = require_entry();
  20900. var error_1 = require_error();
  20901. var entry_2 = require_entry2();
  20902. var Provider = class {
  20903. constructor(_settings) {
  20904. this._settings = _settings;
  20905. this.errorFilter = new error_1.default(this._settings);
  20906. this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
  20907. this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
  20908. this.entryTransformer = new entry_2.default(this._settings);
  20909. }
  20910. _getRootDirectory(task) {
  20911. return path.resolve(this._settings.cwd, task.base);
  20912. }
  20913. _getReaderOptions(task) {
  20914. const basePath = task.base === "." ? "" : task.base;
  20915. return {
  20916. basePath,
  20917. pathSegmentSeparator: "/",
  20918. concurrency: this._settings.concurrency,
  20919. deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
  20920. entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
  20921. errorFilter: this.errorFilter.getFilter(),
  20922. followSymbolicLinks: this._settings.followSymbolicLinks,
  20923. fs: this._settings.fs,
  20924. stats: this._settings.stats,
  20925. throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
  20926. transform: this.entryTransformer.getTransformer()
  20927. };
  20928. }
  20929. _getMicromatchOptions() {
  20930. return {
  20931. dot: this._settings.dot,
  20932. matchBase: this._settings.baseNameMatch,
  20933. nobrace: !this._settings.braceExpansion,
  20934. nocase: !this._settings.caseSensitiveMatch,
  20935. noext: !this._settings.extglob,
  20936. noglobstar: !this._settings.globstar,
  20937. posix: true,
  20938. strictSlashes: false
  20939. };
  20940. }
  20941. };
  20942. exports2.default = Provider;
  20943. }
  20944. });
  20945. var require_async6 = __commonJS2({
  20946. "node_modules/fast-glob/out/providers/async.js"(exports2) {
  20947. "use strict";
  20948. Object.defineProperty(exports2, "__esModule", {
  20949. value: true
  20950. });
  20951. var stream_1 = require_stream3();
  20952. var provider_1 = require_provider();
  20953. var ProviderAsync = class extends provider_1.default {
  20954. constructor() {
  20955. super(...arguments);
  20956. this._reader = new stream_1.default(this._settings);
  20957. }
  20958. read(task) {
  20959. const root = this._getRootDirectory(task);
  20960. const options = this._getReaderOptions(task);
  20961. const entries = [];
  20962. return new Promise((resolve, reject) => {
  20963. const stream = this.api(root, task, options);
  20964. stream.once("error", reject);
  20965. stream.on("data", (entry) => entries.push(options.transform(entry)));
  20966. stream.once("end", () => resolve(entries));
  20967. });
  20968. }
  20969. api(root, task, options) {
  20970. if (task.dynamic) {
  20971. return this._reader.dynamic(root, options);
  20972. }
  20973. return this._reader.static(task.patterns, options);
  20974. }
  20975. };
  20976. exports2.default = ProviderAsync;
  20977. }
  20978. });
  20979. var require_stream4 = __commonJS2({
  20980. "node_modules/fast-glob/out/providers/stream.js"(exports2) {
  20981. "use strict";
  20982. Object.defineProperty(exports2, "__esModule", {
  20983. value: true
  20984. });
  20985. var stream_1 = require("stream");
  20986. var stream_2 = require_stream3();
  20987. var provider_1 = require_provider();
  20988. var ProviderStream = class extends provider_1.default {
  20989. constructor() {
  20990. super(...arguments);
  20991. this._reader = new stream_2.default(this._settings);
  20992. }
  20993. read(task) {
  20994. const root = this._getRootDirectory(task);
  20995. const options = this._getReaderOptions(task);
  20996. const source = this.api(root, task, options);
  20997. const destination = new stream_1.Readable({
  20998. objectMode: true,
  20999. read: () => {
  21000. }
  21001. });
  21002. source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
  21003. destination.once("close", () => source.destroy());
  21004. return destination;
  21005. }
  21006. api(root, task, options) {
  21007. if (task.dynamic) {
  21008. return this._reader.dynamic(root, options);
  21009. }
  21010. return this._reader.static(task.patterns, options);
  21011. }
  21012. };
  21013. exports2.default = ProviderStream;
  21014. }
  21015. });
  21016. var require_sync6 = __commonJS2({
  21017. "node_modules/fast-glob/out/readers/sync.js"(exports2) {
  21018. "use strict";
  21019. Object.defineProperty(exports2, "__esModule", {
  21020. value: true
  21021. });
  21022. var fsStat = require_out();
  21023. var fsWalk = require_out3();
  21024. var reader_1 = require_reader2();
  21025. var ReaderSync = class extends reader_1.default {
  21026. constructor() {
  21027. super(...arguments);
  21028. this._walkSync = fsWalk.walkSync;
  21029. this._statSync = fsStat.statSync;
  21030. }
  21031. dynamic(root, options) {
  21032. return this._walkSync(root, options);
  21033. }
  21034. static(patterns, options) {
  21035. const entries = [];
  21036. for (const pattern of patterns) {
  21037. const filepath = this._getFullEntryPath(pattern);
  21038. const entry = this._getEntry(filepath, pattern, options);
  21039. if (entry === null || !options.entryFilter(entry)) {
  21040. continue;
  21041. }
  21042. entries.push(entry);
  21043. }
  21044. return entries;
  21045. }
  21046. _getEntry(filepath, pattern, options) {
  21047. try {
  21048. const stats = this._getStat(filepath);
  21049. return this._makeEntry(stats, pattern);
  21050. } catch (error) {
  21051. if (options.errorFilter(error)) {
  21052. return null;
  21053. }
  21054. throw error;
  21055. }
  21056. }
  21057. _getStat(filepath) {
  21058. return this._statSync(filepath, this._fsStatSettings);
  21059. }
  21060. };
  21061. exports2.default = ReaderSync;
  21062. }
  21063. });
  21064. var require_sync7 = __commonJS2({
  21065. "node_modules/fast-glob/out/providers/sync.js"(exports2) {
  21066. "use strict";
  21067. Object.defineProperty(exports2, "__esModule", {
  21068. value: true
  21069. });
  21070. var sync_1 = require_sync6();
  21071. var provider_1 = require_provider();
  21072. var ProviderSync = class extends provider_1.default {
  21073. constructor() {
  21074. super(...arguments);
  21075. this._reader = new sync_1.default(this._settings);
  21076. }
  21077. read(task) {
  21078. const root = this._getRootDirectory(task);
  21079. const options = this._getReaderOptions(task);
  21080. const entries = this.api(root, task, options);
  21081. return entries.map(options.transform);
  21082. }
  21083. api(root, task, options) {
  21084. if (task.dynamic) {
  21085. return this._reader.dynamic(root, options);
  21086. }
  21087. return this._reader.static(task.patterns, options);
  21088. }
  21089. };
  21090. exports2.default = ProviderSync;
  21091. }
  21092. });
  21093. var require_settings4 = __commonJS2({
  21094. "node_modules/fast-glob/out/settings.js"(exports2) {
  21095. "use strict";
  21096. Object.defineProperty(exports2, "__esModule", {
  21097. value: true
  21098. });
  21099. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
  21100. var fs = require("fs");
  21101. var os = require("os");
  21102. var CPU_COUNT = Math.max(os.cpus().length, 1);
  21103. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
  21104. lstat: fs.lstat,
  21105. lstatSync: fs.lstatSync,
  21106. stat: fs.stat,
  21107. statSync: fs.statSync,
  21108. readdir: fs.readdir,
  21109. readdirSync: fs.readdirSync
  21110. };
  21111. var Settings = class {
  21112. constructor(_options = {}) {
  21113. this._options = _options;
  21114. this.absolute = this._getValue(this._options.absolute, false);
  21115. this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
  21116. this.braceExpansion = this._getValue(this._options.braceExpansion, true);
  21117. this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
  21118. this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
  21119. this.cwd = this._getValue(this._options.cwd, process.cwd());
  21120. this.deep = this._getValue(this._options.deep, Infinity);
  21121. this.dot = this._getValue(this._options.dot, false);
  21122. this.extglob = this._getValue(this._options.extglob, true);
  21123. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
  21124. this.fs = this._getFileSystemMethods(this._options.fs);
  21125. this.globstar = this._getValue(this._options.globstar, true);
  21126. this.ignore = this._getValue(this._options.ignore, []);
  21127. this.markDirectories = this._getValue(this._options.markDirectories, false);
  21128. this.objectMode = this._getValue(this._options.objectMode, false);
  21129. this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
  21130. this.onlyFiles = this._getValue(this._options.onlyFiles, true);
  21131. this.stats = this._getValue(this._options.stats, false);
  21132. this.suppressErrors = this._getValue(this._options.suppressErrors, false);
  21133. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
  21134. this.unique = this._getValue(this._options.unique, true);
  21135. if (this.onlyDirectories) {
  21136. this.onlyFiles = false;
  21137. }
  21138. if (this.stats) {
  21139. this.objectMode = true;
  21140. }
  21141. }
  21142. _getValue(option, value) {
  21143. return option === void 0 ? value : option;
  21144. }
  21145. _getFileSystemMethods(methods = {}) {
  21146. return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
  21147. }
  21148. };
  21149. exports2.default = Settings;
  21150. }
  21151. });
  21152. var require_out4 = __commonJS2({
  21153. "node_modules/fast-glob/out/index.js"(exports2, module2) {
  21154. "use strict";
  21155. var taskManager = require_tasks();
  21156. var patternManager = require_patterns();
  21157. var async_1 = require_async6();
  21158. var stream_1 = require_stream4();
  21159. var sync_1 = require_sync7();
  21160. var settings_1 = require_settings4();
  21161. var utils = require_utils4();
  21162. async function FastGlob(source, options) {
  21163. assertPatternsInput(source);
  21164. const works = getWorks(source, async_1.default, options);
  21165. const result = await Promise.all(works);
  21166. return utils.array.flatten(result);
  21167. }
  21168. (function(FastGlob2) {
  21169. function sync(source, options) {
  21170. assertPatternsInput(source);
  21171. const works = getWorks(source, sync_1.default, options);
  21172. return utils.array.flatten(works);
  21173. }
  21174. FastGlob2.sync = sync;
  21175. function stream(source, options) {
  21176. assertPatternsInput(source);
  21177. const works = getWorks(source, stream_1.default, options);
  21178. return utils.stream.merge(works);
  21179. }
  21180. FastGlob2.stream = stream;
  21181. function generateTasks(source, options) {
  21182. assertPatternsInput(source);
  21183. const patterns = patternManager.transform([].concat(source));
  21184. const settings = new settings_1.default(options);
  21185. return taskManager.generate(patterns, settings);
  21186. }
  21187. FastGlob2.generateTasks = generateTasks;
  21188. function isDynamicPattern(source, options) {
  21189. assertPatternsInput(source);
  21190. const settings = new settings_1.default(options);
  21191. return utils.pattern.isDynamicPattern(source, settings);
  21192. }
  21193. FastGlob2.isDynamicPattern = isDynamicPattern;
  21194. function escapePath(source) {
  21195. assertPatternsInput(source);
  21196. return utils.path.escape(source);
  21197. }
  21198. FastGlob2.escapePath = escapePath;
  21199. })(FastGlob || (FastGlob = {}));
  21200. function getWorks(source, _Provider, options) {
  21201. const patterns = patternManager.transform([].concat(source));
  21202. const settings = new settings_1.default(options);
  21203. const tasks = taskManager.generate(patterns, settings);
  21204. const provider = new _Provider(settings);
  21205. return tasks.map(provider.read, provider);
  21206. }
  21207. function assertPatternsInput(input) {
  21208. const source = [].concat(input);
  21209. const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
  21210. if (!isValidSource) {
  21211. throw new TypeError("Patterns must be a string (non empty) or an array of strings");
  21212. }
  21213. }
  21214. module2.exports = FastGlob;
  21215. }
  21216. });
  21217. var require_uniq_by_key = __commonJS2({
  21218. "src/utils/uniq-by-key.js"(exports2, module2) {
  21219. "use strict";
  21220. function uniqByKey(array, key) {
  21221. const result = [];
  21222. const seen = /* @__PURE__ */ new Set();
  21223. for (const element of array) {
  21224. const value = element[key];
  21225. if (!seen.has(value)) {
  21226. seen.add(value);
  21227. result.push(element);
  21228. }
  21229. }
  21230. return result;
  21231. }
  21232. module2.exports = uniqByKey;
  21233. }
  21234. });
  21235. var require_create_language = __commonJS2({
  21236. "src/utils/create-language.js"(exports2, module2) {
  21237. "use strict";
  21238. module2.exports = function(linguistData, override) {
  21239. const {
  21240. languageId
  21241. } = linguistData, rest = _objectWithoutProperties(linguistData, _excluded4);
  21242. return Object.assign(Object.assign({
  21243. linguistLanguageId: languageId
  21244. }, rest), override(linguistData));
  21245. };
  21246. }
  21247. });
  21248. var require_ast = __commonJS2({
  21249. "node_modules/esutils/lib/ast.js"(exports2, module2) {
  21250. (function() {
  21251. "use strict";
  21252. function isExpression(node) {
  21253. if (node == null) {
  21254. return false;
  21255. }
  21256. switch (node.type) {
  21257. case "ArrayExpression":
  21258. case "AssignmentExpression":
  21259. case "BinaryExpression":
  21260. case "CallExpression":
  21261. case "ConditionalExpression":
  21262. case "FunctionExpression":
  21263. case "Identifier":
  21264. case "Literal":
  21265. case "LogicalExpression":
  21266. case "MemberExpression":
  21267. case "NewExpression":
  21268. case "ObjectExpression":
  21269. case "SequenceExpression":
  21270. case "ThisExpression":
  21271. case "UnaryExpression":
  21272. case "UpdateExpression":
  21273. return true;
  21274. }
  21275. return false;
  21276. }
  21277. function isIterationStatement(node) {
  21278. if (node == null) {
  21279. return false;
  21280. }
  21281. switch (node.type) {
  21282. case "DoWhileStatement":
  21283. case "ForInStatement":
  21284. case "ForStatement":
  21285. case "WhileStatement":
  21286. return true;
  21287. }
  21288. return false;
  21289. }
  21290. function isStatement(node) {
  21291. if (node == null) {
  21292. return false;
  21293. }
  21294. switch (node.type) {
  21295. case "BlockStatement":
  21296. case "BreakStatement":
  21297. case "ContinueStatement":
  21298. case "DebuggerStatement":
  21299. case "DoWhileStatement":
  21300. case "EmptyStatement":
  21301. case "ExpressionStatement":
  21302. case "ForInStatement":
  21303. case "ForStatement":
  21304. case "IfStatement":
  21305. case "LabeledStatement":
  21306. case "ReturnStatement":
  21307. case "SwitchStatement":
  21308. case "ThrowStatement":
  21309. case "TryStatement":
  21310. case "VariableDeclaration":
  21311. case "WhileStatement":
  21312. case "WithStatement":
  21313. return true;
  21314. }
  21315. return false;
  21316. }
  21317. function isSourceElement(node) {
  21318. return isStatement(node) || node != null && node.type === "FunctionDeclaration";
  21319. }
  21320. function trailingStatement(node) {
  21321. switch (node.type) {
  21322. case "IfStatement":
  21323. if (node.alternate != null) {
  21324. return node.alternate;
  21325. }
  21326. return node.consequent;
  21327. case "LabeledStatement":
  21328. case "ForStatement":
  21329. case "ForInStatement":
  21330. case "WhileStatement":
  21331. case "WithStatement":
  21332. return node.body;
  21333. }
  21334. return null;
  21335. }
  21336. function isProblematicIfStatement(node) {
  21337. var current;
  21338. if (node.type !== "IfStatement") {
  21339. return false;
  21340. }
  21341. if (node.alternate == null) {
  21342. return false;
  21343. }
  21344. current = node.consequent;
  21345. do {
  21346. if (current.type === "IfStatement") {
  21347. if (current.alternate == null) {
  21348. return true;
  21349. }
  21350. }
  21351. current = trailingStatement(current);
  21352. } while (current);
  21353. return false;
  21354. }
  21355. module2.exports = {
  21356. isExpression,
  21357. isStatement,
  21358. isIterationStatement,
  21359. isSourceElement,
  21360. isProblematicIfStatement,
  21361. trailingStatement
  21362. };
  21363. })();
  21364. }
  21365. });
  21366. var require_code = __commonJS2({
  21367. "node_modules/esutils/lib/code.js"(exports2, module2) {
  21368. (function() {
  21369. "use strict";
  21370. var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
  21371. ES5Regex = {
  21372. NonAsciiIdentifierStart: /[\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\u08B6-\u08BD\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\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\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\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-\u1884\u1887-\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\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\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-\uA7AE\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]/,
  21373. NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\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\u08B6-\u08BD\u08D4-\u08E1\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\u0C80-\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\u0D54-\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\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-\u19D9\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\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\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\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\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-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\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]/
  21374. };
  21375. ES6Regex = {
  21376. NonAsciiIdentifierStart: /[\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\u08B6-\u08BD\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\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\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\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\u1C80-\u1C88\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-\uA7AE\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\uDCB0-\uDCD3\uDCD8-\uDCFB\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[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\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\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\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\uDD00-\uDD43]|\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]/,
  21377. NonAsciiIdentifierPart: /[\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\u08B6-\u08BD\u08D4-\u08E1\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\u0C80-\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\u0D54-\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\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\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-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\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\uDCB0-\uDCD3\uDCD8-\uDCFB\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\uDE3E\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[\uDC00-\uDC4A\uDC50-\uDC59\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]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\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\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\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]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\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]/
  21378. };
  21379. function isDecimalDigit(ch2) {
  21380. return 48 <= ch2 && ch2 <= 57;
  21381. }
  21382. function isHexDigit(ch2) {
  21383. return 48 <= ch2 && ch2 <= 57 || 97 <= ch2 && ch2 <= 102 || 65 <= ch2 && ch2 <= 70;
  21384. }
  21385. function isOctalDigit(ch2) {
  21386. return ch2 >= 48 && ch2 <= 55;
  21387. }
  21388. NON_ASCII_WHITESPACES = [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279];
  21389. function isWhiteSpace(ch2) {
  21390. return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && NON_ASCII_WHITESPACES.indexOf(ch2) >= 0;
  21391. }
  21392. function isLineTerminator(ch2) {
  21393. return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233;
  21394. }
  21395. function fromCodePoint(cp) {
  21396. if (cp <= 65535) {
  21397. return String.fromCharCode(cp);
  21398. }
  21399. var cu1 = String.fromCharCode(Math.floor((cp - 65536) / 1024) + 55296);
  21400. var cu2 = String.fromCharCode((cp - 65536) % 1024 + 56320);
  21401. return cu1 + cu2;
  21402. }
  21403. IDENTIFIER_START = new Array(128);
  21404. for (ch = 0; ch < 128; ++ch) {
  21405. IDENTIFIER_START[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch === 36 || ch === 95;
  21406. }
  21407. IDENTIFIER_PART = new Array(128);
  21408. for (ch = 0; ch < 128; ++ch) {
  21409. IDENTIFIER_PART[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95;
  21410. }
  21411. function isIdentifierStartES5(ch2) {
  21412. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21413. }
  21414. function isIdentifierPartES5(ch2) {
  21415. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21416. }
  21417. function isIdentifierStartES6(ch2) {
  21418. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21419. }
  21420. function isIdentifierPartES6(ch2) {
  21421. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21422. }
  21423. module2.exports = {
  21424. isDecimalDigit,
  21425. isHexDigit,
  21426. isOctalDigit,
  21427. isWhiteSpace,
  21428. isLineTerminator,
  21429. isIdentifierStartES5,
  21430. isIdentifierPartES5,
  21431. isIdentifierStartES6,
  21432. isIdentifierPartES6
  21433. };
  21434. })();
  21435. }
  21436. });
  21437. var require_keyword2 = __commonJS2({
  21438. "node_modules/esutils/lib/keyword.js"(exports2, module2) {
  21439. (function() {
  21440. "use strict";
  21441. var code = require_code();
  21442. function isStrictModeReservedWordES6(id) {
  21443. switch (id) {
  21444. case "implements":
  21445. case "interface":
  21446. case "package":
  21447. case "private":
  21448. case "protected":
  21449. case "public":
  21450. case "static":
  21451. case "let":
  21452. return true;
  21453. default:
  21454. return false;
  21455. }
  21456. }
  21457. function isKeywordES5(id, strict) {
  21458. if (!strict && id === "yield") {
  21459. return false;
  21460. }
  21461. return isKeywordES6(id, strict);
  21462. }
  21463. function isKeywordES6(id, strict) {
  21464. if (strict && isStrictModeReservedWordES6(id)) {
  21465. return true;
  21466. }
  21467. switch (id.length) {
  21468. case 2:
  21469. return id === "if" || id === "in" || id === "do";
  21470. case 3:
  21471. return id === "var" || id === "for" || id === "new" || id === "try";
  21472. case 4:
  21473. return id === "this" || id === "else" || id === "case" || id === "void" || id === "with" || id === "enum";
  21474. case 5:
  21475. return id === "while" || id === "break" || id === "catch" || id === "throw" || id === "const" || id === "yield" || id === "class" || id === "super";
  21476. case 6:
  21477. return id === "return" || id === "typeof" || id === "delete" || id === "switch" || id === "export" || id === "import";
  21478. case 7:
  21479. return id === "default" || id === "finally" || id === "extends";
  21480. case 8:
  21481. return id === "function" || id === "continue" || id === "debugger";
  21482. case 10:
  21483. return id === "instanceof";
  21484. default:
  21485. return false;
  21486. }
  21487. }
  21488. function isReservedWordES5(id, strict) {
  21489. return id === "null" || id === "true" || id === "false" || isKeywordES5(id, strict);
  21490. }
  21491. function isReservedWordES6(id, strict) {
  21492. return id === "null" || id === "true" || id === "false" || isKeywordES6(id, strict);
  21493. }
  21494. function isRestrictedWord(id) {
  21495. return id === "eval" || id === "arguments";
  21496. }
  21497. function isIdentifierNameES5(id) {
  21498. var i, iz, ch;
  21499. if (id.length === 0) {
  21500. return false;
  21501. }
  21502. ch = id.charCodeAt(0);
  21503. if (!code.isIdentifierStartES5(ch)) {
  21504. return false;
  21505. }
  21506. for (i = 1, iz = id.length; i < iz; ++i) {
  21507. ch = id.charCodeAt(i);
  21508. if (!code.isIdentifierPartES5(ch)) {
  21509. return false;
  21510. }
  21511. }
  21512. return true;
  21513. }
  21514. function decodeUtf16(lead, trail) {
  21515. return (lead - 55296) * 1024 + (trail - 56320) + 65536;
  21516. }
  21517. function isIdentifierNameES6(id) {
  21518. var i, iz, ch, lowCh, check;
  21519. if (id.length === 0) {
  21520. return false;
  21521. }
  21522. check = code.isIdentifierStartES6;
  21523. for (i = 0, iz = id.length; i < iz; ++i) {
  21524. ch = id.charCodeAt(i);
  21525. if (55296 <= ch && ch <= 56319) {
  21526. ++i;
  21527. if (i >= iz) {
  21528. return false;
  21529. }
  21530. lowCh = id.charCodeAt(i);
  21531. if (!(56320 <= lowCh && lowCh <= 57343)) {
  21532. return false;
  21533. }
  21534. ch = decodeUtf16(ch, lowCh);
  21535. }
  21536. if (!check(ch)) {
  21537. return false;
  21538. }
  21539. check = code.isIdentifierPartES6;
  21540. }
  21541. return true;
  21542. }
  21543. function isIdentifierES5(id, strict) {
  21544. return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
  21545. }
  21546. function isIdentifierES6(id, strict) {
  21547. return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
  21548. }
  21549. module2.exports = {
  21550. isKeywordES5,
  21551. isKeywordES6,
  21552. isReservedWordES5,
  21553. isReservedWordES6,
  21554. isRestrictedWord,
  21555. isIdentifierNameES5,
  21556. isIdentifierNameES6,
  21557. isIdentifierES5,
  21558. isIdentifierES6
  21559. };
  21560. })();
  21561. }
  21562. });
  21563. var require_utils6 = __commonJS2({
  21564. "node_modules/esutils/lib/utils.js"(exports2) {
  21565. (function() {
  21566. "use strict";
  21567. exports2.ast = require_ast();
  21568. exports2.code = require_code();
  21569. exports2.keyword = require_keyword2();
  21570. })();
  21571. }
  21572. });
  21573. var require_is_block_comment = __commonJS2({
  21574. "src/language-js/utils/is-block-comment.js"(exports2, module2) {
  21575. "use strict";
  21576. var BLOCK_COMMENT_TYPES = /* @__PURE__ */ new Set(["Block", "CommentBlock", "MultiLine"]);
  21577. var isBlockComment = (comment) => BLOCK_COMMENT_TYPES.has(comment === null || comment === void 0 ? void 0 : comment.type);
  21578. module2.exports = isBlockComment;
  21579. }
  21580. });
  21581. var require_is_node_matches = __commonJS2({
  21582. "src/language-js/utils/is-node-matches.js"(exports2, module2) {
  21583. "use strict";
  21584. function isNodeMatchesNameOrPath(node, nameOrPath) {
  21585. const names = nameOrPath.split(".");
  21586. for (let index = names.length - 1; index >= 0; index--) {
  21587. const name = names[index];
  21588. if (index === 0) {
  21589. return node.type === "Identifier" && node.name === name;
  21590. }
  21591. if (node.type !== "MemberExpression" || node.optional || node.computed || node.property.type !== "Identifier" || node.property.name !== name) {
  21592. return false;
  21593. }
  21594. node = node.object;
  21595. }
  21596. }
  21597. function isNodeMatches(node, nameOrPaths) {
  21598. return nameOrPaths.some((nameOrPath) => isNodeMatchesNameOrPath(node, nameOrPath));
  21599. }
  21600. module2.exports = isNodeMatches;
  21601. }
  21602. });
  21603. var require_utils7 = __commonJS2({
  21604. "src/language-js/utils/index.js"(exports2, module2) {
  21605. "use strict";
  21606. var isIdentifierName = require_utils6().keyword.isIdentifierNameES5;
  21607. var {
  21608. getLast,
  21609. hasNewline,
  21610. skipWhitespace,
  21611. isNonEmptyArray,
  21612. isNextLineEmptyAfterIndex,
  21613. getStringWidth
  21614. } = require_util();
  21615. var {
  21616. locStart,
  21617. locEnd,
  21618. hasSameLocStart
  21619. } = require_loc();
  21620. var isBlockComment = require_is_block_comment();
  21621. var isNodeMatches = require_is_node_matches();
  21622. var NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
  21623. var FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`);
  21624. var FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`);
  21625. function hasFlowShorthandAnnotationComment(node) {
  21626. var _node$extra, _node$trailingComment;
  21627. return ((_node$extra = node.extra) === null || _node$extra === void 0 ? void 0 : _node$extra.parenthesized) && isBlockComment((_node$trailingComment = node.trailingComments) === null || _node$trailingComment === void 0 ? void 0 : _node$trailingComment[0]) && FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value);
  21628. }
  21629. function hasFlowAnnotationComment(comments) {
  21630. const firstComment = comments === null || comments === void 0 ? void 0 : comments[0];
  21631. return isBlockComment(firstComment) && FLOW_ANNOTATION.test(firstComment.value);
  21632. }
  21633. function hasNode(node, fn) {
  21634. if (!node || typeof node !== "object") {
  21635. return false;
  21636. }
  21637. if (Array.isArray(node)) {
  21638. return node.some((value) => hasNode(value, fn));
  21639. }
  21640. const result = fn(node);
  21641. return typeof result === "boolean" ? result : Object.values(node).some((value) => hasNode(value, fn));
  21642. }
  21643. function hasNakedLeftSide(node) {
  21644. return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || isCallExpression(node) || isMemberExpression(node) || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || isTSTypeExpression(node) || node.type === "TSNonNullExpression";
  21645. }
  21646. function getLeftSide(node) {
  21647. var _ref2, _ref3, _ref4, _ref5, _ref6, _node$left;
  21648. if (node.expressions) {
  21649. return node.expressions[0];
  21650. }
  21651. return (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_node$left = node.left) !== null && _node$left !== void 0 ? _node$left : node.test) !== null && _ref6 !== void 0 ? _ref6 : node.callee) !== null && _ref5 !== void 0 ? _ref5 : node.object) !== null && _ref4 !== void 0 ? _ref4 : node.tag) !== null && _ref3 !== void 0 ? _ref3 : node.argument) !== null && _ref2 !== void 0 ? _ref2 : node.expression;
  21652. }
  21653. function getLeftSidePathName(path, node) {
  21654. if (node.expressions) {
  21655. return ["expressions", 0];
  21656. }
  21657. if (node.left) {
  21658. return ["left"];
  21659. }
  21660. if (node.test) {
  21661. return ["test"];
  21662. }
  21663. if (node.object) {
  21664. return ["object"];
  21665. }
  21666. if (node.callee) {
  21667. return ["callee"];
  21668. }
  21669. if (node.tag) {
  21670. return ["tag"];
  21671. }
  21672. if (node.argument) {
  21673. return ["argument"];
  21674. }
  21675. if (node.expression) {
  21676. return ["expression"];
  21677. }
  21678. throw new Error("Unexpected node has no left side.");
  21679. }
  21680. function createTypeCheckFunction(types) {
  21681. types = new Set(types);
  21682. return (node) => types.has(node === null || node === void 0 ? void 0 : node.type);
  21683. }
  21684. var isLineComment = createTypeCheckFunction(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose"]);
  21685. var isExportDeclaration = createTypeCheckFunction(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
  21686. function getParentExportDeclaration(path) {
  21687. const parentNode = path.getParentNode();
  21688. if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
  21689. return parentNode;
  21690. }
  21691. return null;
  21692. }
  21693. var isLiteral = createTypeCheckFunction(["BooleanLiteral", "DirectiveLiteral", "Literal", "NullLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "RegExpLiteral", "StringLiteral", "TemplateLiteral", "TSTypeLiteral", "JSXText"]);
  21694. function isNumericLiteral(node) {
  21695. return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
  21696. }
  21697. function isSignedNumericLiteral(node) {
  21698. return node.type === "UnaryExpression" && (node.operator === "+" || node.operator === "-") && isNumericLiteral(node.argument);
  21699. }
  21700. function isStringLiteral(node) {
  21701. return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
  21702. }
  21703. var isObjectType = createTypeCheckFunction(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]);
  21704. var isFunctionOrArrowExpression = createTypeCheckFunction(["FunctionExpression", "ArrowFunctionExpression"]);
  21705. function isFunctionOrArrowExpressionWithBody(node) {
  21706. return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
  21707. }
  21708. function isAngularTestWrapper(node) {
  21709. return isCallExpression(node) && node.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(node.callee.name);
  21710. }
  21711. var isJsxNode = createTypeCheckFunction(["JSXElement", "JSXFragment"]);
  21712. function isTheOnlyJsxElementInMarkdown(options, path) {
  21713. if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
  21714. return false;
  21715. }
  21716. const node = path.getNode();
  21717. if (!node.expression || !isJsxNode(node.expression)) {
  21718. return false;
  21719. }
  21720. const parent = path.getParentNode();
  21721. return parent.type === "Program" && parent.body.length === 1;
  21722. }
  21723. function isGetterOrSetter(node) {
  21724. return node.kind === "get" || node.kind === "set";
  21725. }
  21726. function isFunctionNotation(node) {
  21727. return isGetterOrSetter(node) || hasSameLocStart(node, node.value);
  21728. }
  21729. function isObjectTypePropertyAFunction(node) {
  21730. return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node);
  21731. }
  21732. function isTypeAnnotationAFunction(node) {
  21733. return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !hasSameLocStart(node, node.typeAnnotation);
  21734. }
  21735. var isBinaryish = createTypeCheckFunction(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
  21736. function isMemberish(node) {
  21737. return isMemberExpression(node) || node.type === "BindExpression" && Boolean(node.object);
  21738. }
  21739. var simpleTypeAnnotations = /* @__PURE__ */ new Set(["AnyTypeAnnotation", "TSAnyKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword", "ThisTypeAnnotation", "TSThisType", "NumberTypeAnnotation", "TSNumberKeyword", "VoidTypeAnnotation", "TSVoidKeyword", "BooleanTypeAnnotation", "TSBooleanKeyword", "BigIntTypeAnnotation", "TSBigIntKeyword", "SymbolTypeAnnotation", "TSSymbolKeyword", "StringTypeAnnotation", "TSStringKeyword", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType", "EmptyTypeAnnotation", "MixedTypeAnnotation", "TSNeverKeyword", "TSObjectKeyword", "TSUndefinedKeyword", "TSUnknownKeyword"]);
  21740. function isSimpleType(node) {
  21741. if (!node) {
  21742. return false;
  21743. }
  21744. if ((node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference") && !node.typeParameters) {
  21745. return true;
  21746. }
  21747. if (simpleTypeAnnotations.has(node.type)) {
  21748. return true;
  21749. }
  21750. return false;
  21751. }
  21752. function isUnitTestSetUp(node) {
  21753. const unitTestSetUpRe = /^(?:before|after)(?:Each|All)$/;
  21754. return node.callee.type === "Identifier" && unitTestSetUpRe.test(node.callee.name) && node.arguments.length === 1;
  21755. }
  21756. var testCallCalleePatterns = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.step", "test.describe", "test.describe.only", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"];
  21757. function isTestCallCallee(node) {
  21758. return isNodeMatches(node, testCallCalleePatterns);
  21759. }
  21760. function isTestCall(node, parent) {
  21761. if (node.type !== "CallExpression") {
  21762. return false;
  21763. }
  21764. if (node.arguments.length === 1) {
  21765. if (isAngularTestWrapper(node) && parent && isTestCall(parent)) {
  21766. return isFunctionOrArrowExpression(node.arguments[0]);
  21767. }
  21768. if (isUnitTestSetUp(node)) {
  21769. return isAngularTestWrapper(node.arguments[0]);
  21770. }
  21771. } else if (node.arguments.length === 2 || node.arguments.length === 3) {
  21772. if ((node.arguments[0].type === "TemplateLiteral" || isStringLiteral(node.arguments[0])) && isTestCallCallee(node.callee)) {
  21773. if (node.arguments[2] && !isNumericLiteral(node.arguments[2])) {
  21774. return false;
  21775. }
  21776. return (node.arguments.length === 2 ? isFunctionOrArrowExpression(node.arguments[1]) : isFunctionOrArrowExpressionWithBody(node.arguments[1]) && getFunctionParameters(node.arguments[1]).length <= 1) || isAngularTestWrapper(node.arguments[1]);
  21777. }
  21778. }
  21779. return false;
  21780. }
  21781. var isCallExpression = createTypeCheckFunction(["CallExpression", "OptionalCallExpression"]);
  21782. var isMemberExpression = createTypeCheckFunction(["MemberExpression", "OptionalMemberExpression"]);
  21783. function isSimpleTemplateLiteral(node) {
  21784. let expressionsKey = "expressions";
  21785. if (node.type === "TSTemplateLiteralType") {
  21786. expressionsKey = "types";
  21787. }
  21788. const expressions = node[expressionsKey];
  21789. if (expressions.length === 0) {
  21790. return false;
  21791. }
  21792. return expressions.every((expr) => {
  21793. if (hasComment(expr)) {
  21794. return false;
  21795. }
  21796. if (expr.type === "Identifier" || expr.type === "ThisExpression") {
  21797. return true;
  21798. }
  21799. if (isMemberExpression(expr)) {
  21800. let head = expr;
  21801. while (isMemberExpression(head)) {
  21802. if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
  21803. return false;
  21804. }
  21805. head = head.object;
  21806. if (hasComment(head)) {
  21807. return false;
  21808. }
  21809. }
  21810. if (head.type === "Identifier" || head.type === "ThisExpression") {
  21811. return true;
  21812. }
  21813. return false;
  21814. }
  21815. return false;
  21816. });
  21817. }
  21818. function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
  21819. if (tokenNode === "+" || tokenNode === "-") {
  21820. return tokenNode + keyword;
  21821. }
  21822. return keyword;
  21823. }
  21824. function isFlowAnnotationComment(text, typeAnnotation) {
  21825. const start = locStart(typeAnnotation);
  21826. const end = skipWhitespace(text, locEnd(typeAnnotation));
  21827. return end !== false && text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
  21828. }
  21829. function hasLeadingOwnLineComment(text, node) {
  21830. if (isJsxNode(node)) {
  21831. return hasNodeIgnoreComment(node);
  21832. }
  21833. return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(text, locEnd(comment)));
  21834. }
  21835. function isStringPropSafeToUnquote(node, options) {
  21836. return options.parser !== "json" && isStringLiteral(node.key) && rawText(node.key).slice(1, -1) === node.key.value && (isIdentifierName(node.key.value) && !(options.parser === "babel-ts" && node.type === "ClassProperty" || options.parser === "typescript" && node.type === "PropertyDefinition") || isSimpleNumber(node.key.value) && String(Number(node.key.value)) === node.key.value && (options.parser === "babel" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree"));
  21837. }
  21838. function isSimpleNumber(numberString) {
  21839. return /^(?:\d+|\d+\.\d+)$/.test(numberString);
  21840. }
  21841. function isJestEachTemplateLiteral(node, parentNode) {
  21842. const jestEachTriggerRegex = /^[fx]?(?:describe|it|test)$/;
  21843. return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
  21844. }
  21845. function templateLiteralHasNewLines(template) {
  21846. return template.quasis.some((quasi) => quasi.value.raw.includes("\n"));
  21847. }
  21848. function isTemplateOnItsOwnLine(node, text) {
  21849. return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(text, locStart(node), {
  21850. backwards: true
  21851. });
  21852. }
  21853. function needsHardlineAfterDanglingComment(node) {
  21854. if (!hasComment(node)) {
  21855. return false;
  21856. }
  21857. const lastDanglingComment = getLast(getComments(node, CommentCheckFlags.Dangling));
  21858. return lastDanglingComment && !isBlockComment(lastDanglingComment);
  21859. }
  21860. function isFunctionCompositionArgs(args) {
  21861. if (args.length <= 1) {
  21862. return false;
  21863. }
  21864. let count = 0;
  21865. for (const arg of args) {
  21866. if (isFunctionOrArrowExpression(arg)) {
  21867. count += 1;
  21868. if (count > 1) {
  21869. return true;
  21870. }
  21871. } else if (isCallExpression(arg)) {
  21872. for (const childArg of arg.arguments) {
  21873. if (isFunctionOrArrowExpression(childArg)) {
  21874. return true;
  21875. }
  21876. }
  21877. }
  21878. }
  21879. return false;
  21880. }
  21881. function isLongCurriedCallExpression(path) {
  21882. const node = path.getValue();
  21883. const parent = path.getParentNode();
  21884. return isCallExpression(node) && isCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
  21885. }
  21886. function isSimpleCallArgument(node, depth) {
  21887. if (depth >= 2) {
  21888. return false;
  21889. }
  21890. const isChildSimple = (child) => isSimpleCallArgument(child, depth + 1);
  21891. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  21892. if (regexpPattern && getStringWidth(regexpPattern) > 5) {
  21893. return false;
  21894. }
  21895. if (node.type === "Literal" || node.type === "BigIntLiteral" || node.type === "DecimalLiteral" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "PrivateName" || node.type === "PrivateIdentifier" || node.type === "ArgumentPlaceholder" || node.type === "Import") {
  21896. return true;
  21897. }
  21898. if (node.type === "TemplateLiteral") {
  21899. return node.quasis.every((element) => !element.value.raw.includes("\n")) && node.expressions.every(isChildSimple);
  21900. }
  21901. if (node.type === "ObjectExpression") {
  21902. return node.properties.every((p) => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
  21903. }
  21904. if (node.type === "ArrayExpression") {
  21905. return node.elements.every((x) => x === null || isChildSimple(x));
  21906. }
  21907. if (isCallLikeExpression(node)) {
  21908. return (node.type === "ImportExpression" || isSimpleCallArgument(node.callee, depth)) && getCallArguments(node).every(isChildSimple);
  21909. }
  21910. if (isMemberExpression(node)) {
  21911. return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
  21912. }
  21913. const targetUnaryExpressionOperators = {
  21914. "!": true,
  21915. "-": true,
  21916. "+": true,
  21917. "~": true
  21918. };
  21919. if (node.type === "UnaryExpression" && targetUnaryExpressionOperators[node.operator]) {
  21920. return isSimpleCallArgument(node.argument, depth);
  21921. }
  21922. const targetUpdateExpressionOperators = {
  21923. "++": true,
  21924. "--": true
  21925. };
  21926. if (node.type === "UpdateExpression" && targetUpdateExpressionOperators[node.operator]) {
  21927. return isSimpleCallArgument(node.argument, depth);
  21928. }
  21929. if (node.type === "TSNonNullExpression") {
  21930. return isSimpleCallArgument(node.expression, depth);
  21931. }
  21932. return false;
  21933. }
  21934. function rawText(node) {
  21935. var _node$extra$raw, _node$extra2;
  21936. return (_node$extra$raw = (_node$extra2 = node.extra) === null || _node$extra2 === void 0 ? void 0 : _node$extra2.raw) !== null && _node$extra$raw !== void 0 ? _node$extra$raw : node.raw;
  21937. }
  21938. function identity(x) {
  21939. return x;
  21940. }
  21941. function isTSXFile(options) {
  21942. return options.filepath && /\.tsx$/i.test(options.filepath);
  21943. }
  21944. function shouldPrintComma(options, level = "es5") {
  21945. return options.trailingComma === "es5" && level === "es5" || options.trailingComma === "all" && (level === "all" || level === "es5");
  21946. }
  21947. function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
  21948. node = getLeftMost(node);
  21949. switch (node.type) {
  21950. case "FunctionExpression":
  21951. case "ClassExpression":
  21952. case "DoExpression":
  21953. return forbidFunctionClassAndDoExpr;
  21954. case "ObjectExpression":
  21955. return true;
  21956. case "MemberExpression":
  21957. case "OptionalMemberExpression":
  21958. return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
  21959. case "TaggedTemplateExpression":
  21960. if (node.tag.type === "FunctionExpression") {
  21961. return false;
  21962. }
  21963. return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
  21964. case "CallExpression":
  21965. case "OptionalCallExpression":
  21966. if (node.callee.type === "FunctionExpression") {
  21967. return false;
  21968. }
  21969. return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
  21970. case "ConditionalExpression":
  21971. return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
  21972. case "UpdateExpression":
  21973. return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
  21974. case "BindExpression":
  21975. return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
  21976. case "SequenceExpression":
  21977. return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
  21978. case "TSSatisfiesExpression":
  21979. case "TSAsExpression":
  21980. case "TSNonNullExpression":
  21981. return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
  21982. default:
  21983. return false;
  21984. }
  21985. }
  21986. var equalityOperators = {
  21987. "==": true,
  21988. "!=": true,
  21989. "===": true,
  21990. "!==": true
  21991. };
  21992. var multiplicativeOperators = {
  21993. "*": true,
  21994. "/": true,
  21995. "%": true
  21996. };
  21997. var bitshiftOperators = {
  21998. ">>": true,
  21999. ">>>": true,
  22000. "<<": true
  22001. };
  22002. function shouldFlatten(parentOp, nodeOp) {
  22003. if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
  22004. return false;
  22005. }
  22006. if (parentOp === "**") {
  22007. return false;
  22008. }
  22009. if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
  22010. return false;
  22011. }
  22012. if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
  22013. return false;
  22014. }
  22015. if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
  22016. return false;
  22017. }
  22018. if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
  22019. return false;
  22020. }
  22021. return true;
  22022. }
  22023. var PRECEDENCE = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((operators, index) => operators.map((operator) => [operator, index])));
  22024. function getPrecedence(operator) {
  22025. return PRECEDENCE.get(operator);
  22026. }
  22027. function getLeftMost(node) {
  22028. while (node.left) {
  22029. node = node.left;
  22030. }
  22031. return node;
  22032. }
  22033. function isBitwiseOperator(operator) {
  22034. return Boolean(bitshiftOperators[operator]) || operator === "|" || operator === "^" || operator === "&";
  22035. }
  22036. function hasRestParameter(node) {
  22037. var _getLast;
  22038. if (node.rest) {
  22039. return true;
  22040. }
  22041. const parameters = getFunctionParameters(node);
  22042. return ((_getLast = getLast(parameters)) === null || _getLast === void 0 ? void 0 : _getLast.type) === "RestElement";
  22043. }
  22044. var functionParametersCache = /* @__PURE__ */ new WeakMap();
  22045. function getFunctionParameters(node) {
  22046. if (functionParametersCache.has(node)) {
  22047. return functionParametersCache.get(node);
  22048. }
  22049. const parameters = [];
  22050. if (node.this) {
  22051. parameters.push(node.this);
  22052. }
  22053. if (Array.isArray(node.parameters)) {
  22054. parameters.push(...node.parameters);
  22055. } else if (Array.isArray(node.params)) {
  22056. parameters.push(...node.params);
  22057. }
  22058. if (node.rest) {
  22059. parameters.push(node.rest);
  22060. }
  22061. functionParametersCache.set(node, parameters);
  22062. return parameters;
  22063. }
  22064. function iterateFunctionParametersPath(path, iteratee) {
  22065. const node = path.getValue();
  22066. let index = 0;
  22067. const callback = (childPath) => iteratee(childPath, index++);
  22068. if (node.this) {
  22069. path.call(callback, "this");
  22070. }
  22071. if (Array.isArray(node.parameters)) {
  22072. path.each(callback, "parameters");
  22073. } else if (Array.isArray(node.params)) {
  22074. path.each(callback, "params");
  22075. }
  22076. if (node.rest) {
  22077. path.call(callback, "rest");
  22078. }
  22079. }
  22080. var callArgumentsCache = /* @__PURE__ */ new WeakMap();
  22081. function getCallArguments(node) {
  22082. if (callArgumentsCache.has(node)) {
  22083. return callArgumentsCache.get(node);
  22084. }
  22085. let args = node.arguments;
  22086. if (node.type === "ImportExpression") {
  22087. args = [node.source];
  22088. if (node.attributes) {
  22089. args.push(node.attributes);
  22090. }
  22091. }
  22092. callArgumentsCache.set(node, args);
  22093. return args;
  22094. }
  22095. function iterateCallArgumentsPath(path, iteratee) {
  22096. const node = path.getValue();
  22097. if (node.type === "ImportExpression") {
  22098. path.call((sourcePath) => iteratee(sourcePath, 0), "source");
  22099. if (node.attributes) {
  22100. path.call((sourcePath) => iteratee(sourcePath, 1), "attributes");
  22101. }
  22102. } else {
  22103. path.each(iteratee, "arguments");
  22104. }
  22105. }
  22106. function isPrettierIgnoreComment(comment) {
  22107. return comment.value.trim() === "prettier-ignore" && !comment.unignore;
  22108. }
  22109. function hasNodeIgnoreComment(node) {
  22110. return node && (node.prettierIgnore || hasComment(node, CommentCheckFlags.PrettierIgnore));
  22111. }
  22112. function hasIgnoreComment(path) {
  22113. const node = path.getValue();
  22114. return hasNodeIgnoreComment(node);
  22115. }
  22116. var CommentCheckFlags = {
  22117. Leading: 1 << 1,
  22118. Trailing: 1 << 2,
  22119. Dangling: 1 << 3,
  22120. Block: 1 << 4,
  22121. Line: 1 << 5,
  22122. PrettierIgnore: 1 << 6,
  22123. First: 1 << 7,
  22124. Last: 1 << 8
  22125. };
  22126. var getCommentTestFunction = (flags, fn) => {
  22127. if (typeof flags === "function") {
  22128. fn = flags;
  22129. flags = 0;
  22130. }
  22131. if (flags || fn) {
  22132. return (comment, index, comments) => !(flags & CommentCheckFlags.Leading && !comment.leading || flags & CommentCheckFlags.Trailing && !comment.trailing || flags & CommentCheckFlags.Dangling && (comment.leading || comment.trailing) || flags & CommentCheckFlags.Block && !isBlockComment(comment) || flags & CommentCheckFlags.Line && !isLineComment(comment) || flags & CommentCheckFlags.First && index !== 0 || flags & CommentCheckFlags.Last && index !== comments.length - 1 || flags & CommentCheckFlags.PrettierIgnore && !isPrettierIgnoreComment(comment) || fn && !fn(comment));
  22133. }
  22134. };
  22135. function hasComment(node, flags, fn) {
  22136. if (!isNonEmptyArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22137. return false;
  22138. }
  22139. const test = getCommentTestFunction(flags, fn);
  22140. return test ? node.comments.some(test) : true;
  22141. }
  22142. function getComments(node, flags, fn) {
  22143. if (!Array.isArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22144. return [];
  22145. }
  22146. const test = getCommentTestFunction(flags, fn);
  22147. return test ? node.comments.filter(test) : node.comments;
  22148. }
  22149. var isNextLineEmpty = (node, {
  22150. originalText
  22151. }) => isNextLineEmptyAfterIndex(originalText, locEnd(node));
  22152. function isCallLikeExpression(node) {
  22153. return isCallExpression(node) || node.type === "NewExpression" || node.type === "ImportExpression";
  22154. }
  22155. function isObjectProperty(node) {
  22156. return node && (node.type === "ObjectProperty" || node.type === "Property" && !node.method && node.kind === "init");
  22157. }
  22158. function isEnabledHackPipeline(options) {
  22159. return Boolean(options.__isUsingHackPipeline);
  22160. }
  22161. var markerForIfWithoutBlockAndSameLineComment = Symbol("ifWithoutBlockAndSameLineComment");
  22162. function isTSTypeExpression(node) {
  22163. return node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression";
  22164. }
  22165. module2.exports = {
  22166. getFunctionParameters,
  22167. iterateFunctionParametersPath,
  22168. getCallArguments,
  22169. iterateCallArgumentsPath,
  22170. hasRestParameter,
  22171. getLeftSide,
  22172. getLeftSidePathName,
  22173. getParentExportDeclaration,
  22174. getTypeScriptMappedTypeModifier,
  22175. hasFlowAnnotationComment,
  22176. hasFlowShorthandAnnotationComment,
  22177. hasLeadingOwnLineComment,
  22178. hasNakedLeftSide,
  22179. hasNode,
  22180. hasIgnoreComment,
  22181. hasNodeIgnoreComment,
  22182. identity,
  22183. isBinaryish,
  22184. isCallLikeExpression,
  22185. isEnabledHackPipeline,
  22186. isLineComment,
  22187. isPrettierIgnoreComment,
  22188. isCallExpression,
  22189. isMemberExpression,
  22190. isExportDeclaration,
  22191. isFlowAnnotationComment,
  22192. isFunctionCompositionArgs,
  22193. isFunctionNotation,
  22194. isFunctionOrArrowExpression,
  22195. isGetterOrSetter,
  22196. isJestEachTemplateLiteral,
  22197. isJsxNode,
  22198. isLiteral,
  22199. isLongCurriedCallExpression,
  22200. isSimpleCallArgument,
  22201. isMemberish,
  22202. isNumericLiteral,
  22203. isSignedNumericLiteral,
  22204. isObjectProperty,
  22205. isObjectType,
  22206. isObjectTypePropertyAFunction,
  22207. isSimpleType,
  22208. isSimpleNumber,
  22209. isSimpleTemplateLiteral,
  22210. isStringLiteral,
  22211. isStringPropSafeToUnquote,
  22212. isTemplateOnItsOwnLine,
  22213. isTestCall,
  22214. isTheOnlyJsxElementInMarkdown,
  22215. isTSXFile,
  22216. isTypeAnnotationAFunction,
  22217. isNextLineEmpty,
  22218. needsHardlineAfterDanglingComment,
  22219. rawText,
  22220. shouldPrintComma,
  22221. isBitwiseOperator,
  22222. shouldFlatten,
  22223. startsWithNoLookaheadToken,
  22224. getPrecedence,
  22225. hasComment,
  22226. getComments,
  22227. CommentCheckFlags,
  22228. markerForIfWithoutBlockAndSameLineComment,
  22229. isTSTypeExpression
  22230. };
  22231. }
  22232. });
  22233. var require_template_literal = __commonJS2({
  22234. "src/language-js/print/template-literal.js"(exports2, module2) {
  22235. "use strict";
  22236. var getLast = require_get_last();
  22237. var {
  22238. getStringWidth,
  22239. getIndentSize
  22240. } = require_util();
  22241. var {
  22242. builders: {
  22243. join,
  22244. hardline,
  22245. softline,
  22246. group,
  22247. indent,
  22248. align,
  22249. lineSuffixBoundary,
  22250. addAlignmentToDoc
  22251. },
  22252. printer: {
  22253. printDocToString
  22254. },
  22255. utils: {
  22256. mapDoc
  22257. }
  22258. } = require("./doc.js");
  22259. var {
  22260. isBinaryish,
  22261. isJestEachTemplateLiteral,
  22262. isSimpleTemplateLiteral,
  22263. hasComment,
  22264. isMemberExpression,
  22265. isTSTypeExpression
  22266. } = require_utils7();
  22267. function printTemplateLiteral(path, print, options) {
  22268. const node = path.getValue();
  22269. const isTemplateLiteral = node.type === "TemplateLiteral";
  22270. if (isTemplateLiteral && isJestEachTemplateLiteral(node, path.getParentNode())) {
  22271. const printed = printJestEachTemplateLiteral(path, options, print);
  22272. if (printed) {
  22273. return printed;
  22274. }
  22275. }
  22276. let expressionsKey = "expressions";
  22277. if (node.type === "TSTemplateLiteralType") {
  22278. expressionsKey = "types";
  22279. }
  22280. const parts = [];
  22281. let expressions = path.map(print, expressionsKey);
  22282. const isSimple = isSimpleTemplateLiteral(node);
  22283. if (isSimple) {
  22284. expressions = expressions.map((doc2) => printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22285. printWidth: Number.POSITIVE_INFINITY
  22286. })).formatted);
  22287. }
  22288. parts.push(lineSuffixBoundary, "`");
  22289. path.each((childPath) => {
  22290. const i = childPath.getName();
  22291. parts.push(print());
  22292. if (i < expressions.length) {
  22293. const {
  22294. tabWidth
  22295. } = options;
  22296. const quasi = childPath.getValue();
  22297. const indentSize = getIndentSize(quasi.value.raw, tabWidth);
  22298. let printed = expressions[i];
  22299. if (!isSimple) {
  22300. const expression = node[expressionsKey][i];
  22301. if (hasComment(expression) || isMemberExpression(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || isTSTypeExpression(expression) || isBinaryish(expression)) {
  22302. printed = [indent([softline, printed]), softline];
  22303. }
  22304. }
  22305. const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align(Number.NEGATIVE_INFINITY, printed) : addAlignmentToDoc(printed, indentSize, tabWidth);
  22306. parts.push(group(["${", aligned, lineSuffixBoundary, "}"]));
  22307. }
  22308. }, "quasis");
  22309. parts.push("`");
  22310. return parts;
  22311. }
  22312. function printJestEachTemplateLiteral(path, options, print) {
  22313. const node = path.getNode();
  22314. const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
  22315. if (headerNames.length > 1 || headerNames.some((headerName) => headerName.length > 0)) {
  22316. options.__inJestEach = true;
  22317. const expressions = path.map(print, "expressions");
  22318. options.__inJestEach = false;
  22319. const parts = [];
  22320. const stringifiedExpressions = expressions.map((doc2) => "${" + printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22321. printWidth: Number.POSITIVE_INFINITY,
  22322. endOfLine: "lf"
  22323. })).formatted + "}");
  22324. const tableBody = [{
  22325. hasLineBreak: false,
  22326. cells: []
  22327. }];
  22328. for (let i = 1; i < node.quasis.length; i++) {
  22329. const row = getLast(tableBody);
  22330. const correspondingExpression = stringifiedExpressions[i - 1];
  22331. row.cells.push(correspondingExpression);
  22332. if (correspondingExpression.includes("\n")) {
  22333. row.hasLineBreak = true;
  22334. }
  22335. if (node.quasis[i].value.raw.includes("\n")) {
  22336. tableBody.push({
  22337. hasLineBreak: false,
  22338. cells: []
  22339. });
  22340. }
  22341. }
  22342. const maxColumnCount = Math.max(headerNames.length, ...tableBody.map((row) => row.cells.length));
  22343. const maxColumnWidths = Array.from({
  22344. length: maxColumnCount
  22345. }).fill(0);
  22346. const table = [{
  22347. cells: headerNames
  22348. }, ...tableBody.filter((row) => row.cells.length > 0)];
  22349. for (const {
  22350. cells
  22351. } of table.filter((row) => !row.hasLineBreak)) {
  22352. for (const [index, cell] of cells.entries()) {
  22353. maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth(cell));
  22354. }
  22355. }
  22356. parts.push(lineSuffixBoundary, "`", indent([hardline, join(hardline, table.map((row) => join(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth(cell))))))]), hardline, "`");
  22357. return parts;
  22358. }
  22359. }
  22360. function printTemplateExpression(path, print) {
  22361. const node = path.getValue();
  22362. let printed = print();
  22363. if (hasComment(node)) {
  22364. printed = group([indent([softline, printed]), softline]);
  22365. }
  22366. return ["${", printed, lineSuffixBoundary, "}"];
  22367. }
  22368. function printTemplateExpressions(path, print) {
  22369. return path.map((path2) => printTemplateExpression(path2, print), "expressions");
  22370. }
  22371. function escapeTemplateCharacters(doc2, raw) {
  22372. return mapDoc(doc2, (currentDoc) => {
  22373. if (typeof currentDoc === "string") {
  22374. return raw ? currentDoc.replace(/(\\*)`/g, "$1$1\\`") : uncookTemplateElementValue(currentDoc);
  22375. }
  22376. return currentDoc;
  22377. });
  22378. }
  22379. function uncookTemplateElementValue(cookedValue) {
  22380. return cookedValue.replace(/([\\`]|\${)/g, "\\$1");
  22381. }
  22382. module2.exports = {
  22383. printTemplateLiteral,
  22384. printTemplateExpressions,
  22385. escapeTemplateCharacters,
  22386. uncookTemplateElementValue
  22387. };
  22388. }
  22389. });
  22390. var require_markdown = __commonJS2({
  22391. "src/language-js/embed/markdown.js"(exports2, module2) {
  22392. "use strict";
  22393. var {
  22394. builders: {
  22395. indent,
  22396. softline,
  22397. literalline,
  22398. dedentToRoot
  22399. }
  22400. } = require("./doc.js");
  22401. var {
  22402. escapeTemplateCharacters
  22403. } = require_template_literal();
  22404. function format(path, print, textToDoc) {
  22405. const node = path.getValue();
  22406. let text = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
  22407. const indentation = getIndentation(text);
  22408. const hasIndent = indentation !== "";
  22409. if (hasIndent) {
  22410. text = text.replace(new RegExp(`^${indentation}`, "gm"), "");
  22411. }
  22412. const doc2 = escapeTemplateCharacters(textToDoc(text, {
  22413. parser: "markdown",
  22414. __inJsTemplate: true
  22415. }, {
  22416. stripTrailingHardline: true
  22417. }), true);
  22418. return ["`", hasIndent ? indent([softline, doc2]) : [literalline, dedentToRoot(doc2)], softline, "`"];
  22419. }
  22420. function getIndentation(str) {
  22421. const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
  22422. return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
  22423. }
  22424. module2.exports = format;
  22425. }
  22426. });
  22427. var require_css = __commonJS2({
  22428. "src/language-js/embed/css.js"(exports2, module2) {
  22429. "use strict";
  22430. var {
  22431. isNonEmptyArray
  22432. } = require_util();
  22433. var {
  22434. builders: {
  22435. indent,
  22436. hardline,
  22437. softline
  22438. },
  22439. utils: {
  22440. mapDoc,
  22441. replaceEndOfLine,
  22442. cleanDoc
  22443. }
  22444. } = require("./doc.js");
  22445. var {
  22446. printTemplateExpressions
  22447. } = require_template_literal();
  22448. function format(path, print, textToDoc) {
  22449. const node = path.getValue();
  22450. const rawQuasis = node.quasis.map((q) => q.value.raw);
  22451. let placeholderID = 0;
  22452. const text = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
  22453. const doc2 = textToDoc(text, {
  22454. parser: "scss"
  22455. }, {
  22456. stripTrailingHardline: true
  22457. });
  22458. const expressionDocs = printTemplateExpressions(path, print);
  22459. return transformCssDoc(doc2, node, expressionDocs);
  22460. }
  22461. function transformCssDoc(quasisDoc, parentNode, expressionDocs) {
  22462. const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
  22463. if (isEmpty) {
  22464. return "``";
  22465. }
  22466. const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
  22467. if (!newDoc) {
  22468. throw new Error("Couldn't insert all the expressions");
  22469. }
  22470. return ["`", indent([hardline, newDoc]), softline, "`"];
  22471. }
  22472. function replacePlaceholders(quasisDoc, expressionDocs) {
  22473. if (!isNonEmptyArray(expressionDocs)) {
  22474. return quasisDoc;
  22475. }
  22476. let replaceCounter = 0;
  22477. const newDoc = mapDoc(cleanDoc(quasisDoc), (doc2) => {
  22478. if (typeof doc2 !== "string" || !doc2.includes("@prettier-placeholder")) {
  22479. return doc2;
  22480. }
  22481. return doc2.split(/@prettier-placeholder-(\d+)-id/).map((component, idx) => {
  22482. if (idx % 2 === 0) {
  22483. return replaceEndOfLine(component);
  22484. }
  22485. replaceCounter++;
  22486. return expressionDocs[component];
  22487. });
  22488. });
  22489. return expressionDocs.length === replaceCounter ? newDoc : null;
  22490. }
  22491. module2.exports = format;
  22492. }
  22493. });
  22494. var require_graphql = __commonJS2({
  22495. "src/language-js/embed/graphql.js"(exports2, module2) {
  22496. "use strict";
  22497. var {
  22498. builders: {
  22499. indent,
  22500. join,
  22501. hardline
  22502. }
  22503. } = require("./doc.js");
  22504. var {
  22505. escapeTemplateCharacters,
  22506. printTemplateExpressions
  22507. } = require_template_literal();
  22508. function format(path, print, textToDoc) {
  22509. const node = path.getValue();
  22510. const numQuasis = node.quasis.length;
  22511. if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
  22512. return "``";
  22513. }
  22514. const expressionDocs = printTemplateExpressions(path, print);
  22515. const parts = [];
  22516. for (let i = 0; i < numQuasis; i++) {
  22517. const templateElement = node.quasis[i];
  22518. const isFirst = i === 0;
  22519. const isLast = i === numQuasis - 1;
  22520. const text = templateElement.value.cooked;
  22521. const lines = text.split("\n");
  22522. const numLines = lines.length;
  22523. const expressionDoc = expressionDocs[i];
  22524. const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
  22525. const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
  22526. const commentsAndWhitespaceOnly = lines.every((line) => /^\s*(?:#[^\n\r]*)?$/.test(line));
  22527. if (!isLast && /#[^\n\r]*$/.test(lines[numLines - 1])) {
  22528. return null;
  22529. }
  22530. let doc2 = null;
  22531. if (commentsAndWhitespaceOnly) {
  22532. doc2 = printGraphqlComments(lines);
  22533. } else {
  22534. doc2 = textToDoc(text, {
  22535. parser: "graphql"
  22536. }, {
  22537. stripTrailingHardline: true
  22538. });
  22539. }
  22540. if (doc2) {
  22541. doc2 = escapeTemplateCharacters(doc2, false);
  22542. if (!isFirst && startsWithBlankLine) {
  22543. parts.push("");
  22544. }
  22545. parts.push(doc2);
  22546. if (!isLast && endsWithBlankLine) {
  22547. parts.push("");
  22548. }
  22549. } else if (!isFirst && !isLast && startsWithBlankLine) {
  22550. parts.push("");
  22551. }
  22552. if (expressionDoc) {
  22553. parts.push(expressionDoc);
  22554. }
  22555. }
  22556. return ["`", indent([hardline, join(hardline, parts)]), hardline, "`"];
  22557. }
  22558. function printGraphqlComments(lines) {
  22559. const parts = [];
  22560. let seenComment = false;
  22561. const array = lines.map((textLine) => textLine.trim());
  22562. for (const [i, textLine] of array.entries()) {
  22563. if (textLine === "") {
  22564. continue;
  22565. }
  22566. if (array[i - 1] === "" && seenComment) {
  22567. parts.push([hardline, textLine]);
  22568. } else {
  22569. parts.push(textLine);
  22570. }
  22571. seenComment = true;
  22572. }
  22573. return parts.length === 0 ? null : join(hardline, parts);
  22574. }
  22575. module2.exports = format;
  22576. }
  22577. });
  22578. var require_html = __commonJS2({
  22579. "src/language-js/embed/html.js"(exports2, module2) {
  22580. "use strict";
  22581. var {
  22582. builders: {
  22583. indent,
  22584. line,
  22585. hardline,
  22586. group
  22587. },
  22588. utils: {
  22589. mapDoc
  22590. }
  22591. } = require("./doc.js");
  22592. var {
  22593. printTemplateExpressions,
  22594. uncookTemplateElementValue
  22595. } = require_template_literal();
  22596. var htmlTemplateLiteralCounter = 0;
  22597. function format(path, print, textToDoc, options, {
  22598. parser
  22599. }) {
  22600. const node = path.getValue();
  22601. const counter = htmlTemplateLiteralCounter;
  22602. htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
  22603. const composePlaceholder = (index) => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
  22604. const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
  22605. const expressionDocs = printTemplateExpressions(path, print);
  22606. if (expressionDocs.length === 0 && text.trim().length === 0) {
  22607. return "``";
  22608. }
  22609. const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
  22610. let topLevelCount = 0;
  22611. const doc2 = textToDoc(text, {
  22612. parser,
  22613. __onHtmlRoot(root) {
  22614. topLevelCount = root.children.length;
  22615. }
  22616. }, {
  22617. stripTrailingHardline: true
  22618. });
  22619. const contentDoc = mapDoc(doc2, (doc3) => {
  22620. if (typeof doc3 !== "string") {
  22621. return doc3;
  22622. }
  22623. const parts = [];
  22624. const components = doc3.split(placeholderRegex);
  22625. for (let i = 0; i < components.length; i++) {
  22626. let component = components[i];
  22627. if (i % 2 === 0) {
  22628. if (component) {
  22629. component = uncookTemplateElementValue(component);
  22630. if (options.__embeddedInHtml) {
  22631. component = component.replace(/<\/(script)\b/gi, "<\\/$1");
  22632. }
  22633. parts.push(component);
  22634. }
  22635. continue;
  22636. }
  22637. const placeholderIndex = Number(component);
  22638. parts.push(expressionDocs[placeholderIndex]);
  22639. }
  22640. return parts;
  22641. });
  22642. const leadingWhitespace = /^\s/.test(text) ? " " : "";
  22643. const trailingWhitespace = /\s$/.test(text) ? " " : "";
  22644. const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline : leadingWhitespace && trailingWhitespace ? line : null;
  22645. if (linebreak) {
  22646. return group(["`", indent([linebreak, group(contentDoc)]), linebreak, "`"]);
  22647. }
  22648. return group(["`", leadingWhitespace, topLevelCount > 1 ? indent(group(contentDoc)) : group(contentDoc), trailingWhitespace, "`"]);
  22649. }
  22650. module2.exports = format;
  22651. }
  22652. });
  22653. var require_embed = __commonJS2({
  22654. "src/language-js/embed.js"(exports2, module2) {
  22655. "use strict";
  22656. var {
  22657. hasComment,
  22658. CommentCheckFlags,
  22659. isObjectProperty
  22660. } = require_utils7();
  22661. var formatMarkdown = require_markdown();
  22662. var formatCss = require_css();
  22663. var formatGraphql = require_graphql();
  22664. var formatHtml = require_html();
  22665. function getLanguage(path) {
  22666. if (isStyledJsx(path) || isStyledComponents(path) || isCssProp(path) || isAngularComponentStyles(path)) {
  22667. return "css";
  22668. }
  22669. if (isGraphQL(path)) {
  22670. return "graphql";
  22671. }
  22672. if (isHtml(path)) {
  22673. return "html";
  22674. }
  22675. if (isAngularComponentTemplate(path)) {
  22676. return "angular";
  22677. }
  22678. if (isMarkdown(path)) {
  22679. return "markdown";
  22680. }
  22681. }
  22682. function embed(path, print, textToDoc, options) {
  22683. const node = path.getValue();
  22684. if (node.type !== "TemplateLiteral" || hasInvalidCookedValue(node)) {
  22685. return;
  22686. }
  22687. const language = getLanguage(path);
  22688. if (!language) {
  22689. return;
  22690. }
  22691. if (language === "markdown") {
  22692. return formatMarkdown(path, print, textToDoc);
  22693. }
  22694. if (language === "css") {
  22695. return formatCss(path, print, textToDoc);
  22696. }
  22697. if (language === "graphql") {
  22698. return formatGraphql(path, print, textToDoc);
  22699. }
  22700. if (language === "html" || language === "angular") {
  22701. return formatHtml(path, print, textToDoc, options, {
  22702. parser: language
  22703. });
  22704. }
  22705. }
  22706. function isMarkdown(path) {
  22707. const node = path.getValue();
  22708. const parent = path.getParentNode();
  22709. return parent && parent.type === "TaggedTemplateExpression" && node.quasis.length === 1 && parent.tag.type === "Identifier" && (parent.tag.name === "md" || parent.tag.name === "markdown");
  22710. }
  22711. function isStyledJsx(path) {
  22712. const node = path.getValue();
  22713. const parent = path.getParentNode();
  22714. const parentParent = path.getParentNode(1);
  22715. return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some((attribute) => attribute.name.name === "jsx") || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve");
  22716. }
  22717. function isAngularComponentStyles(path) {
  22718. return path.match((node) => node.type === "TemplateLiteral", (node, name) => node.type === "ArrayExpression" && name === "elements", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "styles" && name === "value", ...angularComponentObjectExpressionPredicates);
  22719. }
  22720. function isAngularComponentTemplate(path) {
  22721. return path.match((node) => node.type === "TemplateLiteral", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
  22722. }
  22723. var angularComponentObjectExpressionPredicates = [(node, name) => node.type === "ObjectExpression" && name === "properties", (node, name) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments", (node, name) => node.type === "Decorator" && name === "expression"];
  22724. function isStyledComponents(path) {
  22725. const parent = path.getParentNode();
  22726. if (!parent || parent.type !== "TaggedTemplateExpression") {
  22727. return false;
  22728. }
  22729. const tag = parent.tag.type === "ParenthesizedExpression" ? parent.tag.expression : parent.tag;
  22730. switch (tag.type) {
  22731. case "MemberExpression":
  22732. return isStyledIdentifier(tag.object) || isStyledExtend(tag);
  22733. case "CallExpression":
  22734. return isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && (isStyledIdentifier(tag.callee.object.object) || isStyledExtend(tag.callee.object)) || tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee));
  22735. case "Identifier":
  22736. return tag.name === "css";
  22737. default:
  22738. return false;
  22739. }
  22740. }
  22741. function isCssProp(path) {
  22742. const parent = path.getParentNode();
  22743. const parentParent = path.getParentNode(1);
  22744. return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
  22745. }
  22746. function isStyledIdentifier(node) {
  22747. return node.type === "Identifier" && node.name === "styled";
  22748. }
  22749. function isStyledExtend(node) {
  22750. return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
  22751. }
  22752. function isGraphQL(path) {
  22753. const node = path.getValue();
  22754. const parent = path.getParentNode();
  22755. return hasLanguageComment(node, "GraphQL") || parent && (parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && parent.tag.object.name === "graphql" && parent.tag.property.name === "experimental" || parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")) || parent.type === "CallExpression" && parent.callee.type === "Identifier" && parent.callee.name === "graphql");
  22756. }
  22757. function hasLanguageComment(node, languageName) {
  22758. return hasComment(node, CommentCheckFlags.Block | CommentCheckFlags.Leading, ({
  22759. value
  22760. }) => value === ` ${languageName} `);
  22761. }
  22762. function isHtml(path) {
  22763. return hasLanguageComment(path.getValue(), "HTML") || path.match((node) => node.type === "TemplateLiteral", (node, name) => node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi");
  22764. }
  22765. function hasInvalidCookedValue({
  22766. quasis
  22767. }) {
  22768. return quasis.some(({
  22769. value: {
  22770. cooked
  22771. }
  22772. }) => cooked === null);
  22773. }
  22774. module2.exports = embed;
  22775. }
  22776. });
  22777. var require_clean = __commonJS2({
  22778. "src/language-js/clean.js"(exports2, module2) {
  22779. "use strict";
  22780. var isBlockComment = require_is_block_comment();
  22781. var ignoredProperties = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
  22782. var removeTemplateElementsValue = (node) => {
  22783. for (const templateElement of node.quasis) {
  22784. delete templateElement.value;
  22785. }
  22786. };
  22787. function clean(ast, newObj, parent) {
  22788. if (ast.type === "Program") {
  22789. delete newObj.sourceType;
  22790. }
  22791. if (ast.type === "BigIntLiteral" || ast.type === "BigIntLiteralTypeAnnotation") {
  22792. if (newObj.value) {
  22793. newObj.value = newObj.value.toLowerCase();
  22794. }
  22795. }
  22796. if (ast.type === "BigIntLiteral" || ast.type === "Literal") {
  22797. if (newObj.bigint) {
  22798. newObj.bigint = newObj.bigint.toLowerCase();
  22799. }
  22800. }
  22801. if (ast.type === "DecimalLiteral") {
  22802. newObj.value = Number(newObj.value);
  22803. }
  22804. if (ast.type === "Literal" && newObj.decimal) {
  22805. newObj.decimal = Number(newObj.decimal);
  22806. }
  22807. if (ast.type === "EmptyStatement") {
  22808. return null;
  22809. }
  22810. if (ast.type === "JSXText") {
  22811. return null;
  22812. }
  22813. if (ast.type === "JSXExpressionContainer" && (ast.expression.type === "Literal" || ast.expression.type === "StringLiteral") && ast.expression.value === " ") {
  22814. return null;
  22815. }
  22816. if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "ClassMethod" || ast.type === "PropertyDefinition" || ast.type === "TSDeclareMethod" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && typeof ast.key === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "NumericLiteral" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) {
  22817. delete newObj.key;
  22818. }
  22819. if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some((attr) => attr.name.name === "jsx")) {
  22820. for (const {
  22821. type,
  22822. expression: expression2
  22823. } of newObj.children) {
  22824. if (type === "JSXExpressionContainer" && expression2.type === "TemplateLiteral") {
  22825. removeTemplateElementsValue(expression2);
  22826. }
  22827. }
  22828. }
  22829. if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
  22830. removeTemplateElementsValue(newObj.value.expression);
  22831. }
  22832. if (ast.type === "JSXAttribute" && ast.value && ast.value.type === "Literal" && /["']|&quot;|&apos;/.test(ast.value.value)) {
  22833. newObj.value.value = newObj.value.value.replace(/["']|&quot;|&apos;/g, '"');
  22834. }
  22835. const expression = ast.expression || ast.callee;
  22836. if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
  22837. const astProps = ast.expression.arguments[0].properties;
  22838. for (const [index, prop] of newObj.expression.arguments[0].properties.entries()) {
  22839. switch (astProps[index].key.name) {
  22840. case "styles":
  22841. if (prop.value.type === "ArrayExpression") {
  22842. removeTemplateElementsValue(prop.value.elements[0]);
  22843. }
  22844. break;
  22845. case "template":
  22846. if (prop.value.type === "TemplateLiteral") {
  22847. removeTemplateElementsValue(prop.value);
  22848. }
  22849. break;
  22850. }
  22851. }
  22852. }
  22853. if (ast.type === "TaggedTemplateExpression" && (ast.tag.type === "MemberExpression" || ast.tag.type === "Identifier" && (ast.tag.name === "gql" || ast.tag.name === "graphql" || ast.tag.name === "css" || ast.tag.name === "md" || ast.tag.name === "markdown" || ast.tag.name === "html") || ast.tag.type === "CallExpression")) {
  22854. removeTemplateElementsValue(newObj.quasi);
  22855. }
  22856. if (ast.type === "TemplateLiteral") {
  22857. var _ast$leadingComments;
  22858. const hasLanguageComment = (_ast$leadingComments = ast.leadingComments) === null || _ast$leadingComments === void 0 ? void 0 : _ast$leadingComments.some((comment) => isBlockComment(comment) && ["GraphQL", "HTML"].some((languageName) => comment.value === ` ${languageName} `));
  22859. if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql" || !ast.leadingComments) {
  22860. removeTemplateElementsValue(newObj);
  22861. }
  22862. }
  22863. if (ast.type === "InterpreterDirective") {
  22864. newObj.value = newObj.value.trimEnd();
  22865. }
  22866. if ((ast.type === "TSIntersectionType" || ast.type === "TSUnionType") && ast.types.length === 1) {
  22867. return newObj.types[0];
  22868. }
  22869. }
  22870. clean.ignoredProperties = ignoredProperties;
  22871. module2.exports = clean;
  22872. }
  22873. });
  22874. var require_detect_newline = __commonJS2({
  22875. "node_modules/detect-newline/index.js"(exports2, module2) {
  22876. "use strict";
  22877. var detectNewline = (string) => {
  22878. if (typeof string !== "string") {
  22879. throw new TypeError("Expected a string");
  22880. }
  22881. const newlines = string.match(/(?:\r?\n)/g) || [];
  22882. if (newlines.length === 0) {
  22883. return;
  22884. }
  22885. const crlf = newlines.filter((newline) => newline === "\r\n").length;
  22886. const lf = newlines.length - crlf;
  22887. return crlf > lf ? "\r\n" : "\n";
  22888. };
  22889. module2.exports = detectNewline;
  22890. module2.exports.graceful = (string) => typeof string === "string" && detectNewline(string) || "\n";
  22891. }
  22892. });
  22893. var require_build = __commonJS2({
  22894. "node_modules/jest-docblock/build/index.js"(exports2) {
  22895. "use strict";
  22896. Object.defineProperty(exports2, "__esModule", {
  22897. value: true
  22898. });
  22899. exports2.extract = extract;
  22900. exports2.parse = parse;
  22901. exports2.parseWithComments = parseWithComments;
  22902. exports2.print = print;
  22903. exports2.strip = strip;
  22904. function _os() {
  22905. const data = require("os");
  22906. _os = function() {
  22907. return data;
  22908. };
  22909. return data;
  22910. }
  22911. function _detectNewline() {
  22912. const data = _interopRequireDefault(require_detect_newline());
  22913. _detectNewline = function() {
  22914. return data;
  22915. };
  22916. return data;
  22917. }
  22918. function _interopRequireDefault(obj) {
  22919. return obj && obj.__esModule ? obj : {
  22920. default: obj
  22921. };
  22922. }
  22923. var commentEndRe = /\*\/$/;
  22924. var commentStartRe = /^\/\*\*?/;
  22925. var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
  22926. var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
  22927. var ltrimNewlineRe = /^(\r?\n)+/;
  22928. var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
  22929. var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
  22930. var stringStartRe = /(\r?\n|^) *\* ?/g;
  22931. var STRING_ARRAY = [];
  22932. function extract(contents) {
  22933. const match = contents.match(docblockRe);
  22934. return match ? match[0].trimLeft() : "";
  22935. }
  22936. function strip(contents) {
  22937. const match = contents.match(docblockRe);
  22938. return match && match[0] ? contents.substring(match[0].length) : contents;
  22939. }
  22940. function parse(docblock) {
  22941. return parseWithComments(docblock).pragmas;
  22942. }
  22943. function parseWithComments(docblock) {
  22944. const line = (0, _detectNewline().default)(docblock) || _os().EOL;
  22945. docblock = docblock.replace(commentStartRe, "").replace(commentEndRe, "").replace(stringStartRe, "$1");
  22946. let prev = "";
  22947. while (prev !== docblock) {
  22948. prev = docblock;
  22949. docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`);
  22950. }
  22951. docblock = docblock.replace(ltrimNewlineRe, "").trimRight();
  22952. const result = /* @__PURE__ */ Object.create(null);
  22953. const comments = docblock.replace(propertyRe, "").replace(ltrimNewlineRe, "").trimRight();
  22954. let match;
  22955. while (match = propertyRe.exec(docblock)) {
  22956. const nextPragma = match[2].replace(lineCommentRe, "");
  22957. if (typeof result[match[1]] === "string" || Array.isArray(result[match[1]])) {
  22958. result[match[1]] = STRING_ARRAY.concat(result[match[1]], nextPragma);
  22959. } else {
  22960. result[match[1]] = nextPragma;
  22961. }
  22962. }
  22963. return {
  22964. comments,
  22965. pragmas: result
  22966. };
  22967. }
  22968. function print({
  22969. comments = "",
  22970. pragmas = {}
  22971. }) {
  22972. const line = (0, _detectNewline().default)(comments) || _os().EOL;
  22973. const head = "/**";
  22974. const start = " *";
  22975. const tail = " */";
  22976. const keys = Object.keys(pragmas);
  22977. const printedObject = keys.map((key) => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map((keyValue) => `${start} ${keyValue}${line}`).join("");
  22978. if (!comments) {
  22979. if (keys.length === 0) {
  22980. return "";
  22981. }
  22982. if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
  22983. const value = pragmas[keys[0]];
  22984. return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`;
  22985. }
  22986. }
  22987. const printedComments = comments.split(line).map((textLine) => `${start} ${textLine}`).join(line) + line;
  22988. return head + line + (comments ? printedComments : "") + (comments && keys.length ? start + line : "") + printedObject + tail;
  22989. }
  22990. function printKeyValues(key, valueOrArray) {
  22991. return STRING_ARRAY.concat(valueOrArray).map((value) => `@${key} ${value}`.trim());
  22992. }
  22993. }
  22994. });
  22995. var require_get_shebang = __commonJS2({
  22996. "src/language-js/utils/get-shebang.js"(exports2, module2) {
  22997. "use strict";
  22998. function getShebang(text) {
  22999. if (!text.startsWith("#!")) {
  23000. return "";
  23001. }
  23002. const index = text.indexOf("\n");
  23003. if (index === -1) {
  23004. return text;
  23005. }
  23006. return text.slice(0, index);
  23007. }
  23008. module2.exports = getShebang;
  23009. }
  23010. });
  23011. var require_pragma = __commonJS2({
  23012. "src/language-js/pragma.js"(exports2, module2) {
  23013. "use strict";
  23014. var {
  23015. parseWithComments,
  23016. strip,
  23017. extract,
  23018. print
  23019. } = require_build();
  23020. var {
  23021. normalizeEndOfLine
  23022. } = require_end_of_line();
  23023. var getShebang = require_get_shebang();
  23024. function parseDocBlock(text) {
  23025. const shebang = getShebang(text);
  23026. if (shebang) {
  23027. text = text.slice(shebang.length + 1);
  23028. }
  23029. const docBlock = extract(text);
  23030. const {
  23031. pragmas,
  23032. comments
  23033. } = parseWithComments(docBlock);
  23034. return {
  23035. shebang,
  23036. text,
  23037. pragmas,
  23038. comments
  23039. };
  23040. }
  23041. function hasPragma(text) {
  23042. const pragmas = Object.keys(parseDocBlock(text).pragmas);
  23043. return pragmas.includes("prettier") || pragmas.includes("format");
  23044. }
  23045. function insertPragma(originalText) {
  23046. const {
  23047. shebang,
  23048. text,
  23049. pragmas,
  23050. comments
  23051. } = parseDocBlock(originalText);
  23052. const strippedText = strip(text);
  23053. const docBlock = print({
  23054. pragmas: Object.assign({
  23055. format: ""
  23056. }, pragmas),
  23057. comments: comments.trimStart()
  23058. });
  23059. return (shebang ? `${shebang}
  23060. ` : "") + normalizeEndOfLine(docBlock) + (strippedText.startsWith("\n") ? "\n" : "\n\n") + strippedText;
  23061. }
  23062. module2.exports = {
  23063. hasPragma,
  23064. insertPragma
  23065. };
  23066. }
  23067. });
  23068. var require_comments2 = __commonJS2({
  23069. "src/language-js/comments.js"(exports2, module2) {
  23070. "use strict";
  23071. var {
  23072. getLast,
  23073. hasNewline,
  23074. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  23075. getNextNonSpaceNonCommentCharacter,
  23076. hasNewlineInRange,
  23077. addLeadingComment,
  23078. addTrailingComment,
  23079. addDanglingComment,
  23080. getNextNonSpaceNonCommentCharacterIndex,
  23081. isNonEmptyArray
  23082. } = require_util();
  23083. var {
  23084. getFunctionParameters,
  23085. isPrettierIgnoreComment,
  23086. isJsxNode,
  23087. hasFlowShorthandAnnotationComment,
  23088. hasFlowAnnotationComment,
  23089. hasIgnoreComment,
  23090. isCallLikeExpression,
  23091. getCallArguments,
  23092. isCallExpression,
  23093. isMemberExpression,
  23094. isObjectProperty,
  23095. isLineComment,
  23096. getComments,
  23097. CommentCheckFlags,
  23098. markerForIfWithoutBlockAndSameLineComment
  23099. } = require_utils7();
  23100. var {
  23101. locStart,
  23102. locEnd
  23103. } = require_loc();
  23104. var isBlockComment = require_is_block_comment();
  23105. function handleOwnLineComment(context) {
  23106. return [handleIgnoreComments, handleLastFunctionArgComments, handleMemberExpressionComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleForComments, handleUnionTypeComments, handleOnlyComments, handleModuleSpecifiersComments, handleAssignmentPatternComments, handleMethodNameComments, handleLabeledStatementComments, handleBreakAndContinueStatementComments].some((fn) => fn(context));
  23107. }
  23108. function handleEndOfLineComment(context) {
  23109. return [handleClosureTypeCastComments, handleLastFunctionArgComments, handleConditionalExpressionComments, handleModuleSpecifiersComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, handleOnlyComments, handleVariableDeclaratorComments, handleBreakAndContinueStatementComments, handleSwitchDefaultCaseComments].some((fn) => fn(context));
  23110. }
  23111. function handleRemainingComment(context) {
  23112. return [handleIgnoreComments, handleIfStatementComments, handleWhileComments, handleObjectPropertyAssignment, handleCommentInEmptyParens, handleMethodNameComments, handleOnlyComments, handleCommentAfterArrowParams, handleFunctionNameComments, handleTSMappedTypeComments, handleBreakAndContinueStatementComments, handleTSFunctionTrailingComments].some((fn) => fn(context));
  23113. }
  23114. function addBlockStatementFirstComment(node, comment) {
  23115. const firstNonEmptyNode = (node.body || node.properties).find(({
  23116. type
  23117. }) => type !== "EmptyStatement");
  23118. if (firstNonEmptyNode) {
  23119. addLeadingComment(firstNonEmptyNode, comment);
  23120. } else {
  23121. addDanglingComment(node, comment);
  23122. }
  23123. }
  23124. function addBlockOrNotComment(node, comment) {
  23125. if (node.type === "BlockStatement") {
  23126. addBlockStatementFirstComment(node, comment);
  23127. } else {
  23128. addLeadingComment(node, comment);
  23129. }
  23130. }
  23131. function handleClosureTypeCastComments({
  23132. comment,
  23133. followingNode
  23134. }) {
  23135. if (followingNode && isTypeCastComment(comment)) {
  23136. addLeadingComment(followingNode, comment);
  23137. return true;
  23138. }
  23139. return false;
  23140. }
  23141. function handleIfStatementComments({
  23142. comment,
  23143. precedingNode,
  23144. enclosingNode,
  23145. followingNode,
  23146. text
  23147. }) {
  23148. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "IfStatement" || !followingNode) {
  23149. return false;
  23150. }
  23151. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23152. if (nextCharacter === ")") {
  23153. addTrailingComment(precedingNode, comment);
  23154. return true;
  23155. }
  23156. if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
  23157. if (precedingNode.type === "BlockStatement") {
  23158. addTrailingComment(precedingNode, comment);
  23159. } else {
  23160. const isSingleLineComment = comment.type === "SingleLine" || comment.loc.start.line === comment.loc.end.line;
  23161. const isSameLineComment = comment.loc.start.line === precedingNode.loc.start.line;
  23162. if (isSingleLineComment && isSameLineComment) {
  23163. addDanglingComment(precedingNode, comment, markerForIfWithoutBlockAndSameLineComment);
  23164. } else {
  23165. addDanglingComment(enclosingNode, comment);
  23166. }
  23167. }
  23168. return true;
  23169. }
  23170. if (followingNode.type === "BlockStatement") {
  23171. addBlockStatementFirstComment(followingNode, comment);
  23172. return true;
  23173. }
  23174. if (followingNode.type === "IfStatement") {
  23175. addBlockOrNotComment(followingNode.consequent, comment);
  23176. return true;
  23177. }
  23178. if (enclosingNode.consequent === followingNode) {
  23179. addLeadingComment(followingNode, comment);
  23180. return true;
  23181. }
  23182. return false;
  23183. }
  23184. function handleWhileComments({
  23185. comment,
  23186. precedingNode,
  23187. enclosingNode,
  23188. followingNode,
  23189. text
  23190. }) {
  23191. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "WhileStatement" || !followingNode) {
  23192. return false;
  23193. }
  23194. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23195. if (nextCharacter === ")") {
  23196. addTrailingComment(precedingNode, comment);
  23197. return true;
  23198. }
  23199. if (followingNode.type === "BlockStatement") {
  23200. addBlockStatementFirstComment(followingNode, comment);
  23201. return true;
  23202. }
  23203. if (enclosingNode.body === followingNode) {
  23204. addLeadingComment(followingNode, comment);
  23205. return true;
  23206. }
  23207. return false;
  23208. }
  23209. function handleTryStatementComments({
  23210. comment,
  23211. precedingNode,
  23212. enclosingNode,
  23213. followingNode
  23214. }) {
  23215. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TryStatement" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "CatchClause" || !followingNode) {
  23216. return false;
  23217. }
  23218. if (enclosingNode.type === "CatchClause" && precedingNode) {
  23219. addTrailingComment(precedingNode, comment);
  23220. return true;
  23221. }
  23222. if (followingNode.type === "BlockStatement") {
  23223. addBlockStatementFirstComment(followingNode, comment);
  23224. return true;
  23225. }
  23226. if (followingNode.type === "TryStatement") {
  23227. addBlockOrNotComment(followingNode.finalizer, comment);
  23228. return true;
  23229. }
  23230. if (followingNode.type === "CatchClause") {
  23231. addBlockOrNotComment(followingNode.body, comment);
  23232. return true;
  23233. }
  23234. return false;
  23235. }
  23236. function handleMemberExpressionComments({
  23237. comment,
  23238. enclosingNode,
  23239. followingNode
  23240. }) {
  23241. if (isMemberExpression(enclosingNode) && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Identifier") {
  23242. addLeadingComment(enclosingNode, comment);
  23243. return true;
  23244. }
  23245. return false;
  23246. }
  23247. function handleConditionalExpressionComments({
  23248. comment,
  23249. precedingNode,
  23250. enclosingNode,
  23251. followingNode,
  23252. text
  23253. }) {
  23254. const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment));
  23255. if ((!precedingNode || !isSameLineAsPrecedingNode) && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ConditionalExpression" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSConditionalType") && followingNode) {
  23256. addLeadingComment(followingNode, comment);
  23257. return true;
  23258. }
  23259. return false;
  23260. }
  23261. function handleObjectPropertyAssignment({
  23262. comment,
  23263. precedingNode,
  23264. enclosingNode
  23265. }) {
  23266. if (isObjectProperty(enclosingNode) && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
  23267. addTrailingComment(enclosingNode.value.left, comment);
  23268. return true;
  23269. }
  23270. return false;
  23271. }
  23272. var classLikeNodeTypes = /* @__PURE__ */ new Set(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
  23273. function handleClassComments({
  23274. comment,
  23275. precedingNode,
  23276. enclosingNode,
  23277. followingNode
  23278. }) {
  23279. if (classLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23280. if (isNonEmptyArray(enclosingNode.decorators) && !(followingNode && followingNode.type === "Decorator")) {
  23281. addTrailingComment(getLast(enclosingNode.decorators), comment);
  23282. return true;
  23283. }
  23284. if (enclosingNode.body && followingNode === enclosingNode.body) {
  23285. addBlockStatementFirstComment(enclosingNode.body, comment);
  23286. return true;
  23287. }
  23288. if (followingNode) {
  23289. if (enclosingNode.superClass && followingNode === enclosingNode.superClass && precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters)) {
  23290. addTrailingComment(precedingNode, comment);
  23291. return true;
  23292. }
  23293. for (const prop of ["implements", "extends", "mixins"]) {
  23294. if (enclosingNode[prop] && followingNode === enclosingNode[prop][0]) {
  23295. if (precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters || precedingNode === enclosingNode.superClass)) {
  23296. addTrailingComment(precedingNode, comment);
  23297. } else {
  23298. addDanglingComment(enclosingNode, comment, prop);
  23299. }
  23300. return true;
  23301. }
  23302. }
  23303. }
  23304. }
  23305. return false;
  23306. }
  23307. var propertyLikeNodeTypes = /* @__PURE__ */ new Set(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition"]);
  23308. function handleMethodNameComments({
  23309. comment,
  23310. precedingNode,
  23311. enclosingNode,
  23312. text
  23313. }) {
  23314. if (enclosingNode && precedingNode && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(" && (enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && getNextNonSpaceNonCommentCharacter(text, precedingNode, locEnd) !== ":") {
  23315. addTrailingComment(precedingNode, comment);
  23316. return true;
  23317. }
  23318. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Decorator" && propertyLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23319. addTrailingComment(precedingNode, comment);
  23320. return true;
  23321. }
  23322. return false;
  23323. }
  23324. var functionLikeNodeTypes = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
  23325. function handleFunctionNameComments({
  23326. comment,
  23327. precedingNode,
  23328. enclosingNode,
  23329. text
  23330. }) {
  23331. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== "(") {
  23332. return false;
  23333. }
  23334. if (precedingNode && functionLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23335. addTrailingComment(precedingNode, comment);
  23336. return true;
  23337. }
  23338. return false;
  23339. }
  23340. function handleCommentAfterArrowParams({
  23341. comment,
  23342. enclosingNode,
  23343. text
  23344. }) {
  23345. if (!((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ArrowFunctionExpression")) {
  23346. return false;
  23347. }
  23348. const index = getNextNonSpaceNonCommentCharacterIndex(text, comment, locEnd);
  23349. if (index !== false && text.slice(index, index + 2) === "=>") {
  23350. addDanglingComment(enclosingNode, comment);
  23351. return true;
  23352. }
  23353. return false;
  23354. }
  23355. function handleCommentInEmptyParens({
  23356. comment,
  23357. enclosingNode,
  23358. text
  23359. }) {
  23360. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== ")") {
  23361. return false;
  23362. }
  23363. if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters(enclosingNode).length === 0 || isCallLikeExpression(enclosingNode) && getCallArguments(enclosingNode).length === 0)) {
  23364. addDanglingComment(enclosingNode, comment);
  23365. return true;
  23366. }
  23367. if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "MethodDefinition" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getFunctionParameters(enclosingNode.value).length === 0) {
  23368. addDanglingComment(enclosingNode.value, comment);
  23369. return true;
  23370. }
  23371. return false;
  23372. }
  23373. function handleLastFunctionArgComments({
  23374. comment,
  23375. precedingNode,
  23376. enclosingNode,
  23377. followingNode,
  23378. text
  23379. }) {
  23380. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "FunctionTypeParam" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionTypeAnnotation" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) !== "FunctionTypeParam") {
  23381. addTrailingComment(precedingNode, comment);
  23382. return true;
  23383. }
  23384. if (((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Identifier" || (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ")") {
  23385. addTrailingComment(precedingNode, comment);
  23386. return true;
  23387. }
  23388. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionDeclaration" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "BlockStatement") {
  23389. const functionParamRightParenIndex = (() => {
  23390. const parameters = getFunctionParameters(enclosingNode);
  23391. if (parameters.length > 0) {
  23392. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(getLast(parameters)));
  23393. }
  23394. const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(enclosingNode.id));
  23395. return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
  23396. })();
  23397. if (locStart(comment) > functionParamRightParenIndex) {
  23398. addBlockStatementFirstComment(followingNode, comment);
  23399. return true;
  23400. }
  23401. }
  23402. return false;
  23403. }
  23404. function handleLabeledStatementComments({
  23405. comment,
  23406. enclosingNode
  23407. }) {
  23408. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "LabeledStatement") {
  23409. addLeadingComment(enclosingNode, comment);
  23410. return true;
  23411. }
  23412. return false;
  23413. }
  23414. function handleBreakAndContinueStatementComments({
  23415. comment,
  23416. enclosingNode
  23417. }) {
  23418. if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ContinueStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "BreakStatement") && !enclosingNode.label) {
  23419. addTrailingComment(enclosingNode, comment);
  23420. return true;
  23421. }
  23422. return false;
  23423. }
  23424. function handleCallExpressionComments({
  23425. comment,
  23426. precedingNode,
  23427. enclosingNode
  23428. }) {
  23429. if (isCallExpression(enclosingNode) && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
  23430. addLeadingComment(enclosingNode.arguments[0], comment);
  23431. return true;
  23432. }
  23433. return false;
  23434. }
  23435. function handleUnionTypeComments({
  23436. comment,
  23437. precedingNode,
  23438. enclosingNode,
  23439. followingNode
  23440. }) {
  23441. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "UnionTypeAnnotation" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSUnionType") {
  23442. if (isPrettierIgnoreComment(comment)) {
  23443. followingNode.prettierIgnore = true;
  23444. comment.unignore = true;
  23445. }
  23446. if (precedingNode) {
  23447. addTrailingComment(precedingNode, comment);
  23448. return true;
  23449. }
  23450. return false;
  23451. }
  23452. if (((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "UnionTypeAnnotation" || (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSUnionType") && isPrettierIgnoreComment(comment)) {
  23453. followingNode.types[0].prettierIgnore = true;
  23454. comment.unignore = true;
  23455. }
  23456. return false;
  23457. }
  23458. function handlePropertyComments({
  23459. comment,
  23460. enclosingNode
  23461. }) {
  23462. if (isObjectProperty(enclosingNode)) {
  23463. addLeadingComment(enclosingNode, comment);
  23464. return true;
  23465. }
  23466. return false;
  23467. }
  23468. function handleOnlyComments({
  23469. comment,
  23470. enclosingNode,
  23471. followingNode,
  23472. ast,
  23473. isLastComment
  23474. }) {
  23475. if (ast && ast.body && ast.body.length === 0) {
  23476. if (isLastComment) {
  23477. addDanglingComment(ast, comment);
  23478. } else {
  23479. addLeadingComment(ast, comment);
  23480. }
  23481. return true;
  23482. }
  23483. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "Program" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.body.length) === 0 && !isNonEmptyArray(enclosingNode.directives)) {
  23484. if (isLastComment) {
  23485. addDanglingComment(enclosingNode, comment);
  23486. } else {
  23487. addLeadingComment(enclosingNode, comment);
  23488. }
  23489. return true;
  23490. }
  23491. if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Program" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.body.length) === 0 && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ModuleExpression") {
  23492. addDanglingComment(followingNode, comment);
  23493. return true;
  23494. }
  23495. return false;
  23496. }
  23497. function handleForComments({
  23498. comment,
  23499. enclosingNode
  23500. }) {
  23501. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForInStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForOfStatement") {
  23502. addLeadingComment(enclosingNode, comment);
  23503. return true;
  23504. }
  23505. return false;
  23506. }
  23507. function handleModuleSpecifiersComments({
  23508. comment,
  23509. precedingNode,
  23510. enclosingNode,
  23511. text
  23512. }) {
  23513. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportSpecifier" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportSpecifier") {
  23514. addLeadingComment(enclosingNode, comment);
  23515. return true;
  23516. }
  23517. const isImportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ImportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportDeclaration";
  23518. const isExportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ExportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportNamedDeclaration";
  23519. if ((isImportDeclaration || isExportDeclaration) && hasNewline(text, locEnd(comment))) {
  23520. addTrailingComment(precedingNode, comment);
  23521. return true;
  23522. }
  23523. return false;
  23524. }
  23525. function handleAssignmentPatternComments({
  23526. comment,
  23527. enclosingNode
  23528. }) {
  23529. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "AssignmentPattern") {
  23530. addLeadingComment(enclosingNode, comment);
  23531. return true;
  23532. }
  23533. return false;
  23534. }
  23535. var assignmentLikeNodeTypes = /* @__PURE__ */ new Set(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]);
  23536. var complexExprNodeTypes = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
  23537. function handleVariableDeclaratorComments({
  23538. comment,
  23539. enclosingNode,
  23540. followingNode
  23541. }) {
  23542. if (assignmentLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) && followingNode && (complexExprNodeTypes.has(followingNode.type) || isBlockComment(comment))) {
  23543. addLeadingComment(followingNode, comment);
  23544. return true;
  23545. }
  23546. return false;
  23547. }
  23548. function handleTSFunctionTrailingComments({
  23549. comment,
  23550. enclosingNode,
  23551. followingNode,
  23552. text
  23553. }) {
  23554. if (!followingNode && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMethodSignature" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSDeclareFunction" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ";") {
  23555. addTrailingComment(enclosingNode, comment);
  23556. return true;
  23557. }
  23558. return false;
  23559. }
  23560. function handleIgnoreComments({
  23561. comment,
  23562. enclosingNode,
  23563. followingNode
  23564. }) {
  23565. if (isPrettierIgnoreComment(comment) && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMappedType" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.constraint) {
  23566. enclosingNode.prettierIgnore = true;
  23567. comment.unignore = true;
  23568. return true;
  23569. }
  23570. }
  23571. function handleTSMappedTypeComments({
  23572. comment,
  23573. precedingNode,
  23574. enclosingNode,
  23575. followingNode
  23576. }) {
  23577. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TSMappedType") {
  23578. return false;
  23579. }
  23580. if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.name) {
  23581. addLeadingComment(followingNode.name, comment);
  23582. return true;
  23583. }
  23584. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "TSTypeParameter" && precedingNode.constraint) {
  23585. addTrailingComment(precedingNode.constraint, comment);
  23586. return true;
  23587. }
  23588. return false;
  23589. }
  23590. function handleSwitchDefaultCaseComments({
  23591. comment,
  23592. enclosingNode,
  23593. followingNode
  23594. }) {
  23595. if (!enclosingNode || enclosingNode.type !== "SwitchCase" || enclosingNode.test) {
  23596. return false;
  23597. }
  23598. if (followingNode.type === "BlockStatement" && isLineComment(comment)) {
  23599. addBlockStatementFirstComment(followingNode, comment);
  23600. } else {
  23601. addDanglingComment(enclosingNode, comment);
  23602. }
  23603. return true;
  23604. }
  23605. function isRealFunctionLikeNode(node) {
  23606. return node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "TSDeclareFunction" || node.type === "TSCallSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSMethodSignature" || node.type === "TSConstructorType" || node.type === "TSFunctionType" || node.type === "TSDeclareMethod";
  23607. }
  23608. function getCommentChildNodes(node, options) {
  23609. if ((options.parser === "typescript" || options.parser === "flow" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && getFunctionParameters(node.value).length === 0 && !node.value.returnType && !isNonEmptyArray(node.value.typeParameters) && node.value.body) {
  23610. return [...node.decorators || [], node.key, node.value.body];
  23611. }
  23612. }
  23613. function isTypeCastComment(comment) {
  23614. return isBlockComment(comment) && comment.value[0] === "*" && /@type\b/.test(comment.value);
  23615. }
  23616. function willPrintOwnComments(path) {
  23617. const node = path.getValue();
  23618. const parent = path.getParentNode();
  23619. const hasFlowAnnotations = (node2) => hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Leading)) || hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Trailing));
  23620. return (node && (isJsxNode(node) || hasFlowShorthandAnnotationComment(node) || isCallExpression(parent) && hasFlowAnnotations(node)) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType");
  23621. }
  23622. module2.exports = {
  23623. handleOwnLineComment,
  23624. handleEndOfLineComment,
  23625. handleRemainingComment,
  23626. isTypeCastComment,
  23627. getCommentChildNodes,
  23628. willPrintOwnComments
  23629. };
  23630. }
  23631. });
  23632. var require_needs_parens = __commonJS2({
  23633. "src/language-js/needs-parens.js"(exports2, module2) {
  23634. "use strict";
  23635. var getLast = require_get_last();
  23636. var isNonEmptyArray = require_is_non_empty_array();
  23637. var {
  23638. getFunctionParameters,
  23639. getLeftSidePathName,
  23640. hasFlowShorthandAnnotationComment,
  23641. hasNakedLeftSide,
  23642. hasNode,
  23643. isBitwiseOperator,
  23644. startsWithNoLookaheadToken,
  23645. shouldFlatten,
  23646. getPrecedence,
  23647. isCallExpression,
  23648. isMemberExpression,
  23649. isObjectProperty,
  23650. isTSTypeExpression
  23651. } = require_utils7();
  23652. function needsParens(path, options) {
  23653. const parent = path.getParentNode();
  23654. if (!parent) {
  23655. return false;
  23656. }
  23657. const name = path.getName();
  23658. const node = path.getNode();
  23659. if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
  23660. return true;
  23661. }
  23662. if (isStatement(node)) {
  23663. return false;
  23664. }
  23665. if (options.parser !== "flow" && hasFlowShorthandAnnotationComment(path.getValue())) {
  23666. return true;
  23667. }
  23668. if (node.type === "Identifier") {
  23669. if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
  23670. return true;
  23671. }
  23672. if (name === "left" && node.name === "async" && parent.type === "ForOfStatement" && !parent.await) {
  23673. return true;
  23674. }
  23675. return false;
  23676. }
  23677. switch (parent.type) {
  23678. case "ParenthesizedExpression":
  23679. return false;
  23680. case "ClassDeclaration":
  23681. case "ClassExpression": {
  23682. if (name === "superClass" && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression" || node.type === "TSNonNullExpression")) {
  23683. return true;
  23684. }
  23685. break;
  23686. }
  23687. case "ExportDefaultDeclaration": {
  23688. return shouldWrapFunctionForExportDefault(path, options) || node.type === "SequenceExpression";
  23689. }
  23690. case "Decorator": {
  23691. if (name === "expression") {
  23692. let hasCallExpression = false;
  23693. let hasMemberExpression = false;
  23694. let current = node;
  23695. while (current) {
  23696. switch (current.type) {
  23697. case "MemberExpression":
  23698. hasMemberExpression = true;
  23699. current = current.object;
  23700. break;
  23701. case "CallExpression":
  23702. if (hasMemberExpression || hasCallExpression) {
  23703. return options.parser !== "typescript";
  23704. }
  23705. hasCallExpression = true;
  23706. current = current.callee;
  23707. break;
  23708. case "Identifier":
  23709. return false;
  23710. case "TaggedTemplateExpression":
  23711. return options.parser !== "typescript";
  23712. default:
  23713. return true;
  23714. }
  23715. }
  23716. return true;
  23717. }
  23718. break;
  23719. }
  23720. case "ExpressionStatement": {
  23721. if (startsWithNoLookaheadToken(node, true)) {
  23722. return true;
  23723. }
  23724. break;
  23725. }
  23726. case "ArrowFunctionExpression": {
  23727. if (name === "body" && node.type !== "SequenceExpression" && startsWithNoLookaheadToken(node, false)) {
  23728. return true;
  23729. }
  23730. break;
  23731. }
  23732. }
  23733. switch (node.type) {
  23734. case "UpdateExpression":
  23735. if (parent.type === "UnaryExpression") {
  23736. return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
  23737. }
  23738. case "UnaryExpression":
  23739. switch (parent.type) {
  23740. case "UnaryExpression":
  23741. return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
  23742. case "BindExpression":
  23743. return true;
  23744. case "MemberExpression":
  23745. case "OptionalMemberExpression":
  23746. return name === "object";
  23747. case "TaggedTemplateExpression":
  23748. return true;
  23749. case "NewExpression":
  23750. case "CallExpression":
  23751. case "OptionalCallExpression":
  23752. return name === "callee";
  23753. case "BinaryExpression":
  23754. return name === "left" && parent.operator === "**";
  23755. case "TSNonNullExpression":
  23756. return true;
  23757. default:
  23758. return false;
  23759. }
  23760. case "BinaryExpression": {
  23761. if (parent.type === "UpdateExpression") {
  23762. return true;
  23763. }
  23764. if (node.operator === "in" && isPathInForStatementInitializer(path)) {
  23765. return true;
  23766. }
  23767. if (node.operator === "|>" && node.extra && node.extra.parenthesized) {
  23768. const grandParent = path.getParentNode(1);
  23769. if (grandParent.type === "BinaryExpression" && grandParent.operator === "|>") {
  23770. return true;
  23771. }
  23772. }
  23773. }
  23774. case "TSTypeAssertion":
  23775. case "TSAsExpression":
  23776. case "TSSatisfiesExpression":
  23777. case "LogicalExpression":
  23778. switch (parent.type) {
  23779. case "TSSatisfiesExpression":
  23780. case "TSAsExpression":
  23781. return !isTSTypeExpression(node);
  23782. case "ConditionalExpression":
  23783. return isTSTypeExpression(node);
  23784. case "CallExpression":
  23785. case "NewExpression":
  23786. case "OptionalCallExpression":
  23787. return name === "callee";
  23788. case "ClassExpression":
  23789. case "ClassDeclaration":
  23790. return name === "superClass";
  23791. case "TSTypeAssertion":
  23792. case "TaggedTemplateExpression":
  23793. case "UnaryExpression":
  23794. case "JSXSpreadAttribute":
  23795. case "SpreadElement":
  23796. case "SpreadProperty":
  23797. case "BindExpression":
  23798. case "AwaitExpression":
  23799. case "TSNonNullExpression":
  23800. case "UpdateExpression":
  23801. return true;
  23802. case "MemberExpression":
  23803. case "OptionalMemberExpression":
  23804. return name === "object";
  23805. case "AssignmentExpression":
  23806. case "AssignmentPattern":
  23807. return name === "left" && (node.type === "TSTypeAssertion" || isTSTypeExpression(node));
  23808. case "LogicalExpression":
  23809. if (node.type === "LogicalExpression") {
  23810. return parent.operator !== node.operator;
  23811. }
  23812. case "BinaryExpression": {
  23813. const {
  23814. operator,
  23815. type
  23816. } = node;
  23817. if (!operator && type !== "TSTypeAssertion") {
  23818. return true;
  23819. }
  23820. const precedence = getPrecedence(operator);
  23821. const parentOperator = parent.operator;
  23822. const parentPrecedence = getPrecedence(parentOperator);
  23823. if (parentPrecedence > precedence) {
  23824. return true;
  23825. }
  23826. if (name === "right" && parentPrecedence === precedence) {
  23827. return true;
  23828. }
  23829. if (parentPrecedence === precedence && !shouldFlatten(parentOperator, operator)) {
  23830. return true;
  23831. }
  23832. if (parentPrecedence < precedence && operator === "%") {
  23833. return parentOperator === "+" || parentOperator === "-";
  23834. }
  23835. if (isBitwiseOperator(parentOperator)) {
  23836. return true;
  23837. }
  23838. return false;
  23839. }
  23840. default:
  23841. return false;
  23842. }
  23843. case "SequenceExpression":
  23844. switch (parent.type) {
  23845. case "ReturnStatement":
  23846. return false;
  23847. case "ForStatement":
  23848. return false;
  23849. case "ExpressionStatement":
  23850. return name !== "expression";
  23851. case "ArrowFunctionExpression":
  23852. return name !== "body";
  23853. default:
  23854. return true;
  23855. }
  23856. case "YieldExpression":
  23857. if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || isTSTypeExpression(parent) || parent.type === "TSNonNullExpression") {
  23858. return true;
  23859. }
  23860. case "AwaitExpression":
  23861. switch (parent.type) {
  23862. case "TaggedTemplateExpression":
  23863. case "UnaryExpression":
  23864. case "LogicalExpression":
  23865. case "SpreadElement":
  23866. case "SpreadProperty":
  23867. case "TSAsExpression":
  23868. case "TSSatisfiesExpression":
  23869. case "TSNonNullExpression":
  23870. case "BindExpression":
  23871. return true;
  23872. case "MemberExpression":
  23873. case "OptionalMemberExpression":
  23874. return name === "object";
  23875. case "NewExpression":
  23876. case "CallExpression":
  23877. case "OptionalCallExpression":
  23878. return name === "callee";
  23879. case "ConditionalExpression":
  23880. return name === "test";
  23881. case "BinaryExpression": {
  23882. if (!node.argument && parent.operator === "|>") {
  23883. return false;
  23884. }
  23885. return true;
  23886. }
  23887. default:
  23888. return false;
  23889. }
  23890. case "TSConditionalType":
  23891. if (name === "extendsType" && parent.type === "TSConditionalType") {
  23892. return true;
  23893. }
  23894. case "TSFunctionType":
  23895. case "TSConstructorType":
  23896. if (name === "extendsType" && parent.type === "TSConditionalType") {
  23897. const returnTypeAnnotation = (node.returnType || node.typeAnnotation).typeAnnotation;
  23898. if (returnTypeAnnotation.type === "TSInferType" && returnTypeAnnotation.typeParameter.constraint) {
  23899. return true;
  23900. }
  23901. }
  23902. if (name === "checkType" && parent.type === "TSConditionalType") {
  23903. return true;
  23904. }
  23905. case "TSUnionType":
  23906. case "TSIntersectionType":
  23907. if ((parent.type === "TSUnionType" || parent.type === "TSIntersectionType") && parent.types.length > 1 && (!node.types || node.types.length > 1)) {
  23908. return true;
  23909. }
  23910. case "TSInferType":
  23911. if (node.type === "TSInferType" && parent.type === "TSRestType") {
  23912. return false;
  23913. }
  23914. case "TSTypeOperator":
  23915. return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || name === "objectType" && parent.type === "TSIndexedAccessType" || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && path.getParentNode(1).type.startsWith("TSJSDoc");
  23916. case "ArrayTypeAnnotation":
  23917. return parent.type === "NullableTypeAnnotation";
  23918. case "IntersectionTypeAnnotation":
  23919. case "UnionTypeAnnotation":
  23920. return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23921. case "NullableTypeAnnotation":
  23922. return parent.type === "ArrayTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23923. case "FunctionTypeAnnotation": {
  23924. const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
  23925. return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || name === "objectType" && (ancestor.type === "IndexedAccessType" || ancestor.type === "OptionalIndexedAccessType") || ancestor.type === "NullableTypeAnnotation" || parent.type === "FunctionTypeParam" && parent.name === null && getFunctionParameters(node).some((param) => param.typeAnnotation && param.typeAnnotation.type === "NullableTypeAnnotation");
  23926. }
  23927. case "OptionalIndexedAccessType":
  23928. return name === "objectType" && parent.type === "IndexedAccessType";
  23929. case "TypeofTypeAnnotation":
  23930. return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23931. case "StringLiteral":
  23932. case "NumericLiteral":
  23933. case "Literal":
  23934. if (typeof node.value === "string" && parent.type === "ExpressionStatement" && !parent.directive) {
  23935. const grandParent = path.getParentNode(1);
  23936. return grandParent.type === "Program" || grandParent.type === "BlockStatement";
  23937. }
  23938. return name === "object" && parent.type === "MemberExpression" && typeof node.value === "number";
  23939. case "AssignmentExpression": {
  23940. const grandParent = path.getParentNode(1);
  23941. if (name === "body" && parent.type === "ArrowFunctionExpression") {
  23942. return true;
  23943. }
  23944. if (name === "key" && (parent.type === "ClassProperty" || parent.type === "PropertyDefinition") && parent.computed) {
  23945. return false;
  23946. }
  23947. if ((name === "init" || name === "update") && parent.type === "ForStatement") {
  23948. return false;
  23949. }
  23950. if (parent.type === "ExpressionStatement") {
  23951. return node.left.type === "ObjectPattern";
  23952. }
  23953. if (name === "key" && parent.type === "TSPropertySignature") {
  23954. return false;
  23955. }
  23956. if (parent.type === "AssignmentExpression") {
  23957. return false;
  23958. }
  23959. if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
  23960. return false;
  23961. }
  23962. if (name === "value" && parent.type === "Property" && grandParent && grandParent.type === "ObjectPattern" && grandParent.properties.includes(parent)) {
  23963. return false;
  23964. }
  23965. if (parent.type === "NGChainedExpression") {
  23966. return false;
  23967. }
  23968. return true;
  23969. }
  23970. case "ConditionalExpression":
  23971. switch (parent.type) {
  23972. case "TaggedTemplateExpression":
  23973. case "UnaryExpression":
  23974. case "SpreadElement":
  23975. case "SpreadProperty":
  23976. case "BinaryExpression":
  23977. case "LogicalExpression":
  23978. case "NGPipeExpression":
  23979. case "ExportDefaultDeclaration":
  23980. case "AwaitExpression":
  23981. case "JSXSpreadAttribute":
  23982. case "TSTypeAssertion":
  23983. case "TypeCastExpression":
  23984. case "TSAsExpression":
  23985. case "TSSatisfiesExpression":
  23986. case "TSNonNullExpression":
  23987. return true;
  23988. case "NewExpression":
  23989. case "CallExpression":
  23990. case "OptionalCallExpression":
  23991. return name === "callee";
  23992. case "ConditionalExpression":
  23993. return name === "test";
  23994. case "MemberExpression":
  23995. case "OptionalMemberExpression":
  23996. return name === "object";
  23997. default:
  23998. return false;
  23999. }
  24000. case "FunctionExpression":
  24001. switch (parent.type) {
  24002. case "NewExpression":
  24003. case "CallExpression":
  24004. case "OptionalCallExpression":
  24005. return name === "callee";
  24006. case "TaggedTemplateExpression":
  24007. return true;
  24008. default:
  24009. return false;
  24010. }
  24011. case "ArrowFunctionExpression":
  24012. switch (parent.type) {
  24013. case "BinaryExpression":
  24014. return parent.operator !== "|>" || node.extra && node.extra.parenthesized;
  24015. case "NewExpression":
  24016. case "CallExpression":
  24017. case "OptionalCallExpression":
  24018. return name === "callee";
  24019. case "MemberExpression":
  24020. case "OptionalMemberExpression":
  24021. return name === "object";
  24022. case "TSAsExpression":
  24023. case "TSSatisfiesExpression":
  24024. case "TSNonNullExpression":
  24025. case "BindExpression":
  24026. case "TaggedTemplateExpression":
  24027. case "UnaryExpression":
  24028. case "LogicalExpression":
  24029. case "AwaitExpression":
  24030. case "TSTypeAssertion":
  24031. return true;
  24032. case "ConditionalExpression":
  24033. return name === "test";
  24034. default:
  24035. return false;
  24036. }
  24037. case "ClassExpression":
  24038. if (isNonEmptyArray(node.decorators)) {
  24039. return true;
  24040. }
  24041. switch (parent.type) {
  24042. case "NewExpression":
  24043. return name === "callee";
  24044. default:
  24045. return false;
  24046. }
  24047. case "OptionalMemberExpression":
  24048. case "OptionalCallExpression": {
  24049. const parentParent = path.getParentNode(1);
  24050. if (name === "object" && parent.type === "MemberExpression" || name === "callee" && (parent.type === "CallExpression" || parent.type === "NewExpression") || parent.type === "TSNonNullExpression" && parentParent.type === "MemberExpression" && parentParent.object === parent) {
  24051. return true;
  24052. }
  24053. }
  24054. case "CallExpression":
  24055. case "MemberExpression":
  24056. case "TaggedTemplateExpression":
  24057. case "TSNonNullExpression":
  24058. if (name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression")) {
  24059. let object = node;
  24060. while (object) {
  24061. switch (object.type) {
  24062. case "CallExpression":
  24063. case "OptionalCallExpression":
  24064. return true;
  24065. case "MemberExpression":
  24066. case "OptionalMemberExpression":
  24067. case "BindExpression":
  24068. object = object.object;
  24069. break;
  24070. case "TaggedTemplateExpression":
  24071. object = object.tag;
  24072. break;
  24073. case "TSNonNullExpression":
  24074. object = object.expression;
  24075. break;
  24076. default:
  24077. return false;
  24078. }
  24079. }
  24080. }
  24081. return false;
  24082. case "BindExpression":
  24083. return name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression") || name === "object" && isMemberExpression(parent);
  24084. case "NGPipeExpression":
  24085. if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" && !(node.extra && node.extra.parenthesized) || parent.type === "ArrayExpression" || isCallExpression(parent) && parent.arguments[name] === node || name === "right" && parent.type === "NGPipeExpression" || name === "property" && parent.type === "MemberExpression" || parent.type === "AssignmentExpression") {
  24086. return false;
  24087. }
  24088. return true;
  24089. case "JSXFragment":
  24090. case "JSXElement":
  24091. return name === "callee" || name === "left" && parent.type === "BinaryExpression" && parent.operator === "<" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "NewExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && !isCallExpression(parent) && !isObjectProperty(parent) && parent.type !== "ReturnStatement" && parent.type !== "ThrowStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator" && parent.type !== "YieldExpression";
  24092. case "TypeAnnotation":
  24093. return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
  24094. }
  24095. return false;
  24096. }
  24097. function isStatement(node) {
  24098. return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "PropertyDefinition" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
  24099. }
  24100. function isPathInForStatementInitializer(path) {
  24101. let i = 0;
  24102. let node = path.getValue();
  24103. while (node) {
  24104. const parent = path.getParentNode(i++);
  24105. if (parent && parent.type === "ForStatement" && parent.init === node) {
  24106. return true;
  24107. }
  24108. node = parent;
  24109. }
  24110. return false;
  24111. }
  24112. function includesFunctionTypeInObjectType(node) {
  24113. return hasNode(node, (n1) => n1.type === "ObjectTypeAnnotation" && hasNode(n1, (n2) => n2.type === "FunctionTypeAnnotation" || void 0) || void 0);
  24114. }
  24115. function endsWithRightBracket(node) {
  24116. switch (node.type) {
  24117. case "ObjectExpression":
  24118. return true;
  24119. default:
  24120. return false;
  24121. }
  24122. }
  24123. function isFollowedByRightBracket(path) {
  24124. const node = path.getValue();
  24125. const parent = path.getParentNode();
  24126. const name = path.getName();
  24127. switch (parent.type) {
  24128. case "NGPipeExpression":
  24129. if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
  24130. return path.callParent(isFollowedByRightBracket);
  24131. }
  24132. break;
  24133. case "ObjectProperty":
  24134. if (name === "value") {
  24135. const parentParent = path.getParentNode(1);
  24136. return getLast(parentParent.properties) === parent;
  24137. }
  24138. break;
  24139. case "BinaryExpression":
  24140. case "LogicalExpression":
  24141. if (name === "right") {
  24142. return path.callParent(isFollowedByRightBracket);
  24143. }
  24144. break;
  24145. case "ConditionalExpression":
  24146. if (name === "alternate") {
  24147. return path.callParent(isFollowedByRightBracket);
  24148. }
  24149. break;
  24150. case "UnaryExpression":
  24151. if (parent.prefix) {
  24152. return path.callParent(isFollowedByRightBracket);
  24153. }
  24154. break;
  24155. }
  24156. return false;
  24157. }
  24158. function shouldWrapFunctionForExportDefault(path, options) {
  24159. const node = path.getValue();
  24160. const parent = path.getParentNode();
  24161. if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
  24162. return parent.type === "ExportDefaultDeclaration" || !needsParens(path, options);
  24163. }
  24164. if (!hasNakedLeftSide(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
  24165. return false;
  24166. }
  24167. return path.call((childPath) => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName(path, node));
  24168. }
  24169. module2.exports = needsParens;
  24170. }
  24171. });
  24172. var require_print_preprocess = __commonJS2({
  24173. "src/language-js/print-preprocess.js"(exports2, module2) {
  24174. "use strict";
  24175. function preprocess(ast, options) {
  24176. switch (options.parser) {
  24177. case "json":
  24178. case "json5":
  24179. case "json-stringify":
  24180. case "__js_expression":
  24181. case "__vue_expression":
  24182. case "__vue_ts_expression":
  24183. return Object.assign(Object.assign({}, ast), {}, {
  24184. type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
  24185. node: ast,
  24186. comments: [],
  24187. rootMarker: options.rootMarker
  24188. });
  24189. default:
  24190. return ast;
  24191. }
  24192. }
  24193. module2.exports = preprocess;
  24194. }
  24195. });
  24196. var require_html_binding = __commonJS2({
  24197. "src/language-js/print/html-binding.js"(exports2, module2) {
  24198. "use strict";
  24199. var {
  24200. builders: {
  24201. join,
  24202. line,
  24203. group,
  24204. softline,
  24205. indent
  24206. }
  24207. } = require("./doc.js");
  24208. function printHtmlBinding(path, options, print) {
  24209. const node = path.getValue();
  24210. if (options.__onHtmlBindingRoot && path.getName() === null) {
  24211. options.__onHtmlBindingRoot(node, options);
  24212. }
  24213. if (node.type !== "File") {
  24214. return;
  24215. }
  24216. if (options.__isVueForBindingLeft) {
  24217. return path.call((functionDeclarationPath) => {
  24218. const printed = join([",", line], functionDeclarationPath.map(print, "params"));
  24219. const {
  24220. params
  24221. } = functionDeclarationPath.getValue();
  24222. if (params.length === 1) {
  24223. return printed;
  24224. }
  24225. return ["(", indent([softline, group(printed)]), softline, ")"];
  24226. }, "program", "body", 0);
  24227. }
  24228. if (options.__isVueBindings) {
  24229. return path.call((functionDeclarationPath) => join([",", line], functionDeclarationPath.map(print, "params")), "program", "body", 0);
  24230. }
  24231. }
  24232. function isVueEventBindingExpression(node) {
  24233. switch (node.type) {
  24234. case "MemberExpression":
  24235. switch (node.property.type) {
  24236. case "Identifier":
  24237. case "NumericLiteral":
  24238. case "StringLiteral":
  24239. return isVueEventBindingExpression(node.object);
  24240. }
  24241. return false;
  24242. case "Identifier":
  24243. return true;
  24244. default:
  24245. return false;
  24246. }
  24247. }
  24248. module2.exports = {
  24249. isVueEventBindingExpression,
  24250. printHtmlBinding
  24251. };
  24252. }
  24253. });
  24254. var require_binaryish = __commonJS2({
  24255. "src/language-js/print/binaryish.js"(exports2, module2) {
  24256. "use strict";
  24257. var {
  24258. printComments
  24259. } = require_comments();
  24260. var {
  24261. getLast
  24262. } = require_util();
  24263. var {
  24264. builders: {
  24265. join,
  24266. line,
  24267. softline,
  24268. group,
  24269. indent,
  24270. align,
  24271. indentIfBreak
  24272. },
  24273. utils: {
  24274. cleanDoc,
  24275. getDocParts,
  24276. isConcat
  24277. }
  24278. } = require("./doc.js");
  24279. var {
  24280. hasLeadingOwnLineComment,
  24281. isBinaryish,
  24282. isJsxNode,
  24283. shouldFlatten,
  24284. hasComment,
  24285. CommentCheckFlags,
  24286. isCallExpression,
  24287. isMemberExpression,
  24288. isObjectProperty,
  24289. isEnabledHackPipeline
  24290. } = require_utils7();
  24291. var uid = 0;
  24292. function printBinaryishExpression(path, options, print) {
  24293. const node = path.getValue();
  24294. const parent = path.getParentNode();
  24295. const parentParent = path.getParentNode(1);
  24296. const isInsideParenthesis = node !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
  24297. const isHackPipeline = isEnabledHackPipeline(options) && node.operator === "|>";
  24298. const parts = printBinaryishExpressions(path, print, options, false, isInsideParenthesis);
  24299. if (isInsideParenthesis) {
  24300. return parts;
  24301. }
  24302. if (isHackPipeline) {
  24303. return group(parts);
  24304. }
  24305. if (isCallExpression(parent) && parent.callee === node || parent.type === "UnaryExpression" || isMemberExpression(parent) && !parent.computed) {
  24306. return group([indent([softline, ...parts]), softline]);
  24307. }
  24308. const shouldNotIndent = parent.type === "ReturnStatement" || parent.type === "ThrowStatement" || parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || node.operator !== "|" && parent.type === "JsExpressionRoot" || node.type !== "NGPipeExpression" && (parent.type === "NGRoot" && options.parser === "__ng_binding" || parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || node === parent.body && parent.type === "ArrowFunctionExpression" || node !== parent.body && parent.type === "ForStatement" || parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "ThrowStatement" && !isCallExpression(parentParent) || parent.type === "TemplateLiteral";
  24309. const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "PropertyDefinition" || parent.type === "TSAbstractPropertyDefinition" || parent.type === "ClassPrivateProperty" || isObjectProperty(parent);
  24310. const samePrecedenceSubExpression = isBinaryish(node.left) && shouldFlatten(node.operator, node.left.operator);
  24311. if (shouldNotIndent || shouldInlineLogicalExpression(node) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(node) && shouldIndentIfInlining) {
  24312. return group(parts);
  24313. }
  24314. if (parts.length === 0) {
  24315. return "";
  24316. }
  24317. const hasJsx = isJsxNode(node.right);
  24318. const firstGroupIndex = parts.findIndex((part) => typeof part !== "string" && !Array.isArray(part) && part.type === "group");
  24319. const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
  24320. const rest = parts.slice(headParts.length, hasJsx ? -1 : void 0);
  24321. const groupId = Symbol("logicalChain-" + ++uid);
  24322. const chain = group([...headParts, indent(rest)], {
  24323. id: groupId
  24324. });
  24325. if (!hasJsx) {
  24326. return chain;
  24327. }
  24328. const jsxPart = getLast(parts);
  24329. return group([chain, indentIfBreak(jsxPart, {
  24330. groupId
  24331. })]);
  24332. }
  24333. function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
  24334. const node = path.getValue();
  24335. if (!isBinaryish(node)) {
  24336. return [group(print())];
  24337. }
  24338. let parts = [];
  24339. if (shouldFlatten(node.operator, node.left.operator)) {
  24340. parts = path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "left");
  24341. } else {
  24342. parts.push(group(print("left")));
  24343. }
  24344. const shouldInline = shouldInlineLogicalExpression(node);
  24345. const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment(options.originalText, node.right);
  24346. const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
  24347. const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length > 0 ? group(indent([line, ": ", join([line, ": "], path.map(print, "arguments").map((arg) => align(2, group(arg))))])) : "";
  24348. let right;
  24349. if (shouldInline) {
  24350. right = [operator, " ", print("right"), rightSuffix];
  24351. } else {
  24352. const isHackPipeline = isEnabledHackPipeline(options) && operator === "|>";
  24353. const rightContent = isHackPipeline ? path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "right") : print("right");
  24354. right = [lineBeforeOperator ? line : "", operator, lineBeforeOperator ? " " : line, rightContent, rightSuffix];
  24355. }
  24356. const parent = path.getParentNode();
  24357. const shouldBreak = hasComment(node.left, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  24358. const shouldGroup = shouldBreak || !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
  24359. parts.push(lineBeforeOperator ? "" : " ", shouldGroup ? group(right, {
  24360. shouldBreak
  24361. }) : right);
  24362. if (isNested && hasComment(node)) {
  24363. const printed = cleanDoc(printComments(path, parts, options));
  24364. if (isConcat(printed) || printed.type === "fill") {
  24365. return getDocParts(printed);
  24366. }
  24367. return [printed];
  24368. }
  24369. return parts;
  24370. }
  24371. function shouldInlineLogicalExpression(node) {
  24372. if (node.type !== "LogicalExpression") {
  24373. return false;
  24374. }
  24375. if (node.right.type === "ObjectExpression" && node.right.properties.length > 0) {
  24376. return true;
  24377. }
  24378. if (node.right.type === "ArrayExpression" && node.right.elements.length > 0) {
  24379. return true;
  24380. }
  24381. if (isJsxNode(node.right)) {
  24382. return true;
  24383. }
  24384. return false;
  24385. }
  24386. module2.exports = {
  24387. printBinaryishExpression,
  24388. shouldInlineLogicalExpression
  24389. };
  24390. }
  24391. });
  24392. var require_angular = __commonJS2({
  24393. "src/language-js/print/angular.js"(exports2, module2) {
  24394. "use strict";
  24395. var {
  24396. builders: {
  24397. join,
  24398. line,
  24399. group
  24400. }
  24401. } = require("./doc.js");
  24402. var {
  24403. hasNode,
  24404. hasComment,
  24405. getComments
  24406. } = require_utils7();
  24407. var {
  24408. printBinaryishExpression
  24409. } = require_binaryish();
  24410. function printAngular(path, options, print) {
  24411. const node = path.getValue();
  24412. if (!node.type.startsWith("NG")) {
  24413. return;
  24414. }
  24415. switch (node.type) {
  24416. case "NGRoot":
  24417. return [print("node"), !hasComment(node.node) ? "" : " //" + getComments(node.node)[0].value.trimEnd()];
  24418. case "NGPipeExpression":
  24419. return printBinaryishExpression(path, options, print);
  24420. case "NGChainedExpression":
  24421. return group(join([";", line], path.map((childPath) => hasNgSideEffect(childPath) ? print() : ["(", print(), ")"], "expressions")));
  24422. case "NGEmptyExpression":
  24423. return "";
  24424. case "NGQuotedExpression":
  24425. return [node.prefix, ": ", node.value.trim()];
  24426. case "NGMicrosyntax":
  24427. return path.map((childPath, index) => [index === 0 ? "" : isNgForOf(childPath.getValue(), index, node) ? " " : [";", line], print()], "body");
  24428. case "NGMicrosyntaxKey":
  24429. return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/i.test(node.name) ? node.name : JSON.stringify(node.name);
  24430. case "NGMicrosyntaxExpression":
  24431. return [print("expression"), node.alias === null ? "" : [" as ", print("alias")]];
  24432. case "NGMicrosyntaxKeyedExpression": {
  24433. const index = path.getName();
  24434. const parentNode = path.getParentNode();
  24435. const shouldNotPrintColon = isNgForOf(node, index, parentNode) || (index === 1 && (node.key.name === "then" || node.key.name === "else") || index === 2 && node.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression";
  24436. return [print("key"), shouldNotPrintColon ? " " : ": ", print("expression")];
  24437. }
  24438. case "NGMicrosyntaxLet":
  24439. return ["let ", print("key"), node.value === null ? "" : [" = ", print("value")]];
  24440. case "NGMicrosyntaxAs":
  24441. return [print("key"), " as ", print("alias")];
  24442. default:
  24443. throw new Error(`Unknown Angular node type: ${JSON.stringify(node.type)}.`);
  24444. }
  24445. }
  24446. function isNgForOf(node, index, parentNode) {
  24447. return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
  24448. }
  24449. function hasNgSideEffect(path) {
  24450. return hasNode(path.getValue(), (node) => {
  24451. switch (node.type) {
  24452. case void 0:
  24453. return false;
  24454. case "CallExpression":
  24455. case "OptionalCallExpression":
  24456. case "AssignmentExpression":
  24457. return true;
  24458. }
  24459. });
  24460. }
  24461. module2.exports = {
  24462. printAngular
  24463. };
  24464. }
  24465. });
  24466. var require_jsx = __commonJS2({
  24467. "src/language-js/print/jsx.js"(exports2, module2) {
  24468. "use strict";
  24469. var {
  24470. printComments,
  24471. printDanglingComments
  24472. } = require_comments();
  24473. var {
  24474. builders: {
  24475. line,
  24476. hardline,
  24477. softline,
  24478. group,
  24479. indent,
  24480. conditionalGroup,
  24481. fill,
  24482. ifBreak,
  24483. lineSuffixBoundary,
  24484. join
  24485. },
  24486. utils: {
  24487. willBreak
  24488. }
  24489. } = require("./doc.js");
  24490. var {
  24491. getLast,
  24492. getPreferredQuote
  24493. } = require_util();
  24494. var {
  24495. isJsxNode,
  24496. rawText,
  24497. isLiteral,
  24498. isCallExpression,
  24499. isStringLiteral,
  24500. isBinaryish,
  24501. hasComment,
  24502. CommentCheckFlags,
  24503. hasNodeIgnoreComment
  24504. } = require_utils7();
  24505. var pathNeedsParens = require_needs_parens();
  24506. var {
  24507. willPrintOwnComments
  24508. } = require_comments2();
  24509. var isEmptyStringOrAnyLine = (doc2) => doc2 === "" || doc2 === line || doc2 === hardline || doc2 === softline;
  24510. function printJsxElementInternal(path, options, print) {
  24511. const node = path.getValue();
  24512. if (node.type === "JSXElement" && isEmptyJsxElement(node)) {
  24513. return [print("openingElement"), print("closingElement")];
  24514. }
  24515. const openingLines = node.type === "JSXElement" ? print("openingElement") : print("openingFragment");
  24516. const closingLines = node.type === "JSXElement" ? print("closingElement") : print("closingFragment");
  24517. if (node.children.length === 1 && node.children[0].type === "JSXExpressionContainer" && (node.children[0].expression.type === "TemplateLiteral" || node.children[0].expression.type === "TaggedTemplateExpression")) {
  24518. return [openingLines, ...path.map(print, "children"), closingLines];
  24519. }
  24520. node.children = node.children.map((child) => {
  24521. if (isJsxWhitespaceExpression(child)) {
  24522. return {
  24523. type: "JSXText",
  24524. value: " ",
  24525. raw: " "
  24526. };
  24527. }
  24528. return child;
  24529. });
  24530. const containsTag = node.children.some(isJsxNode);
  24531. const containsMultipleExpressions = node.children.filter((child) => child.type === "JSXExpressionContainer").length > 1;
  24532. const containsMultipleAttributes = node.type === "JSXElement" && node.openingElement.attributes.length > 1;
  24533. let forcedBreak = willBreak(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
  24534. const isMdxBlock = path.getParentNode().rootMarker === "mdx";
  24535. const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
  24536. const jsxWhitespace = isMdxBlock ? " " : ifBreak([rawJsxWhitespace, softline], " ");
  24537. const isFacebookTranslationTag = node.openingElement && node.openingElement.name && node.openingElement.name.name === "fbt";
  24538. const children = printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
  24539. const containsText = node.children.some((child) => isMeaningfulJsxText(child));
  24540. for (let i = children.length - 2; i >= 0; i--) {
  24541. const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
  24542. const isPairOfHardlines = children[i] === hardline && children[i + 1] === "" && children[i + 2] === hardline;
  24543. const isLineFollowedByJsxWhitespace = (children[i] === softline || children[i] === hardline) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24544. const isJsxWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline || children[i + 2] === hardline);
  24545. const isDoubleJsxWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24546. const isPairOfHardOrSoftLines = children[i] === softline && children[i + 1] === "" && children[i + 2] === hardline || children[i] === hardline && children[i + 1] === "" && children[i + 2] === softline;
  24547. if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJsxWhitespace || isDoubleJsxWhitespace || isPairOfHardOrSoftLines) {
  24548. children.splice(i, 2);
  24549. } else if (isJsxWhitespaceFollowedByLine) {
  24550. children.splice(i + 1, 2);
  24551. }
  24552. }
  24553. while (children.length > 0 && isEmptyStringOrAnyLine(getLast(children))) {
  24554. children.pop();
  24555. }
  24556. while (children.length > 1 && isEmptyStringOrAnyLine(children[0]) && isEmptyStringOrAnyLine(children[1])) {
  24557. children.shift();
  24558. children.shift();
  24559. }
  24560. const multilineChildren = [];
  24561. for (const [i, child] of children.entries()) {
  24562. if (child === jsxWhitespace) {
  24563. if (i === 1 && children[i - 1] === "") {
  24564. if (children.length === 2) {
  24565. multilineChildren.push(rawJsxWhitespace);
  24566. continue;
  24567. }
  24568. multilineChildren.push([rawJsxWhitespace, hardline]);
  24569. continue;
  24570. } else if (i === children.length - 1) {
  24571. multilineChildren.push(rawJsxWhitespace);
  24572. continue;
  24573. } else if (children[i - 1] === "" && children[i - 2] === hardline) {
  24574. multilineChildren.push(rawJsxWhitespace);
  24575. continue;
  24576. }
  24577. }
  24578. multilineChildren.push(child);
  24579. if (willBreak(child)) {
  24580. forcedBreak = true;
  24581. }
  24582. }
  24583. const content = containsText ? fill(multilineChildren) : group(multilineChildren, {
  24584. shouldBreak: true
  24585. });
  24586. if (isMdxBlock) {
  24587. return content;
  24588. }
  24589. const multiLineElem = group([openingLines, indent([hardline, content]), hardline, closingLines]);
  24590. if (forcedBreak) {
  24591. return multiLineElem;
  24592. }
  24593. return conditionalGroup([group([openingLines, ...children, closingLines]), multiLineElem]);
  24594. }
  24595. function printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
  24596. const parts = [];
  24597. path.each((childPath, i, children) => {
  24598. const child = childPath.getValue();
  24599. if (isLiteral(child)) {
  24600. const text = rawText(child);
  24601. if (isMeaningfulJsxText(child)) {
  24602. const words = text.split(matchJsxWhitespaceRegex);
  24603. if (words[0] === "") {
  24604. parts.push("");
  24605. words.shift();
  24606. if (/\n/.test(words[0])) {
  24607. const next = children[i + 1];
  24608. parts.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
  24609. } else {
  24610. parts.push(jsxWhitespace);
  24611. }
  24612. words.shift();
  24613. }
  24614. let endWhitespace;
  24615. if (getLast(words) === "") {
  24616. words.pop();
  24617. endWhitespace = words.pop();
  24618. }
  24619. if (words.length === 0) {
  24620. return;
  24621. }
  24622. for (const [i2, word] of words.entries()) {
  24623. if (i2 % 2 === 1) {
  24624. parts.push(line);
  24625. } else {
  24626. parts.push(word);
  24627. }
  24628. }
  24629. if (endWhitespace !== void 0) {
  24630. if (/\n/.test(endWhitespace)) {
  24631. const next = children[i + 1];
  24632. parts.push(separatorWithWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24633. } else {
  24634. parts.push(jsxWhitespace);
  24635. }
  24636. } else {
  24637. const next = children[i + 1];
  24638. parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24639. }
  24640. } else if (/\n/.test(text)) {
  24641. if (text.match(/\n/g).length > 1) {
  24642. parts.push("", hardline);
  24643. }
  24644. } else {
  24645. parts.push("", jsxWhitespace);
  24646. }
  24647. } else {
  24648. const printedChild = print();
  24649. parts.push(printedChild);
  24650. const next = children[i + 1];
  24651. const directlyFollowedByMeaningfulText = next && isMeaningfulJsxText(next);
  24652. if (directlyFollowedByMeaningfulText) {
  24653. const firstWord = trimJsxWhitespace(rawText(next)).split(matchJsxWhitespaceRegex)[0];
  24654. parts.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
  24655. } else {
  24656. parts.push(hardline);
  24657. }
  24658. }
  24659. }, "children");
  24660. return parts;
  24661. }
  24662. function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24663. if (isFacebookTranslationTag) {
  24664. return "";
  24665. }
  24666. if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
  24667. return child.length === 1 ? softline : hardline;
  24668. }
  24669. return softline;
  24670. }
  24671. function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24672. if (isFacebookTranslationTag) {
  24673. return hardline;
  24674. }
  24675. if (child.length === 1) {
  24676. return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline : softline;
  24677. }
  24678. return hardline;
  24679. }
  24680. function maybeWrapJsxElementInParens(path, elem, options) {
  24681. const parent = path.getParentNode();
  24682. if (!parent) {
  24683. return elem;
  24684. }
  24685. const NO_WRAP_PARENTS = {
  24686. ArrayExpression: true,
  24687. JSXAttribute: true,
  24688. JSXElement: true,
  24689. JSXExpressionContainer: true,
  24690. JSXFragment: true,
  24691. ExpressionStatement: true,
  24692. CallExpression: true,
  24693. OptionalCallExpression: true,
  24694. ConditionalExpression: true,
  24695. JsExpressionRoot: true
  24696. };
  24697. if (NO_WRAP_PARENTS[parent.type]) {
  24698. return elem;
  24699. }
  24700. const shouldBreak = path.match(void 0, (node) => node.type === "ArrowFunctionExpression", isCallExpression, (node) => node.type === "JSXExpressionContainer");
  24701. const needsParens = pathNeedsParens(path, options);
  24702. return group([needsParens ? "" : ifBreak("("), indent([softline, elem]), softline, needsParens ? "" : ifBreak(")")], {
  24703. shouldBreak
  24704. });
  24705. }
  24706. function printJsxAttribute(path, options, print) {
  24707. const node = path.getValue();
  24708. const parts = [];
  24709. parts.push(print("name"));
  24710. if (node.value) {
  24711. let res;
  24712. if (isStringLiteral(node.value)) {
  24713. const raw = rawText(node.value);
  24714. let final = raw.slice(1, -1).replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  24715. const {
  24716. escaped,
  24717. quote,
  24718. regex
  24719. } = getPreferredQuote(final, options.jsxSingleQuote ? "'" : '"');
  24720. final = final.replace(regex, escaped);
  24721. res = [quote, final, quote];
  24722. } else {
  24723. res = print("value");
  24724. }
  24725. parts.push("=", res);
  24726. }
  24727. return parts;
  24728. }
  24729. function printJsxExpressionContainer(path, options, print) {
  24730. const node = path.getValue();
  24731. const shouldInline = (node2, parent) => node2.type === "JSXEmptyExpression" || !hasComment(node2) && (node2.type === "ArrayExpression" || node2.type === "ObjectExpression" || node2.type === "ArrowFunctionExpression" || node2.type === "AwaitExpression" && (shouldInline(node2.argument, node2) || node2.argument.type === "JSXElement") || isCallExpression(node2) || node2.type === "FunctionExpression" || node2.type === "TemplateLiteral" || node2.type === "TaggedTemplateExpression" || node2.type === "DoExpression" || isJsxNode(parent) && (node2.type === "ConditionalExpression" || isBinaryish(node2)));
  24732. if (shouldInline(node.expression, path.getParentNode(0))) {
  24733. return group(["{", print("expression"), lineSuffixBoundary, "}"]);
  24734. }
  24735. return group(["{", indent([softline, print("expression")]), softline, lineSuffixBoundary, "}"]);
  24736. }
  24737. function printJsxOpeningElement(path, options, print) {
  24738. const node = path.getValue();
  24739. const nameHasComments = node.name && hasComment(node.name) || node.typeParameters && hasComment(node.typeParameters);
  24740. if (node.selfClosing && node.attributes.length === 0 && !nameHasComments) {
  24741. return ["<", print("name"), print("typeParameters"), " />"];
  24742. }
  24743. if (node.attributes && node.attributes.length === 1 && node.attributes[0].value && isStringLiteral(node.attributes[0].value) && !node.attributes[0].value.value.includes("\n") && !nameHasComments && !hasComment(node.attributes[0])) {
  24744. return group(["<", print("name"), print("typeParameters"), " ", ...path.map(print, "attributes"), node.selfClosing ? " />" : ">"]);
  24745. }
  24746. const shouldBreak = node.attributes && node.attributes.some((attr) => attr.value && isStringLiteral(attr.value) && attr.value.value.includes("\n"));
  24747. const attributeLine = options.singleAttributePerLine && node.attributes.length > 1 ? hardline : line;
  24748. return group(["<", print("name"), print("typeParameters"), indent(path.map(() => [attributeLine, print()], "attributes")), ...printEndOfOpeningTag(node, options, nameHasComments)], {
  24749. shouldBreak
  24750. });
  24751. }
  24752. function printEndOfOpeningTag(node, options, nameHasComments) {
  24753. if (node.selfClosing) {
  24754. return [line, "/>"];
  24755. }
  24756. const bracketSameLine = shouldPrintBracketSameLine(node, options, nameHasComments);
  24757. if (bracketSameLine) {
  24758. return [">"];
  24759. }
  24760. return [softline, ">"];
  24761. }
  24762. function shouldPrintBracketSameLine(node, options, nameHasComments) {
  24763. const lastAttrHasTrailingComments = node.attributes.length > 0 && hasComment(getLast(node.attributes), CommentCheckFlags.Trailing);
  24764. return node.attributes.length === 0 && !nameHasComments || (options.bracketSameLine || options.jsxBracketSameLine) && (!nameHasComments || node.attributes.length > 0) && !lastAttrHasTrailingComments;
  24765. }
  24766. function printJsxClosingElement(path, options, print) {
  24767. const node = path.getValue();
  24768. const parts = [];
  24769. parts.push("</");
  24770. const printed = print("name");
  24771. if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Line)) {
  24772. parts.push(indent([hardline, printed]), hardline);
  24773. } else if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Block)) {
  24774. parts.push(" ", printed);
  24775. } else {
  24776. parts.push(printed);
  24777. }
  24778. parts.push(">");
  24779. return parts;
  24780. }
  24781. function printJsxOpeningClosingFragment(path, options) {
  24782. const node = path.getValue();
  24783. const nodeHasComment = hasComment(node);
  24784. const hasOwnLineComment = hasComment(node, CommentCheckFlags.Line);
  24785. const isOpeningFragment = node.type === "JSXOpeningFragment";
  24786. return [isOpeningFragment ? "<" : "</", indent([hasOwnLineComment ? hardline : nodeHasComment && !isOpeningFragment ? " " : "", printDanglingComments(path, options, true)]), hasOwnLineComment ? hardline : "", ">"];
  24787. }
  24788. function printJsxElement(path, options, print) {
  24789. const elem = printComments(path, printJsxElementInternal(path, options, print), options);
  24790. return maybeWrapJsxElementInParens(path, elem, options);
  24791. }
  24792. function printJsxEmptyExpression(path, options) {
  24793. const node = path.getValue();
  24794. const requiresHardline = hasComment(node, CommentCheckFlags.Line);
  24795. return [printDanglingComments(path, options, !requiresHardline), requiresHardline ? hardline : ""];
  24796. }
  24797. function printJsxSpreadAttribute(path, options, print) {
  24798. const node = path.getValue();
  24799. return ["{", path.call((p) => {
  24800. const printed = ["...", print()];
  24801. const node2 = p.getValue();
  24802. if (!hasComment(node2) || !willPrintOwnComments(p)) {
  24803. return printed;
  24804. }
  24805. return [indent([softline, printComments(p, printed, options)]), softline];
  24806. }, node.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
  24807. }
  24808. function printJsx(path, options, print) {
  24809. const node = path.getValue();
  24810. if (!node.type.startsWith("JSX")) {
  24811. return;
  24812. }
  24813. switch (node.type) {
  24814. case "JSXAttribute":
  24815. return printJsxAttribute(path, options, print);
  24816. case "JSXIdentifier":
  24817. return String(node.name);
  24818. case "JSXNamespacedName":
  24819. return join(":", [print("namespace"), print("name")]);
  24820. case "JSXMemberExpression":
  24821. return join(".", [print("object"), print("property")]);
  24822. case "JSXSpreadAttribute":
  24823. return printJsxSpreadAttribute(path, options, print);
  24824. case "JSXSpreadChild": {
  24825. const printJsxSpreadChild = printJsxSpreadAttribute;
  24826. return printJsxSpreadChild(path, options, print);
  24827. }
  24828. case "JSXExpressionContainer":
  24829. return printJsxExpressionContainer(path, options, print);
  24830. case "JSXFragment":
  24831. case "JSXElement":
  24832. return printJsxElement(path, options, print);
  24833. case "JSXOpeningElement":
  24834. return printJsxOpeningElement(path, options, print);
  24835. case "JSXClosingElement":
  24836. return printJsxClosingElement(path, options, print);
  24837. case "JSXOpeningFragment":
  24838. case "JSXClosingFragment":
  24839. return printJsxOpeningClosingFragment(path, options);
  24840. case "JSXEmptyExpression":
  24841. return printJsxEmptyExpression(path, options);
  24842. case "JSXText":
  24843. throw new Error("JSXTest should be handled by JSXElement");
  24844. default:
  24845. throw new Error(`Unknown JSX node type: ${JSON.stringify(node.type)}.`);
  24846. }
  24847. }
  24848. var jsxWhitespaceChars = " \n\r ";
  24849. var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
  24850. var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
  24851. var trimJsxWhitespace = (text) => text.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
  24852. function isEmptyJsxElement(node) {
  24853. if (node.children.length === 0) {
  24854. return true;
  24855. }
  24856. if (node.children.length > 1) {
  24857. return false;
  24858. }
  24859. const child = node.children[0];
  24860. return isLiteral(child) && !isMeaningfulJsxText(child);
  24861. }
  24862. function isMeaningfulJsxText(node) {
  24863. return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
  24864. }
  24865. function isJsxWhitespaceExpression(node) {
  24866. return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !hasComment(node.expression);
  24867. }
  24868. function hasJsxIgnoreComment(path) {
  24869. const node = path.getValue();
  24870. const parent = path.getParentNode();
  24871. if (!parent || !node || !isJsxNode(node) || !isJsxNode(parent)) {
  24872. return false;
  24873. }
  24874. const index = parent.children.indexOf(node);
  24875. let prevSibling = null;
  24876. for (let i = index; i > 0; i--) {
  24877. const candidate = parent.children[i - 1];
  24878. if (candidate.type === "JSXText" && !isMeaningfulJsxText(candidate)) {
  24879. continue;
  24880. }
  24881. prevSibling = candidate;
  24882. break;
  24883. }
  24884. return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && hasNodeIgnoreComment(prevSibling.expression);
  24885. }
  24886. module2.exports = {
  24887. hasJsxIgnoreComment,
  24888. printJsx
  24889. };
  24890. }
  24891. });
  24892. var require_doc_builders = __commonJS2({
  24893. "src/document/doc-builders.js"(exports2, module2) {
  24894. "use strict";
  24895. function concat(parts) {
  24896. if (false) {
  24897. for (const part of parts) {
  24898. assertDoc(part);
  24899. }
  24900. }
  24901. return {
  24902. type: "concat",
  24903. parts
  24904. };
  24905. }
  24906. function indent(contents) {
  24907. if (false) {
  24908. assertDoc(contents);
  24909. }
  24910. return {
  24911. type: "indent",
  24912. contents
  24913. };
  24914. }
  24915. function align(widthOrString, contents) {
  24916. if (false) {
  24917. assertDoc(contents);
  24918. }
  24919. return {
  24920. type: "align",
  24921. contents,
  24922. n: widthOrString
  24923. };
  24924. }
  24925. function group(contents, opts = {}) {
  24926. if (false) {
  24927. assertDoc(contents);
  24928. }
  24929. return {
  24930. type: "group",
  24931. id: opts.id,
  24932. contents,
  24933. break: Boolean(opts.shouldBreak),
  24934. expandedStates: opts.expandedStates
  24935. };
  24936. }
  24937. function dedentToRoot(contents) {
  24938. return align(Number.NEGATIVE_INFINITY, contents);
  24939. }
  24940. function markAsRoot(contents) {
  24941. return align({
  24942. type: "root"
  24943. }, contents);
  24944. }
  24945. function dedent(contents) {
  24946. return align(-1, contents);
  24947. }
  24948. function conditionalGroup(states, opts) {
  24949. return group(states[0], Object.assign(Object.assign({}, opts), {}, {
  24950. expandedStates: states
  24951. }));
  24952. }
  24953. function fill(parts) {
  24954. if (false) {
  24955. for (const part of parts) {
  24956. assertDoc(part);
  24957. }
  24958. }
  24959. return {
  24960. type: "fill",
  24961. parts
  24962. };
  24963. }
  24964. function ifBreak(breakContents, flatContents, opts = {}) {
  24965. if (false) {
  24966. if (breakContents) {
  24967. assertDoc(breakContents);
  24968. }
  24969. if (flatContents) {
  24970. assertDoc(flatContents);
  24971. }
  24972. }
  24973. return {
  24974. type: "if-break",
  24975. breakContents,
  24976. flatContents,
  24977. groupId: opts.groupId
  24978. };
  24979. }
  24980. function indentIfBreak(contents, opts) {
  24981. return {
  24982. type: "indent-if-break",
  24983. contents,
  24984. groupId: opts.groupId,
  24985. negate: opts.negate
  24986. };
  24987. }
  24988. function lineSuffix(contents) {
  24989. if (false) {
  24990. assertDoc(contents);
  24991. }
  24992. return {
  24993. type: "line-suffix",
  24994. contents
  24995. };
  24996. }
  24997. var lineSuffixBoundary = {
  24998. type: "line-suffix-boundary"
  24999. };
  25000. var breakParent = {
  25001. type: "break-parent"
  25002. };
  25003. var trim = {
  25004. type: "trim"
  25005. };
  25006. var hardlineWithoutBreakParent = {
  25007. type: "line",
  25008. hard: true
  25009. };
  25010. var literallineWithoutBreakParent = {
  25011. type: "line",
  25012. hard: true,
  25013. literal: true
  25014. };
  25015. var line = {
  25016. type: "line"
  25017. };
  25018. var softline = {
  25019. type: "line",
  25020. soft: true
  25021. };
  25022. var hardline = concat([hardlineWithoutBreakParent, breakParent]);
  25023. var literalline = concat([literallineWithoutBreakParent, breakParent]);
  25024. var cursor = {
  25025. type: "cursor",
  25026. placeholder: Symbol("cursor")
  25027. };
  25028. function join(sep, arr) {
  25029. const res = [];
  25030. for (let i = 0; i < arr.length; i++) {
  25031. if (i !== 0) {
  25032. res.push(sep);
  25033. }
  25034. res.push(arr[i]);
  25035. }
  25036. return concat(res);
  25037. }
  25038. function addAlignmentToDoc(doc2, size, tabWidth) {
  25039. let aligned = doc2;
  25040. if (size > 0) {
  25041. for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
  25042. aligned = indent(aligned);
  25043. }
  25044. aligned = align(size % tabWidth, aligned);
  25045. aligned = align(Number.NEGATIVE_INFINITY, aligned);
  25046. }
  25047. return aligned;
  25048. }
  25049. function label(label2, contents) {
  25050. return {
  25051. type: "label",
  25052. label: label2,
  25053. contents
  25054. };
  25055. }
  25056. module2.exports = {
  25057. concat,
  25058. join,
  25059. line,
  25060. softline,
  25061. hardline,
  25062. literalline,
  25063. group,
  25064. conditionalGroup,
  25065. fill,
  25066. lineSuffix,
  25067. lineSuffixBoundary,
  25068. cursor,
  25069. breakParent,
  25070. ifBreak,
  25071. trim,
  25072. indent,
  25073. indentIfBreak,
  25074. align,
  25075. addAlignmentToDoc,
  25076. markAsRoot,
  25077. dedentToRoot,
  25078. dedent,
  25079. hardlineWithoutBreakParent,
  25080. literallineWithoutBreakParent,
  25081. label
  25082. };
  25083. }
  25084. });
  25085. var require_doc_utils = __commonJS2({
  25086. "src/document/doc-utils.js"(exports2, module2) {
  25087. "use strict";
  25088. var getLast = require_get_last();
  25089. var {
  25090. literalline,
  25091. join
  25092. } = require_doc_builders();
  25093. var isConcat = (doc2) => Array.isArray(doc2) || doc2 && doc2.type === "concat";
  25094. var getDocParts = (doc2) => {
  25095. if (Array.isArray(doc2)) {
  25096. return doc2;
  25097. }
  25098. if (doc2.type !== "concat" && doc2.type !== "fill") {
  25099. throw new Error("Expect doc type to be `concat` or `fill`.");
  25100. }
  25101. return doc2.parts;
  25102. };
  25103. var traverseDocOnExitStackMarker = {};
  25104. function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) {
  25105. const docsStack = [doc2];
  25106. while (docsStack.length > 0) {
  25107. const doc3 = docsStack.pop();
  25108. if (doc3 === traverseDocOnExitStackMarker) {
  25109. onExit(docsStack.pop());
  25110. continue;
  25111. }
  25112. if (onExit) {
  25113. docsStack.push(doc3, traverseDocOnExitStackMarker);
  25114. }
  25115. if (!onEnter || onEnter(doc3) !== false) {
  25116. if (isConcat(doc3) || doc3.type === "fill") {
  25117. const parts = getDocParts(doc3);
  25118. for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
  25119. docsStack.push(parts[i]);
  25120. }
  25121. } else if (doc3.type === "if-break") {
  25122. if (doc3.flatContents) {
  25123. docsStack.push(doc3.flatContents);
  25124. }
  25125. if (doc3.breakContents) {
  25126. docsStack.push(doc3.breakContents);
  25127. }
  25128. } else if (doc3.type === "group" && doc3.expandedStates) {
  25129. if (shouldTraverseConditionalGroups) {
  25130. for (let ic = doc3.expandedStates.length, i = ic - 1; i >= 0; --i) {
  25131. docsStack.push(doc3.expandedStates[i]);
  25132. }
  25133. } else {
  25134. docsStack.push(doc3.contents);
  25135. }
  25136. } else if (doc3.contents) {
  25137. docsStack.push(doc3.contents);
  25138. }
  25139. }
  25140. }
  25141. }
  25142. function mapDoc(doc2, cb) {
  25143. const mapped = /* @__PURE__ */ new Map();
  25144. return rec(doc2);
  25145. function rec(doc3) {
  25146. if (mapped.has(doc3)) {
  25147. return mapped.get(doc3);
  25148. }
  25149. const result = process2(doc3);
  25150. mapped.set(doc3, result);
  25151. return result;
  25152. }
  25153. function process2(doc3) {
  25154. if (Array.isArray(doc3)) {
  25155. return cb(doc3.map(rec));
  25156. }
  25157. if (doc3.type === "concat" || doc3.type === "fill") {
  25158. const parts = doc3.parts.map(rec);
  25159. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25160. parts
  25161. }));
  25162. }
  25163. if (doc3.type === "if-break") {
  25164. const breakContents = doc3.breakContents && rec(doc3.breakContents);
  25165. const flatContents = doc3.flatContents && rec(doc3.flatContents);
  25166. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25167. breakContents,
  25168. flatContents
  25169. }));
  25170. }
  25171. if (doc3.type === "group" && doc3.expandedStates) {
  25172. const expandedStates = doc3.expandedStates.map(rec);
  25173. const contents = expandedStates[0];
  25174. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25175. contents,
  25176. expandedStates
  25177. }));
  25178. }
  25179. if (doc3.contents) {
  25180. const contents = rec(doc3.contents);
  25181. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25182. contents
  25183. }));
  25184. }
  25185. return cb(doc3);
  25186. }
  25187. }
  25188. function findInDoc(doc2, fn, defaultValue) {
  25189. let result = defaultValue;
  25190. let hasStopped = false;
  25191. function findInDocOnEnterFn(doc3) {
  25192. const maybeResult = fn(doc3);
  25193. if (maybeResult !== void 0) {
  25194. hasStopped = true;
  25195. result = maybeResult;
  25196. }
  25197. if (hasStopped) {
  25198. return false;
  25199. }
  25200. }
  25201. traverseDoc(doc2, findInDocOnEnterFn);
  25202. return result;
  25203. }
  25204. function willBreakFn(doc2) {
  25205. if (doc2.type === "group" && doc2.break) {
  25206. return true;
  25207. }
  25208. if (doc2.type === "line" && doc2.hard) {
  25209. return true;
  25210. }
  25211. if (doc2.type === "break-parent") {
  25212. return true;
  25213. }
  25214. }
  25215. function willBreak(doc2) {
  25216. return findInDoc(doc2, willBreakFn, false);
  25217. }
  25218. function breakParentGroup(groupStack) {
  25219. if (groupStack.length > 0) {
  25220. const parentGroup = getLast(groupStack);
  25221. if (!parentGroup.expandedStates && !parentGroup.break) {
  25222. parentGroup.break = "propagated";
  25223. }
  25224. }
  25225. return null;
  25226. }
  25227. function propagateBreaks(doc2) {
  25228. const alreadyVisitedSet = /* @__PURE__ */ new Set();
  25229. const groupStack = [];
  25230. function propagateBreaksOnEnterFn(doc3) {
  25231. if (doc3.type === "break-parent") {
  25232. breakParentGroup(groupStack);
  25233. }
  25234. if (doc3.type === "group") {
  25235. groupStack.push(doc3);
  25236. if (alreadyVisitedSet.has(doc3)) {
  25237. return false;
  25238. }
  25239. alreadyVisitedSet.add(doc3);
  25240. }
  25241. }
  25242. function propagateBreaksOnExitFn(doc3) {
  25243. if (doc3.type === "group") {
  25244. const group = groupStack.pop();
  25245. if (group.break) {
  25246. breakParentGroup(groupStack);
  25247. }
  25248. }
  25249. }
  25250. traverseDoc(doc2, propagateBreaksOnEnterFn, propagateBreaksOnExitFn, true);
  25251. }
  25252. function removeLinesFn(doc2) {
  25253. if (doc2.type === "line" && !doc2.hard) {
  25254. return doc2.soft ? "" : " ";
  25255. }
  25256. if (doc2.type === "if-break") {
  25257. return doc2.flatContents || "";
  25258. }
  25259. return doc2;
  25260. }
  25261. function removeLines(doc2) {
  25262. return mapDoc(doc2, removeLinesFn);
  25263. }
  25264. var isHardline = (doc2, nextDoc) => doc2 && doc2.type === "line" && doc2.hard && nextDoc && nextDoc.type === "break-parent";
  25265. function stripDocTrailingHardlineFromDoc(doc2) {
  25266. if (!doc2) {
  25267. return doc2;
  25268. }
  25269. if (isConcat(doc2) || doc2.type === "fill") {
  25270. const parts = getDocParts(doc2);
  25271. while (parts.length > 1 && isHardline(...parts.slice(-2))) {
  25272. parts.length -= 2;
  25273. }
  25274. if (parts.length > 0) {
  25275. const lastPart = stripDocTrailingHardlineFromDoc(getLast(parts));
  25276. parts[parts.length - 1] = lastPart;
  25277. }
  25278. return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
  25279. parts
  25280. });
  25281. }
  25282. switch (doc2.type) {
  25283. case "align":
  25284. case "indent":
  25285. case "indent-if-break":
  25286. case "group":
  25287. case "line-suffix":
  25288. case "label": {
  25289. const contents = stripDocTrailingHardlineFromDoc(doc2.contents);
  25290. return Object.assign(Object.assign({}, doc2), {}, {
  25291. contents
  25292. });
  25293. }
  25294. case "if-break": {
  25295. const breakContents = stripDocTrailingHardlineFromDoc(doc2.breakContents);
  25296. const flatContents = stripDocTrailingHardlineFromDoc(doc2.flatContents);
  25297. return Object.assign(Object.assign({}, doc2), {}, {
  25298. breakContents,
  25299. flatContents
  25300. });
  25301. }
  25302. }
  25303. return doc2;
  25304. }
  25305. function stripTrailingHardline(doc2) {
  25306. return stripDocTrailingHardlineFromDoc(cleanDoc(doc2));
  25307. }
  25308. function cleanDocFn(doc2) {
  25309. switch (doc2.type) {
  25310. case "fill":
  25311. if (doc2.parts.every((part) => part === "")) {
  25312. return "";
  25313. }
  25314. break;
  25315. case "group":
  25316. if (!doc2.contents && !doc2.id && !doc2.break && !doc2.expandedStates) {
  25317. return "";
  25318. }
  25319. if (doc2.contents.type === "group" && doc2.contents.id === doc2.id && doc2.contents.break === doc2.break && doc2.contents.expandedStates === doc2.expandedStates) {
  25320. return doc2.contents;
  25321. }
  25322. break;
  25323. case "align":
  25324. case "indent":
  25325. case "indent-if-break":
  25326. case "line-suffix":
  25327. if (!doc2.contents) {
  25328. return "";
  25329. }
  25330. break;
  25331. case "if-break":
  25332. if (!doc2.flatContents && !doc2.breakContents) {
  25333. return "";
  25334. }
  25335. break;
  25336. }
  25337. if (!isConcat(doc2)) {
  25338. return doc2;
  25339. }
  25340. const parts = [];
  25341. for (const part of getDocParts(doc2)) {
  25342. if (!part) {
  25343. continue;
  25344. }
  25345. const [currentPart, ...restParts] = isConcat(part) ? getDocParts(part) : [part];
  25346. if (typeof currentPart === "string" && typeof getLast(parts) === "string") {
  25347. parts[parts.length - 1] += currentPart;
  25348. } else {
  25349. parts.push(currentPart);
  25350. }
  25351. parts.push(...restParts);
  25352. }
  25353. if (parts.length === 0) {
  25354. return "";
  25355. }
  25356. if (parts.length === 1) {
  25357. return parts[0];
  25358. }
  25359. return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
  25360. parts
  25361. });
  25362. }
  25363. function cleanDoc(doc2) {
  25364. return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
  25365. }
  25366. function normalizeParts(parts) {
  25367. const newParts = [];
  25368. const restParts = parts.filter(Boolean);
  25369. while (restParts.length > 0) {
  25370. const part = restParts.shift();
  25371. if (!part) {
  25372. continue;
  25373. }
  25374. if (isConcat(part)) {
  25375. restParts.unshift(...getDocParts(part));
  25376. continue;
  25377. }
  25378. if (newParts.length > 0 && typeof getLast(newParts) === "string" && typeof part === "string") {
  25379. newParts[newParts.length - 1] += part;
  25380. continue;
  25381. }
  25382. newParts.push(part);
  25383. }
  25384. return newParts;
  25385. }
  25386. function normalizeDoc(doc2) {
  25387. return mapDoc(doc2, (currentDoc) => {
  25388. if (Array.isArray(currentDoc)) {
  25389. return normalizeParts(currentDoc);
  25390. }
  25391. if (!currentDoc.parts) {
  25392. return currentDoc;
  25393. }
  25394. return Object.assign(Object.assign({}, currentDoc), {}, {
  25395. parts: normalizeParts(currentDoc.parts)
  25396. });
  25397. });
  25398. }
  25399. function replaceEndOfLine(doc2) {
  25400. return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" && currentDoc.includes("\n") ? replaceTextEndOfLine(currentDoc) : currentDoc);
  25401. }
  25402. function replaceTextEndOfLine(text, replacement = literalline) {
  25403. return join(replacement, text.split("\n")).parts;
  25404. }
  25405. function canBreakFn(doc2) {
  25406. if (doc2.type === "line") {
  25407. return true;
  25408. }
  25409. }
  25410. function canBreak(doc2) {
  25411. return findInDoc(doc2, canBreakFn, false);
  25412. }
  25413. module2.exports = {
  25414. isConcat,
  25415. getDocParts,
  25416. willBreak,
  25417. traverseDoc,
  25418. findInDoc,
  25419. mapDoc,
  25420. propagateBreaks,
  25421. removeLines,
  25422. stripTrailingHardline,
  25423. normalizeParts,
  25424. normalizeDoc,
  25425. cleanDoc,
  25426. replaceTextEndOfLine,
  25427. replaceEndOfLine,
  25428. canBreak
  25429. };
  25430. }
  25431. });
  25432. var require_misc = __commonJS2({
  25433. "src/language-js/print/misc.js"(exports2, module2) {
  25434. "use strict";
  25435. var {
  25436. isNonEmptyArray
  25437. } = require_util();
  25438. var {
  25439. builders: {
  25440. indent,
  25441. join,
  25442. line
  25443. }
  25444. } = require("./doc.js");
  25445. var {
  25446. isFlowAnnotationComment
  25447. } = require_utils7();
  25448. function printOptionalToken(path) {
  25449. const node = path.getValue();
  25450. if (!node.optional || node.type === "Identifier" && node === path.getParentNode().key) {
  25451. return "";
  25452. }
  25453. if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
  25454. return "?.";
  25455. }
  25456. return "?";
  25457. }
  25458. function printDefiniteToken(path) {
  25459. return path.getValue().definite || path.match(void 0, (node, name) => name === "id" && node.type === "VariableDeclarator" && node.definite) ? "!" : "";
  25460. }
  25461. function printFunctionTypeParameters(path, options, print) {
  25462. const fun = path.getValue();
  25463. if (fun.typeArguments) {
  25464. return print("typeArguments");
  25465. }
  25466. if (fun.typeParameters) {
  25467. return print("typeParameters");
  25468. }
  25469. return "";
  25470. }
  25471. function printTypeAnnotation(path, options, print) {
  25472. const node = path.getValue();
  25473. if (!node.typeAnnotation) {
  25474. return "";
  25475. }
  25476. const parentNode = path.getParentNode();
  25477. const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
  25478. if (isFlowAnnotationComment(options.originalText, node.typeAnnotation)) {
  25479. return [" /*: ", print("typeAnnotation"), " */"];
  25480. }
  25481. return [isFunctionDeclarationIdentifier ? "" : ": ", print("typeAnnotation")];
  25482. }
  25483. function printBindExpressionCallee(path, options, print) {
  25484. return ["::", print("callee")];
  25485. }
  25486. function printTypeScriptModifiers(path, options, print) {
  25487. const node = path.getValue();
  25488. if (!isNonEmptyArray(node.modifiers)) {
  25489. return "";
  25490. }
  25491. return [join(" ", path.map(print, "modifiers")), " "];
  25492. }
  25493. function adjustClause(node, clause, forceSpace) {
  25494. if (node.type === "EmptyStatement") {
  25495. return ";";
  25496. }
  25497. if (node.type === "BlockStatement" || forceSpace) {
  25498. return [" ", clause];
  25499. }
  25500. return indent([line, clause]);
  25501. }
  25502. function printRestSpread(path, options, print) {
  25503. return ["...", print("argument"), printTypeAnnotation(path, options, print)];
  25504. }
  25505. module2.exports = {
  25506. printOptionalToken,
  25507. printDefiniteToken,
  25508. printFunctionTypeParameters,
  25509. printBindExpressionCallee,
  25510. printTypeScriptModifiers,
  25511. printTypeAnnotation,
  25512. printRestSpread,
  25513. adjustClause
  25514. };
  25515. }
  25516. });
  25517. var require_array4 = __commonJS2({
  25518. "src/language-js/print/array.js"(exports2, module2) {
  25519. "use strict";
  25520. var {
  25521. printDanglingComments
  25522. } = require_comments();
  25523. var {
  25524. builders: {
  25525. line,
  25526. softline,
  25527. hardline,
  25528. group,
  25529. indent,
  25530. ifBreak,
  25531. fill
  25532. }
  25533. } = require("./doc.js");
  25534. var {
  25535. getLast,
  25536. hasNewline
  25537. } = require_util();
  25538. var {
  25539. shouldPrintComma,
  25540. hasComment,
  25541. CommentCheckFlags,
  25542. isNextLineEmpty,
  25543. isNumericLiteral,
  25544. isSignedNumericLiteral
  25545. } = require_utils7();
  25546. var {
  25547. locStart
  25548. } = require_loc();
  25549. var {
  25550. printOptionalToken,
  25551. printTypeAnnotation
  25552. } = require_misc();
  25553. function printArray(path, options, print) {
  25554. const node = path.getValue();
  25555. const parts = [];
  25556. const openBracket = node.type === "TupleExpression" ? "#[" : "[";
  25557. const closeBracket = "]";
  25558. if (node.elements.length === 0) {
  25559. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  25560. parts.push(openBracket, closeBracket);
  25561. } else {
  25562. parts.push(group([openBracket, printDanglingComments(path, options), softline, closeBracket]));
  25563. }
  25564. } else {
  25565. const lastElem = getLast(node.elements);
  25566. const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement");
  25567. const needsForcedTrailingComma = lastElem === null;
  25568. const groupId = Symbol("array");
  25569. const shouldBreak = !options.__inJestEach && node.elements.length > 1 && node.elements.every((element, i, elements) => {
  25570. const elementType = element && element.type;
  25571. if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
  25572. return false;
  25573. }
  25574. const nextElement = elements[i + 1];
  25575. if (nextElement && elementType !== nextElement.type) {
  25576. return false;
  25577. }
  25578. const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
  25579. return element[itemsKey] && element[itemsKey].length > 1;
  25580. });
  25581. const shouldUseConciseFormatting = isConciselyPrintedArray(node, options);
  25582. const trailingComma = !canHaveTrailingComma ? "" : needsForcedTrailingComma ? "," : !shouldPrintComma(options) ? "" : shouldUseConciseFormatting ? ifBreak(",", "", {
  25583. groupId
  25584. }) : ifBreak(",");
  25585. parts.push(group([openBracket, indent([softline, shouldUseConciseFormatting ? printArrayItemsConcisely(path, options, print, trailingComma) : [printArrayItems(path, options, "elements", print), trailingComma], printDanglingComments(path, options, true)]), softline, closeBracket], {
  25586. shouldBreak,
  25587. id: groupId
  25588. }));
  25589. }
  25590. parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
  25591. return parts;
  25592. }
  25593. function isConciselyPrintedArray(node, options) {
  25594. return node.elements.length > 1 && node.elements.every((element) => element && (isNumericLiteral(element) || isSignedNumericLiteral(element) && !hasComment(element.argument)) && !hasComment(element, CommentCheckFlags.Trailing | CommentCheckFlags.Line, (comment) => !hasNewline(options.originalText, locStart(comment), {
  25595. backwards: true
  25596. })));
  25597. }
  25598. function printArrayItems(path, options, printPath, print) {
  25599. const printedElements = [];
  25600. let separatorParts = [];
  25601. path.each((childPath) => {
  25602. printedElements.push(separatorParts, group(print()));
  25603. separatorParts = [",", line];
  25604. if (childPath.getValue() && isNextLineEmpty(childPath.getValue(), options)) {
  25605. separatorParts.push(softline);
  25606. }
  25607. }, printPath);
  25608. return printedElements;
  25609. }
  25610. function printArrayItemsConcisely(path, options, print, trailingComma) {
  25611. const parts = [];
  25612. path.each((childPath, i, elements) => {
  25613. const isLast = i === elements.length - 1;
  25614. parts.push([print(), isLast ? trailingComma : ","]);
  25615. if (!isLast) {
  25616. parts.push(isNextLineEmpty(childPath.getValue(), options) ? [hardline, hardline] : hasComment(elements[i + 1], CommentCheckFlags.Leading | CommentCheckFlags.Line) ? hardline : line);
  25617. }
  25618. }, "elements");
  25619. return fill(parts);
  25620. }
  25621. module2.exports = {
  25622. printArray,
  25623. printArrayItems,
  25624. isConciselyPrintedArray
  25625. };
  25626. }
  25627. });
  25628. var require_call_arguments = __commonJS2({
  25629. "src/language-js/print/call-arguments.js"(exports2, module2) {
  25630. "use strict";
  25631. var {
  25632. printDanglingComments
  25633. } = require_comments();
  25634. var {
  25635. getLast,
  25636. getPenultimate
  25637. } = require_util();
  25638. var {
  25639. getFunctionParameters,
  25640. hasComment,
  25641. CommentCheckFlags,
  25642. isFunctionCompositionArgs,
  25643. isJsxNode,
  25644. isLongCurriedCallExpression,
  25645. shouldPrintComma,
  25646. getCallArguments,
  25647. iterateCallArgumentsPath,
  25648. isNextLineEmpty,
  25649. isCallExpression,
  25650. isStringLiteral,
  25651. isObjectProperty,
  25652. isTSTypeExpression
  25653. } = require_utils7();
  25654. var {
  25655. builders: {
  25656. line,
  25657. hardline,
  25658. softline,
  25659. group,
  25660. indent,
  25661. conditionalGroup,
  25662. ifBreak,
  25663. breakParent
  25664. },
  25665. utils: {
  25666. willBreak
  25667. }
  25668. } = require("./doc.js");
  25669. var {
  25670. ArgExpansionBailout
  25671. } = require_errors();
  25672. var {
  25673. isConciselyPrintedArray
  25674. } = require_array4();
  25675. function printCallArguments(path, options, print) {
  25676. const node = path.getValue();
  25677. const isDynamicImport = node.type === "ImportExpression";
  25678. const args = getCallArguments(node);
  25679. if (args.length === 0) {
  25680. return ["(", printDanglingComments(path, options, true), ")"];
  25681. }
  25682. if (isReactHookCallWithDepsArray(args)) {
  25683. return ["(", print(["arguments", 0]), ", ", print(["arguments", 1]), ")"];
  25684. }
  25685. let anyArgEmptyLine = false;
  25686. let hasEmptyLineFollowingFirstArg = false;
  25687. const lastArgIndex = args.length - 1;
  25688. const printedArguments = [];
  25689. iterateCallArgumentsPath(path, (argPath, index) => {
  25690. const arg = argPath.getNode();
  25691. const parts = [print()];
  25692. if (index === lastArgIndex) {
  25693. } else if (isNextLineEmpty(arg, options)) {
  25694. if (index === 0) {
  25695. hasEmptyLineFollowingFirstArg = true;
  25696. }
  25697. anyArgEmptyLine = true;
  25698. parts.push(",", hardline, hardline);
  25699. } else {
  25700. parts.push(",", line);
  25701. }
  25702. printedArguments.push(parts);
  25703. });
  25704. const maybeTrailingComma = !(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : "";
  25705. function allArgsBrokenOut() {
  25706. return group(["(", indent([line, ...printedArguments]), maybeTrailingComma, line, ")"], {
  25707. shouldBreak: true
  25708. });
  25709. }
  25710. if (anyArgEmptyLine || path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs(args)) {
  25711. return allArgsBrokenOut();
  25712. }
  25713. const shouldGroupFirst = shouldGroupFirstArg(args);
  25714. const shouldGroupLast = shouldGroupLastArg(args, options);
  25715. if (shouldGroupFirst || shouldGroupLast) {
  25716. if (shouldGroupFirst ? printedArguments.slice(1).some(willBreak) : printedArguments.slice(0, -1).some(willBreak)) {
  25717. return allArgsBrokenOut();
  25718. }
  25719. let printedExpanded = [];
  25720. try {
  25721. path.try(() => {
  25722. iterateCallArgumentsPath(path, (argPath, i) => {
  25723. if (shouldGroupFirst && i === 0) {
  25724. printedExpanded = [[print([], {
  25725. expandFirstArg: true
  25726. }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline : line, hasEmptyLineFollowingFirstArg ? hardline : ""], ...printedArguments.slice(1)];
  25727. }
  25728. if (shouldGroupLast && i === lastArgIndex) {
  25729. printedExpanded = [...printedArguments.slice(0, -1), print([], {
  25730. expandLastArg: true
  25731. })];
  25732. }
  25733. });
  25734. });
  25735. } catch (caught) {
  25736. if (caught instanceof ArgExpansionBailout) {
  25737. return allArgsBrokenOut();
  25738. }
  25739. throw caught;
  25740. }
  25741. return [printedArguments.some(willBreak) ? breakParent : "", conditionalGroup([["(", ...printedExpanded, ")"], shouldGroupFirst ? ["(", group(printedExpanded[0], {
  25742. shouldBreak: true
  25743. }), ...printedExpanded.slice(1), ")"] : ["(", ...printedArguments.slice(0, -1), group(getLast(printedExpanded), {
  25744. shouldBreak: true
  25745. }), ")"], allArgsBrokenOut()])];
  25746. }
  25747. const contents = ["(", indent([softline, ...printedArguments]), ifBreak(maybeTrailingComma), softline, ")"];
  25748. if (isLongCurriedCallExpression(path)) {
  25749. return contents;
  25750. }
  25751. return group(contents, {
  25752. shouldBreak: printedArguments.some(willBreak) || anyArgEmptyLine
  25753. });
  25754. }
  25755. function couldGroupArg(arg, arrowChainRecursion = false) {
  25756. return arg.type === "ObjectExpression" && (arg.properties.length > 0 || hasComment(arg)) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || hasComment(arg)) || arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression) || isTSTypeExpression(arg) && couldGroupArg(arg.expression) || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && (!arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference" || isNonEmptyBlockStatement(arg.body)) && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" && couldGroupArg(arg.body, true) || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || !arrowChainRecursion && (isCallExpression(arg.body) || arg.body.type === "ConditionalExpression") || isJsxNode(arg.body)) || arg.type === "DoExpression" || arg.type === "ModuleExpression";
  25757. }
  25758. function shouldGroupLastArg(args, options) {
  25759. const lastArg = getLast(args);
  25760. const penultimateArg = getPenultimate(args);
  25761. return !hasComment(lastArg, CommentCheckFlags.Leading) && !hasComment(lastArg, CommentCheckFlags.Trailing) && couldGroupArg(lastArg) && (!penultimateArg || penultimateArg.type !== lastArg.type) && (args.length !== 2 || penultimateArg.type !== "ArrowFunctionExpression" || lastArg.type !== "ArrayExpression") && !(args.length > 1 && lastArg.type === "ArrayExpression" && isConciselyPrintedArray(lastArg, options));
  25762. }
  25763. function shouldGroupFirstArg(args) {
  25764. if (args.length !== 2) {
  25765. return false;
  25766. }
  25767. const [firstArg, secondArg] = args;
  25768. if (firstArg.type === "ModuleExpression" && isTypeModuleObjectExpression(secondArg)) {
  25769. return true;
  25770. }
  25771. return !hasComment(firstArg) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
  25772. }
  25773. function isReactHookCallWithDepsArray(args) {
  25774. return args.length === 2 && args[0].type === "ArrowFunctionExpression" && getFunctionParameters(args[0]).length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.some((arg) => hasComment(arg));
  25775. }
  25776. function isNonEmptyBlockStatement(node) {
  25777. return node.type === "BlockStatement" && (node.body.some((node2) => node2.type !== "EmptyStatement") || hasComment(node, CommentCheckFlags.Dangling));
  25778. }
  25779. function isTypeModuleObjectExpression(node) {
  25780. return node.type === "ObjectExpression" && node.properties.length === 1 && isObjectProperty(node.properties[0]) && node.properties[0].key.type === "Identifier" && node.properties[0].key.name === "type" && isStringLiteral(node.properties[0].value) && node.properties[0].value.value === "module";
  25781. }
  25782. module2.exports = printCallArguments;
  25783. }
  25784. });
  25785. var require_member = __commonJS2({
  25786. "src/language-js/print/member.js"(exports2, module2) {
  25787. "use strict";
  25788. var {
  25789. builders: {
  25790. softline,
  25791. group,
  25792. indent,
  25793. label
  25794. }
  25795. } = require("./doc.js");
  25796. var {
  25797. isNumericLiteral,
  25798. isMemberExpression,
  25799. isCallExpression
  25800. } = require_utils7();
  25801. var {
  25802. printOptionalToken
  25803. } = require_misc();
  25804. function printMemberExpression(path, options, print) {
  25805. const node = path.getValue();
  25806. const parent = path.getParentNode();
  25807. let firstNonMemberParent;
  25808. let i = 0;
  25809. do {
  25810. firstNonMemberParent = path.getParentNode(i);
  25811. i++;
  25812. } while (firstNonMemberParent && (isMemberExpression(firstNonMemberParent) || firstNonMemberParent.type === "TSNonNullExpression"));
  25813. const objectDoc = print("object");
  25814. const lookupDoc = printMemberLookup(path, options, print);
  25815. const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || node.computed || node.object.type === "Identifier" && node.property.type === "Identifier" && !isMemberExpression(parent) || (parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator") && (isCallExpression(node.object) && node.object.arguments.length > 0 || node.object.type === "TSNonNullExpression" && isCallExpression(node.object.expression) && node.object.expression.arguments.length > 0 || objectDoc.label === "member-chain");
  25816. return label(objectDoc.label === "member-chain" ? "member-chain" : "member", [objectDoc, shouldInline ? lookupDoc : group(indent([softline, lookupDoc]))]);
  25817. }
  25818. function printMemberLookup(path, options, print) {
  25819. const property = print("property");
  25820. const node = path.getValue();
  25821. const optional = printOptionalToken(path);
  25822. if (!node.computed) {
  25823. return [optional, ".", property];
  25824. }
  25825. if (!node.property || isNumericLiteral(node.property)) {
  25826. return [optional, "[", property, "]"];
  25827. }
  25828. return group([optional, "[", indent([softline, property]), softline, "]"]);
  25829. }
  25830. module2.exports = {
  25831. printMemberExpression,
  25832. printMemberLookup
  25833. };
  25834. }
  25835. });
  25836. var require_member_chain = __commonJS2({
  25837. "src/language-js/print/member-chain.js"(exports2, module2) {
  25838. "use strict";
  25839. var {
  25840. printComments
  25841. } = require_comments();
  25842. var {
  25843. getLast,
  25844. isNextLineEmptyAfterIndex,
  25845. getNextNonSpaceNonCommentCharacterIndex
  25846. } = require_util();
  25847. var pathNeedsParens = require_needs_parens();
  25848. var {
  25849. isCallExpression,
  25850. isMemberExpression,
  25851. isFunctionOrArrowExpression,
  25852. isLongCurriedCallExpression,
  25853. isMemberish,
  25854. isNumericLiteral,
  25855. isSimpleCallArgument,
  25856. hasComment,
  25857. CommentCheckFlags,
  25858. isNextLineEmpty
  25859. } = require_utils7();
  25860. var {
  25861. locEnd
  25862. } = require_loc();
  25863. var {
  25864. builders: {
  25865. join,
  25866. hardline,
  25867. group,
  25868. indent,
  25869. conditionalGroup,
  25870. breakParent,
  25871. label
  25872. },
  25873. utils: {
  25874. willBreak
  25875. }
  25876. } = require("./doc.js");
  25877. var printCallArguments = require_call_arguments();
  25878. var {
  25879. printMemberLookup
  25880. } = require_member();
  25881. var {
  25882. printOptionalToken,
  25883. printFunctionTypeParameters,
  25884. printBindExpressionCallee
  25885. } = require_misc();
  25886. function printMemberChain(path, options, print) {
  25887. const parent = path.getParentNode();
  25888. const isExpressionStatement = !parent || parent.type === "ExpressionStatement";
  25889. const printedNodes = [];
  25890. function shouldInsertEmptyLineAfter(node2) {
  25891. const {
  25892. originalText
  25893. } = options;
  25894. const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex(originalText, node2, locEnd);
  25895. const nextChar = originalText.charAt(nextCharIndex);
  25896. if (nextChar === ")") {
  25897. return nextCharIndex !== false && isNextLineEmptyAfterIndex(originalText, nextCharIndex + 1);
  25898. }
  25899. return isNextLineEmpty(node2, options);
  25900. }
  25901. function rec(path2) {
  25902. const node2 = path2.getValue();
  25903. if (isCallExpression(node2) && (isMemberish(node2.callee) || isCallExpression(node2.callee))) {
  25904. printedNodes.unshift({
  25905. node: node2,
  25906. printed: [printComments(path2, [printOptionalToken(path2), printFunctionTypeParameters(path2, options, print), printCallArguments(path2, options, print)], options), shouldInsertEmptyLineAfter(node2) ? hardline : ""]
  25907. });
  25908. path2.call((callee) => rec(callee), "callee");
  25909. } else if (isMemberish(node2)) {
  25910. printedNodes.unshift({
  25911. node: node2,
  25912. needsParens: pathNeedsParens(path2, options),
  25913. printed: printComments(path2, isMemberExpression(node2) ? printMemberLookup(path2, options, print) : printBindExpressionCallee(path2, options, print), options)
  25914. });
  25915. path2.call((object) => rec(object), "object");
  25916. } else if (node2.type === "TSNonNullExpression") {
  25917. printedNodes.unshift({
  25918. node: node2,
  25919. printed: printComments(path2, "!", options)
  25920. });
  25921. path2.call((expression) => rec(expression), "expression");
  25922. } else {
  25923. printedNodes.unshift({
  25924. node: node2,
  25925. printed: print()
  25926. });
  25927. }
  25928. }
  25929. const node = path.getValue();
  25930. printedNodes.unshift({
  25931. node,
  25932. printed: [printOptionalToken(path), printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)]
  25933. });
  25934. if (node.callee) {
  25935. path.call((callee) => rec(callee), "callee");
  25936. }
  25937. const groups = [];
  25938. let currentGroup = [printedNodes[0]];
  25939. let i = 1;
  25940. for (; i < printedNodes.length; ++i) {
  25941. if (printedNodes[i].node.type === "TSNonNullExpression" || isCallExpression(printedNodes[i].node) || isMemberExpression(printedNodes[i].node) && printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  25942. currentGroup.push(printedNodes[i]);
  25943. } else {
  25944. break;
  25945. }
  25946. }
  25947. if (!isCallExpression(printedNodes[0].node)) {
  25948. for (; i + 1 < printedNodes.length; ++i) {
  25949. if (isMemberish(printedNodes[i].node) && isMemberish(printedNodes[i + 1].node)) {
  25950. currentGroup.push(printedNodes[i]);
  25951. } else {
  25952. break;
  25953. }
  25954. }
  25955. }
  25956. groups.push(currentGroup);
  25957. currentGroup = [];
  25958. let hasSeenCallExpression = false;
  25959. for (; i < printedNodes.length; ++i) {
  25960. if (hasSeenCallExpression && isMemberish(printedNodes[i].node)) {
  25961. if (printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  25962. currentGroup.push(printedNodes[i]);
  25963. continue;
  25964. }
  25965. groups.push(currentGroup);
  25966. currentGroup = [];
  25967. hasSeenCallExpression = false;
  25968. }
  25969. if (isCallExpression(printedNodes[i].node) || printedNodes[i].node.type === "ImportExpression") {
  25970. hasSeenCallExpression = true;
  25971. }
  25972. currentGroup.push(printedNodes[i]);
  25973. if (hasComment(printedNodes[i].node, CommentCheckFlags.Trailing)) {
  25974. groups.push(currentGroup);
  25975. currentGroup = [];
  25976. hasSeenCallExpression = false;
  25977. }
  25978. }
  25979. if (currentGroup.length > 0) {
  25980. groups.push(currentGroup);
  25981. }
  25982. function isFactory(name) {
  25983. return /^[A-Z]|^[$_]+$/.test(name);
  25984. }
  25985. function isShort(name) {
  25986. return name.length <= options.tabWidth;
  25987. }
  25988. function shouldNotWrap(groups2) {
  25989. const hasComputed = groups2[1].length > 0 && groups2[1][0].node.computed;
  25990. if (groups2[0].length === 1) {
  25991. const firstNode = groups2[0][0].node;
  25992. return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpressionStatement && isShort(firstNode.name) || hasComputed);
  25993. }
  25994. const lastNode = getLast(groups2[0]).node;
  25995. return isMemberExpression(lastNode) && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
  25996. }
  25997. const shouldMerge = groups.length >= 2 && !hasComment(groups[1][0].node) && shouldNotWrap(groups);
  25998. function printGroup(printedGroup) {
  25999. const printed = printedGroup.map((tuple) => tuple.printed);
  26000. if (printedGroup.length > 0 && getLast(printedGroup).needsParens) {
  26001. return ["(", ...printed, ")"];
  26002. }
  26003. return printed;
  26004. }
  26005. function printIndentedGroup(groups2) {
  26006. if (groups2.length === 0) {
  26007. return "";
  26008. }
  26009. return indent(group([hardline, join(hardline, groups2.map(printGroup))]));
  26010. }
  26011. const printedGroups = groups.map(printGroup);
  26012. const oneLine = printedGroups;
  26013. const cutoff = shouldMerge ? 3 : 2;
  26014. const flatGroups = groups.flat();
  26015. const nodeHasComment = flatGroups.slice(1, -1).some((node2) => hasComment(node2.node, CommentCheckFlags.Leading)) || flatGroups.slice(0, -1).some((node2) => hasComment(node2.node, CommentCheckFlags.Trailing)) || groups[cutoff] && hasComment(groups[cutoff][0].node, CommentCheckFlags.Leading);
  26016. if (groups.length <= cutoff && !nodeHasComment) {
  26017. if (isLongCurriedCallExpression(path)) {
  26018. return oneLine;
  26019. }
  26020. return group(oneLine);
  26021. }
  26022. const lastNodeBeforeIndent = getLast(groups[shouldMerge ? 1 : 0]).node;
  26023. const shouldHaveEmptyLineBeforeIndent = !isCallExpression(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
  26024. const expanded = [printGroup(groups[0]), shouldMerge ? groups.slice(1, 2).map(printGroup) : "", shouldHaveEmptyLineBeforeIndent ? hardline : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))];
  26025. const callExpressions = printedNodes.map(({
  26026. node: node2
  26027. }) => node2).filter(isCallExpression);
  26028. function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
  26029. const lastGroupNode = getLast(getLast(groups)).node;
  26030. const lastGroupDoc = getLast(printedGroups);
  26031. return isCallExpression(lastGroupNode) && willBreak(lastGroupDoc) && callExpressions.slice(0, -1).some((node2) => node2.arguments.some(isFunctionOrArrowExpression));
  26032. }
  26033. let result;
  26034. if (nodeHasComment || callExpressions.length > 2 && callExpressions.some((expr) => !expr.arguments.every((arg) => isSimpleCallArgument(arg, 0))) || printedGroups.slice(0, -1).some(willBreak) || lastGroupWillBreakAndOtherCallsHaveFunctionArguments()) {
  26035. result = group(expanded);
  26036. } else {
  26037. result = [willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", conditionalGroup([oneLine, expanded])];
  26038. }
  26039. return label("member-chain", result);
  26040. }
  26041. module2.exports = printMemberChain;
  26042. }
  26043. });
  26044. var require_call_expression = __commonJS2({
  26045. "src/language-js/print/call-expression.js"(exports2, module2) {
  26046. "use strict";
  26047. var {
  26048. builders: {
  26049. join,
  26050. group
  26051. }
  26052. } = require("./doc.js");
  26053. var pathNeedsParens = require_needs_parens();
  26054. var {
  26055. getCallArguments,
  26056. hasFlowAnnotationComment,
  26057. isCallExpression,
  26058. isMemberish,
  26059. isStringLiteral,
  26060. isTemplateOnItsOwnLine,
  26061. isTestCall,
  26062. iterateCallArgumentsPath
  26063. } = require_utils7();
  26064. var printMemberChain = require_member_chain();
  26065. var printCallArguments = require_call_arguments();
  26066. var {
  26067. printOptionalToken,
  26068. printFunctionTypeParameters
  26069. } = require_misc();
  26070. function printCallExpression(path, options, print) {
  26071. const node = path.getValue();
  26072. const parentNode = path.getParentNode();
  26073. const isNew = node.type === "NewExpression";
  26074. const isDynamicImport = node.type === "ImportExpression";
  26075. const optional = printOptionalToken(path);
  26076. const args = getCallArguments(node);
  26077. if (args.length > 0 && (!isDynamicImport && !isNew && isCommonsJsOrAmdCall(node, parentNode) || args.length === 1 && isTemplateOnItsOwnLine(args[0], options.originalText) || !isNew && isTestCall(node, parentNode))) {
  26078. const printed = [];
  26079. iterateCallArgumentsPath(path, () => {
  26080. printed.push(print());
  26081. });
  26082. return [isNew ? "new " : "", print("callee"), optional, printFunctionTypeParameters(path, options, print), "(", join(", ", printed), ")"];
  26083. }
  26084. const isIdentifierWithFlowAnnotation = (options.parser === "babel" || options.parser === "babel-flow") && node.callee && node.callee.type === "Identifier" && hasFlowAnnotationComment(node.callee.trailingComments);
  26085. if (isIdentifierWithFlowAnnotation) {
  26086. node.callee.trailingComments[0].printed = true;
  26087. }
  26088. if (!isDynamicImport && !isNew && isMemberish(node.callee) && !path.call((path2) => pathNeedsParens(path2, options), "callee")) {
  26089. return printMemberChain(path, options, print);
  26090. }
  26091. const contents = [isNew ? "new " : "", isDynamicImport ? "import" : print("callee"), optional, isIdentifierWithFlowAnnotation ? `/*:: ${node.callee.trailingComments[0].value.slice(2).trim()} */` : "", printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)];
  26092. if (isDynamicImport || isCallExpression(node.callee)) {
  26093. return group(contents);
  26094. }
  26095. return contents;
  26096. }
  26097. function isCommonsJsOrAmdCall(node, parentNode) {
  26098. if (node.callee.type !== "Identifier") {
  26099. return false;
  26100. }
  26101. if (node.callee.name === "require") {
  26102. return true;
  26103. }
  26104. if (node.callee.name === "define") {
  26105. const args = getCallArguments(node);
  26106. return parentNode.type === "ExpressionStatement" && (args.length === 1 || args.length === 2 && args[0].type === "ArrayExpression" || args.length === 3 && isStringLiteral(args[0]) && args[1].type === "ArrayExpression");
  26107. }
  26108. return false;
  26109. }
  26110. module2.exports = {
  26111. printCallExpression
  26112. };
  26113. }
  26114. });
  26115. var require_assignment = __commonJS2({
  26116. "src/language-js/print/assignment.js"(exports2, module2) {
  26117. "use strict";
  26118. var {
  26119. isNonEmptyArray,
  26120. getStringWidth
  26121. } = require_util();
  26122. var {
  26123. builders: {
  26124. line,
  26125. group,
  26126. indent,
  26127. indentIfBreak,
  26128. lineSuffixBoundary
  26129. },
  26130. utils: {
  26131. cleanDoc,
  26132. willBreak,
  26133. canBreak
  26134. }
  26135. } = require("./doc.js");
  26136. var {
  26137. hasLeadingOwnLineComment,
  26138. isBinaryish,
  26139. isStringLiteral,
  26140. isLiteral,
  26141. isNumericLiteral,
  26142. isCallExpression,
  26143. isMemberExpression,
  26144. getCallArguments,
  26145. rawText,
  26146. hasComment,
  26147. isSignedNumericLiteral,
  26148. isObjectProperty
  26149. } = require_utils7();
  26150. var {
  26151. shouldInlineLogicalExpression
  26152. } = require_binaryish();
  26153. var {
  26154. printCallExpression
  26155. } = require_call_expression();
  26156. function printAssignment(path, options, print, leftDoc, operator, rightPropertyName) {
  26157. const layout = chooseLayout(path, options, print, leftDoc, rightPropertyName);
  26158. const rightDoc = print(rightPropertyName, {
  26159. assignmentLayout: layout
  26160. });
  26161. switch (layout) {
  26162. case "break-after-operator":
  26163. return group([group(leftDoc), operator, group(indent([line, rightDoc]))]);
  26164. case "never-break-after-operator":
  26165. return group([group(leftDoc), operator, " ", rightDoc]);
  26166. case "fluid": {
  26167. const groupId = Symbol("assignment");
  26168. return group([group(leftDoc), operator, group(indent(line), {
  26169. id: groupId
  26170. }), lineSuffixBoundary, indentIfBreak(rightDoc, {
  26171. groupId
  26172. })]);
  26173. }
  26174. case "break-lhs":
  26175. return group([leftDoc, operator, " ", group(rightDoc)]);
  26176. case "chain":
  26177. return [group(leftDoc), operator, line, rightDoc];
  26178. case "chain-tail":
  26179. return [group(leftDoc), operator, indent([line, rightDoc])];
  26180. case "chain-tail-arrow-chain":
  26181. return [group(leftDoc), operator, rightDoc];
  26182. case "only-left":
  26183. return leftDoc;
  26184. }
  26185. }
  26186. function printAssignmentExpression(path, options, print) {
  26187. const node = path.getValue();
  26188. return printAssignment(path, options, print, print("left"), [" ", node.operator], "right");
  26189. }
  26190. function printVariableDeclarator(path, options, print) {
  26191. return printAssignment(path, options, print, print("id"), " =", "init");
  26192. }
  26193. function chooseLayout(path, options, print, leftDoc, rightPropertyName) {
  26194. const node = path.getValue();
  26195. const rightNode = node[rightPropertyName];
  26196. if (!rightNode) {
  26197. return "only-left";
  26198. }
  26199. const isTail = !isAssignment(rightNode);
  26200. const shouldUseChainFormatting = path.match(isAssignment, isAssignmentOrVariableDeclarator, (node2) => !isTail || node2.type !== "ExpressionStatement" && node2.type !== "VariableDeclaration");
  26201. if (shouldUseChainFormatting) {
  26202. return !isTail ? "chain" : rightNode.type === "ArrowFunctionExpression" && rightNode.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail";
  26203. }
  26204. const isHeadOfLongChain = !isTail && isAssignment(rightNode.right);
  26205. if (isHeadOfLongChain || hasLeadingOwnLineComment(options.originalText, rightNode)) {
  26206. return "break-after-operator";
  26207. }
  26208. if (rightNode.type === "CallExpression" && rightNode.callee.name === "require" || options.parser === "json5" || options.parser === "json") {
  26209. return "never-break-after-operator";
  26210. }
  26211. if (isComplexDestructuring(node) || isComplexTypeAliasParams(node) || hasComplexTypeAnnotation(node) || isArrowFunctionVariableDeclarator(node) && canBreak(leftDoc)) {
  26212. return "break-lhs";
  26213. }
  26214. const hasShortKey = isObjectPropertyWithShortKey(node, leftDoc, options);
  26215. if (path.call(() => shouldBreakAfterOperator(path, options, print, hasShortKey), rightPropertyName)) {
  26216. return "break-after-operator";
  26217. }
  26218. if (hasShortKey || rightNode.type === "TemplateLiteral" || rightNode.type === "TaggedTemplateExpression" || rightNode.type === "BooleanLiteral" || isNumericLiteral(rightNode) || rightNode.type === "ClassExpression") {
  26219. return "never-break-after-operator";
  26220. }
  26221. return "fluid";
  26222. }
  26223. function shouldBreakAfterOperator(path, options, print, hasShortKey) {
  26224. const rightNode = path.getValue();
  26225. if (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
  26226. return true;
  26227. }
  26228. switch (rightNode.type) {
  26229. case "StringLiteralTypeAnnotation":
  26230. case "SequenceExpression":
  26231. return true;
  26232. case "ConditionalExpression": {
  26233. const {
  26234. test
  26235. } = rightNode;
  26236. return isBinaryish(test) && !shouldInlineLogicalExpression(test);
  26237. }
  26238. case "ClassExpression":
  26239. return isNonEmptyArray(rightNode.decorators);
  26240. }
  26241. if (hasShortKey) {
  26242. return false;
  26243. }
  26244. let node = rightNode;
  26245. const propertiesForPath = [];
  26246. for (; ; ) {
  26247. if (node.type === "UnaryExpression") {
  26248. node = node.argument;
  26249. propertiesForPath.push("argument");
  26250. } else if (node.type === "TSNonNullExpression") {
  26251. node = node.expression;
  26252. propertiesForPath.push("expression");
  26253. } else {
  26254. break;
  26255. }
  26256. }
  26257. if (isStringLiteral(node) || path.call(() => isPoorlyBreakableMemberOrCallChain(path, options, print), ...propertiesForPath)) {
  26258. return true;
  26259. }
  26260. return false;
  26261. }
  26262. function isComplexDestructuring(node) {
  26263. if (isAssignmentOrVariableDeclarator(node)) {
  26264. const leftNode = node.left || node.id;
  26265. return leftNode.type === "ObjectPattern" && leftNode.properties.length > 2 && leftNode.properties.some((property) => isObjectProperty(property) && (!property.shorthand || property.value && property.value.type === "AssignmentPattern"));
  26266. }
  26267. return false;
  26268. }
  26269. function isAssignment(node) {
  26270. return node.type === "AssignmentExpression";
  26271. }
  26272. function isAssignmentOrVariableDeclarator(node) {
  26273. return isAssignment(node) || node.type === "VariableDeclarator";
  26274. }
  26275. function isComplexTypeAliasParams(node) {
  26276. const typeParams = getTypeParametersFromTypeAlias(node);
  26277. if (isNonEmptyArray(typeParams)) {
  26278. const constraintPropertyName = node.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
  26279. if (typeParams.length > 1 && typeParams.some((param) => param[constraintPropertyName] || param.default)) {
  26280. return true;
  26281. }
  26282. }
  26283. return false;
  26284. }
  26285. function getTypeParametersFromTypeAlias(node) {
  26286. if (isTypeAlias(node) && node.typeParameters && node.typeParameters.params) {
  26287. return node.typeParameters.params;
  26288. }
  26289. return null;
  26290. }
  26291. function isTypeAlias(node) {
  26292. return node.type === "TSTypeAliasDeclaration" || node.type === "TypeAlias";
  26293. }
  26294. function hasComplexTypeAnnotation(node) {
  26295. if (node.type !== "VariableDeclarator") {
  26296. return false;
  26297. }
  26298. const {
  26299. typeAnnotation
  26300. } = node.id;
  26301. if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
  26302. return false;
  26303. }
  26304. const typeParams = getTypeParametersFromTypeReference(typeAnnotation.typeAnnotation);
  26305. return isNonEmptyArray(typeParams) && typeParams.length > 1 && typeParams.some((param) => isNonEmptyArray(getTypeParametersFromTypeReference(param)) || param.type === "TSConditionalType");
  26306. }
  26307. function isArrowFunctionVariableDeclarator(node) {
  26308. return node.type === "VariableDeclarator" && node.init && node.init.type === "ArrowFunctionExpression";
  26309. }
  26310. function getTypeParametersFromTypeReference(node) {
  26311. if (isTypeReference(node) && node.typeParameters && node.typeParameters.params) {
  26312. return node.typeParameters.params;
  26313. }
  26314. return null;
  26315. }
  26316. function isTypeReference(node) {
  26317. return node.type === "TSTypeReference" || node.type === "GenericTypeAnnotation";
  26318. }
  26319. function isPoorlyBreakableMemberOrCallChain(path, options, print, deep = false) {
  26320. const node = path.getValue();
  26321. const goDeeper = () => isPoorlyBreakableMemberOrCallChain(path, options, print, true);
  26322. if (node.type === "TSNonNullExpression") {
  26323. return path.call(goDeeper, "expression");
  26324. }
  26325. if (isCallExpression(node)) {
  26326. const doc2 = printCallExpression(path, options, print);
  26327. if (doc2.label === "member-chain") {
  26328. return false;
  26329. }
  26330. const args = getCallArguments(node);
  26331. const isPoorlyBreakableCall = args.length === 0 || args.length === 1 && isLoneShortArgument(args[0], options);
  26332. if (!isPoorlyBreakableCall) {
  26333. return false;
  26334. }
  26335. if (isCallExpressionWithComplexTypeArguments(node, print)) {
  26336. return false;
  26337. }
  26338. return path.call(goDeeper, "callee");
  26339. }
  26340. if (isMemberExpression(node)) {
  26341. return path.call(goDeeper, "object");
  26342. }
  26343. return deep && (node.type === "Identifier" || node.type === "ThisExpression");
  26344. }
  26345. var LONE_SHORT_ARGUMENT_THRESHOLD_RATE = 0.25;
  26346. function isLoneShortArgument(node, {
  26347. printWidth
  26348. }) {
  26349. if (hasComment(node)) {
  26350. return false;
  26351. }
  26352. const threshold = printWidth * LONE_SHORT_ARGUMENT_THRESHOLD_RATE;
  26353. if (node.type === "ThisExpression" || node.type === "Identifier" && node.name.length <= threshold || isSignedNumericLiteral(node) && !hasComment(node.argument)) {
  26354. return true;
  26355. }
  26356. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  26357. if (regexpPattern) {
  26358. return regexpPattern.length <= threshold;
  26359. }
  26360. if (isStringLiteral(node)) {
  26361. return rawText(node).length <= threshold;
  26362. }
  26363. if (node.type === "TemplateLiteral") {
  26364. return node.expressions.length === 0 && node.quasis[0].value.raw.length <= threshold && !node.quasis[0].value.raw.includes("\n");
  26365. }
  26366. return isLiteral(node);
  26367. }
  26368. function isObjectPropertyWithShortKey(node, keyDoc, options) {
  26369. if (!isObjectProperty(node)) {
  26370. return false;
  26371. }
  26372. keyDoc = cleanDoc(keyDoc);
  26373. const MIN_OVERLAP_FOR_BREAK = 3;
  26374. return typeof keyDoc === "string" && getStringWidth(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK;
  26375. }
  26376. function isCallExpressionWithComplexTypeArguments(node, print) {
  26377. const typeArgs = getTypeArgumentsFromCallExpression(node);
  26378. if (isNonEmptyArray(typeArgs)) {
  26379. if (typeArgs.length > 1) {
  26380. return true;
  26381. }
  26382. if (typeArgs.length === 1) {
  26383. const firstArg = typeArgs[0];
  26384. if (firstArg.type === "TSUnionType" || firstArg.type === "UnionTypeAnnotation" || firstArg.type === "TSIntersectionType" || firstArg.type === "IntersectionTypeAnnotation" || firstArg.type === "TSTypeLiteral" || firstArg.type === "ObjectTypeAnnotation") {
  26385. return true;
  26386. }
  26387. }
  26388. const typeArgsKeyName = node.typeParameters ? "typeParameters" : "typeArguments";
  26389. if (willBreak(print(typeArgsKeyName))) {
  26390. return true;
  26391. }
  26392. }
  26393. return false;
  26394. }
  26395. function getTypeArgumentsFromCallExpression(node) {
  26396. return node.typeParameters && node.typeParameters.params || node.typeArguments && node.typeArguments.params;
  26397. }
  26398. module2.exports = {
  26399. printVariableDeclarator,
  26400. printAssignmentExpression,
  26401. printAssignment,
  26402. isArrowFunctionVariableDeclarator
  26403. };
  26404. }
  26405. });
  26406. var require_function_parameters = __commonJS2({
  26407. "src/language-js/print/function-parameters.js"(exports2, module2) {
  26408. "use strict";
  26409. var {
  26410. getNextNonSpaceNonCommentCharacter
  26411. } = require_util();
  26412. var {
  26413. printDanglingComments
  26414. } = require_comments();
  26415. var {
  26416. builders: {
  26417. line,
  26418. hardline,
  26419. softline,
  26420. group,
  26421. indent,
  26422. ifBreak
  26423. },
  26424. utils: {
  26425. removeLines,
  26426. willBreak
  26427. }
  26428. } = require("./doc.js");
  26429. var {
  26430. getFunctionParameters,
  26431. iterateFunctionParametersPath,
  26432. isSimpleType,
  26433. isTestCall,
  26434. isTypeAnnotationAFunction,
  26435. isObjectType,
  26436. isObjectTypePropertyAFunction,
  26437. hasRestParameter,
  26438. shouldPrintComma,
  26439. hasComment,
  26440. isNextLineEmpty
  26441. } = require_utils7();
  26442. var {
  26443. locEnd
  26444. } = require_loc();
  26445. var {
  26446. ArgExpansionBailout
  26447. } = require_errors();
  26448. var {
  26449. printFunctionTypeParameters
  26450. } = require_misc();
  26451. function printFunctionParameters(path, print, options, expandArg, printTypeParams) {
  26452. const functionNode = path.getValue();
  26453. const parameters = getFunctionParameters(functionNode);
  26454. const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
  26455. if (parameters.length === 0) {
  26456. return [typeParams, "(", printDanglingComments(path, options, true, (comment) => getNextNonSpaceNonCommentCharacter(options.originalText, comment, locEnd) === ")"), ")"];
  26457. }
  26458. const parent = path.getParentNode();
  26459. const isParametersInTestCall = isTestCall(parent);
  26460. const shouldHugParameters = shouldHugFunctionParameters(functionNode);
  26461. const printed = [];
  26462. iterateFunctionParametersPath(path, (parameterPath, index) => {
  26463. const isLastParameter = index === parameters.length - 1;
  26464. if (isLastParameter && functionNode.rest) {
  26465. printed.push("...");
  26466. }
  26467. printed.push(print());
  26468. if (isLastParameter) {
  26469. return;
  26470. }
  26471. printed.push(",");
  26472. if (isParametersInTestCall || shouldHugParameters) {
  26473. printed.push(" ");
  26474. } else if (isNextLineEmpty(parameters[index], options)) {
  26475. printed.push(hardline, hardline);
  26476. } else {
  26477. printed.push(line);
  26478. }
  26479. });
  26480. if (expandArg) {
  26481. if (willBreak(typeParams) || willBreak(printed)) {
  26482. throw new ArgExpansionBailout();
  26483. }
  26484. return group([removeLines(typeParams), "(", removeLines(printed), ")"]);
  26485. }
  26486. const hasNotParameterDecorator = parameters.every((node) => !node.decorators);
  26487. if (shouldHugParameters && hasNotParameterDecorator) {
  26488. return [typeParams, "(", ...printed, ")"];
  26489. }
  26490. if (isParametersInTestCall) {
  26491. return [typeParams, "(", ...printed, ")"];
  26492. }
  26493. const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction(parent) || isTypeAnnotationAFunction(parent) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === functionNode) && parameters.length === 1 && parameters[0].name === null && functionNode.this !== parameters[0] && parameters[0].typeAnnotation && functionNode.typeParameters === null && isSimpleType(parameters[0].typeAnnotation) && !functionNode.rest;
  26494. if (isFlowShorthandWithOneArg) {
  26495. if (options.arrowParens === "always") {
  26496. return ["(", ...printed, ")"];
  26497. }
  26498. return printed;
  26499. }
  26500. return [typeParams, "(", indent([softline, ...printed]), ifBreak(!hasRestParameter(functionNode) && shouldPrintComma(options, "all") ? "," : ""), softline, ")"];
  26501. }
  26502. function shouldHugFunctionParameters(node) {
  26503. if (!node) {
  26504. return false;
  26505. }
  26506. const parameters = getFunctionParameters(node);
  26507. if (parameters.length !== 1) {
  26508. return false;
  26509. }
  26510. const [parameter] = parameters;
  26511. return !hasComment(parameter) && (parameter.type === "ObjectPattern" || parameter.type === "ArrayPattern" || parameter.type === "Identifier" && parameter.typeAnnotation && (parameter.typeAnnotation.type === "TypeAnnotation" || parameter.typeAnnotation.type === "TSTypeAnnotation") && isObjectType(parameter.typeAnnotation.typeAnnotation) || parameter.type === "FunctionTypeParam" && isObjectType(parameter.typeAnnotation) || parameter.type === "AssignmentPattern" && (parameter.left.type === "ObjectPattern" || parameter.left.type === "ArrayPattern") && (parameter.right.type === "Identifier" || parameter.right.type === "ObjectExpression" && parameter.right.properties.length === 0 || parameter.right.type === "ArrayExpression" && parameter.right.elements.length === 0));
  26512. }
  26513. function getReturnTypeNode(functionNode) {
  26514. let returnTypeNode;
  26515. if (functionNode.returnType) {
  26516. returnTypeNode = functionNode.returnType;
  26517. if (returnTypeNode.typeAnnotation) {
  26518. returnTypeNode = returnTypeNode.typeAnnotation;
  26519. }
  26520. } else if (functionNode.typeAnnotation) {
  26521. returnTypeNode = functionNode.typeAnnotation;
  26522. }
  26523. return returnTypeNode;
  26524. }
  26525. function shouldGroupFunctionParameters(functionNode, returnTypeDoc) {
  26526. const returnTypeNode = getReturnTypeNode(functionNode);
  26527. if (!returnTypeNode) {
  26528. return false;
  26529. }
  26530. const typeParameters = functionNode.typeParameters && functionNode.typeParameters.params;
  26531. if (typeParameters) {
  26532. if (typeParameters.length > 1) {
  26533. return false;
  26534. }
  26535. if (typeParameters.length === 1) {
  26536. const typeParameter = typeParameters[0];
  26537. if (typeParameter.constraint || typeParameter.default) {
  26538. return false;
  26539. }
  26540. }
  26541. }
  26542. return getFunctionParameters(functionNode).length === 1 && (isObjectType(returnTypeNode) || willBreak(returnTypeDoc));
  26543. }
  26544. module2.exports = {
  26545. printFunctionParameters,
  26546. shouldHugFunctionParameters,
  26547. shouldGroupFunctionParameters
  26548. };
  26549. }
  26550. });
  26551. var require_type_annotation = __commonJS2({
  26552. "src/language-js/print/type-annotation.js"(exports2, module2) {
  26553. "use strict";
  26554. var {
  26555. printComments,
  26556. printDanglingComments
  26557. } = require_comments();
  26558. var {
  26559. isNonEmptyArray
  26560. } = require_util();
  26561. var {
  26562. builders: {
  26563. group,
  26564. join,
  26565. line,
  26566. softline,
  26567. indent,
  26568. align,
  26569. ifBreak
  26570. }
  26571. } = require("./doc.js");
  26572. var pathNeedsParens = require_needs_parens();
  26573. var {
  26574. locStart
  26575. } = require_loc();
  26576. var {
  26577. isSimpleType,
  26578. isObjectType,
  26579. hasLeadingOwnLineComment,
  26580. isObjectTypePropertyAFunction,
  26581. shouldPrintComma
  26582. } = require_utils7();
  26583. var {
  26584. printAssignment
  26585. } = require_assignment();
  26586. var {
  26587. printFunctionParameters,
  26588. shouldGroupFunctionParameters
  26589. } = require_function_parameters();
  26590. var {
  26591. printArrayItems
  26592. } = require_array4();
  26593. function shouldHugType(node) {
  26594. if (isSimpleType(node) || isObjectType(node)) {
  26595. return true;
  26596. }
  26597. if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
  26598. const voidCount = node.types.filter((node2) => node2.type === "VoidTypeAnnotation" || node2.type === "TSVoidKeyword" || node2.type === "NullLiteralTypeAnnotation" || node2.type === "TSNullKeyword").length;
  26599. const hasObject = node.types.some((node2) => node2.type === "ObjectTypeAnnotation" || node2.type === "TSTypeLiteral" || node2.type === "GenericTypeAnnotation" || node2.type === "TSTypeReference");
  26600. if (node.types.length - 1 === voidCount && hasObject) {
  26601. return true;
  26602. }
  26603. }
  26604. return false;
  26605. }
  26606. function printOpaqueType(path, options, print) {
  26607. const semi = options.semi ? ";" : "";
  26608. const node = path.getValue();
  26609. const parts = [];
  26610. parts.push("opaque type ", print("id"), print("typeParameters"));
  26611. if (node.supertype) {
  26612. parts.push(": ", print("supertype"));
  26613. }
  26614. if (node.impltype) {
  26615. parts.push(" = ", print("impltype"));
  26616. }
  26617. parts.push(semi);
  26618. return parts;
  26619. }
  26620. function printTypeAlias(path, options, print) {
  26621. const semi = options.semi ? ";" : "";
  26622. const node = path.getValue();
  26623. const parts = [];
  26624. if (node.declare) {
  26625. parts.push("declare ");
  26626. }
  26627. parts.push("type ", print("id"), print("typeParameters"));
  26628. const rightPropertyName = node.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
  26629. return [printAssignment(path, options, print, parts, " =", rightPropertyName), semi];
  26630. }
  26631. function printIntersectionType(path, options, print) {
  26632. const node = path.getValue();
  26633. const types = path.map(print, "types");
  26634. const result = [];
  26635. let wasIndented = false;
  26636. for (let i = 0; i < types.length; ++i) {
  26637. if (i === 0) {
  26638. result.push(types[i]);
  26639. } else if (isObjectType(node.types[i - 1]) && isObjectType(node.types[i])) {
  26640. result.push([" & ", wasIndented ? indent(types[i]) : types[i]]);
  26641. } else if (!isObjectType(node.types[i - 1]) && !isObjectType(node.types[i])) {
  26642. result.push(indent([" &", line, types[i]]));
  26643. } else {
  26644. if (i > 1) {
  26645. wasIndented = true;
  26646. }
  26647. result.push(" & ", i > 1 ? indent(types[i]) : types[i]);
  26648. }
  26649. }
  26650. return group(result);
  26651. }
  26652. function printUnionType(path, options, print) {
  26653. const node = path.getValue();
  26654. const parent = path.getParentNode();
  26655. const shouldIndent = parent.type !== "TypeParameterInstantiation" && parent.type !== "TSTypeParameterInstantiation" && parent.type !== "GenericTypeAnnotation" && parent.type !== "TSTypeReference" && parent.type !== "TSTypeAssertion" && parent.type !== "TupleTypeAnnotation" && parent.type !== "TSTupleType" && !(parent.type === "FunctionTypeParam" && !parent.name && path.getParentNode(1).this !== parent) && !((parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment(options.originalText, node));
  26656. const shouldHug = shouldHugType(node);
  26657. const printed = path.map((typePath) => {
  26658. let printedType = print();
  26659. if (!shouldHug) {
  26660. printedType = align(2, printedType);
  26661. }
  26662. return printComments(typePath, printedType, options);
  26663. }, "types");
  26664. if (shouldHug) {
  26665. return join(" | ", printed);
  26666. }
  26667. const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, node);
  26668. const code = [ifBreak([shouldAddStartLine ? line : "", "| "]), join([line, "| "], printed)];
  26669. if (pathNeedsParens(path, options)) {
  26670. return group([indent(code), softline]);
  26671. }
  26672. if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
  26673. return group([indent([ifBreak(["(", softline]), code]), softline, ifBreak(")")]);
  26674. }
  26675. return group(shouldIndent ? indent(code) : code);
  26676. }
  26677. function printFunctionType(path, options, print) {
  26678. const node = path.getValue();
  26679. const parts = [];
  26680. const parent = path.getParentNode(0);
  26681. const parentParent = path.getParentNode(1);
  26682. const parentParentParent = path.getParentNode(2);
  26683. let isArrowFunctionTypeAnnotation = node.type === "TSFunctionType" || !((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && !parent.variance && !parent.optional && locStart(parent) === locStart(node) || parent.type === "ObjectTypeCallProperty" || parentParentParent && parentParentParent.type === "DeclareFunction");
  26684. let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation");
  26685. const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
  26686. if (isObjectTypePropertyAFunction(parent)) {
  26687. isArrowFunctionTypeAnnotation = true;
  26688. needsColon = true;
  26689. }
  26690. if (needsParens) {
  26691. parts.push("(");
  26692. }
  26693. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  26694. const returnTypeDoc = node.returnType || node.predicate || node.typeAnnotation ? [isArrowFunctionTypeAnnotation ? " => " : ": ", print("returnType"), print("predicate"), print("typeAnnotation")] : "";
  26695. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26696. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  26697. if (returnTypeDoc) {
  26698. parts.push(returnTypeDoc);
  26699. }
  26700. if (needsParens) {
  26701. parts.push(")");
  26702. }
  26703. return group(parts);
  26704. }
  26705. function printTupleType(path, options, print) {
  26706. const node = path.getValue();
  26707. const typesField = node.type === "TSTupleType" ? "elementTypes" : "types";
  26708. const types = node[typesField];
  26709. const isNonEmptyTuple = isNonEmptyArray(types);
  26710. const bracketsDelimiterLine = isNonEmptyTuple ? softline : "";
  26711. return group(["[", indent([bracketsDelimiterLine, printArrayItems(path, options, typesField, print)]), ifBreak(isNonEmptyTuple && shouldPrintComma(options, "all") ? "," : ""), printDanglingComments(path, options, true), bracketsDelimiterLine, "]"]);
  26712. }
  26713. function printIndexedAccessType(path, options, print) {
  26714. const node = path.getValue();
  26715. const leftDelimiter = node.type === "OptionalIndexedAccessType" && node.optional ? "?.[" : "[";
  26716. return [print("objectType"), leftDelimiter, print("indexType"), "]"];
  26717. }
  26718. function printJSDocType(path, print, token) {
  26719. const node = path.getValue();
  26720. return [node.postfix ? "" : token, print("typeAnnotation"), node.postfix ? token : ""];
  26721. }
  26722. module2.exports = {
  26723. printOpaqueType,
  26724. printTypeAlias,
  26725. printIntersectionType,
  26726. printUnionType,
  26727. printFunctionType,
  26728. printTupleType,
  26729. printIndexedAccessType,
  26730. shouldHugType,
  26731. printJSDocType
  26732. };
  26733. }
  26734. });
  26735. var require_type_parameters = __commonJS2({
  26736. "src/language-js/print/type-parameters.js"(exports2, module2) {
  26737. "use strict";
  26738. var {
  26739. printDanglingComments
  26740. } = require_comments();
  26741. var {
  26742. builders: {
  26743. join,
  26744. line,
  26745. hardline,
  26746. softline,
  26747. group,
  26748. indent,
  26749. ifBreak
  26750. }
  26751. } = require("./doc.js");
  26752. var {
  26753. isTestCall,
  26754. hasComment,
  26755. CommentCheckFlags,
  26756. isTSXFile,
  26757. shouldPrintComma,
  26758. getFunctionParameters,
  26759. isObjectType
  26760. } = require_utils7();
  26761. var {
  26762. createGroupIdMapper
  26763. } = require_util();
  26764. var {
  26765. shouldHugType
  26766. } = require_type_annotation();
  26767. var {
  26768. isArrowFunctionVariableDeclarator
  26769. } = require_assignment();
  26770. var getTypeParametersGroupId = createGroupIdMapper("typeParameters");
  26771. function printTypeParameters(path, options, print, paramsKey) {
  26772. const node = path.getValue();
  26773. if (!node[paramsKey]) {
  26774. return "";
  26775. }
  26776. if (!Array.isArray(node[paramsKey])) {
  26777. return print(paramsKey);
  26778. }
  26779. const grandparent = path.getNode(2);
  26780. const isParameterInTestCall = grandparent && isTestCall(grandparent);
  26781. const isArrowFunctionVariable = path.match((node2) => !(node2[paramsKey].length === 1 && isObjectType(node2[paramsKey][0])), void 0, (node2, name) => name === "typeAnnotation", (node2) => node2.type === "Identifier", isArrowFunctionVariableDeclarator);
  26782. const shouldInline = !isArrowFunctionVariable && (isParameterInTestCall || node[paramsKey].length === 0 || node[paramsKey].length === 1 && (node[paramsKey][0].type === "NullableTypeAnnotation" || shouldHugType(node[paramsKey][0])));
  26783. if (shouldInline) {
  26784. return ["<", join(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(path, options), ">"];
  26785. }
  26786. const trailingComma = node.type === "TSTypeParameterInstantiation" ? "" : getFunctionParameters(node).length === 1 && isTSXFile(options) && !node[paramsKey][0].constraint && path.getParentNode().type === "ArrowFunctionExpression" ? "," : shouldPrintComma(options, "all") ? ifBreak(",") : "";
  26787. return group(["<", indent([softline, join([",", line], path.map(print, paramsKey))]), trailingComma, softline, ">"], {
  26788. id: getTypeParametersGroupId(node)
  26789. });
  26790. }
  26791. function printDanglingCommentsForInline(path, options) {
  26792. const node = path.getValue();
  26793. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  26794. return "";
  26795. }
  26796. const hasOnlyBlockComments = !hasComment(node, CommentCheckFlags.Line);
  26797. const printed = printDanglingComments(path, options, hasOnlyBlockComments);
  26798. if (hasOnlyBlockComments) {
  26799. return printed;
  26800. }
  26801. return [printed, hardline];
  26802. }
  26803. function printTypeParameter(path, options, print) {
  26804. const node = path.getValue();
  26805. const parts = [];
  26806. const parent = path.getParentNode();
  26807. if (parent.type === "TSMappedType") {
  26808. parts.push("[", print("name"));
  26809. if (node.constraint) {
  26810. parts.push(" in ", print("constraint"));
  26811. }
  26812. if (parent.nameType) {
  26813. parts.push(" as ", path.callParent(() => print("nameType")));
  26814. }
  26815. parts.push("]");
  26816. return parts;
  26817. }
  26818. if (node.variance) {
  26819. parts.push(print("variance"));
  26820. }
  26821. if (node.in) {
  26822. parts.push("in ");
  26823. }
  26824. if (node.out) {
  26825. parts.push("out ");
  26826. }
  26827. parts.push(print("name"));
  26828. if (node.bound) {
  26829. parts.push(": ", print("bound"));
  26830. }
  26831. if (node.constraint) {
  26832. parts.push(" extends ", print("constraint"));
  26833. }
  26834. if (node.default) {
  26835. parts.push(" = ", print("default"));
  26836. }
  26837. return parts;
  26838. }
  26839. module2.exports = {
  26840. printTypeParameter,
  26841. printTypeParameters,
  26842. getTypeParametersGroupId
  26843. };
  26844. }
  26845. });
  26846. var require_property = __commonJS2({
  26847. "src/language-js/print/property.js"(exports2, module2) {
  26848. "use strict";
  26849. var {
  26850. printComments
  26851. } = require_comments();
  26852. var {
  26853. printString,
  26854. printNumber
  26855. } = require_util();
  26856. var {
  26857. isNumericLiteral,
  26858. isSimpleNumber,
  26859. isStringLiteral,
  26860. isStringPropSafeToUnquote,
  26861. rawText
  26862. } = require_utils7();
  26863. var {
  26864. printAssignment
  26865. } = require_assignment();
  26866. var needsQuoteProps = /* @__PURE__ */ new WeakMap();
  26867. function printPropertyKey(path, options, print) {
  26868. const node = path.getNode();
  26869. if (node.computed) {
  26870. return ["[", print("key"), "]"];
  26871. }
  26872. const parent = path.getParentNode();
  26873. const {
  26874. key
  26875. } = node;
  26876. if (node.type === "ClassPrivateProperty" && key.type === "Identifier") {
  26877. return ["#", print("key")];
  26878. }
  26879. if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
  26880. const objectHasStringProp = (parent.properties || parent.body || parent.members).some((prop) => !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToUnquote(prop, options));
  26881. needsQuoteProps.set(parent, objectHasStringProp);
  26882. }
  26883. if ((key.type === "Identifier" || isNumericLiteral(key) && isSimpleNumber(printNumber(rawText(key))) && String(key.value) === printNumber(rawText(key)) && !(options.parser === "typescript" || options.parser === "babel-ts")) && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
  26884. const prop = printString(JSON.stringify(key.type === "Identifier" ? key.name : key.value.toString()), options);
  26885. return path.call((keyPath) => printComments(keyPath, prop, options), "key");
  26886. }
  26887. if (isStringPropSafeToUnquote(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
  26888. return path.call((keyPath) => printComments(keyPath, /^\d/.test(key.value) ? printNumber(key.value) : key.value, options), "key");
  26889. }
  26890. return print("key");
  26891. }
  26892. function printProperty(path, options, print) {
  26893. const node = path.getValue();
  26894. if (node.shorthand) {
  26895. return print("value");
  26896. }
  26897. return printAssignment(path, options, print, printPropertyKey(path, options, print), ":", "value");
  26898. }
  26899. module2.exports = {
  26900. printProperty,
  26901. printPropertyKey
  26902. };
  26903. }
  26904. });
  26905. var require_function = __commonJS2({
  26906. "src/language-js/print/function.js"(exports2, module2) {
  26907. "use strict";
  26908. var assert = require("assert");
  26909. var {
  26910. printDanglingComments,
  26911. printCommentsSeparately
  26912. } = require_comments();
  26913. var getLast = require_get_last();
  26914. var {
  26915. getNextNonSpaceNonCommentCharacterIndex
  26916. } = require_util();
  26917. var {
  26918. builders: {
  26919. line,
  26920. softline,
  26921. group,
  26922. indent,
  26923. ifBreak,
  26924. hardline,
  26925. join,
  26926. indentIfBreak
  26927. },
  26928. utils: {
  26929. removeLines,
  26930. willBreak
  26931. }
  26932. } = require("./doc.js");
  26933. var {
  26934. ArgExpansionBailout
  26935. } = require_errors();
  26936. var {
  26937. getFunctionParameters,
  26938. hasLeadingOwnLineComment,
  26939. isFlowAnnotationComment,
  26940. isJsxNode,
  26941. isTemplateOnItsOwnLine,
  26942. shouldPrintComma,
  26943. startsWithNoLookaheadToken,
  26944. isBinaryish,
  26945. isLineComment,
  26946. hasComment,
  26947. getComments,
  26948. CommentCheckFlags,
  26949. isCallLikeExpression,
  26950. isCallExpression,
  26951. getCallArguments,
  26952. hasNakedLeftSide,
  26953. getLeftSide
  26954. } = require_utils7();
  26955. var {
  26956. locEnd
  26957. } = require_loc();
  26958. var {
  26959. printFunctionParameters,
  26960. shouldGroupFunctionParameters
  26961. } = require_function_parameters();
  26962. var {
  26963. printPropertyKey
  26964. } = require_property();
  26965. var {
  26966. printFunctionTypeParameters
  26967. } = require_misc();
  26968. function printFunction(path, print, options, args) {
  26969. const node = path.getValue();
  26970. let expandArg = false;
  26971. if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && args && args.expandLastArg) {
  26972. const parent = path.getParentNode();
  26973. if (isCallExpression(parent) && getCallArguments(parent).length > 1) {
  26974. expandArg = true;
  26975. }
  26976. }
  26977. const parts = [];
  26978. if (node.type === "TSDeclareFunction" && node.declare) {
  26979. parts.push("declare ");
  26980. }
  26981. if (node.async) {
  26982. parts.push("async ");
  26983. }
  26984. if (node.generator) {
  26985. parts.push("function* ");
  26986. } else {
  26987. parts.push("function ");
  26988. }
  26989. if (node.id) {
  26990. parts.push(print("id"));
  26991. }
  26992. const parametersDoc = printFunctionParameters(path, print, options, expandArg);
  26993. const returnTypeDoc = printReturnType(path, print, options);
  26994. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26995. parts.push(printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc]), node.body ? " " : "", print("body"));
  26996. if (options.semi && (node.declare || !node.body)) {
  26997. parts.push(";");
  26998. }
  26999. return parts;
  27000. }
  27001. function printMethod(path, options, print) {
  27002. const node = path.getNode();
  27003. const {
  27004. kind
  27005. } = node;
  27006. const value = node.value || node;
  27007. const parts = [];
  27008. if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
  27009. if (value.async) {
  27010. parts.push("async ");
  27011. }
  27012. } else {
  27013. assert.ok(kind === "get" || kind === "set");
  27014. parts.push(kind, " ");
  27015. }
  27016. if (value.generator) {
  27017. parts.push("*");
  27018. }
  27019. parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "");
  27020. if (node === value) {
  27021. parts.push(printMethodInternal(path, options, print));
  27022. } else if (value.type === "FunctionExpression") {
  27023. parts.push(path.call((path2) => printMethodInternal(path2, options, print), "value"));
  27024. } else {
  27025. parts.push(print("value"));
  27026. }
  27027. return parts;
  27028. }
  27029. function printMethodInternal(path, options, print) {
  27030. const node = path.getNode();
  27031. const parametersDoc = printFunctionParameters(path, print, options);
  27032. const returnTypeDoc = printReturnType(path, print, options);
  27033. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  27034. const parts = [printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc])];
  27035. if (node.body) {
  27036. parts.push(" ", print("body"));
  27037. } else {
  27038. parts.push(options.semi ? ";" : "");
  27039. }
  27040. return parts;
  27041. }
  27042. function printArrowFunctionSignature(path, options, print, args) {
  27043. const node = path.getValue();
  27044. const parts = [];
  27045. if (node.async) {
  27046. parts.push("async ");
  27047. }
  27048. if (shouldPrintParamsWithoutParens(path, options)) {
  27049. parts.push(print(["params", 0]));
  27050. } else {
  27051. const expandArg = args && (args.expandLastArg || args.expandFirstArg);
  27052. let returnTypeDoc = printReturnType(path, print, options);
  27053. if (expandArg) {
  27054. if (willBreak(returnTypeDoc)) {
  27055. throw new ArgExpansionBailout();
  27056. }
  27057. returnTypeDoc = group(removeLines(returnTypeDoc));
  27058. }
  27059. parts.push(group([printFunctionParameters(path, print, options, expandArg, true), returnTypeDoc]));
  27060. }
  27061. const dangling = printDanglingComments(path, options, true, (comment) => {
  27062. const nextCharacter = getNextNonSpaceNonCommentCharacterIndex(options.originalText, comment, locEnd);
  27063. return nextCharacter !== false && options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
  27064. });
  27065. if (dangling) {
  27066. parts.push(" ", dangling);
  27067. }
  27068. return parts;
  27069. }
  27070. function printArrowChain(path, args, signatures, shouldBreak, bodyDoc, tailNode) {
  27071. const name = path.getName();
  27072. const parent = path.getParentNode();
  27073. const isCallee = isCallLikeExpression(parent) && name === "callee";
  27074. const isAssignmentRhs = Boolean(args && args.assignmentLayout);
  27075. const shouldPutBodyOnSeparateLine = tailNode.body.type !== "BlockStatement" && tailNode.body.type !== "ObjectExpression" && tailNode.body.type !== "SequenceExpression";
  27076. const shouldBreakBeforeChain = isCallee && shouldPutBodyOnSeparateLine || args && args.assignmentLayout === "chain-tail-arrow-chain";
  27077. const groupId = Symbol("arrow-chain");
  27078. if (tailNode.body.type === "SequenceExpression") {
  27079. bodyDoc = group(["(", indent([softline, bodyDoc]), softline, ")"]);
  27080. }
  27081. return group([group(indent([isCallee || isAssignmentRhs ? softline : "", group(join([" =>", line], signatures), {
  27082. shouldBreak
  27083. })]), {
  27084. id: groupId,
  27085. shouldBreak: shouldBreakBeforeChain
  27086. }), " =>", indentIfBreak(shouldPutBodyOnSeparateLine ? indent([line, bodyDoc]) : [" ", bodyDoc], {
  27087. groupId
  27088. }), isCallee ? ifBreak(softline, "", {
  27089. groupId
  27090. }) : ""]);
  27091. }
  27092. function printArrowFunction(path, options, print, args) {
  27093. let node = path.getValue();
  27094. const signatures = [];
  27095. const body = [];
  27096. let chainShouldBreak = false;
  27097. (function rec() {
  27098. const doc2 = printArrowFunctionSignature(path, options, print, args);
  27099. if (signatures.length === 0) {
  27100. signatures.push(doc2);
  27101. } else {
  27102. const {
  27103. leading,
  27104. trailing
  27105. } = printCommentsSeparately(path, options);
  27106. signatures.push([leading, doc2]);
  27107. body.unshift(trailing);
  27108. }
  27109. chainShouldBreak = chainShouldBreak || node.returnType && getFunctionParameters(node).length > 0 || node.typeParameters || getFunctionParameters(node).some((param) => param.type !== "Identifier");
  27110. if (node.body.type !== "ArrowFunctionExpression" || args && args.expandLastArg) {
  27111. body.unshift(print("body", args));
  27112. } else {
  27113. node = node.body;
  27114. path.call(rec, "body");
  27115. }
  27116. })();
  27117. if (signatures.length > 1) {
  27118. return printArrowChain(path, args, signatures, chainShouldBreak, body, node);
  27119. }
  27120. const parts = signatures;
  27121. parts.push(" =>");
  27122. if (!hasLeadingOwnLineComment(options.originalText, node.body) && (node.body.type === "ArrayExpression" || node.body.type === "ObjectExpression" || node.body.type === "BlockStatement" || isJsxNode(node.body) || isTemplateOnItsOwnLine(node.body, options.originalText) || node.body.type === "ArrowFunctionExpression" || node.body.type === "DoExpression")) {
  27123. return group([...parts, " ", body]);
  27124. }
  27125. if (node.body.type === "SequenceExpression") {
  27126. return group([...parts, group([" (", indent([softline, body]), softline, ")"])]);
  27127. }
  27128. const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !hasComment(node);
  27129. const printTrailingComma = args && args.expandLastArg && shouldPrintComma(options, "all");
  27130. const shouldAddParens = node.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken(node.body, false);
  27131. return group([...parts, group([indent([line, shouldAddParens ? ifBreak("", "(") : "", body, shouldAddParens ? ifBreak("", ")") : ""]), shouldAddSoftLine ? [ifBreak(printTrailingComma ? "," : ""), softline] : ""])]);
  27132. }
  27133. function canPrintParamsWithoutParens(node) {
  27134. const parameters = getFunctionParameters(node);
  27135. return parameters.length === 1 && !node.typeParameters && !hasComment(node, CommentCheckFlags.Dangling) && parameters[0].type === "Identifier" && !parameters[0].typeAnnotation && !hasComment(parameters[0]) && !parameters[0].optional && !node.predicate && !node.returnType;
  27136. }
  27137. function shouldPrintParamsWithoutParens(path, options) {
  27138. if (options.arrowParens === "always") {
  27139. return false;
  27140. }
  27141. if (options.arrowParens === "avoid") {
  27142. const node = path.getValue();
  27143. return canPrintParamsWithoutParens(node);
  27144. }
  27145. return false;
  27146. }
  27147. function printReturnType(path, print, options) {
  27148. const node = path.getValue();
  27149. const returnType = print("returnType");
  27150. if (node.returnType && isFlowAnnotationComment(options.originalText, node.returnType)) {
  27151. return [" /*: ", returnType, " */"];
  27152. }
  27153. const parts = [returnType];
  27154. if (node.returnType && node.returnType.typeAnnotation) {
  27155. parts.unshift(": ");
  27156. }
  27157. if (node.predicate) {
  27158. parts.push(node.returnType ? " " : ": ", print("predicate"));
  27159. }
  27160. return parts;
  27161. }
  27162. function printReturnOrThrowArgument(path, options, print) {
  27163. const node = path.getValue();
  27164. const semi = options.semi ? ";" : "";
  27165. const parts = [];
  27166. if (node.argument) {
  27167. if (returnArgumentHasLeadingComment(options, node.argument)) {
  27168. parts.push([" (", indent([hardline, print("argument")]), hardline, ")"]);
  27169. } else if (isBinaryish(node.argument) || node.argument.type === "SequenceExpression") {
  27170. parts.push(group([ifBreak(" (", " "), indent([softline, print("argument")]), softline, ifBreak(")")]));
  27171. } else {
  27172. parts.push(" ", print("argument"));
  27173. }
  27174. }
  27175. const comments = getComments(node);
  27176. const lastComment = getLast(comments);
  27177. const isLastCommentLine = lastComment && isLineComment(lastComment);
  27178. if (isLastCommentLine) {
  27179. parts.push(semi);
  27180. }
  27181. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27182. parts.push(" ", printDanglingComments(path, options, true));
  27183. }
  27184. if (!isLastCommentLine) {
  27185. parts.push(semi);
  27186. }
  27187. return parts;
  27188. }
  27189. function printReturnStatement(path, options, print) {
  27190. return ["return", printReturnOrThrowArgument(path, options, print)];
  27191. }
  27192. function printThrowStatement(path, options, print) {
  27193. return ["throw", printReturnOrThrowArgument(path, options, print)];
  27194. }
  27195. function returnArgumentHasLeadingComment(options, argument) {
  27196. if (hasLeadingOwnLineComment(options.originalText, argument)) {
  27197. return true;
  27198. }
  27199. if (hasNakedLeftSide(argument)) {
  27200. let leftMost = argument;
  27201. let newLeftMost;
  27202. while (newLeftMost = getLeftSide(leftMost)) {
  27203. leftMost = newLeftMost;
  27204. if (hasLeadingOwnLineComment(options.originalText, leftMost)) {
  27205. return true;
  27206. }
  27207. }
  27208. }
  27209. return false;
  27210. }
  27211. module2.exports = {
  27212. printFunction,
  27213. printArrowFunction,
  27214. printMethod,
  27215. printReturnStatement,
  27216. printThrowStatement,
  27217. printMethodInternal,
  27218. shouldPrintParamsWithoutParens
  27219. };
  27220. }
  27221. });
  27222. var require_decorators = __commonJS2({
  27223. "src/language-js/print/decorators.js"(exports2, module2) {
  27224. "use strict";
  27225. var {
  27226. isNonEmptyArray,
  27227. hasNewline
  27228. } = require_util();
  27229. var {
  27230. builders: {
  27231. line,
  27232. hardline,
  27233. join,
  27234. breakParent,
  27235. group
  27236. }
  27237. } = require("./doc.js");
  27238. var {
  27239. locStart,
  27240. locEnd
  27241. } = require_loc();
  27242. var {
  27243. getParentExportDeclaration
  27244. } = require_utils7();
  27245. function printClassMemberDecorators(path, options, print) {
  27246. const node = path.getValue();
  27247. return group([join(line, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators(node, options) ? hardline : line]);
  27248. }
  27249. function printDecoratorsBeforeExport(path, options, print) {
  27250. return [join(hardline, path.map(print, "declaration", "decorators")), hardline];
  27251. }
  27252. function printDecorators(path, options, print) {
  27253. const node = path.getValue();
  27254. const {
  27255. decorators
  27256. } = node;
  27257. if (!isNonEmptyArray(decorators) || hasDecoratorsBeforeExport(path.getParentNode())) {
  27258. return;
  27259. }
  27260. const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators(node, options);
  27261. return [getParentExportDeclaration(path) ? hardline : shouldBreak ? breakParent : "", join(line, path.map(print, "decorators")), line];
  27262. }
  27263. function hasNewlineBetweenOrAfterDecorators(node, options) {
  27264. return node.decorators.some((decorator) => hasNewline(options.originalText, locEnd(decorator)));
  27265. }
  27266. function hasDecoratorsBeforeExport(node) {
  27267. if (node.type !== "ExportDefaultDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "DeclareExportDeclaration") {
  27268. return false;
  27269. }
  27270. const decorators = node.declaration && node.declaration.decorators;
  27271. return isNonEmptyArray(decorators) && locStart(node) === locStart(decorators[0]);
  27272. }
  27273. module2.exports = {
  27274. printDecorators,
  27275. printClassMemberDecorators,
  27276. printDecoratorsBeforeExport,
  27277. hasDecoratorsBeforeExport
  27278. };
  27279. }
  27280. });
  27281. var require_class = __commonJS2({
  27282. "src/language-js/print/class.js"(exports2, module2) {
  27283. "use strict";
  27284. var {
  27285. isNonEmptyArray,
  27286. createGroupIdMapper
  27287. } = require_util();
  27288. var {
  27289. printComments,
  27290. printDanglingComments
  27291. } = require_comments();
  27292. var {
  27293. builders: {
  27294. join,
  27295. line,
  27296. hardline,
  27297. softline,
  27298. group,
  27299. indent,
  27300. ifBreak
  27301. }
  27302. } = require("./doc.js");
  27303. var {
  27304. hasComment,
  27305. CommentCheckFlags
  27306. } = require_utils7();
  27307. var {
  27308. getTypeParametersGroupId
  27309. } = require_type_parameters();
  27310. var {
  27311. printMethod
  27312. } = require_function();
  27313. var {
  27314. printOptionalToken,
  27315. printTypeAnnotation,
  27316. printDefiniteToken
  27317. } = require_misc();
  27318. var {
  27319. printPropertyKey
  27320. } = require_property();
  27321. var {
  27322. printAssignment
  27323. } = require_assignment();
  27324. var {
  27325. printClassMemberDecorators
  27326. } = require_decorators();
  27327. function printClass(path, options, print) {
  27328. const node = path.getValue();
  27329. const parts = [];
  27330. if (node.declare) {
  27331. parts.push("declare ");
  27332. }
  27333. if (node.abstract) {
  27334. parts.push("abstract ");
  27335. }
  27336. parts.push("class");
  27337. const groupMode = node.id && hasComment(node.id, CommentCheckFlags.Trailing) || node.typeParameters && hasComment(node.typeParameters, CommentCheckFlags.Trailing) || node.superClass && hasComment(node.superClass) || isNonEmptyArray(node.extends) || isNonEmptyArray(node.mixins) || isNonEmptyArray(node.implements);
  27338. const partsGroup = [];
  27339. const extendsParts = [];
  27340. if (node.id) {
  27341. partsGroup.push(" ", print("id"));
  27342. }
  27343. partsGroup.push(print("typeParameters"));
  27344. if (node.superClass) {
  27345. const printed = [printSuperClass(path, options, print), print("superTypeParameters")];
  27346. const printedWithComments = path.call((superClass) => ["extends ", printComments(superClass, printed, options)], "superClass");
  27347. if (groupMode) {
  27348. extendsParts.push(line, group(printedWithComments));
  27349. } else {
  27350. extendsParts.push(" ", printedWithComments);
  27351. }
  27352. } else {
  27353. extendsParts.push(printList(path, options, print, "extends"));
  27354. }
  27355. extendsParts.push(printList(path, options, print, "mixins"), printList(path, options, print, "implements"));
  27356. if (groupMode) {
  27357. let printedPartsGroup;
  27358. if (shouldIndentOnlyHeritageClauses(node)) {
  27359. printedPartsGroup = [...partsGroup, indent(extendsParts)];
  27360. } else {
  27361. printedPartsGroup = indent([...partsGroup, extendsParts]);
  27362. }
  27363. parts.push(group(printedPartsGroup, {
  27364. id: getHeritageGroupId(node)
  27365. }));
  27366. } else {
  27367. parts.push(...partsGroup, ...extendsParts);
  27368. }
  27369. parts.push(" ", print("body"));
  27370. return parts;
  27371. }
  27372. var getHeritageGroupId = createGroupIdMapper("heritageGroup");
  27373. function printHardlineAfterHeritage(node) {
  27374. return ifBreak(hardline, "", {
  27375. groupId: getHeritageGroupId(node)
  27376. });
  27377. }
  27378. function hasMultipleHeritage(node) {
  27379. return ["superClass", "extends", "mixins", "implements"].filter((key) => Boolean(node[key])).length > 1;
  27380. }
  27381. function shouldIndentOnlyHeritageClauses(node) {
  27382. return node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line) && !hasMultipleHeritage(node);
  27383. }
  27384. function printList(path, options, print, listName) {
  27385. const node = path.getValue();
  27386. if (!isNonEmptyArray(node[listName])) {
  27387. return "";
  27388. }
  27389. const printedLeadingComments = printDanglingComments(path, options, true, ({
  27390. marker
  27391. }) => marker === listName);
  27392. return [shouldIndentOnlyHeritageClauses(node) ? ifBreak(" ", line, {
  27393. groupId: getTypeParametersGroupId(node.typeParameters)
  27394. }) : line, printedLeadingComments, printedLeadingComments && hardline, listName, group(indent([line, join([",", line], path.map(print, listName))]))];
  27395. }
  27396. function printSuperClass(path, options, print) {
  27397. const printed = print("superClass");
  27398. const parent = path.getParentNode();
  27399. if (parent.type === "AssignmentExpression") {
  27400. return group(ifBreak(["(", indent([softline, printed]), softline, ")"], printed));
  27401. }
  27402. return printed;
  27403. }
  27404. function printClassMethod(path, options, print) {
  27405. const node = path.getValue();
  27406. const parts = [];
  27407. if (isNonEmptyArray(node.decorators)) {
  27408. parts.push(printClassMemberDecorators(path, options, print));
  27409. }
  27410. if (node.accessibility) {
  27411. parts.push(node.accessibility + " ");
  27412. }
  27413. if (node.readonly) {
  27414. parts.push("readonly ");
  27415. }
  27416. if (node.declare) {
  27417. parts.push("declare ");
  27418. }
  27419. if (node.static) {
  27420. parts.push("static ");
  27421. }
  27422. if (node.type === "TSAbstractMethodDefinition" || node.abstract) {
  27423. parts.push("abstract ");
  27424. }
  27425. if (node.override) {
  27426. parts.push("override ");
  27427. }
  27428. parts.push(printMethod(path, options, print));
  27429. return parts;
  27430. }
  27431. function printClassProperty(path, options, print) {
  27432. const node = path.getValue();
  27433. const parts = [];
  27434. const semi = options.semi ? ";" : "";
  27435. if (isNonEmptyArray(node.decorators)) {
  27436. parts.push(printClassMemberDecorators(path, options, print));
  27437. }
  27438. if (node.accessibility) {
  27439. parts.push(node.accessibility + " ");
  27440. }
  27441. if (node.declare) {
  27442. parts.push("declare ");
  27443. }
  27444. if (node.static) {
  27445. parts.push("static ");
  27446. }
  27447. if (node.type === "TSAbstractPropertyDefinition" || node.type === "TSAbstractAccessorProperty" || node.abstract) {
  27448. parts.push("abstract ");
  27449. }
  27450. if (node.override) {
  27451. parts.push("override ");
  27452. }
  27453. if (node.readonly) {
  27454. parts.push("readonly ");
  27455. }
  27456. if (node.variance) {
  27457. parts.push(print("variance"));
  27458. }
  27459. if (node.type === "ClassAccessorProperty" || node.type === "AccessorProperty" || node.type === "TSAbstractAccessorProperty") {
  27460. parts.push("accessor ");
  27461. }
  27462. parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print));
  27463. return [printAssignment(path, options, print, parts, " =", "value"), semi];
  27464. }
  27465. module2.exports = {
  27466. printClass,
  27467. printClassMethod,
  27468. printClassProperty,
  27469. printHardlineAfterHeritage
  27470. };
  27471. }
  27472. });
  27473. var require_interface = __commonJS2({
  27474. "src/language-js/print/interface.js"(exports2, module2) {
  27475. "use strict";
  27476. var {
  27477. isNonEmptyArray
  27478. } = require_util();
  27479. var {
  27480. builders: {
  27481. join,
  27482. line,
  27483. group,
  27484. indent,
  27485. ifBreak
  27486. }
  27487. } = require("./doc.js");
  27488. var {
  27489. hasComment,
  27490. identity,
  27491. CommentCheckFlags
  27492. } = require_utils7();
  27493. var {
  27494. getTypeParametersGroupId
  27495. } = require_type_parameters();
  27496. var {
  27497. printTypeScriptModifiers
  27498. } = require_misc();
  27499. function printInterface(path, options, print) {
  27500. const node = path.getValue();
  27501. const parts = [];
  27502. if (node.declare) {
  27503. parts.push("declare ");
  27504. }
  27505. if (node.type === "TSInterfaceDeclaration") {
  27506. parts.push(node.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print));
  27507. }
  27508. parts.push("interface");
  27509. const partsGroup = [];
  27510. const extendsParts = [];
  27511. if (node.type !== "InterfaceTypeAnnotation") {
  27512. partsGroup.push(" ", print("id"), print("typeParameters"));
  27513. }
  27514. const shouldIndentOnlyHeritageClauses = node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  27515. if (isNonEmptyArray(node.extends)) {
  27516. extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak(" ", line, {
  27517. groupId: getTypeParametersGroupId(node.typeParameters)
  27518. }) : line, "extends ", (node.extends.length === 1 ? identity : indent)(join([",", line], path.map(print, "extends"))));
  27519. }
  27520. if (node.id && hasComment(node.id, CommentCheckFlags.Trailing) || isNonEmptyArray(node.extends)) {
  27521. if (shouldIndentOnlyHeritageClauses) {
  27522. parts.push(group([...partsGroup, indent(extendsParts)]));
  27523. } else {
  27524. parts.push(group(indent([...partsGroup, ...extendsParts])));
  27525. }
  27526. } else {
  27527. parts.push(...partsGroup, ...extendsParts);
  27528. }
  27529. parts.push(" ", print("body"));
  27530. return group(parts);
  27531. }
  27532. module2.exports = {
  27533. printInterface
  27534. };
  27535. }
  27536. });
  27537. var require_module = __commonJS2({
  27538. "src/language-js/print/module.js"(exports2, module2) {
  27539. "use strict";
  27540. var {
  27541. isNonEmptyArray
  27542. } = require_util();
  27543. var {
  27544. builders: {
  27545. softline,
  27546. group,
  27547. indent,
  27548. join,
  27549. line,
  27550. ifBreak,
  27551. hardline
  27552. }
  27553. } = require("./doc.js");
  27554. var {
  27555. printDanglingComments
  27556. } = require_comments();
  27557. var {
  27558. hasComment,
  27559. CommentCheckFlags,
  27560. shouldPrintComma,
  27561. needsHardlineAfterDanglingComment,
  27562. isStringLiteral,
  27563. rawText
  27564. } = require_utils7();
  27565. var {
  27566. locStart,
  27567. hasSameLoc
  27568. } = require_loc();
  27569. var {
  27570. hasDecoratorsBeforeExport,
  27571. printDecoratorsBeforeExport
  27572. } = require_decorators();
  27573. function printImportDeclaration(path, options, print) {
  27574. const node = path.getValue();
  27575. const semi = options.semi ? ";" : "";
  27576. const parts = [];
  27577. const {
  27578. importKind
  27579. } = node;
  27580. parts.push("import");
  27581. if (importKind && importKind !== "value") {
  27582. parts.push(" ", importKind);
  27583. }
  27584. parts.push(printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27585. return parts;
  27586. }
  27587. function printExportDeclaration(path, options, print) {
  27588. const node = path.getValue();
  27589. const parts = [];
  27590. if (hasDecoratorsBeforeExport(node)) {
  27591. parts.push(printDecoratorsBeforeExport(path, options, print));
  27592. }
  27593. const {
  27594. type,
  27595. exportKind,
  27596. declaration
  27597. } = node;
  27598. parts.push("export");
  27599. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27600. if (isDefaultExport) {
  27601. parts.push(" default");
  27602. }
  27603. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27604. parts.push(" ", printDanglingComments(path, options, true));
  27605. if (needsHardlineAfterDanglingComment(node)) {
  27606. parts.push(hardline);
  27607. }
  27608. }
  27609. if (declaration) {
  27610. parts.push(" ", print("declaration"));
  27611. } else {
  27612. parts.push(exportKind === "type" ? " type" : "", printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print));
  27613. }
  27614. if (shouldExportDeclarationPrintSemi(node, options)) {
  27615. parts.push(";");
  27616. }
  27617. return parts;
  27618. }
  27619. function printExportAllDeclaration(path, options, print) {
  27620. const node = path.getValue();
  27621. const semi = options.semi ? ";" : "";
  27622. const parts = [];
  27623. const {
  27624. exportKind,
  27625. exported
  27626. } = node;
  27627. parts.push("export");
  27628. if (exportKind === "type") {
  27629. parts.push(" type");
  27630. }
  27631. parts.push(" *");
  27632. if (exported) {
  27633. parts.push(" as ", print("exported"));
  27634. }
  27635. parts.push(printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27636. return parts;
  27637. }
  27638. function shouldExportDeclarationPrintSemi(node, options) {
  27639. if (!options.semi) {
  27640. return false;
  27641. }
  27642. const {
  27643. type,
  27644. declaration
  27645. } = node;
  27646. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27647. if (!declaration) {
  27648. return true;
  27649. }
  27650. const {
  27651. type: declarationType
  27652. } = declaration;
  27653. if (isDefaultExport && declarationType !== "ClassDeclaration" && declarationType !== "FunctionDeclaration" && declarationType !== "TSInterfaceDeclaration" && declarationType !== "DeclareClass" && declarationType !== "DeclareFunction" && declarationType !== "TSDeclareFunction" && declarationType !== "EnumDeclaration") {
  27654. return true;
  27655. }
  27656. return false;
  27657. }
  27658. function printModuleSource(path, options, print) {
  27659. const node = path.getValue();
  27660. if (!node.source) {
  27661. return "";
  27662. }
  27663. const parts = [];
  27664. if (!shouldNotPrintSpecifiers(node, options)) {
  27665. parts.push(" from");
  27666. }
  27667. parts.push(" ", print("source"));
  27668. return parts;
  27669. }
  27670. function printModuleSpecifiers(path, options, print) {
  27671. const node = path.getValue();
  27672. if (shouldNotPrintSpecifiers(node, options)) {
  27673. return "";
  27674. }
  27675. const parts = [" "];
  27676. if (isNonEmptyArray(node.specifiers)) {
  27677. const standaloneSpecifiers = [];
  27678. const groupedSpecifiers = [];
  27679. path.each(() => {
  27680. const specifierType = path.getValue().type;
  27681. if (specifierType === "ExportNamespaceSpecifier" || specifierType === "ExportDefaultSpecifier" || specifierType === "ImportNamespaceSpecifier" || specifierType === "ImportDefaultSpecifier") {
  27682. standaloneSpecifiers.push(print());
  27683. } else if (specifierType === "ExportSpecifier" || specifierType === "ImportSpecifier") {
  27684. groupedSpecifiers.push(print());
  27685. } else {
  27686. throw new Error(`Unknown specifier type ${JSON.stringify(specifierType)}`);
  27687. }
  27688. }, "specifiers");
  27689. parts.push(join(", ", standaloneSpecifiers));
  27690. if (groupedSpecifiers.length > 0) {
  27691. if (standaloneSpecifiers.length > 0) {
  27692. parts.push(", ");
  27693. }
  27694. const canBreak = groupedSpecifiers.length > 1 || standaloneSpecifiers.length > 0 || node.specifiers.some((node2) => hasComment(node2));
  27695. if (canBreak) {
  27696. parts.push(group(["{", indent([options.bracketSpacing ? line : softline, join([",", line], groupedSpecifiers)]), ifBreak(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line : softline, "}"]));
  27697. } else {
  27698. parts.push(["{", options.bracketSpacing ? " " : "", ...groupedSpecifiers, options.bracketSpacing ? " " : "", "}"]);
  27699. }
  27700. }
  27701. } else {
  27702. parts.push("{}");
  27703. }
  27704. return parts;
  27705. }
  27706. function shouldNotPrintSpecifiers(node, options) {
  27707. const {
  27708. type,
  27709. importKind,
  27710. source,
  27711. specifiers
  27712. } = node;
  27713. if (type !== "ImportDeclaration" || isNonEmptyArray(specifiers) || importKind === "type") {
  27714. return false;
  27715. }
  27716. return !/{\s*}/.test(options.originalText.slice(locStart(node), locStart(source)));
  27717. }
  27718. function printImportAssertions(path, options, print) {
  27719. const node = path.getNode();
  27720. if (isNonEmptyArray(node.assertions)) {
  27721. return [" assert {", options.bracketSpacing ? " " : "", join(", ", path.map(print, "assertions")), options.bracketSpacing ? " " : "", "}"];
  27722. }
  27723. return "";
  27724. }
  27725. function printModuleSpecifier(path, options, print) {
  27726. const node = path.getNode();
  27727. const {
  27728. type
  27729. } = node;
  27730. const parts = [];
  27731. const kind = type === "ImportSpecifier" ? node.importKind : node.exportKind;
  27732. if (kind && kind !== "value") {
  27733. parts.push(kind, " ");
  27734. }
  27735. const isImport = type.startsWith("Import");
  27736. const leftSideProperty = isImport ? "imported" : "local";
  27737. const rightSideProperty = isImport ? "local" : "exported";
  27738. const leftSideNode = node[leftSideProperty];
  27739. const rightSideNode = node[rightSideProperty];
  27740. let left = "";
  27741. let right = "";
  27742. if (type === "ExportNamespaceSpecifier" || type === "ImportNamespaceSpecifier") {
  27743. left = "*";
  27744. } else if (leftSideNode) {
  27745. left = print(leftSideProperty);
  27746. }
  27747. if (rightSideNode && !isShorthandSpecifier(node)) {
  27748. right = print(rightSideProperty);
  27749. }
  27750. parts.push(left, left && right ? " as " : "", right);
  27751. return parts;
  27752. }
  27753. function isShorthandSpecifier(specifier) {
  27754. if (specifier.type !== "ImportSpecifier" && specifier.type !== "ExportSpecifier") {
  27755. return false;
  27756. }
  27757. const {
  27758. local,
  27759. [specifier.type === "ImportSpecifier" ? "imported" : "exported"]: importedOrExported
  27760. } = specifier;
  27761. if (local.type !== importedOrExported.type || !hasSameLoc(local, importedOrExported)) {
  27762. return false;
  27763. }
  27764. if (isStringLiteral(local)) {
  27765. return local.value === importedOrExported.value && rawText(local) === rawText(importedOrExported);
  27766. }
  27767. switch (local.type) {
  27768. case "Identifier":
  27769. return local.name === importedOrExported.name;
  27770. default:
  27771. return false;
  27772. }
  27773. }
  27774. module2.exports = {
  27775. printImportDeclaration,
  27776. printExportDeclaration,
  27777. printExportAllDeclaration,
  27778. printModuleSpecifier
  27779. };
  27780. }
  27781. });
  27782. var require_object = __commonJS2({
  27783. "src/language-js/print/object.js"(exports2, module2) {
  27784. "use strict";
  27785. var {
  27786. printDanglingComments
  27787. } = require_comments();
  27788. var {
  27789. builders: {
  27790. line,
  27791. softline,
  27792. group,
  27793. indent,
  27794. ifBreak,
  27795. hardline
  27796. }
  27797. } = require("./doc.js");
  27798. var {
  27799. getLast,
  27800. hasNewlineInRange,
  27801. hasNewline,
  27802. isNonEmptyArray
  27803. } = require_util();
  27804. var {
  27805. shouldPrintComma,
  27806. hasComment,
  27807. getComments,
  27808. CommentCheckFlags,
  27809. isNextLineEmpty
  27810. } = require_utils7();
  27811. var {
  27812. locStart,
  27813. locEnd
  27814. } = require_loc();
  27815. var {
  27816. printOptionalToken,
  27817. printTypeAnnotation
  27818. } = require_misc();
  27819. var {
  27820. shouldHugFunctionParameters
  27821. } = require_function_parameters();
  27822. var {
  27823. shouldHugType
  27824. } = require_type_annotation();
  27825. var {
  27826. printHardlineAfterHeritage
  27827. } = require_class();
  27828. function printObject(path, options, print) {
  27829. const semi = options.semi ? ";" : "";
  27830. const node = path.getValue();
  27831. let propertiesField;
  27832. if (node.type === "TSTypeLiteral") {
  27833. propertiesField = "members";
  27834. } else if (node.type === "TSInterfaceBody") {
  27835. propertiesField = "body";
  27836. } else {
  27837. propertiesField = "properties";
  27838. }
  27839. const isTypeAnnotation = node.type === "ObjectTypeAnnotation";
  27840. const fields = [propertiesField];
  27841. if (isTypeAnnotation) {
  27842. fields.push("indexers", "callProperties", "internalSlots");
  27843. }
  27844. const firstProperty = fields.map((field) => node[field][0]).sort((a, b) => locStart(a) - locStart(b))[0];
  27845. const parent = path.getParentNode(0);
  27846. const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
  27847. const shouldBreak = node.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || node.type === "ObjectPattern" && parent.type !== "FunctionDeclaration" && parent.type !== "FunctionExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "ObjectMethod" && parent.type !== "ClassMethod" && parent.type !== "ClassPrivateMethod" && parent.type !== "AssignmentPattern" && parent.type !== "CatchClause" && node.properties.some((property) => property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern")) || node.type !== "ObjectPattern" && firstProperty && hasNewlineInRange(options.originalText, locStart(node), locStart(firstProperty));
  27848. const separator = isFlowInterfaceLikeBody ? ";" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" ? ifBreak(semi, ";") : ",";
  27849. const leftBrace = node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
  27850. const rightBrace = node.exact ? "|}" : "}";
  27851. const propsAndLoc = [];
  27852. for (const field of fields) {
  27853. path.each((childPath) => {
  27854. const node2 = childPath.getValue();
  27855. propsAndLoc.push({
  27856. node: node2,
  27857. printed: print(),
  27858. loc: locStart(node2)
  27859. });
  27860. }, field);
  27861. }
  27862. if (fields.length > 1) {
  27863. propsAndLoc.sort((a, b) => a.loc - b.loc);
  27864. }
  27865. let separatorParts = [];
  27866. const props = propsAndLoc.map((prop) => {
  27867. const result = [...separatorParts, group(prop.printed)];
  27868. separatorParts = [separator, line];
  27869. if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasComment(prop.node, CommentCheckFlags.PrettierIgnore)) {
  27870. separatorParts.shift();
  27871. }
  27872. if (isNextLineEmpty(prop.node, options)) {
  27873. separatorParts.push(hardline);
  27874. }
  27875. return result;
  27876. });
  27877. if (node.inexact) {
  27878. let printed;
  27879. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27880. const hasLineComments = hasComment(node, CommentCheckFlags.Line);
  27881. const printedDanglingComments = printDanglingComments(path, options, true);
  27882. printed = [printedDanglingComments, hasLineComments || hasNewline(options.originalText, locEnd(getLast(getComments(node)))) ? hardline : line, "..."];
  27883. } else {
  27884. printed = ["..."];
  27885. }
  27886. props.push([...separatorParts, ...printed]);
  27887. }
  27888. const lastElem = getLast(node[propertiesField]);
  27889. const canHaveTrailingSeparator = !(node.inexact || lastElem && lastElem.type === "RestElement" || lastElem && (lastElem.type === "TSPropertySignature" || lastElem.type === "TSCallSignatureDeclaration" || lastElem.type === "TSMethodSignature" || lastElem.type === "TSConstructSignatureDeclaration") && hasComment(lastElem, CommentCheckFlags.PrettierIgnore));
  27890. let content;
  27891. if (props.length === 0) {
  27892. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  27893. return [leftBrace, rightBrace, printTypeAnnotation(path, options, print)];
  27894. }
  27895. content = group([leftBrace, printDanglingComments(path, options), softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
  27896. } else {
  27897. content = [isFlowInterfaceLikeBody && isNonEmptyArray(node.properties) ? printHardlineAfterHeritage(parent) : "", leftBrace, indent([options.bracketSpacing ? line : softline, ...props]), ifBreak(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma(options)) ? separator : ""), options.bracketSpacing ? line : softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)];
  27898. }
  27899. if (path.match((node2) => node2.type === "ObjectPattern" && !node2.decorators, (node2, name, number) => shouldHugFunctionParameters(node2) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || path.match(shouldHugType, (node2, name) => name === "typeAnnotation", (node2, name) => name === "typeAnnotation", (node2, name, number) => shouldHugFunctionParameters(node2) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || !shouldBreak && path.match((node2) => node2.type === "ObjectPattern", (node2) => node2.type === "AssignmentExpression" || node2.type === "VariableDeclarator")) {
  27900. return content;
  27901. }
  27902. return group(content, {
  27903. shouldBreak
  27904. });
  27905. }
  27906. module2.exports = {
  27907. printObject
  27908. };
  27909. }
  27910. });
  27911. var require_flow = __commonJS2({
  27912. "src/language-js/print/flow.js"(exports2, module2) {
  27913. "use strict";
  27914. var assert = require("assert");
  27915. var {
  27916. printDanglingComments
  27917. } = require_comments();
  27918. var {
  27919. printString,
  27920. printNumber
  27921. } = require_util();
  27922. var {
  27923. builders: {
  27924. hardline,
  27925. softline,
  27926. group,
  27927. indent
  27928. }
  27929. } = require("./doc.js");
  27930. var {
  27931. getParentExportDeclaration,
  27932. isFunctionNotation,
  27933. isGetterOrSetter,
  27934. rawText,
  27935. shouldPrintComma
  27936. } = require_utils7();
  27937. var {
  27938. locStart,
  27939. locEnd
  27940. } = require_loc();
  27941. var {
  27942. replaceTextEndOfLine
  27943. } = require_doc_utils();
  27944. var {
  27945. printClass
  27946. } = require_class();
  27947. var {
  27948. printOpaqueType,
  27949. printTypeAlias,
  27950. printIntersectionType,
  27951. printUnionType,
  27952. printFunctionType,
  27953. printTupleType,
  27954. printIndexedAccessType
  27955. } = require_type_annotation();
  27956. var {
  27957. printInterface
  27958. } = require_interface();
  27959. var {
  27960. printTypeParameter,
  27961. printTypeParameters
  27962. } = require_type_parameters();
  27963. var {
  27964. printExportDeclaration,
  27965. printExportAllDeclaration
  27966. } = require_module();
  27967. var {
  27968. printArrayItems
  27969. } = require_array4();
  27970. var {
  27971. printObject
  27972. } = require_object();
  27973. var {
  27974. printPropertyKey
  27975. } = require_property();
  27976. var {
  27977. printOptionalToken,
  27978. printTypeAnnotation,
  27979. printRestSpread
  27980. } = require_misc();
  27981. function printFlow(path, options, print) {
  27982. const node = path.getValue();
  27983. const semi = options.semi ? ";" : "";
  27984. const parts = [];
  27985. switch (node.type) {
  27986. case "DeclareClass":
  27987. return printFlowDeclaration(path, printClass(path, options, print));
  27988. case "DeclareFunction":
  27989. return printFlowDeclaration(path, ["function ", print("id"), node.predicate ? " " : "", print("predicate"), semi]);
  27990. case "DeclareModule":
  27991. return printFlowDeclaration(path, ["module ", print("id"), " ", print("body")]);
  27992. case "DeclareModuleExports":
  27993. return printFlowDeclaration(path, ["module.exports", ": ", print("typeAnnotation"), semi]);
  27994. case "DeclareVariable":
  27995. return printFlowDeclaration(path, ["var ", print("id"), semi]);
  27996. case "DeclareOpaqueType":
  27997. return printFlowDeclaration(path, printOpaqueType(path, options, print));
  27998. case "DeclareInterface":
  27999. return printFlowDeclaration(path, printInterface(path, options, print));
  28000. case "DeclareTypeAlias":
  28001. return printFlowDeclaration(path, printTypeAlias(path, options, print));
  28002. case "DeclareExportDeclaration":
  28003. return printFlowDeclaration(path, printExportDeclaration(path, options, print));
  28004. case "DeclareExportAllDeclaration":
  28005. return printFlowDeclaration(path, printExportAllDeclaration(path, options, print));
  28006. case "OpaqueType":
  28007. return printOpaqueType(path, options, print);
  28008. case "TypeAlias":
  28009. return printTypeAlias(path, options, print);
  28010. case "IntersectionTypeAnnotation":
  28011. return printIntersectionType(path, options, print);
  28012. case "UnionTypeAnnotation":
  28013. return printUnionType(path, options, print);
  28014. case "FunctionTypeAnnotation":
  28015. return printFunctionType(path, options, print);
  28016. case "TupleTypeAnnotation":
  28017. return printTupleType(path, options, print);
  28018. case "GenericTypeAnnotation":
  28019. return [print("id"), printTypeParameters(path, options, print, "typeParameters")];
  28020. case "IndexedAccessType":
  28021. case "OptionalIndexedAccessType":
  28022. return printIndexedAccessType(path, options, print);
  28023. case "TypeAnnotation":
  28024. return print("typeAnnotation");
  28025. case "TypeParameter":
  28026. return printTypeParameter(path, options, print);
  28027. case "TypeofTypeAnnotation":
  28028. return ["typeof ", print("argument")];
  28029. case "ExistsTypeAnnotation":
  28030. return "*";
  28031. case "EmptyTypeAnnotation":
  28032. return "empty";
  28033. case "MixedTypeAnnotation":
  28034. return "mixed";
  28035. case "ArrayTypeAnnotation":
  28036. return [print("elementType"), "[]"];
  28037. case "BooleanLiteralTypeAnnotation":
  28038. return String(node.value);
  28039. case "EnumDeclaration":
  28040. return ["enum ", print("id"), " ", print("body")];
  28041. case "EnumBooleanBody":
  28042. case "EnumNumberBody":
  28043. case "EnumStringBody":
  28044. case "EnumSymbolBody": {
  28045. if (node.type === "EnumSymbolBody" || node.explicitType) {
  28046. let type = null;
  28047. switch (node.type) {
  28048. case "EnumBooleanBody":
  28049. type = "boolean";
  28050. break;
  28051. case "EnumNumberBody":
  28052. type = "number";
  28053. break;
  28054. case "EnumStringBody":
  28055. type = "string";
  28056. break;
  28057. case "EnumSymbolBody":
  28058. type = "symbol";
  28059. break;
  28060. }
  28061. parts.push("of ", type, " ");
  28062. }
  28063. if (node.members.length === 0 && !node.hasUnknownMembers) {
  28064. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  28065. } else {
  28066. const members = node.members.length > 0 ? [hardline, printArrayItems(path, options, "members", print), node.hasUnknownMembers || shouldPrintComma(options) ? "," : ""] : [];
  28067. parts.push(group(["{", indent([...members, ...node.hasUnknownMembers ? [hardline, "..."] : []]), printDanglingComments(path, options, true), hardline, "}"]));
  28068. }
  28069. return parts;
  28070. }
  28071. case "EnumBooleanMember":
  28072. case "EnumNumberMember":
  28073. case "EnumStringMember":
  28074. return [print("id"), " = ", typeof node.init === "object" ? print("init") : String(node.init)];
  28075. case "EnumDefaultedMember":
  28076. return print("id");
  28077. case "FunctionTypeParam": {
  28078. const name = node.name ? print("name") : path.getParentNode().this === node ? "this" : "";
  28079. return [name, printOptionalToken(path), name ? ": " : "", print("typeAnnotation")];
  28080. }
  28081. case "InterfaceDeclaration":
  28082. case "InterfaceTypeAnnotation":
  28083. return printInterface(path, options, print);
  28084. case "ClassImplements":
  28085. case "InterfaceExtends":
  28086. return [print("id"), print("typeParameters")];
  28087. case "NullableTypeAnnotation":
  28088. return ["?", print("typeAnnotation")];
  28089. case "Variance": {
  28090. const {
  28091. kind
  28092. } = node;
  28093. assert.ok(kind === "plus" || kind === "minus");
  28094. return kind === "plus" ? "+" : "-";
  28095. }
  28096. case "ObjectTypeCallProperty":
  28097. if (node.static) {
  28098. parts.push("static ");
  28099. }
  28100. parts.push(print("value"));
  28101. return parts;
  28102. case "ObjectTypeIndexer": {
  28103. return [node.static ? "static " : "", node.variance ? print("variance") : "", "[", print("id"), node.id ? ": " : "", print("key"), "]: ", print("value")];
  28104. }
  28105. case "ObjectTypeProperty": {
  28106. let modifier = "";
  28107. if (node.proto) {
  28108. modifier = "proto ";
  28109. } else if (node.static) {
  28110. modifier = "static ";
  28111. }
  28112. return [modifier, isGetterOrSetter(node) ? node.kind + " " : "", node.variance ? print("variance") : "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation(node) ? "" : ": ", print("value")];
  28113. }
  28114. case "ObjectTypeAnnotation":
  28115. return printObject(path, options, print);
  28116. case "ObjectTypeInternalSlot":
  28117. return [node.static ? "static " : "", "[[", print("id"), "]]", printOptionalToken(path), node.method ? "" : ": ", print("value")];
  28118. case "ObjectTypeSpreadProperty":
  28119. return printRestSpread(path, options, print);
  28120. case "QualifiedTypeofIdentifier":
  28121. case "QualifiedTypeIdentifier":
  28122. return [print("qualification"), ".", print("id")];
  28123. case "StringLiteralTypeAnnotation":
  28124. return replaceTextEndOfLine(printString(rawText(node), options));
  28125. case "NumberLiteralTypeAnnotation":
  28126. assert.strictEqual(typeof node.value, "number");
  28127. case "BigIntLiteralTypeAnnotation":
  28128. if (node.extra) {
  28129. return printNumber(node.extra.raw);
  28130. }
  28131. return printNumber(node.raw);
  28132. case "TypeCastExpression": {
  28133. return ["(", print("expression"), printTypeAnnotation(path, options, print), ")"];
  28134. }
  28135. case "TypeParameterDeclaration":
  28136. case "TypeParameterInstantiation": {
  28137. const printed = printTypeParameters(path, options, print, "params");
  28138. if (options.parser === "flow") {
  28139. const start = locStart(node);
  28140. const end = locEnd(node);
  28141. const commentStartIndex = options.originalText.lastIndexOf("/*", start);
  28142. const commentEndIndex = options.originalText.indexOf("*/", end);
  28143. if (commentStartIndex !== -1 && commentEndIndex !== -1) {
  28144. const comment = options.originalText.slice(commentStartIndex + 2, commentEndIndex).trim();
  28145. if (comment.startsWith("::") && !comment.includes("/*") && !comment.includes("*/")) {
  28146. return ["/*:: ", printed, " */"];
  28147. }
  28148. }
  28149. }
  28150. return printed;
  28151. }
  28152. case "InferredPredicate":
  28153. return "%checks";
  28154. case "DeclaredPredicate":
  28155. return ["%checks(", print("value"), ")"];
  28156. case "AnyTypeAnnotation":
  28157. return "any";
  28158. case "BooleanTypeAnnotation":
  28159. return "boolean";
  28160. case "BigIntTypeAnnotation":
  28161. return "bigint";
  28162. case "NullLiteralTypeAnnotation":
  28163. return "null";
  28164. case "NumberTypeAnnotation":
  28165. return "number";
  28166. case "SymbolTypeAnnotation":
  28167. return "symbol";
  28168. case "StringTypeAnnotation":
  28169. return "string";
  28170. case "VoidTypeAnnotation":
  28171. return "void";
  28172. case "ThisTypeAnnotation":
  28173. return "this";
  28174. case "Node":
  28175. case "Printable":
  28176. case "SourceLocation":
  28177. case "Position":
  28178. case "Statement":
  28179. case "Function":
  28180. case "Pattern":
  28181. case "Expression":
  28182. case "Declaration":
  28183. case "Specifier":
  28184. case "NamedSpecifier":
  28185. case "Comment":
  28186. case "MemberTypeAnnotation":
  28187. case "Type":
  28188. throw new Error("unprintable type: " + JSON.stringify(node.type));
  28189. }
  28190. }
  28191. function printFlowDeclaration(path, printed) {
  28192. const parentExportDecl = getParentExportDeclaration(path);
  28193. if (parentExportDecl) {
  28194. assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
  28195. return printed;
  28196. }
  28197. return ["declare ", printed];
  28198. }
  28199. module2.exports = {
  28200. printFlow
  28201. };
  28202. }
  28203. });
  28204. var require_is_ts_keyword_type = __commonJS2({
  28205. "src/language-js/utils/is-ts-keyword-type.js"(exports2, module2) {
  28206. "use strict";
  28207. function isTsKeywordType({
  28208. type
  28209. }) {
  28210. return type.startsWith("TS") && type.endsWith("Keyword");
  28211. }
  28212. module2.exports = isTsKeywordType;
  28213. }
  28214. });
  28215. var require_ternary = __commonJS2({
  28216. "src/language-js/print/ternary.js"(exports2, module2) {
  28217. "use strict";
  28218. var {
  28219. hasNewlineInRange
  28220. } = require_util();
  28221. var {
  28222. isJsxNode,
  28223. getComments,
  28224. isCallExpression,
  28225. isMemberExpression,
  28226. isTSTypeExpression
  28227. } = require_utils7();
  28228. var {
  28229. locStart,
  28230. locEnd
  28231. } = require_loc();
  28232. var isBlockComment = require_is_block_comment();
  28233. var {
  28234. builders: {
  28235. line,
  28236. softline,
  28237. group,
  28238. indent,
  28239. align,
  28240. ifBreak,
  28241. dedent,
  28242. breakParent
  28243. }
  28244. } = require("./doc.js");
  28245. function conditionalExpressionChainContainsJsx(node) {
  28246. const conditionalExpressions = [node];
  28247. for (let index = 0; index < conditionalExpressions.length; index++) {
  28248. const conditionalExpression = conditionalExpressions[index];
  28249. for (const property of ["test", "consequent", "alternate"]) {
  28250. const node2 = conditionalExpression[property];
  28251. if (isJsxNode(node2)) {
  28252. return true;
  28253. }
  28254. if (node2.type === "ConditionalExpression") {
  28255. conditionalExpressions.push(node2);
  28256. }
  28257. }
  28258. }
  28259. return false;
  28260. }
  28261. function printTernaryTest(path, options, print) {
  28262. const node = path.getValue();
  28263. const isConditionalExpression = node.type === "ConditionalExpression";
  28264. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  28265. const parent = path.getParentNode();
  28266. const printed = isConditionalExpression ? print("test") : [print("checkType"), " ", "extends", " ", print("extendsType")];
  28267. if (parent.type === node.type && parent[alternateNodePropertyName] === node) {
  28268. return align(2, printed);
  28269. }
  28270. return printed;
  28271. }
  28272. var ancestorNameMap = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"]]);
  28273. function shouldExtraIndentForConditionalExpression(path) {
  28274. const node = path.getValue();
  28275. if (node.type !== "ConditionalExpression") {
  28276. return false;
  28277. }
  28278. let parent;
  28279. let child = node;
  28280. for (let ancestorCount = 0; !parent; ancestorCount++) {
  28281. const node2 = path.getParentNode(ancestorCount);
  28282. if (isCallExpression(node2) && node2.callee === child || isMemberExpression(node2) && node2.object === child || node2.type === "TSNonNullExpression" && node2.expression === child) {
  28283. child = node2;
  28284. continue;
  28285. }
  28286. if (node2.type === "NewExpression" && node2.callee === child || isTSTypeExpression(node2) && node2.expression === child) {
  28287. parent = path.getParentNode(ancestorCount + 1);
  28288. child = node2;
  28289. } else {
  28290. parent = node2;
  28291. }
  28292. }
  28293. if (child === node) {
  28294. return false;
  28295. }
  28296. return parent[ancestorNameMap.get(parent.type)] === child;
  28297. }
  28298. function printTernary(path, options, print) {
  28299. const node = path.getValue();
  28300. const isConditionalExpression = node.type === "ConditionalExpression";
  28301. const consequentNodePropertyName = isConditionalExpression ? "consequent" : "trueType";
  28302. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  28303. const testNodePropertyNames = isConditionalExpression ? ["test"] : ["checkType", "extendsType"];
  28304. const consequentNode = node[consequentNodePropertyName];
  28305. const alternateNode = node[alternateNodePropertyName];
  28306. const parts = [];
  28307. let jsxMode = false;
  28308. const parent = path.getParentNode();
  28309. const isParentTest = parent.type === node.type && testNodePropertyNames.some((prop) => parent[prop] === node);
  28310. let forceNoIndent = parent.type === node.type && !isParentTest;
  28311. let currentParent;
  28312. let previousParent;
  28313. let i = 0;
  28314. do {
  28315. previousParent = currentParent || node;
  28316. currentParent = path.getParentNode(i);
  28317. i++;
  28318. } while (currentParent && currentParent.type === node.type && testNodePropertyNames.every((prop) => currentParent[prop] !== previousParent));
  28319. const firstNonConditionalParent = currentParent || parent;
  28320. const lastConditionalParent = previousParent;
  28321. if (isConditionalExpression && (isJsxNode(node[testNodePropertyNames[0]]) || isJsxNode(consequentNode) || isJsxNode(alternateNode) || conditionalExpressionChainContainsJsx(lastConditionalParent))) {
  28322. jsxMode = true;
  28323. forceNoIndent = true;
  28324. const wrap = (doc2) => [ifBreak("("), indent([softline, doc2]), softline, ifBreak(")")];
  28325. const isNil = (node2) => node2.type === "NullLiteral" || node2.type === "Literal" && node2.value === null || node2.type === "Identifier" && node2.name === "undefined";
  28326. parts.push(" ? ", isNil(consequentNode) ? print(consequentNodePropertyName) : wrap(print(consequentNodePropertyName)), " : ", alternateNode.type === node.type || isNil(alternateNode) ? print(alternateNodePropertyName) : wrap(print(alternateNodePropertyName)));
  28327. } else {
  28328. const part = [line, "? ", consequentNode.type === node.type ? ifBreak("", "(") : "", align(2, print(consequentNodePropertyName)), consequentNode.type === node.type ? ifBreak("", ")") : "", line, ": ", alternateNode.type === node.type ? print(alternateNodePropertyName) : align(2, print(alternateNodePropertyName))];
  28329. parts.push(parent.type !== node.type || parent[alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent(indent(part)) : align(Math.max(0, options.tabWidth - 2), part));
  28330. }
  28331. const comments = [...testNodePropertyNames.map((propertyName) => getComments(node[propertyName])), getComments(consequentNode), getComments(alternateNode)].flat();
  28332. const shouldBreak = comments.some((comment) => isBlockComment(comment) && hasNewlineInRange(options.originalText, locStart(comment), locEnd(comment)));
  28333. const maybeGroup = (doc2) => parent === firstNonConditionalParent ? group(doc2, {
  28334. shouldBreak
  28335. }) : shouldBreak ? [doc2, breakParent] : doc2;
  28336. const breakClosingParen = !jsxMode && (isMemberExpression(parent) || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
  28337. const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
  28338. const result = maybeGroup([printTernaryTest(path, options, print), forceNoIndent ? parts : indent(parts), isConditionalExpression && breakClosingParen && !shouldExtraIndent ? softline : ""]);
  28339. return isParentTest || shouldExtraIndent ? group([indent([softline, result]), softline]) : result;
  28340. }
  28341. module2.exports = {
  28342. printTernary
  28343. };
  28344. }
  28345. });
  28346. var require_statement = __commonJS2({
  28347. "src/language-js/print/statement.js"(exports2, module2) {
  28348. "use strict";
  28349. var {
  28350. builders: {
  28351. hardline
  28352. }
  28353. } = require("./doc.js");
  28354. var pathNeedsParens = require_needs_parens();
  28355. var {
  28356. getLeftSidePathName,
  28357. hasNakedLeftSide,
  28358. isJsxNode,
  28359. isTheOnlyJsxElementInMarkdown,
  28360. hasComment,
  28361. CommentCheckFlags,
  28362. isNextLineEmpty
  28363. } = require_utils7();
  28364. var {
  28365. shouldPrintParamsWithoutParens
  28366. } = require_function();
  28367. function printStatementSequence(path, options, print, property) {
  28368. const node = path.getValue();
  28369. const parts = [];
  28370. const isClassBody = node.type === "ClassBody";
  28371. const lastStatement = getLastStatement(node[property]);
  28372. path.each((path2, index, statements) => {
  28373. const node2 = path2.getValue();
  28374. if (node2.type === "EmptyStatement") {
  28375. return;
  28376. }
  28377. const printed = print();
  28378. if (!options.semi && !isClassBody && !isTheOnlyJsxElementInMarkdown(options, path2) && statementNeedsASIProtection(path2, options)) {
  28379. if (hasComment(node2, CommentCheckFlags.Leading)) {
  28380. parts.push(print([], {
  28381. needsSemi: true
  28382. }));
  28383. } else {
  28384. parts.push(";", printed);
  28385. }
  28386. } else {
  28387. parts.push(printed);
  28388. }
  28389. if (!options.semi && isClassBody && isClassProperty(node2) && shouldPrintSemicolonAfterClassProperty(node2, statements[index + 1])) {
  28390. parts.push(";");
  28391. }
  28392. if (node2 !== lastStatement) {
  28393. parts.push(hardline);
  28394. if (isNextLineEmpty(node2, options)) {
  28395. parts.push(hardline);
  28396. }
  28397. }
  28398. }, property);
  28399. return parts;
  28400. }
  28401. function getLastStatement(statements) {
  28402. for (let i = statements.length - 1; i >= 0; i--) {
  28403. const statement = statements[i];
  28404. if (statement.type !== "EmptyStatement") {
  28405. return statement;
  28406. }
  28407. }
  28408. }
  28409. function statementNeedsASIProtection(path, options) {
  28410. const node = path.getNode();
  28411. if (node.type !== "ExpressionStatement") {
  28412. return false;
  28413. }
  28414. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), "expression");
  28415. }
  28416. function expressionNeedsASIProtection(path, options) {
  28417. const node = path.getValue();
  28418. switch (node.type) {
  28419. case "ParenthesizedExpression":
  28420. case "TypeCastExpression":
  28421. case "ArrayExpression":
  28422. case "ArrayPattern":
  28423. case "TemplateLiteral":
  28424. case "TemplateElement":
  28425. case "RegExpLiteral":
  28426. return true;
  28427. case "ArrowFunctionExpression": {
  28428. if (!shouldPrintParamsWithoutParens(path, options)) {
  28429. return true;
  28430. }
  28431. break;
  28432. }
  28433. case "UnaryExpression": {
  28434. const {
  28435. prefix,
  28436. operator
  28437. } = node;
  28438. if (prefix && (operator === "+" || operator === "-")) {
  28439. return true;
  28440. }
  28441. break;
  28442. }
  28443. case "BindExpression": {
  28444. if (!node.object) {
  28445. return true;
  28446. }
  28447. break;
  28448. }
  28449. case "Literal": {
  28450. if (node.regex) {
  28451. return true;
  28452. }
  28453. break;
  28454. }
  28455. default: {
  28456. if (isJsxNode(node)) {
  28457. return true;
  28458. }
  28459. }
  28460. }
  28461. if (pathNeedsParens(path, options)) {
  28462. return true;
  28463. }
  28464. if (!hasNakedLeftSide(node)) {
  28465. return false;
  28466. }
  28467. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), ...getLeftSidePathName(path, node));
  28468. }
  28469. function printBody(path, options, print) {
  28470. return printStatementSequence(path, options, print, "body");
  28471. }
  28472. function printSwitchCaseConsequent(path, options, print) {
  28473. return printStatementSequence(path, options, print, "consequent");
  28474. }
  28475. var isClassProperty = ({
  28476. type
  28477. }) => type === "ClassProperty" || type === "PropertyDefinition" || type === "ClassPrivateProperty" || type === "ClassAccessorProperty" || type === "AccessorProperty" || type === "TSAbstractPropertyDefinition" || type === "TSAbstractAccessorProperty";
  28478. function shouldPrintSemicolonAfterClassProperty(node, nextNode) {
  28479. const {
  28480. name
  28481. } = node.key;
  28482. if ((name === "static" || name === "get" || name === "set" || name === "accessor") && !node.value && !node.typeAnnotation) {
  28483. return true;
  28484. }
  28485. if (!nextNode) {
  28486. return false;
  28487. }
  28488. if (nextNode.static || nextNode.accessibility) {
  28489. return false;
  28490. }
  28491. if (!nextNode.computed) {
  28492. const name2 = nextNode.key && nextNode.key.name;
  28493. if (name2 === "in" || name2 === "instanceof") {
  28494. return true;
  28495. }
  28496. }
  28497. if (isClassProperty(nextNode) && nextNode.variance && !nextNode.static && !nextNode.declare) {
  28498. return true;
  28499. }
  28500. switch (nextNode.type) {
  28501. case "ClassProperty":
  28502. case "PropertyDefinition":
  28503. case "TSAbstractPropertyDefinition":
  28504. return nextNode.computed;
  28505. case "MethodDefinition":
  28506. case "TSAbstractMethodDefinition":
  28507. case "ClassMethod":
  28508. case "ClassPrivateMethod": {
  28509. const isAsync = nextNode.value ? nextNode.value.async : nextNode.async;
  28510. if (isAsync || nextNode.kind === "get" || nextNode.kind === "set") {
  28511. return false;
  28512. }
  28513. const isGenerator = nextNode.value ? nextNode.value.generator : nextNode.generator;
  28514. if (nextNode.computed || isGenerator) {
  28515. return true;
  28516. }
  28517. return false;
  28518. }
  28519. case "TSIndexSignature":
  28520. return true;
  28521. }
  28522. return false;
  28523. }
  28524. module2.exports = {
  28525. printBody,
  28526. printSwitchCaseConsequent
  28527. };
  28528. }
  28529. });
  28530. var require_block = __commonJS2({
  28531. "src/language-js/print/block.js"(exports2, module2) {
  28532. "use strict";
  28533. var {
  28534. printDanglingComments
  28535. } = require_comments();
  28536. var {
  28537. isNonEmptyArray
  28538. } = require_util();
  28539. var {
  28540. builders: {
  28541. hardline,
  28542. indent
  28543. }
  28544. } = require("./doc.js");
  28545. var {
  28546. hasComment,
  28547. CommentCheckFlags,
  28548. isNextLineEmpty
  28549. } = require_utils7();
  28550. var {
  28551. printHardlineAfterHeritage
  28552. } = require_class();
  28553. var {
  28554. printBody
  28555. } = require_statement();
  28556. function printBlock(path, options, print) {
  28557. const node = path.getValue();
  28558. const parts = [];
  28559. if (node.type === "StaticBlock") {
  28560. parts.push("static ");
  28561. }
  28562. if (node.type === "ClassBody" && isNonEmptyArray(node.body)) {
  28563. const parent = path.getParentNode();
  28564. parts.push(printHardlineAfterHeritage(parent));
  28565. }
  28566. parts.push("{");
  28567. const printed = printBlockBody(path, options, print);
  28568. if (printed) {
  28569. parts.push(indent([hardline, printed]), hardline);
  28570. } else {
  28571. const parent = path.getParentNode();
  28572. const parentParent = path.getParentNode(1);
  28573. if (!(parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ObjectMethod" || parent.type === "ClassMethod" || parent.type === "ClassPrivateMethod" || parent.type === "ForStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || parent.type === "CatchClause" && !parentParent.finalizer || parent.type === "TSModuleDeclaration" || parent.type === "TSDeclareFunction" || node.type === "StaticBlock" || node.type === "ClassBody")) {
  28574. parts.push(hardline);
  28575. }
  28576. }
  28577. parts.push("}");
  28578. return parts;
  28579. }
  28580. function printBlockBody(path, options, print) {
  28581. const node = path.getValue();
  28582. const nodeHasDirectives = isNonEmptyArray(node.directives);
  28583. const nodeHasBody = node.body.some((node2) => node2.type !== "EmptyStatement");
  28584. const nodeHasComment = hasComment(node, CommentCheckFlags.Dangling);
  28585. if (!nodeHasDirectives && !nodeHasBody && !nodeHasComment) {
  28586. return "";
  28587. }
  28588. const parts = [];
  28589. if (nodeHasDirectives) {
  28590. path.each((childPath, index, directives) => {
  28591. parts.push(print());
  28592. if (index < directives.length - 1 || nodeHasBody || nodeHasComment) {
  28593. parts.push(hardline);
  28594. if (isNextLineEmpty(childPath.getValue(), options)) {
  28595. parts.push(hardline);
  28596. }
  28597. }
  28598. }, "directives");
  28599. }
  28600. if (nodeHasBody) {
  28601. parts.push(printBody(path, options, print));
  28602. }
  28603. if (nodeHasComment) {
  28604. parts.push(printDanglingComments(path, options, true));
  28605. }
  28606. if (node.type === "Program") {
  28607. const parent = path.getParentNode();
  28608. if (!parent || parent.type !== "ModuleExpression") {
  28609. parts.push(hardline);
  28610. }
  28611. }
  28612. return parts;
  28613. }
  28614. module2.exports = {
  28615. printBlock,
  28616. printBlockBody
  28617. };
  28618. }
  28619. });
  28620. var require_typescript = __commonJS2({
  28621. "src/language-js/print/typescript.js"(exports2, module2) {
  28622. "use strict";
  28623. var {
  28624. printDanglingComments
  28625. } = require_comments();
  28626. var {
  28627. hasNewlineInRange
  28628. } = require_util();
  28629. var {
  28630. builders: {
  28631. join,
  28632. line,
  28633. hardline,
  28634. softline,
  28635. group,
  28636. indent,
  28637. conditionalGroup,
  28638. ifBreak
  28639. }
  28640. } = require("./doc.js");
  28641. var {
  28642. isLiteral,
  28643. getTypeScriptMappedTypeModifier,
  28644. shouldPrintComma,
  28645. isCallExpression,
  28646. isMemberExpression
  28647. } = require_utils7();
  28648. var isTsKeywordType = require_is_ts_keyword_type();
  28649. var {
  28650. locStart,
  28651. locEnd
  28652. } = require_loc();
  28653. var {
  28654. printOptionalToken,
  28655. printTypeScriptModifiers
  28656. } = require_misc();
  28657. var {
  28658. printTernary
  28659. } = require_ternary();
  28660. var {
  28661. printFunctionParameters,
  28662. shouldGroupFunctionParameters
  28663. } = require_function_parameters();
  28664. var {
  28665. printTemplateLiteral
  28666. } = require_template_literal();
  28667. var {
  28668. printArrayItems
  28669. } = require_array4();
  28670. var {
  28671. printObject
  28672. } = require_object();
  28673. var {
  28674. printClassProperty,
  28675. printClassMethod
  28676. } = require_class();
  28677. var {
  28678. printTypeParameter,
  28679. printTypeParameters
  28680. } = require_type_parameters();
  28681. var {
  28682. printPropertyKey
  28683. } = require_property();
  28684. var {
  28685. printFunction,
  28686. printMethodInternal
  28687. } = require_function();
  28688. var {
  28689. printInterface
  28690. } = require_interface();
  28691. var {
  28692. printBlock
  28693. } = require_block();
  28694. var {
  28695. printTypeAlias,
  28696. printIntersectionType,
  28697. printUnionType,
  28698. printFunctionType,
  28699. printTupleType,
  28700. printIndexedAccessType,
  28701. printJSDocType
  28702. } = require_type_annotation();
  28703. function printTypescript(path, options, print) {
  28704. const node = path.getValue();
  28705. if (!node.type.startsWith("TS")) {
  28706. return;
  28707. }
  28708. if (isTsKeywordType(node)) {
  28709. return node.type.slice(2, -7).toLowerCase();
  28710. }
  28711. const semi = options.semi ? ";" : "";
  28712. const parts = [];
  28713. switch (node.type) {
  28714. case "TSThisType":
  28715. return "this";
  28716. case "TSTypeAssertion": {
  28717. const shouldBreakAfterCast = !(node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression");
  28718. const castGroup = group(["<", indent([softline, print("typeAnnotation")]), softline, ">"]);
  28719. const exprContents = [ifBreak("("), indent([softline, print("expression")]), softline, ifBreak(")")];
  28720. if (shouldBreakAfterCast) {
  28721. return conditionalGroup([[castGroup, print("expression")], [castGroup, group(exprContents, {
  28722. shouldBreak: true
  28723. })], [castGroup, print("expression")]]);
  28724. }
  28725. return group([castGroup, print("expression")]);
  28726. }
  28727. case "TSDeclareFunction":
  28728. return printFunction(path, print, options);
  28729. case "TSExportAssignment":
  28730. return ["export = ", print("expression"), semi];
  28731. case "TSModuleBlock":
  28732. return printBlock(path, options, print);
  28733. case "TSInterfaceBody":
  28734. case "TSTypeLiteral":
  28735. return printObject(path, options, print);
  28736. case "TSTypeAliasDeclaration":
  28737. return printTypeAlias(path, options, print);
  28738. case "TSQualifiedName":
  28739. return join(".", [print("left"), print("right")]);
  28740. case "TSAbstractMethodDefinition":
  28741. case "TSDeclareMethod":
  28742. return printClassMethod(path, options, print);
  28743. case "TSAbstractAccessorProperty":
  28744. case "TSAbstractPropertyDefinition":
  28745. return printClassProperty(path, options, print);
  28746. case "TSInterfaceHeritage":
  28747. case "TSExpressionWithTypeArguments":
  28748. parts.push(print("expression"));
  28749. if (node.typeParameters) {
  28750. parts.push(print("typeParameters"));
  28751. }
  28752. return parts;
  28753. case "TSTemplateLiteralType":
  28754. return printTemplateLiteral(path, print, options);
  28755. case "TSNamedTupleMember":
  28756. return [print("label"), node.optional ? "?" : "", ": ", print("elementType")];
  28757. case "TSRestType":
  28758. return ["...", print("typeAnnotation")];
  28759. case "TSOptionalType":
  28760. return [print("typeAnnotation"), "?"];
  28761. case "TSInterfaceDeclaration":
  28762. return printInterface(path, options, print);
  28763. case "TSClassImplements":
  28764. return [print("expression"), print("typeParameters")];
  28765. case "TSTypeParameterDeclaration":
  28766. case "TSTypeParameterInstantiation":
  28767. return printTypeParameters(path, options, print, "params");
  28768. case "TSTypeParameter":
  28769. return printTypeParameter(path, options, print);
  28770. case "TSSatisfiesExpression":
  28771. case "TSAsExpression": {
  28772. const operator = node.type === "TSAsExpression" ? "as" : "satisfies";
  28773. parts.push(print("expression"), ` ${operator} `, print("typeAnnotation"));
  28774. const parent = path.getParentNode();
  28775. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  28776. return group([indent([softline, ...parts]), softline]);
  28777. }
  28778. return parts;
  28779. }
  28780. case "TSArrayType":
  28781. return [print("elementType"), "[]"];
  28782. case "TSPropertySignature": {
  28783. if (node.readonly) {
  28784. parts.push("readonly ");
  28785. }
  28786. parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
  28787. if (node.typeAnnotation) {
  28788. parts.push(": ", print("typeAnnotation"));
  28789. }
  28790. if (node.initializer) {
  28791. parts.push(" = ", print("initializer"));
  28792. }
  28793. return parts;
  28794. }
  28795. case "TSParameterProperty":
  28796. if (node.accessibility) {
  28797. parts.push(node.accessibility + " ");
  28798. }
  28799. if (node.export) {
  28800. parts.push("export ");
  28801. }
  28802. if (node.static) {
  28803. parts.push("static ");
  28804. }
  28805. if (node.override) {
  28806. parts.push("override ");
  28807. }
  28808. if (node.readonly) {
  28809. parts.push("readonly ");
  28810. }
  28811. parts.push(print("parameter"));
  28812. return parts;
  28813. case "TSTypeQuery":
  28814. return ["typeof ", print("exprName"), print("typeParameters")];
  28815. case "TSIndexSignature": {
  28816. const parent = path.getParentNode();
  28817. const trailingComma = node.parameters.length > 1 ? ifBreak(shouldPrintComma(options) ? "," : "") : "";
  28818. const parametersGroup = group([indent([softline, join([", ", softline], path.map(print, "parameters"))]), trailingComma, softline]);
  28819. return [node.export ? "export " : "", node.accessibility ? [node.accessibility, " "] : "", node.static ? "static " : "", node.readonly ? "readonly " : "", node.declare ? "declare " : "", "[", node.parameters ? parametersGroup : "", node.typeAnnotation ? "]: " : "]", node.typeAnnotation ? print("typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""];
  28820. }
  28821. case "TSTypePredicate":
  28822. return [node.asserts ? "asserts " : "", print("parameterName"), node.typeAnnotation ? [" is ", print("typeAnnotation")] : ""];
  28823. case "TSNonNullExpression":
  28824. return [print("expression"), "!"];
  28825. case "TSImportType":
  28826. return [!node.isTypeOf ? "" : "typeof ", "import(", print(node.parameter ? "parameter" : "argument"), ")", !node.qualifier ? "" : [".", print("qualifier")], printTypeParameters(path, options, print, "typeParameters")];
  28827. case "TSLiteralType":
  28828. return print("literal");
  28829. case "TSIndexedAccessType":
  28830. return printIndexedAccessType(path, options, print);
  28831. case "TSConstructSignatureDeclaration":
  28832. case "TSCallSignatureDeclaration":
  28833. case "TSConstructorType": {
  28834. if (node.type === "TSConstructorType" && node.abstract) {
  28835. parts.push("abstract ");
  28836. }
  28837. if (node.type !== "TSCallSignatureDeclaration") {
  28838. parts.push("new ");
  28839. }
  28840. parts.push(group(printFunctionParameters(path, print, options, false, true)));
  28841. if (node.returnType || node.typeAnnotation) {
  28842. const isType = node.type === "TSConstructorType";
  28843. parts.push(isType ? " => " : ": ", print("returnType"), print("typeAnnotation"));
  28844. }
  28845. return parts;
  28846. }
  28847. case "TSTypeOperator":
  28848. return [node.operator, " ", print("typeAnnotation")];
  28849. case "TSMappedType": {
  28850. const shouldBreak = hasNewlineInRange(options.originalText, locStart(node), locEnd(node));
  28851. return group(["{", indent([options.bracketSpacing ? line : softline, node.readonly ? [getTypeScriptMappedTypeModifier(node.readonly, "readonly"), " "] : "", printTypeScriptModifiers(path, options, print), print("typeParameter"), node.optional ? getTypeScriptMappedTypeModifier(node.optional, "?") : "", node.typeAnnotation ? ": " : "", print("typeAnnotation"), ifBreak(semi)]), printDanglingComments(path, options, true), options.bracketSpacing ? line : softline, "}"], {
  28852. shouldBreak
  28853. });
  28854. }
  28855. case "TSMethodSignature": {
  28856. const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
  28857. parts.push(node.accessibility ? [node.accessibility, " "] : "", kind, node.export ? "export " : "", node.static ? "static " : "", node.readonly ? "readonly " : "", node.abstract ? "abstract " : "", node.declare ? "declare " : "", node.computed ? "[" : "", print("key"), node.computed ? "]" : "", printOptionalToken(path));
  28858. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  28859. const returnTypePropertyName = node.returnType ? "returnType" : "typeAnnotation";
  28860. const returnTypeNode = node[returnTypePropertyName];
  28861. const returnTypeDoc = returnTypeNode ? print(returnTypePropertyName) : "";
  28862. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  28863. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  28864. if (returnTypeNode) {
  28865. parts.push(": ", group(returnTypeDoc));
  28866. }
  28867. return group(parts);
  28868. }
  28869. case "TSNamespaceExportDeclaration":
  28870. parts.push("export as namespace ", print("id"));
  28871. if (options.semi) {
  28872. parts.push(";");
  28873. }
  28874. return group(parts);
  28875. case "TSEnumDeclaration":
  28876. if (node.declare) {
  28877. parts.push("declare ");
  28878. }
  28879. if (node.modifiers) {
  28880. parts.push(printTypeScriptModifiers(path, options, print));
  28881. }
  28882. if (node.const) {
  28883. parts.push("const ");
  28884. }
  28885. parts.push("enum ", print("id"), " ");
  28886. if (node.members.length === 0) {
  28887. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  28888. } else {
  28889. parts.push(group(["{", indent([hardline, printArrayItems(path, options, "members", print), shouldPrintComma(options, "es5") ? "," : ""]), printDanglingComments(path, options, true), hardline, "}"]));
  28890. }
  28891. return parts;
  28892. case "TSEnumMember":
  28893. if (node.computed) {
  28894. parts.push("[", print("id"), "]");
  28895. } else {
  28896. parts.push(print("id"));
  28897. }
  28898. if (node.initializer) {
  28899. parts.push(" = ", print("initializer"));
  28900. }
  28901. return parts;
  28902. case "TSImportEqualsDeclaration":
  28903. if (node.isExport) {
  28904. parts.push("export ");
  28905. }
  28906. parts.push("import ");
  28907. if (node.importKind && node.importKind !== "value") {
  28908. parts.push(node.importKind, " ");
  28909. }
  28910. parts.push(print("id"), " = ", print("moduleReference"));
  28911. if (options.semi) {
  28912. parts.push(";");
  28913. }
  28914. return group(parts);
  28915. case "TSExternalModuleReference":
  28916. return ["require(", print("expression"), ")"];
  28917. case "TSModuleDeclaration": {
  28918. const parent = path.getParentNode();
  28919. const isExternalModule = isLiteral(node.id);
  28920. const parentIsDeclaration = parent.type === "TSModuleDeclaration";
  28921. const bodyIsDeclaration = node.body && node.body.type === "TSModuleDeclaration";
  28922. if (parentIsDeclaration) {
  28923. parts.push(".");
  28924. } else {
  28925. if (node.declare) {
  28926. parts.push("declare ");
  28927. }
  28928. parts.push(printTypeScriptModifiers(path, options, print));
  28929. const textBetweenNodeAndItsId = options.originalText.slice(locStart(node), locStart(node.id));
  28930. const isGlobalDeclaration = node.id.type === "Identifier" && node.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
  28931. if (!isGlobalDeclaration) {
  28932. parts.push(isExternalModule || /(?:^|\s)module(?:\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
  28933. }
  28934. }
  28935. parts.push(print("id"));
  28936. if (bodyIsDeclaration) {
  28937. parts.push(print("body"));
  28938. } else if (node.body) {
  28939. parts.push(" ", group(print("body")));
  28940. } else {
  28941. parts.push(semi);
  28942. }
  28943. return parts;
  28944. }
  28945. case "TSConditionalType":
  28946. return printTernary(path, options, print);
  28947. case "TSInferType":
  28948. return ["infer", " ", print("typeParameter")];
  28949. case "TSIntersectionType":
  28950. return printIntersectionType(path, options, print);
  28951. case "TSUnionType":
  28952. return printUnionType(path, options, print);
  28953. case "TSFunctionType":
  28954. return printFunctionType(path, options, print);
  28955. case "TSTupleType":
  28956. return printTupleType(path, options, print);
  28957. case "TSTypeReference":
  28958. return [print("typeName"), printTypeParameters(path, options, print, "typeParameters")];
  28959. case "TSTypeAnnotation":
  28960. return print("typeAnnotation");
  28961. case "TSEmptyBodyFunctionExpression":
  28962. return printMethodInternal(path, options, print);
  28963. case "TSJSDocAllType":
  28964. return "*";
  28965. case "TSJSDocUnknownType":
  28966. return "?";
  28967. case "TSJSDocNullableType":
  28968. return printJSDocType(path, print, "?");
  28969. case "TSJSDocNonNullableType":
  28970. return printJSDocType(path, print, "!");
  28971. case "TSInstantiationExpression":
  28972. return [print("expression"), print("typeParameters")];
  28973. default:
  28974. throw new Error(`Unknown TypeScript node type: ${JSON.stringify(node.type)}.`);
  28975. }
  28976. }
  28977. module2.exports = {
  28978. printTypescript
  28979. };
  28980. }
  28981. });
  28982. var require_comment = __commonJS2({
  28983. "src/language-js/print/comment.js"(exports2, module2) {
  28984. "use strict";
  28985. var {
  28986. hasNewline
  28987. } = require_util();
  28988. var {
  28989. builders: {
  28990. join,
  28991. hardline
  28992. },
  28993. utils: {
  28994. replaceTextEndOfLine
  28995. }
  28996. } = require("./doc.js");
  28997. var {
  28998. isLineComment
  28999. } = require_utils7();
  29000. var {
  29001. locStart,
  29002. locEnd
  29003. } = require_loc();
  29004. var isBlockComment = require_is_block_comment();
  29005. function printComment(commentPath, options) {
  29006. const comment = commentPath.getValue();
  29007. if (isLineComment(comment)) {
  29008. return options.originalText.slice(locStart(comment), locEnd(comment)).trimEnd();
  29009. }
  29010. if (isBlockComment(comment)) {
  29011. if (isIndentableBlockComment(comment)) {
  29012. const printed = printIndentableBlockComment(comment);
  29013. if (comment.trailing && !hasNewline(options.originalText, locStart(comment), {
  29014. backwards: true
  29015. })) {
  29016. return [hardline, printed];
  29017. }
  29018. return printed;
  29019. }
  29020. const commentEnd = locEnd(comment);
  29021. const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
  29022. return ["/*", replaceTextEndOfLine(comment.value), isInsideFlowComment ? "*-/" : "*/"];
  29023. }
  29024. throw new Error("Not a comment: " + JSON.stringify(comment));
  29025. }
  29026. function isIndentableBlockComment(comment) {
  29027. const lines = `*${comment.value}*`.split("\n");
  29028. return lines.length > 1 && lines.every((line) => line.trim()[0] === "*");
  29029. }
  29030. function printIndentableBlockComment(comment) {
  29031. const lines = comment.value.split("\n");
  29032. return ["/*", join(hardline, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"];
  29033. }
  29034. module2.exports = {
  29035. printComment
  29036. };
  29037. }
  29038. });
  29039. var require_literal = __commonJS2({
  29040. "src/language-js/print/literal.js"(exports2, module2) {
  29041. "use strict";
  29042. var {
  29043. printString,
  29044. printNumber
  29045. } = require_util();
  29046. var {
  29047. replaceTextEndOfLine
  29048. } = require_doc_utils();
  29049. function printLiteral(path, options) {
  29050. const node = path.getNode();
  29051. switch (node.type) {
  29052. case "RegExpLiteral":
  29053. return printRegex(node);
  29054. case "BigIntLiteral":
  29055. return printBigInt(node.bigint || node.extra.raw);
  29056. case "NumericLiteral":
  29057. return printNumber(node.extra.raw);
  29058. case "StringLiteral":
  29059. return replaceTextEndOfLine(printString(node.extra.raw, options));
  29060. case "NullLiteral":
  29061. return "null";
  29062. case "BooleanLiteral":
  29063. return String(node.value);
  29064. case "DecimalLiteral":
  29065. return printNumber(node.value) + "m";
  29066. case "Literal": {
  29067. if (node.regex) {
  29068. return printRegex(node.regex);
  29069. }
  29070. if (node.bigint) {
  29071. return printBigInt(node.raw);
  29072. }
  29073. if (node.decimal) {
  29074. return printNumber(node.decimal) + "m";
  29075. }
  29076. const {
  29077. value
  29078. } = node;
  29079. if (typeof value === "number") {
  29080. return printNumber(node.raw);
  29081. }
  29082. if (typeof value === "string") {
  29083. return replaceTextEndOfLine(printString(node.raw, options));
  29084. }
  29085. return String(value);
  29086. }
  29087. }
  29088. }
  29089. function printBigInt(raw) {
  29090. return raw.toLowerCase();
  29091. }
  29092. function printRegex({
  29093. pattern,
  29094. flags
  29095. }) {
  29096. flags = [...flags].sort().join("");
  29097. return `/${pattern}/${flags}`;
  29098. }
  29099. module2.exports = {
  29100. printLiteral
  29101. };
  29102. }
  29103. });
  29104. var require_printer_estree = __commonJS2({
  29105. "src/language-js/printer-estree.js"(exports2, module2) {
  29106. "use strict";
  29107. var {
  29108. printDanglingComments
  29109. } = require_comments();
  29110. var {
  29111. hasNewline
  29112. } = require_util();
  29113. var {
  29114. builders: {
  29115. join,
  29116. line,
  29117. hardline,
  29118. softline,
  29119. group,
  29120. indent
  29121. },
  29122. utils: {
  29123. replaceTextEndOfLine
  29124. }
  29125. } = require("./doc.js");
  29126. var embed = require_embed();
  29127. var clean = require_clean();
  29128. var {
  29129. insertPragma
  29130. } = require_pragma();
  29131. var handleComments = require_comments2();
  29132. var pathNeedsParens = require_needs_parens();
  29133. var preprocess = require_print_preprocess();
  29134. var {
  29135. hasFlowShorthandAnnotationComment,
  29136. hasComment,
  29137. CommentCheckFlags,
  29138. isTheOnlyJsxElementInMarkdown,
  29139. isLineComment,
  29140. isNextLineEmpty,
  29141. needsHardlineAfterDanglingComment,
  29142. rawText,
  29143. hasIgnoreComment,
  29144. isCallExpression,
  29145. isMemberExpression,
  29146. markerForIfWithoutBlockAndSameLineComment
  29147. } = require_utils7();
  29148. var {
  29149. locStart,
  29150. locEnd
  29151. } = require_loc();
  29152. var isBlockComment = require_is_block_comment();
  29153. var {
  29154. printHtmlBinding,
  29155. isVueEventBindingExpression
  29156. } = require_html_binding();
  29157. var {
  29158. printAngular
  29159. } = require_angular();
  29160. var {
  29161. printJsx,
  29162. hasJsxIgnoreComment
  29163. } = require_jsx();
  29164. var {
  29165. printFlow
  29166. } = require_flow();
  29167. var {
  29168. printTypescript
  29169. } = require_typescript();
  29170. var {
  29171. printOptionalToken,
  29172. printBindExpressionCallee,
  29173. printTypeAnnotation,
  29174. adjustClause,
  29175. printRestSpread,
  29176. printDefiniteToken
  29177. } = require_misc();
  29178. var {
  29179. printImportDeclaration,
  29180. printExportDeclaration,
  29181. printExportAllDeclaration,
  29182. printModuleSpecifier
  29183. } = require_module();
  29184. var {
  29185. printTernary
  29186. } = require_ternary();
  29187. var {
  29188. printTemplateLiteral
  29189. } = require_template_literal();
  29190. var {
  29191. printArray
  29192. } = require_array4();
  29193. var {
  29194. printObject
  29195. } = require_object();
  29196. var {
  29197. printClass,
  29198. printClassMethod,
  29199. printClassProperty
  29200. } = require_class();
  29201. var {
  29202. printProperty
  29203. } = require_property();
  29204. var {
  29205. printFunction,
  29206. printArrowFunction,
  29207. printMethod,
  29208. printReturnStatement,
  29209. printThrowStatement
  29210. } = require_function();
  29211. var {
  29212. printCallExpression
  29213. } = require_call_expression();
  29214. var {
  29215. printVariableDeclarator,
  29216. printAssignmentExpression
  29217. } = require_assignment();
  29218. var {
  29219. printBinaryishExpression
  29220. } = require_binaryish();
  29221. var {
  29222. printSwitchCaseConsequent
  29223. } = require_statement();
  29224. var {
  29225. printMemberExpression
  29226. } = require_member();
  29227. var {
  29228. printBlock,
  29229. printBlockBody
  29230. } = require_block();
  29231. var {
  29232. printComment
  29233. } = require_comment();
  29234. var {
  29235. printLiteral
  29236. } = require_literal();
  29237. var {
  29238. printDecorators
  29239. } = require_decorators();
  29240. function genericPrint(path, options, print, args) {
  29241. const printed = printPathNoParens(path, options, print, args);
  29242. if (!printed) {
  29243. return "";
  29244. }
  29245. const node = path.getValue();
  29246. const {
  29247. type
  29248. } = node;
  29249. if (type === "ClassMethod" || type === "ClassPrivateMethod" || type === "ClassProperty" || type === "ClassAccessorProperty" || type === "AccessorProperty" || type === "TSAbstractAccessorProperty" || type === "PropertyDefinition" || type === "TSAbstractPropertyDefinition" || type === "ClassPrivateProperty" || type === "MethodDefinition" || type === "TSAbstractMethodDefinition" || type === "TSDeclareMethod") {
  29250. return printed;
  29251. }
  29252. let parts = [printed];
  29253. const printedDecorators = printDecorators(path, options, print);
  29254. const isClassExpressionWithDecorators = node.type === "ClassExpression" && printedDecorators;
  29255. if (printedDecorators) {
  29256. parts = [...printedDecorators, printed];
  29257. if (!isClassExpressionWithDecorators) {
  29258. return group(parts);
  29259. }
  29260. }
  29261. const needsParens = pathNeedsParens(path, options);
  29262. if (!needsParens) {
  29263. if (args && args.needsSemi) {
  29264. parts.unshift(";");
  29265. }
  29266. if (parts.length === 1 && parts[0] === printed) {
  29267. return printed;
  29268. }
  29269. return parts;
  29270. }
  29271. if (isClassExpressionWithDecorators) {
  29272. parts = [indent([line, ...parts])];
  29273. }
  29274. parts.unshift("(");
  29275. if (args && args.needsSemi) {
  29276. parts.unshift(";");
  29277. }
  29278. if (hasFlowShorthandAnnotationComment(node)) {
  29279. const [comment] = node.trailingComments;
  29280. parts.push(" /*", comment.value.trimStart(), "*/");
  29281. comment.printed = true;
  29282. }
  29283. if (isClassExpressionWithDecorators) {
  29284. parts.push(line);
  29285. }
  29286. parts.push(")");
  29287. return parts;
  29288. }
  29289. function printPathNoParens(path, options, print, args) {
  29290. const node = path.getValue();
  29291. const semi = options.semi ? ";" : "";
  29292. if (!node) {
  29293. return "";
  29294. }
  29295. if (typeof node === "string") {
  29296. return node;
  29297. }
  29298. for (const printer of [printLiteral, printHtmlBinding, printAngular, printJsx, printFlow, printTypescript]) {
  29299. const printed = printer(path, options, print);
  29300. if (typeof printed !== "undefined") {
  29301. return printed;
  29302. }
  29303. }
  29304. let parts = [];
  29305. switch (node.type) {
  29306. case "JsExpressionRoot":
  29307. return print("node");
  29308. case "JsonRoot":
  29309. return [print("node"), hardline];
  29310. case "File":
  29311. if (node.program && node.program.interpreter) {
  29312. parts.push(print(["program", "interpreter"]));
  29313. }
  29314. parts.push(print("program"));
  29315. return parts;
  29316. case "Program":
  29317. return printBlockBody(path, options, print);
  29318. case "EmptyStatement":
  29319. return "";
  29320. case "ExpressionStatement": {
  29321. if (node.directive) {
  29322. return [printDirective(node.expression, options), semi];
  29323. }
  29324. if (options.parser === "__vue_event_binding" || options.parser === "__vue_ts_event_binding") {
  29325. const parent = path.getParentNode();
  29326. if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === node) {
  29327. return [print("expression"), isVueEventBindingExpression(node.expression) ? ";" : ""];
  29328. }
  29329. }
  29330. const danglingComment = printDanglingComments(path, options, true, ({
  29331. marker
  29332. }) => marker === markerForIfWithoutBlockAndSameLineComment);
  29333. return [print("expression"), isTheOnlyJsxElementInMarkdown(options, path) ? "" : semi, danglingComment ? [" ", danglingComment] : ""];
  29334. }
  29335. case "ParenthesizedExpression": {
  29336. const shouldHug = !hasComment(node.expression) && (node.expression.type === "ObjectExpression" || node.expression.type === "ArrayExpression");
  29337. if (shouldHug) {
  29338. return ["(", print("expression"), ")"];
  29339. }
  29340. return group(["(", indent([softline, print("expression")]), softline, ")"]);
  29341. }
  29342. case "AssignmentExpression":
  29343. return printAssignmentExpression(path, options, print);
  29344. case "VariableDeclarator":
  29345. return printVariableDeclarator(path, options, print);
  29346. case "BinaryExpression":
  29347. case "LogicalExpression":
  29348. return printBinaryishExpression(path, options, print);
  29349. case "AssignmentPattern":
  29350. return [print("left"), " = ", print("right")];
  29351. case "OptionalMemberExpression":
  29352. case "MemberExpression": {
  29353. return printMemberExpression(path, options, print);
  29354. }
  29355. case "MetaProperty":
  29356. return [print("meta"), ".", print("property")];
  29357. case "BindExpression":
  29358. if (node.object) {
  29359. parts.push(print("object"));
  29360. }
  29361. parts.push(group(indent([softline, printBindExpressionCallee(path, options, print)])));
  29362. return parts;
  29363. case "Identifier": {
  29364. return [node.name, printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print)];
  29365. }
  29366. case "V8IntrinsicIdentifier":
  29367. return ["%", node.name];
  29368. case "SpreadElement":
  29369. case "SpreadElementPattern":
  29370. case "SpreadProperty":
  29371. case "SpreadPropertyPattern":
  29372. case "RestElement":
  29373. return printRestSpread(path, options, print);
  29374. case "FunctionDeclaration":
  29375. case "FunctionExpression":
  29376. return printFunction(path, print, options, args);
  29377. case "ArrowFunctionExpression":
  29378. return printArrowFunction(path, options, print, args);
  29379. case "YieldExpression":
  29380. parts.push("yield");
  29381. if (node.delegate) {
  29382. parts.push("*");
  29383. }
  29384. if (node.argument) {
  29385. parts.push(" ", print("argument"));
  29386. }
  29387. return parts;
  29388. case "AwaitExpression": {
  29389. parts.push("await");
  29390. if (node.argument) {
  29391. parts.push(" ", print("argument"));
  29392. const parent = path.getParentNode();
  29393. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  29394. parts = [indent([softline, ...parts]), softline];
  29395. const parentAwaitOrBlock = path.findAncestor((node2) => node2.type === "AwaitExpression" || node2.type === "BlockStatement");
  29396. if (!parentAwaitOrBlock || parentAwaitOrBlock.type !== "AwaitExpression") {
  29397. return group(parts);
  29398. }
  29399. }
  29400. }
  29401. return parts;
  29402. }
  29403. case "ExportDefaultDeclaration":
  29404. case "ExportNamedDeclaration":
  29405. return printExportDeclaration(path, options, print);
  29406. case "ExportAllDeclaration":
  29407. return printExportAllDeclaration(path, options, print);
  29408. case "ImportDeclaration":
  29409. return printImportDeclaration(path, options, print);
  29410. case "ImportSpecifier":
  29411. case "ExportSpecifier":
  29412. case "ImportNamespaceSpecifier":
  29413. case "ExportNamespaceSpecifier":
  29414. case "ImportDefaultSpecifier":
  29415. case "ExportDefaultSpecifier":
  29416. return printModuleSpecifier(path, options, print);
  29417. case "ImportAttribute":
  29418. return [print("key"), ": ", print("value")];
  29419. case "Import":
  29420. return "import";
  29421. case "BlockStatement":
  29422. case "StaticBlock":
  29423. case "ClassBody":
  29424. return printBlock(path, options, print);
  29425. case "ThrowStatement":
  29426. return printThrowStatement(path, options, print);
  29427. case "ReturnStatement":
  29428. return printReturnStatement(path, options, print);
  29429. case "NewExpression":
  29430. case "ImportExpression":
  29431. case "OptionalCallExpression":
  29432. case "CallExpression":
  29433. return printCallExpression(path, options, print);
  29434. case "ObjectExpression":
  29435. case "ObjectPattern":
  29436. case "RecordExpression":
  29437. return printObject(path, options, print);
  29438. case "ObjectProperty":
  29439. case "Property":
  29440. if (node.method || node.kind === "get" || node.kind === "set") {
  29441. return printMethod(path, options, print);
  29442. }
  29443. return printProperty(path, options, print);
  29444. case "ObjectMethod":
  29445. return printMethod(path, options, print);
  29446. case "Decorator":
  29447. return ["@", print("expression")];
  29448. case "ArrayExpression":
  29449. case "ArrayPattern":
  29450. case "TupleExpression":
  29451. return printArray(path, options, print);
  29452. case "SequenceExpression": {
  29453. const parent = path.getParentNode(0);
  29454. if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
  29455. const parts2 = [];
  29456. path.each((expressionPath, index) => {
  29457. if (index === 0) {
  29458. parts2.push(print());
  29459. } else {
  29460. parts2.push(",", indent([line, print()]));
  29461. }
  29462. }, "expressions");
  29463. return group(parts2);
  29464. }
  29465. return group(join([",", line], path.map(print, "expressions")));
  29466. }
  29467. case "ThisExpression":
  29468. return "this";
  29469. case "Super":
  29470. return "super";
  29471. case "Directive":
  29472. return [print("value"), semi];
  29473. case "DirectiveLiteral":
  29474. return printDirective(node, options);
  29475. case "UnaryExpression":
  29476. parts.push(node.operator);
  29477. if (/[a-z]$/.test(node.operator)) {
  29478. parts.push(" ");
  29479. }
  29480. if (hasComment(node.argument)) {
  29481. parts.push(group(["(", indent([softline, print("argument")]), softline, ")"]));
  29482. } else {
  29483. parts.push(print("argument"));
  29484. }
  29485. return parts;
  29486. case "UpdateExpression":
  29487. parts.push(print("argument"), node.operator);
  29488. if (node.prefix) {
  29489. parts.reverse();
  29490. }
  29491. return parts;
  29492. case "ConditionalExpression":
  29493. return printTernary(path, options, print);
  29494. case "VariableDeclaration": {
  29495. const printed = path.map(print, "declarations");
  29496. const parentNode = path.getParentNode();
  29497. const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
  29498. const hasValue = node.declarations.some((decl) => decl.init);
  29499. let firstVariable;
  29500. if (printed.length === 1 && !hasComment(node.declarations[0])) {
  29501. firstVariable = printed[0];
  29502. } else if (printed.length > 0) {
  29503. firstVariable = indent(printed[0]);
  29504. }
  29505. parts = [node.declare ? "declare " : "", node.kind, firstVariable ? [" ", firstVariable] : "", indent(printed.slice(1).map((p) => [",", hasValue && !isParentForLoop ? hardline : line, p]))];
  29506. if (!(isParentForLoop && parentNode.body !== node)) {
  29507. parts.push(semi);
  29508. }
  29509. return group(parts);
  29510. }
  29511. case "WithStatement":
  29512. return group(["with (", print("object"), ")", adjustClause(node.body, print("body"))]);
  29513. case "IfStatement": {
  29514. const con = adjustClause(node.consequent, print("consequent"));
  29515. const opening = group(["if (", group([indent([softline, print("test")]), softline]), ")", con]);
  29516. parts.push(opening);
  29517. if (node.alternate) {
  29518. const commentOnOwnLine = hasComment(node.consequent, CommentCheckFlags.Trailing | CommentCheckFlags.Line) || needsHardlineAfterDanglingComment(node);
  29519. const elseOnSameLine = node.consequent.type === "BlockStatement" && !commentOnOwnLine;
  29520. parts.push(elseOnSameLine ? " " : hardline);
  29521. if (hasComment(node, CommentCheckFlags.Dangling)) {
  29522. parts.push(printDanglingComments(path, options, true), commentOnOwnLine ? hardline : " ");
  29523. }
  29524. parts.push("else", group(adjustClause(node.alternate, print("alternate"), node.alternate.type === "IfStatement")));
  29525. }
  29526. return parts;
  29527. }
  29528. case "ForStatement": {
  29529. const body = adjustClause(node.body, print("body"));
  29530. const dangling = printDanglingComments(path, options, true);
  29531. const printedComments = dangling ? [dangling, softline] : "";
  29532. if (!node.init && !node.test && !node.update) {
  29533. return [printedComments, group(["for (;;)", body])];
  29534. }
  29535. return [printedComments, group(["for (", group([indent([softline, print("init"), ";", line, print("test"), ";", line, print("update")]), softline]), ")", body])];
  29536. }
  29537. case "WhileStatement":
  29538. return group(["while (", group([indent([softline, print("test")]), softline]), ")", adjustClause(node.body, print("body"))]);
  29539. case "ForInStatement":
  29540. return group(["for (", print("left"), " in ", print("right"), ")", adjustClause(node.body, print("body"))]);
  29541. case "ForOfStatement":
  29542. return group(["for", node.await ? " await" : "", " (", print("left"), " of ", print("right"), ")", adjustClause(node.body, print("body"))]);
  29543. case "DoWhileStatement": {
  29544. const clause = adjustClause(node.body, print("body"));
  29545. const doBody = group(["do", clause]);
  29546. parts = [doBody];
  29547. if (node.body.type === "BlockStatement") {
  29548. parts.push(" ");
  29549. } else {
  29550. parts.push(hardline);
  29551. }
  29552. parts.push("while (", group([indent([softline, print("test")]), softline]), ")", semi);
  29553. return parts;
  29554. }
  29555. case "DoExpression":
  29556. return [node.async ? "async " : "", "do ", print("body")];
  29557. case "BreakStatement":
  29558. parts.push("break");
  29559. if (node.label) {
  29560. parts.push(" ", print("label"));
  29561. }
  29562. parts.push(semi);
  29563. return parts;
  29564. case "ContinueStatement":
  29565. parts.push("continue");
  29566. if (node.label) {
  29567. parts.push(" ", print("label"));
  29568. }
  29569. parts.push(semi);
  29570. return parts;
  29571. case "LabeledStatement":
  29572. if (node.body.type === "EmptyStatement") {
  29573. return [print("label"), ":;"];
  29574. }
  29575. return [print("label"), ": ", print("body")];
  29576. case "TryStatement":
  29577. return ["try ", print("block"), node.handler ? [" ", print("handler")] : "", node.finalizer ? [" finally ", print("finalizer")] : ""];
  29578. case "CatchClause":
  29579. if (node.param) {
  29580. const parameterHasComments = hasComment(node.param, (comment) => !isBlockComment(comment) || comment.leading && hasNewline(options.originalText, locEnd(comment)) || comment.trailing && hasNewline(options.originalText, locStart(comment), {
  29581. backwards: true
  29582. }));
  29583. const param = print("param");
  29584. return ["catch ", parameterHasComments ? ["(", indent([softline, param]), softline, ") "] : ["(", param, ") "], print("body")];
  29585. }
  29586. return ["catch ", print("body")];
  29587. case "SwitchStatement":
  29588. return [group(["switch (", indent([softline, print("discriminant")]), softline, ")"]), " {", node.cases.length > 0 ? indent([hardline, join(hardline, path.map((casePath, index, cases) => {
  29589. const caseNode = casePath.getValue();
  29590. return [print(), index !== cases.length - 1 && isNextLineEmpty(caseNode, options) ? hardline : ""];
  29591. }, "cases"))]) : "", hardline, "}"];
  29592. case "SwitchCase": {
  29593. if (node.test) {
  29594. parts.push("case ", print("test"), ":");
  29595. } else {
  29596. parts.push("default:");
  29597. }
  29598. if (hasComment(node, CommentCheckFlags.Dangling)) {
  29599. parts.push(" ", printDanglingComments(path, options, true));
  29600. }
  29601. const consequent = node.consequent.filter((node2) => node2.type !== "EmptyStatement");
  29602. if (consequent.length > 0) {
  29603. const cons = printSwitchCaseConsequent(path, options, print);
  29604. parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? [" ", cons] : indent([hardline, cons]));
  29605. }
  29606. return parts;
  29607. }
  29608. case "DebuggerStatement":
  29609. return ["debugger", semi];
  29610. case "ClassDeclaration":
  29611. case "ClassExpression":
  29612. return printClass(path, options, print);
  29613. case "ClassMethod":
  29614. case "ClassPrivateMethod":
  29615. case "MethodDefinition":
  29616. return printClassMethod(path, options, print);
  29617. case "ClassProperty":
  29618. case "PropertyDefinition":
  29619. case "ClassPrivateProperty":
  29620. case "ClassAccessorProperty":
  29621. case "AccessorProperty":
  29622. return printClassProperty(path, options, print);
  29623. case "TemplateElement":
  29624. return replaceTextEndOfLine(node.value.raw);
  29625. case "TemplateLiteral":
  29626. return printTemplateLiteral(path, print, options);
  29627. case "TaggedTemplateExpression":
  29628. return [print("tag"), print("typeParameters"), print("quasi")];
  29629. case "PrivateIdentifier":
  29630. return ["#", print("name")];
  29631. case "PrivateName":
  29632. return ["#", print("id")];
  29633. case "InterpreterDirective":
  29634. parts.push("#!", node.value, hardline);
  29635. if (isNextLineEmpty(node, options)) {
  29636. parts.push(hardline);
  29637. }
  29638. return parts;
  29639. case "TopicReference":
  29640. return "%";
  29641. case "ArgumentPlaceholder":
  29642. return "?";
  29643. case "ModuleExpression": {
  29644. parts.push("module {");
  29645. const printed = print("body");
  29646. if (printed) {
  29647. parts.push(indent([hardline, printed]), hardline);
  29648. }
  29649. parts.push("}");
  29650. return parts;
  29651. }
  29652. default:
  29653. throw new Error("unknown type: " + JSON.stringify(node.type));
  29654. }
  29655. }
  29656. function printDirective(node, options) {
  29657. const raw = rawText(node);
  29658. const rawContent = raw.slice(1, -1);
  29659. if (rawContent.includes('"') || rawContent.includes("'")) {
  29660. return raw;
  29661. }
  29662. const enclosingQuote = options.singleQuote ? "'" : '"';
  29663. return enclosingQuote + rawContent + enclosingQuote;
  29664. }
  29665. function canAttachComment(node) {
  29666. return node.type && !isBlockComment(node) && !isLineComment(node) && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && node.type !== "TSEmptyBodyFunctionExpression";
  29667. }
  29668. module2.exports = {
  29669. preprocess,
  29670. print: genericPrint,
  29671. embed,
  29672. insertPragma,
  29673. massageAstNode: clean,
  29674. hasPrettierIgnore(path) {
  29675. return hasIgnoreComment(path) || hasJsxIgnoreComment(path);
  29676. },
  29677. willPrintOwnComments: handleComments.willPrintOwnComments,
  29678. canAttachComment,
  29679. printComment,
  29680. isBlockComment,
  29681. handleComments: {
  29682. avoidAstMutation: true,
  29683. ownLine: handleComments.handleOwnLineComment,
  29684. endOfLine: handleComments.handleEndOfLineComment,
  29685. remaining: handleComments.handleRemainingComment
  29686. },
  29687. getCommentChildNodes: handleComments.getCommentChildNodes
  29688. };
  29689. }
  29690. });
  29691. var require_printer_estree_json = __commonJS2({
  29692. "src/language-js/printer-estree-json.js"(exports2, module2) {
  29693. "use strict";
  29694. var {
  29695. builders: {
  29696. hardline,
  29697. indent,
  29698. join
  29699. }
  29700. } = require("./doc.js");
  29701. var preprocess = require_print_preprocess();
  29702. function genericPrint(path, options, print) {
  29703. const node = path.getValue();
  29704. switch (node.type) {
  29705. case "JsonRoot":
  29706. return [print("node"), hardline];
  29707. case "ArrayExpression": {
  29708. if (node.elements.length === 0) {
  29709. return "[]";
  29710. }
  29711. const printed = path.map(() => path.getValue() === null ? "null" : print(), "elements");
  29712. return ["[", indent([hardline, join([",", hardline], printed)]), hardline, "]"];
  29713. }
  29714. case "ObjectExpression":
  29715. return node.properties.length === 0 ? "{}" : ["{", indent([hardline, join([",", hardline], path.map(print, "properties"))]), hardline, "}"];
  29716. case "ObjectProperty":
  29717. return [print("key"), ": ", print("value")];
  29718. case "UnaryExpression":
  29719. return [node.operator === "+" ? "" : node.operator, print("argument")];
  29720. case "NullLiteral":
  29721. return "null";
  29722. case "BooleanLiteral":
  29723. return node.value ? "true" : "false";
  29724. case "StringLiteral":
  29725. case "NumericLiteral":
  29726. return JSON.stringify(node.value);
  29727. case "Identifier": {
  29728. const parent = path.getParentNode();
  29729. if (parent && parent.type === "ObjectProperty" && parent.key === node) {
  29730. return JSON.stringify(node.name);
  29731. }
  29732. return node.name;
  29733. }
  29734. case "TemplateLiteral":
  29735. return print(["quasis", 0]);
  29736. case "TemplateElement":
  29737. return JSON.stringify(node.value.cooked);
  29738. default:
  29739. throw new Error("unknown type: " + JSON.stringify(node.type));
  29740. }
  29741. }
  29742. var ignoredProperties = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
  29743. function clean(node, newNode) {
  29744. const {
  29745. type
  29746. } = node;
  29747. if (type === "ObjectProperty" && node.key.type === "Identifier") {
  29748. newNode.key = {
  29749. type: "StringLiteral",
  29750. value: node.key.name
  29751. };
  29752. return;
  29753. }
  29754. if (type === "UnaryExpression" && node.operator === "+") {
  29755. return newNode.argument;
  29756. }
  29757. if (type === "ArrayExpression") {
  29758. for (const [index, element] of node.elements.entries()) {
  29759. if (element === null) {
  29760. newNode.elements.splice(index, 0, {
  29761. type: "NullLiteral"
  29762. });
  29763. }
  29764. }
  29765. return;
  29766. }
  29767. if (type === "TemplateLiteral") {
  29768. return {
  29769. type: "StringLiteral",
  29770. value: node.quasis[0].value.cooked
  29771. };
  29772. }
  29773. }
  29774. clean.ignoredProperties = ignoredProperties;
  29775. module2.exports = {
  29776. preprocess,
  29777. print: genericPrint,
  29778. massageAstNode: clean
  29779. };
  29780. }
  29781. });
  29782. var require_common_options = __commonJS2({
  29783. "src/common/common-options.js"(exports2, module2) {
  29784. "use strict";
  29785. var CATEGORY_COMMON = "Common";
  29786. module2.exports = {
  29787. bracketSpacing: {
  29788. since: "0.0.0",
  29789. category: CATEGORY_COMMON,
  29790. type: "boolean",
  29791. default: true,
  29792. description: "Print spaces between brackets.",
  29793. oppositeDescription: "Do not print spaces between brackets."
  29794. },
  29795. singleQuote: {
  29796. since: "0.0.0",
  29797. category: CATEGORY_COMMON,
  29798. type: "boolean",
  29799. default: false,
  29800. description: "Use single quotes instead of double quotes."
  29801. },
  29802. proseWrap: {
  29803. since: "1.8.2",
  29804. category: CATEGORY_COMMON,
  29805. type: "choice",
  29806. default: [{
  29807. since: "1.8.2",
  29808. value: true
  29809. }, {
  29810. since: "1.9.0",
  29811. value: "preserve"
  29812. }],
  29813. description: "How to wrap prose.",
  29814. choices: [{
  29815. since: "1.9.0",
  29816. value: "always",
  29817. description: "Wrap prose if it exceeds the print width."
  29818. }, {
  29819. since: "1.9.0",
  29820. value: "never",
  29821. description: "Do not wrap prose."
  29822. }, {
  29823. since: "1.9.0",
  29824. value: "preserve",
  29825. description: "Wrap prose as-is."
  29826. }]
  29827. },
  29828. bracketSameLine: {
  29829. since: "2.4.0",
  29830. category: CATEGORY_COMMON,
  29831. type: "boolean",
  29832. default: false,
  29833. description: "Put > of opening tags on the last line instead of on a new line."
  29834. },
  29835. singleAttributePerLine: {
  29836. since: "2.6.0",
  29837. category: CATEGORY_COMMON,
  29838. type: "boolean",
  29839. default: false,
  29840. description: "Enforce single attribute per line in HTML, Vue and JSX."
  29841. }
  29842. };
  29843. }
  29844. });
  29845. var require_options2 = __commonJS2({
  29846. "src/language-js/options.js"(exports2, module2) {
  29847. "use strict";
  29848. var commonOptions = require_common_options();
  29849. var CATEGORY_JAVASCRIPT = "JavaScript";
  29850. module2.exports = {
  29851. arrowParens: {
  29852. since: "1.9.0",
  29853. category: CATEGORY_JAVASCRIPT,
  29854. type: "choice",
  29855. default: [{
  29856. since: "1.9.0",
  29857. value: "avoid"
  29858. }, {
  29859. since: "2.0.0",
  29860. value: "always"
  29861. }],
  29862. description: "Include parentheses around a sole arrow function parameter.",
  29863. choices: [{
  29864. value: "always",
  29865. description: "Always include parens. Example: `(x) => x`"
  29866. }, {
  29867. value: "avoid",
  29868. description: "Omit parens when possible. Example: `x => x`"
  29869. }]
  29870. },
  29871. bracketSameLine: commonOptions.bracketSameLine,
  29872. bracketSpacing: commonOptions.bracketSpacing,
  29873. jsxBracketSameLine: {
  29874. since: "0.17.0",
  29875. category: CATEGORY_JAVASCRIPT,
  29876. type: "boolean",
  29877. description: "Put > on the last line instead of at a new line.",
  29878. deprecated: "2.4.0"
  29879. },
  29880. semi: {
  29881. since: "1.0.0",
  29882. category: CATEGORY_JAVASCRIPT,
  29883. type: "boolean",
  29884. default: true,
  29885. description: "Print semicolons.",
  29886. oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
  29887. },
  29888. singleQuote: commonOptions.singleQuote,
  29889. jsxSingleQuote: {
  29890. since: "1.15.0",
  29891. category: CATEGORY_JAVASCRIPT,
  29892. type: "boolean",
  29893. default: false,
  29894. description: "Use single quotes in JSX."
  29895. },
  29896. quoteProps: {
  29897. since: "1.17.0",
  29898. category: CATEGORY_JAVASCRIPT,
  29899. type: "choice",
  29900. default: "as-needed",
  29901. description: "Change when properties in objects are quoted.",
  29902. choices: [{
  29903. value: "as-needed",
  29904. description: "Only add quotes around object properties where required."
  29905. }, {
  29906. value: "consistent",
  29907. description: "If at least one property in an object requires quotes, quote all properties."
  29908. }, {
  29909. value: "preserve",
  29910. description: "Respect the input use of quotes in object properties."
  29911. }]
  29912. },
  29913. trailingComma: {
  29914. since: "0.0.0",
  29915. category: CATEGORY_JAVASCRIPT,
  29916. type: "choice",
  29917. default: [{
  29918. since: "0.0.0",
  29919. value: false
  29920. }, {
  29921. since: "0.19.0",
  29922. value: "none"
  29923. }, {
  29924. since: "2.0.0",
  29925. value: "es5"
  29926. }],
  29927. description: "Print trailing commas wherever possible when multi-line.",
  29928. choices: [{
  29929. value: "es5",
  29930. description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
  29931. }, {
  29932. value: "none",
  29933. description: "No trailing commas."
  29934. }, {
  29935. value: "all",
  29936. description: "Trailing commas wherever possible (including function arguments)."
  29937. }]
  29938. },
  29939. singleAttributePerLine: commonOptions.singleAttributePerLine
  29940. };
  29941. }
  29942. });
  29943. var require_parsers = __commonJS2({
  29944. "src/language-js/parse/parsers.js"(exports2, module2) {
  29945. "use strict";
  29946. module2.exports = {
  29947. get babel() {
  29948. return require("./parser-babel.js").parsers.babel;
  29949. },
  29950. get "babel-flow"() {
  29951. return require("./parser-babel.js").parsers["babel-flow"];
  29952. },
  29953. get "babel-ts"() {
  29954. return require("./parser-babel.js").parsers["babel-ts"];
  29955. },
  29956. get json() {
  29957. return require("./parser-babel.js").parsers.json;
  29958. },
  29959. get json5() {
  29960. return require("./parser-babel.js").parsers.json5;
  29961. },
  29962. get "json-stringify"() {
  29963. return require("./parser-babel.js").parsers["json-stringify"];
  29964. },
  29965. get __js_expression() {
  29966. return require("./parser-babel.js").parsers.__js_expression;
  29967. },
  29968. get __vue_expression() {
  29969. return require("./parser-babel.js").parsers.__vue_expression;
  29970. },
  29971. get __vue_ts_expression() {
  29972. return require("./parser-babel.js").parsers.__vue_ts_expression;
  29973. },
  29974. get __vue_event_binding() {
  29975. return require("./parser-babel.js").parsers.__vue_event_binding;
  29976. },
  29977. get __vue_ts_event_binding() {
  29978. return require("./parser-babel.js").parsers.__vue_ts_event_binding;
  29979. },
  29980. get flow() {
  29981. return require("./parser-flow.js").parsers.flow;
  29982. },
  29983. get typescript() {
  29984. return require("./parser-typescript.js").parsers.typescript;
  29985. },
  29986. get __ng_action() {
  29987. return require("./parser-angular.js").parsers.__ng_action;
  29988. },
  29989. get __ng_binding() {
  29990. return require("./parser-angular.js").parsers.__ng_binding;
  29991. },
  29992. get __ng_interpolation() {
  29993. return require("./parser-angular.js").parsers.__ng_interpolation;
  29994. },
  29995. get __ng_directive() {
  29996. return require("./parser-angular.js").parsers.__ng_directive;
  29997. },
  29998. get acorn() {
  29999. return require("./parser-espree.js").parsers.acorn;
  30000. },
  30001. get espree() {
  30002. return require("./parser-espree.js").parsers.espree;
  30003. },
  30004. get meriyah() {
  30005. return require("./parser-meriyah.js").parsers.meriyah;
  30006. },
  30007. get __babel_estree() {
  30008. return require("./parser-babel.js").parsers.__babel_estree;
  30009. }
  30010. };
  30011. }
  30012. });
  30013. var require_JavaScript = __commonJS2({
  30014. "node_modules/linguist-languages/data/JavaScript.json"(exports2, module2) {
  30015. module2.exports = {
  30016. name: "JavaScript",
  30017. type: "programming",
  30018. tmScope: "source.js",
  30019. aceMode: "javascript",
  30020. codemirrorMode: "javascript",
  30021. codemirrorMimeType: "text/javascript",
  30022. color: "#f1e05a",
  30023. aliases: ["js", "node"],
  30024. extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".frag", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".jsx", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"],
  30025. filenames: ["Jakefile"],
  30026. interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"],
  30027. languageId: 183
  30028. };
  30029. }
  30030. });
  30031. var require_TypeScript = __commonJS2({
  30032. "node_modules/linguist-languages/data/TypeScript.json"(exports2, module2) {
  30033. module2.exports = {
  30034. name: "TypeScript",
  30035. type: "programming",
  30036. color: "#3178c6",
  30037. aliases: ["ts"],
  30038. interpreters: ["deno", "ts-node"],
  30039. extensions: [".ts", ".cts", ".mts"],
  30040. tmScope: "source.ts",
  30041. aceMode: "typescript",
  30042. codemirrorMode: "javascript",
  30043. codemirrorMimeType: "application/typescript",
  30044. languageId: 378
  30045. };
  30046. }
  30047. });
  30048. var require_TSX = __commonJS2({
  30049. "node_modules/linguist-languages/data/TSX.json"(exports2, module2) {
  30050. module2.exports = {
  30051. name: "TSX",
  30052. type: "programming",
  30053. color: "#3178c6",
  30054. group: "TypeScript",
  30055. extensions: [".tsx"],
  30056. tmScope: "source.tsx",
  30057. aceMode: "javascript",
  30058. codemirrorMode: "jsx",
  30059. codemirrorMimeType: "text/jsx",
  30060. languageId: 94901924
  30061. };
  30062. }
  30063. });
  30064. var require_JSON = __commonJS2({
  30065. "node_modules/linguist-languages/data/JSON.json"(exports2, module2) {
  30066. module2.exports = {
  30067. name: "JSON",
  30068. type: "data",
  30069. color: "#292929",
  30070. tmScope: "source.json",
  30071. aceMode: "json",
  30072. codemirrorMode: "javascript",
  30073. codemirrorMimeType: "application/json",
  30074. aliases: ["geojson", "jsonl", "topojson"],
  30075. extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"],
  30076. filenames: [".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", "Pipfile.lock", "composer.lock", "mcmod.info"],
  30077. languageId: 174
  30078. };
  30079. }
  30080. });
  30081. var require_JSON_with_Comments = __commonJS2({
  30082. "node_modules/linguist-languages/data/JSON with Comments.json"(exports2, module2) {
  30083. module2.exports = {
  30084. name: "JSON with Comments",
  30085. type: "data",
  30086. color: "#292929",
  30087. group: "JSON",
  30088. tmScope: "source.js",
  30089. aceMode: "javascript",
  30090. codemirrorMode: "javascript",
  30091. codemirrorMimeType: "text/javascript",
  30092. aliases: ["jsonc"],
  30093. extensions: [".jsonc", ".code-snippets", ".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"],
  30094. filenames: [".babelrc", ".devcontainer.json", ".eslintrc.json", ".jscsrc", ".jshintrc", ".jslintrc", "api-extractor.json", "devcontainer.json", "jsconfig.json", "language-configuration.json", "tsconfig.json", "tslint.json"],
  30095. languageId: 423
  30096. };
  30097. }
  30098. });
  30099. var require_JSON5 = __commonJS2({
  30100. "node_modules/linguist-languages/data/JSON5.json"(exports2, module2) {
  30101. module2.exports = {
  30102. name: "JSON5",
  30103. type: "data",
  30104. color: "#267CB9",
  30105. extensions: [".json5"],
  30106. tmScope: "source.js",
  30107. aceMode: "javascript",
  30108. codemirrorMode: "javascript",
  30109. codemirrorMimeType: "application/json",
  30110. languageId: 175
  30111. };
  30112. }
  30113. });
  30114. var require_language_js = __commonJS2({
  30115. "src/language-js/index.js"(exports2, module2) {
  30116. "use strict";
  30117. var createLanguage = require_create_language();
  30118. var estreePrinter = require_printer_estree();
  30119. var estreeJsonPrinter = require_printer_estree_json();
  30120. var options = require_options2();
  30121. var parsers = require_parsers();
  30122. var languages = [createLanguage(require_JavaScript(), (data) => ({
  30123. since: "0.0.0",
  30124. parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"],
  30125. vscodeLanguageIds: ["javascript", "mongo"],
  30126. interpreters: [...data.interpreters, "zx"],
  30127. extensions: [...data.extensions.filter((extension) => extension !== ".jsx"), ".wxs"]
  30128. })), createLanguage(require_JavaScript(), () => ({
  30129. name: "Flow",
  30130. since: "0.0.0",
  30131. parsers: ["flow", "babel-flow"],
  30132. vscodeLanguageIds: ["javascript"],
  30133. aliases: [],
  30134. filenames: [],
  30135. extensions: [".js.flow"]
  30136. })), createLanguage(require_JavaScript(), () => ({
  30137. name: "JSX",
  30138. since: "0.0.0",
  30139. parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"],
  30140. vscodeLanguageIds: ["javascriptreact"],
  30141. aliases: void 0,
  30142. filenames: void 0,
  30143. extensions: [".jsx"],
  30144. group: "JavaScript",
  30145. interpreters: void 0,
  30146. tmScope: "source.js.jsx",
  30147. aceMode: "javascript",
  30148. codemirrorMode: "jsx",
  30149. codemirrorMimeType: "text/jsx",
  30150. color: void 0
  30151. })), createLanguage(require_TypeScript(), () => ({
  30152. since: "1.4.0",
  30153. parsers: ["typescript", "babel-ts"],
  30154. vscodeLanguageIds: ["typescript"]
  30155. })), createLanguage(require_TSX(), () => ({
  30156. since: "1.4.0",
  30157. parsers: ["typescript", "babel-ts"],
  30158. vscodeLanguageIds: ["typescriptreact"]
  30159. })), createLanguage(require_JSON(), () => ({
  30160. name: "JSON.stringify",
  30161. since: "1.13.0",
  30162. parsers: ["json-stringify"],
  30163. vscodeLanguageIds: ["json"],
  30164. extensions: [".importmap"],
  30165. filenames: ["package.json", "package-lock.json", "composer.json"]
  30166. })), createLanguage(require_JSON(), (data) => ({
  30167. since: "1.5.0",
  30168. parsers: ["json"],
  30169. vscodeLanguageIds: ["json"],
  30170. extensions: data.extensions.filter((extension) => extension !== ".jsonl")
  30171. })), createLanguage(require_JSON_with_Comments(), (data) => ({
  30172. since: "1.5.0",
  30173. parsers: ["json"],
  30174. vscodeLanguageIds: ["jsonc"],
  30175. filenames: [...data.filenames, ".eslintrc", ".swcrc"]
  30176. })), createLanguage(require_JSON5(), () => ({
  30177. since: "1.13.0",
  30178. parsers: ["json5"],
  30179. vscodeLanguageIds: ["json5"]
  30180. }))];
  30181. var printers = {
  30182. estree: estreePrinter,
  30183. "estree-json": estreeJsonPrinter
  30184. };
  30185. module2.exports = {
  30186. languages,
  30187. options,
  30188. printers,
  30189. parsers
  30190. };
  30191. }
  30192. });
  30193. var require_clean2 = __commonJS2({
  30194. "src/language-css/clean.js"(exports2, module2) {
  30195. "use strict";
  30196. var {
  30197. isFrontMatterNode
  30198. } = require_util();
  30199. var getLast = require_get_last();
  30200. var ignoredProperties = /* @__PURE__ */ new Set(["raw", "raws", "sourceIndex", "source", "before", "after", "trailingComma"]);
  30201. function clean(ast, newObj, parent) {
  30202. if (isFrontMatterNode(ast) && ast.lang === "yaml") {
  30203. delete newObj.value;
  30204. }
  30205. if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length > 0) {
  30206. if (parent.nodes[0] === ast || isFrontMatterNode(parent.nodes[0]) && parent.nodes[1] === ast) {
  30207. delete newObj.text;
  30208. if (/^\*\s*@(?:format|prettier)\s*$/.test(ast.text)) {
  30209. return null;
  30210. }
  30211. }
  30212. if (parent.type === "css-root" && getLast(parent.nodes) === ast) {
  30213. return null;
  30214. }
  30215. }
  30216. if (ast.type === "value-root") {
  30217. delete newObj.text;
  30218. }
  30219. if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
  30220. delete newObj.value;
  30221. }
  30222. if (ast.type === "css-rule") {
  30223. delete newObj.params;
  30224. }
  30225. if (ast.type === "selector-combinator") {
  30226. newObj.value = newObj.value.replace(/\s+/g, " ");
  30227. }
  30228. if (ast.type === "media-feature") {
  30229. newObj.value = newObj.value.replace(/ /g, "");
  30230. }
  30231. if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].includes(newObj.value.replace().toLowerCase())) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") {
  30232. newObj.value = newObj.value.toLowerCase();
  30233. }
  30234. if (ast.type === "css-decl") {
  30235. newObj.prop = newObj.prop.toLowerCase();
  30236. }
  30237. if (ast.type === "css-atrule" || ast.type === "css-import") {
  30238. newObj.name = newObj.name.toLowerCase();
  30239. }
  30240. if (ast.type === "value-number") {
  30241. newObj.unit = newObj.unit.toLowerCase();
  30242. }
  30243. if ((ast.type === "media-feature" || ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-attribute" || ast.type === "selector-string" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "value-string") && newObj.value) {
  30244. newObj.value = cleanCSSStrings(newObj.value);
  30245. }
  30246. if (ast.type === "selector-attribute") {
  30247. newObj.attribute = newObj.attribute.trim();
  30248. if (newObj.namespace) {
  30249. if (typeof newObj.namespace === "string") {
  30250. newObj.namespace = newObj.namespace.trim();
  30251. if (newObj.namespace.length === 0) {
  30252. newObj.namespace = true;
  30253. }
  30254. }
  30255. }
  30256. if (newObj.value) {
  30257. newObj.value = newObj.value.trim().replace(/^["']|["']$/g, "");
  30258. delete newObj.quoted;
  30259. }
  30260. }
  30261. if ((ast.type === "media-value" || ast.type === "media-type" || ast.type === "value-number" || ast.type === "selector-root-invalid" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "selector-tag") && newObj.value) {
  30262. newObj.value = newObj.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g, (match, numStr, unit) => {
  30263. const num = Number(numStr);
  30264. return Number.isNaN(num) ? match : num + unit.toLowerCase();
  30265. });
  30266. }
  30267. if (ast.type === "selector-tag") {
  30268. const lowercasedValue = ast.value.toLowerCase();
  30269. if (["from", "to"].includes(lowercasedValue)) {
  30270. newObj.value = lowercasedValue;
  30271. }
  30272. }
  30273. if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
  30274. delete newObj.value;
  30275. }
  30276. if (ast.type === "selector-unknown") {
  30277. delete newObj.value;
  30278. }
  30279. if (ast.type === "value-comma_group") {
  30280. const index = ast.groups.findIndex((node) => node.type === "value-number" && node.unit === "...");
  30281. if (index !== -1) {
  30282. newObj.groups[index].unit = "";
  30283. newObj.groups.splice(index + 1, 0, {
  30284. type: "value-word",
  30285. value: "...",
  30286. isColor: false,
  30287. isHex: false
  30288. });
  30289. }
  30290. }
  30291. }
  30292. clean.ignoredProperties = ignoredProperties;
  30293. function cleanCSSStrings(value) {
  30294. return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1");
  30295. }
  30296. module2.exports = clean;
  30297. }
  30298. });
  30299. var require_print = __commonJS2({
  30300. "src/utils/front-matter/print.js"(exports2, module2) {
  30301. "use strict";
  30302. var {
  30303. builders: {
  30304. hardline,
  30305. markAsRoot
  30306. }
  30307. } = require("./doc.js");
  30308. function print(node, textToDoc) {
  30309. if (node.lang === "yaml") {
  30310. const value = node.value.trim();
  30311. const doc2 = value ? textToDoc(value, {
  30312. parser: "yaml"
  30313. }, {
  30314. stripTrailingHardline: true
  30315. }) : "";
  30316. return markAsRoot([node.startDelimiter, hardline, doc2, doc2 ? hardline : "", node.endDelimiter]);
  30317. }
  30318. }
  30319. module2.exports = print;
  30320. }
  30321. });
  30322. var require_embed2 = __commonJS2({
  30323. "src/language-css/embed.js"(exports2, module2) {
  30324. "use strict";
  30325. var {
  30326. builders: {
  30327. hardline
  30328. }
  30329. } = require("./doc.js");
  30330. var printFrontMatter = require_print();
  30331. function embed(path, print, textToDoc) {
  30332. const node = path.getValue();
  30333. if (node.type === "front-matter") {
  30334. const doc2 = printFrontMatter(node, textToDoc);
  30335. return doc2 ? [doc2, hardline] : "";
  30336. }
  30337. }
  30338. module2.exports = embed;
  30339. }
  30340. });
  30341. var require_parse4 = __commonJS2({
  30342. "src/utils/front-matter/parse.js"(exports2, module2) {
  30343. "use strict";
  30344. var frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})(?<language>[^\\n]*)\\n(?:|(?<value>.*?)\\n)(?<endDelimiter>\\k<startDelimiter>|\\.{3})[^\\S\\n]*(?:\\n|$)", "s");
  30345. function parse(text) {
  30346. const match = text.match(frontMatterRegex);
  30347. if (!match) {
  30348. return {
  30349. content: text
  30350. };
  30351. }
  30352. const {
  30353. startDelimiter,
  30354. language,
  30355. value = "",
  30356. endDelimiter
  30357. } = match.groups;
  30358. let lang = language.trim() || "yaml";
  30359. if (startDelimiter === "+++") {
  30360. lang = "toml";
  30361. }
  30362. if (lang !== "yaml" && startDelimiter !== endDelimiter) {
  30363. return {
  30364. content: text
  30365. };
  30366. }
  30367. const [raw] = match;
  30368. const frontMatter = {
  30369. type: "front-matter",
  30370. lang,
  30371. value,
  30372. startDelimiter,
  30373. endDelimiter,
  30374. raw: raw.replace(/\n$/, "")
  30375. };
  30376. return {
  30377. frontMatter,
  30378. content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
  30379. };
  30380. }
  30381. module2.exports = parse;
  30382. }
  30383. });
  30384. var require_pragma2 = __commonJS2({
  30385. "src/language-css/pragma.js"(exports2, module2) {
  30386. "use strict";
  30387. var jsPragma = require_pragma();
  30388. var parseFrontMatter = require_parse4();
  30389. function hasPragma(text) {
  30390. return jsPragma.hasPragma(parseFrontMatter(text).content);
  30391. }
  30392. function insertPragma(text) {
  30393. const {
  30394. frontMatter,
  30395. content
  30396. } = parseFrontMatter(text);
  30397. return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
  30398. }
  30399. module2.exports = {
  30400. hasPragma,
  30401. insertPragma
  30402. };
  30403. }
  30404. });
  30405. var require_utils8 = __commonJS2({
  30406. "src/language-css/utils/index.js"(exports2, module2) {
  30407. "use strict";
  30408. var colorAdjusterFunctions = /* @__PURE__ */ new Set(["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"]);
  30409. function getAncestorCounter(path, typeOrTypes) {
  30410. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  30411. let counter = -1;
  30412. let ancestorNode;
  30413. while (ancestorNode = path.getParentNode(++counter)) {
  30414. if (types.includes(ancestorNode.type)) {
  30415. return counter;
  30416. }
  30417. }
  30418. return -1;
  30419. }
  30420. function getAncestorNode(path, typeOrTypes) {
  30421. const counter = getAncestorCounter(path, typeOrTypes);
  30422. return counter === -1 ? null : path.getParentNode(counter);
  30423. }
  30424. function getPropOfDeclNode(path) {
  30425. var _declAncestorNode$pro;
  30426. const declAncestorNode = getAncestorNode(path, "css-decl");
  30427. return declAncestorNode === null || declAncestorNode === void 0 ? void 0 : (_declAncestorNode$pro = declAncestorNode.prop) === null || _declAncestorNode$pro === void 0 ? void 0 : _declAncestorNode$pro.toLowerCase();
  30428. }
  30429. var wideKeywords = /* @__PURE__ */ new Set(["initial", "inherit", "unset", "revert"]);
  30430. function isWideKeywords(value) {
  30431. return wideKeywords.has(value.toLowerCase());
  30432. }
  30433. function isKeyframeAtRuleKeywords(path, value) {
  30434. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30435. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
  30436. }
  30437. function maybeToLowerCase(value) {
  30438. return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
  30439. }
  30440. function insideValueFunctionNode(path, functionName) {
  30441. var _funcAncestorNode$val;
  30442. const funcAncestorNode = getAncestorNode(path, "value-func");
  30443. return (funcAncestorNode === null || funcAncestorNode === void 0 ? void 0 : (_funcAncestorNode$val = funcAncestorNode.value) === null || _funcAncestorNode$val === void 0 ? void 0 : _funcAncestorNode$val.toLowerCase()) === functionName;
  30444. }
  30445. function insideICSSRuleNode(path) {
  30446. var _ruleAncestorNode$raw;
  30447. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  30448. const selector = ruleAncestorNode === null || ruleAncestorNode === void 0 ? void 0 : (_ruleAncestorNode$raw = ruleAncestorNode.raws) === null || _ruleAncestorNode$raw === void 0 ? void 0 : _ruleAncestorNode$raw.selector;
  30449. return selector && (selector.startsWith(":import") || selector.startsWith(":export"));
  30450. }
  30451. function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
  30452. const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames) ? atRuleNameOrAtRuleNames : [atRuleNameOrAtRuleNames];
  30453. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30454. return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
  30455. }
  30456. function insideURLFunctionInImportAtRuleNode(path) {
  30457. const node = path.getValue();
  30458. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30459. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) === "import" && node.groups[0].value === "url" && node.groups.length === 2;
  30460. }
  30461. function isURLFunctionNode(node) {
  30462. return node.type === "value-func" && node.value.toLowerCase() === "url";
  30463. }
  30464. function isLastNode(path, node) {
  30465. var _path$getParentNode;
  30466. const nodes = (_path$getParentNode = path.getParentNode()) === null || _path$getParentNode === void 0 ? void 0 : _path$getParentNode.nodes;
  30467. return nodes && nodes.indexOf(node) === nodes.length - 1;
  30468. }
  30469. function isDetachedRulesetDeclarationNode(node) {
  30470. const {
  30471. selector
  30472. } = node;
  30473. if (!selector) {
  30474. return false;
  30475. }
  30476. return typeof selector === "string" && /^@.+:.*$/.test(selector) || selector.value && /^@.+:.*$/.test(selector.value);
  30477. }
  30478. function isForKeywordNode(node) {
  30479. return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
  30480. }
  30481. function isIfElseKeywordNode(node) {
  30482. return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
  30483. }
  30484. function isEachKeywordNode(node) {
  30485. return node.type === "value-word" && node.value === "in";
  30486. }
  30487. function isMultiplicationNode(node) {
  30488. return node.type === "value-operator" && node.value === "*";
  30489. }
  30490. function isDivisionNode(node) {
  30491. return node.type === "value-operator" && node.value === "/";
  30492. }
  30493. function isAdditionNode(node) {
  30494. return node.type === "value-operator" && node.value === "+";
  30495. }
  30496. function isSubtractionNode(node) {
  30497. return node.type === "value-operator" && node.value === "-";
  30498. }
  30499. function isModuloNode(node) {
  30500. return node.type === "value-operator" && node.value === "%";
  30501. }
  30502. function isMathOperatorNode(node) {
  30503. return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
  30504. }
  30505. function isEqualityOperatorNode(node) {
  30506. return node.type === "value-word" && ["==", "!="].includes(node.value);
  30507. }
  30508. function isRelationalOperatorNode(node) {
  30509. return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
  30510. }
  30511. function isSCSSControlDirectiveNode(node) {
  30512. return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
  30513. }
  30514. function isDetachedRulesetCallNode(node) {
  30515. var _node$raws;
  30516. return ((_node$raws = node.raws) === null || _node$raws === void 0 ? void 0 : _node$raws.params) && /^\(\s*\)$/.test(node.raws.params);
  30517. }
  30518. function isTemplatePlaceholderNode(node) {
  30519. return node.name.startsWith("prettier-placeholder");
  30520. }
  30521. function isTemplatePropNode(node) {
  30522. return node.prop.startsWith("@prettier-placeholder");
  30523. }
  30524. function isPostcssSimpleVarNode(currentNode, nextNode) {
  30525. return currentNode.value === "$$" && currentNode.type === "value-func" && (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "value-word" && !nextNode.raws.before;
  30526. }
  30527. function hasComposesNode(node) {
  30528. var _node$value, _node$value$group;
  30529. return ((_node$value = node.value) === null || _node$value === void 0 ? void 0 : _node$value.type) === "value-root" && ((_node$value$group = node.value.group) === null || _node$value$group === void 0 ? void 0 : _node$value$group.type) === "value-value" && node.prop.toLowerCase() === "composes";
  30530. }
  30531. function hasParensAroundNode(node) {
  30532. var _node$value2, _node$value2$group, _node$value2$group$gr;
  30533. return ((_node$value2 = node.value) === null || _node$value2 === void 0 ? void 0 : (_node$value2$group = _node$value2.group) === null || _node$value2$group === void 0 ? void 0 : (_node$value2$group$gr = _node$value2$group.group) === null || _node$value2$group$gr === void 0 ? void 0 : _node$value2$group$gr.type) === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null;
  30534. }
  30535. function hasEmptyRawBefore(node) {
  30536. var _node$raws2;
  30537. return ((_node$raws2 = node.raws) === null || _node$raws2 === void 0 ? void 0 : _node$raws2.before) === "";
  30538. }
  30539. function isKeyValuePairNode(node) {
  30540. var _node$groups, _node$groups$;
  30541. return node.type === "value-comma_group" && ((_node$groups = node.groups) === null || _node$groups === void 0 ? void 0 : (_node$groups$ = _node$groups[1]) === null || _node$groups$ === void 0 ? void 0 : _node$groups$.type) === "value-colon";
  30542. }
  30543. function isKeyValuePairInParenGroupNode(node) {
  30544. var _node$groups2;
  30545. return node.type === "value-paren_group" && ((_node$groups2 = node.groups) === null || _node$groups2 === void 0 ? void 0 : _node$groups2[0]) && isKeyValuePairNode(node.groups[0]);
  30546. }
  30547. function isSCSSMapItemNode(path) {
  30548. var _declNode$prop;
  30549. const node = path.getValue();
  30550. if (node.groups.length === 0) {
  30551. return false;
  30552. }
  30553. const parentParentNode = path.getParentNode(1);
  30554. if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
  30555. return false;
  30556. }
  30557. const declNode = getAncestorNode(path, "css-decl");
  30558. if (declNode !== null && declNode !== void 0 && (_declNode$prop = declNode.prop) !== null && _declNode$prop !== void 0 && _declNode$prop.startsWith("$")) {
  30559. return true;
  30560. }
  30561. if (isKeyValuePairInParenGroupNode(parentParentNode)) {
  30562. return true;
  30563. }
  30564. if (parentParentNode.type === "value-func") {
  30565. return true;
  30566. }
  30567. return false;
  30568. }
  30569. function isInlineValueCommentNode(node) {
  30570. return node.type === "value-comment" && node.inline;
  30571. }
  30572. function isHashNode(node) {
  30573. return node.type === "value-word" && node.value === "#";
  30574. }
  30575. function isLeftCurlyBraceNode(node) {
  30576. return node.type === "value-word" && node.value === "{";
  30577. }
  30578. function isRightCurlyBraceNode(node) {
  30579. return node.type === "value-word" && node.value === "}";
  30580. }
  30581. function isWordNode(node) {
  30582. return ["value-word", "value-atword"].includes(node.type);
  30583. }
  30584. function isColonNode(node) {
  30585. return (node === null || node === void 0 ? void 0 : node.type) === "value-colon";
  30586. }
  30587. function isKeyInValuePairNode(node, parentNode) {
  30588. if (!isKeyValuePairNode(parentNode)) {
  30589. return false;
  30590. }
  30591. const {
  30592. groups
  30593. } = parentNode;
  30594. const index = groups.indexOf(node);
  30595. if (index === -1) {
  30596. return false;
  30597. }
  30598. return isColonNode(groups[index + 1]);
  30599. }
  30600. function isMediaAndSupportsKeywords(node) {
  30601. return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
  30602. }
  30603. function isColorAdjusterFuncNode(node) {
  30604. if (node.type !== "value-func") {
  30605. return false;
  30606. }
  30607. return colorAdjusterFunctions.has(node.value.toLowerCase());
  30608. }
  30609. function lastLineHasInlineComment(text) {
  30610. return /\/\//.test(text.split(/[\n\r]/).pop());
  30611. }
  30612. function isAtWordPlaceholderNode(node) {
  30613. return (node === null || node === void 0 ? void 0 : node.type) === "value-atword" && node.value.startsWith("prettier-placeholder-");
  30614. }
  30615. function isConfigurationNode(node, parentNode) {
  30616. var _node$open, _node$close;
  30617. if (((_node$open = node.open) === null || _node$open === void 0 ? void 0 : _node$open.value) !== "(" || ((_node$close = node.close) === null || _node$close === void 0 ? void 0 : _node$close.value) !== ")" || node.groups.some((group) => group.type !== "value-comma_group")) {
  30618. return false;
  30619. }
  30620. if (parentNode.type === "value-comma_group") {
  30621. const prevIdx = parentNode.groups.indexOf(node) - 1;
  30622. const maybeWithNode = parentNode.groups[prevIdx];
  30623. if ((maybeWithNode === null || maybeWithNode === void 0 ? void 0 : maybeWithNode.type) === "value-word" && maybeWithNode.value === "with") {
  30624. return true;
  30625. }
  30626. }
  30627. return false;
  30628. }
  30629. function isParenGroupNode(node) {
  30630. var _node$open2, _node$close2;
  30631. return node.type === "value-paren_group" && ((_node$open2 = node.open) === null || _node$open2 === void 0 ? void 0 : _node$open2.value) === "(" && ((_node$close2 = node.close) === null || _node$close2 === void 0 ? void 0 : _node$close2.value) === ")";
  30632. }
  30633. module2.exports = {
  30634. getAncestorCounter,
  30635. getAncestorNode,
  30636. getPropOfDeclNode,
  30637. maybeToLowerCase,
  30638. insideValueFunctionNode,
  30639. insideICSSRuleNode,
  30640. insideAtRuleNode,
  30641. insideURLFunctionInImportAtRuleNode,
  30642. isKeyframeAtRuleKeywords,
  30643. isWideKeywords,
  30644. isLastNode,
  30645. isSCSSControlDirectiveNode,
  30646. isDetachedRulesetDeclarationNode,
  30647. isRelationalOperatorNode,
  30648. isEqualityOperatorNode,
  30649. isMultiplicationNode,
  30650. isDivisionNode,
  30651. isAdditionNode,
  30652. isSubtractionNode,
  30653. isModuloNode,
  30654. isMathOperatorNode,
  30655. isEachKeywordNode,
  30656. isForKeywordNode,
  30657. isURLFunctionNode,
  30658. isIfElseKeywordNode,
  30659. hasComposesNode,
  30660. hasParensAroundNode,
  30661. hasEmptyRawBefore,
  30662. isDetachedRulesetCallNode,
  30663. isTemplatePlaceholderNode,
  30664. isTemplatePropNode,
  30665. isPostcssSimpleVarNode,
  30666. isKeyValuePairNode,
  30667. isKeyValuePairInParenGroupNode,
  30668. isKeyInValuePairNode,
  30669. isSCSSMapItemNode,
  30670. isInlineValueCommentNode,
  30671. isHashNode,
  30672. isLeftCurlyBraceNode,
  30673. isRightCurlyBraceNode,
  30674. isWordNode,
  30675. isColonNode,
  30676. isMediaAndSupportsKeywords,
  30677. isColorAdjusterFuncNode,
  30678. lastLineHasInlineComment,
  30679. isAtWordPlaceholderNode,
  30680. isConfigurationNode,
  30681. isParenGroupNode
  30682. };
  30683. }
  30684. });
  30685. var require_line_column_to_index = __commonJS2({
  30686. "src/utils/line-column-to-index.js"(exports2, module2) {
  30687. "use strict";
  30688. module2.exports = function(lineColumn, text) {
  30689. let index = 0;
  30690. for (let i = 0; i < lineColumn.line - 1; ++i) {
  30691. index = text.indexOf("\n", index) + 1;
  30692. }
  30693. return index + lineColumn.column;
  30694. };
  30695. }
  30696. });
  30697. var require_loc2 = __commonJS2({
  30698. "src/language-css/loc.js"(exports2, module2) {
  30699. "use strict";
  30700. var {
  30701. skipEverythingButNewLine
  30702. } = require_skip();
  30703. var getLast = require_get_last();
  30704. var lineColumnToIndex = require_line_column_to_index();
  30705. function calculateLocStart(node, text) {
  30706. if (typeof node.sourceIndex === "number") {
  30707. return node.sourceIndex;
  30708. }
  30709. return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
  30710. }
  30711. function calculateLocEnd(node, text) {
  30712. if (node.type === "css-comment" && node.inline) {
  30713. return skipEverythingButNewLine(text, node.source.startOffset);
  30714. }
  30715. const endNode = node.nodes && getLast(node.nodes);
  30716. if (endNode && node.source && !node.source.end) {
  30717. node = endNode;
  30718. }
  30719. if (node.source && node.source.end) {
  30720. return lineColumnToIndex(node.source.end, text);
  30721. }
  30722. return null;
  30723. }
  30724. function calculateLoc(node, text) {
  30725. if (node.source) {
  30726. node.source.startOffset = calculateLocStart(node, text);
  30727. node.source.endOffset = calculateLocEnd(node, text);
  30728. }
  30729. for (const key in node) {
  30730. const child = node[key];
  30731. if (key === "source" || !child || typeof child !== "object") {
  30732. continue;
  30733. }
  30734. if (child.type === "value-root" || child.type === "value-unknown") {
  30735. calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
  30736. } else {
  30737. calculateLoc(child, text);
  30738. }
  30739. }
  30740. }
  30741. function calculateValueNodeLoc(node, rootOffset, text) {
  30742. if (node.source) {
  30743. node.source.startOffset = calculateLocStart(node, text) + rootOffset;
  30744. node.source.endOffset = calculateLocEnd(node, text) + rootOffset;
  30745. }
  30746. for (const key in node) {
  30747. const child = node[key];
  30748. if (key === "source" || !child || typeof child !== "object") {
  30749. continue;
  30750. }
  30751. calculateValueNodeLoc(child, rootOffset, text);
  30752. }
  30753. }
  30754. function getValueRootOffset(node) {
  30755. let result = node.source.startOffset;
  30756. if (typeof node.prop === "string") {
  30757. result += node.prop.length;
  30758. }
  30759. if (node.type === "css-atrule" && typeof node.name === "string") {
  30760. result += 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
  30761. }
  30762. if (node.type !== "css-atrule" && node.raws && typeof node.raws.between === "string") {
  30763. result += node.raws.between.length;
  30764. }
  30765. return result;
  30766. }
  30767. function replaceQuotesInInlineComments(text) {
  30768. let state = "initial";
  30769. let stateToReturnFromQuotes = "initial";
  30770. let inlineCommentStartIndex;
  30771. let inlineCommentContainsQuotes = false;
  30772. const inlineCommentsToReplace = [];
  30773. for (let i = 0; i < text.length; i++) {
  30774. const c = text[i];
  30775. switch (state) {
  30776. case "initial":
  30777. if (c === "'") {
  30778. state = "single-quotes";
  30779. continue;
  30780. }
  30781. if (c === '"') {
  30782. state = "double-quotes";
  30783. continue;
  30784. }
  30785. if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
  30786. state = "url";
  30787. i += 3;
  30788. continue;
  30789. }
  30790. if (c === "*" && text[i - 1] === "/") {
  30791. state = "comment-block";
  30792. continue;
  30793. }
  30794. if (c === "/" && text[i - 1] === "/") {
  30795. state = "comment-inline";
  30796. inlineCommentStartIndex = i - 1;
  30797. continue;
  30798. }
  30799. continue;
  30800. case "single-quotes":
  30801. if (c === "'" && text[i - 1] !== "\\") {
  30802. state = stateToReturnFromQuotes;
  30803. stateToReturnFromQuotes = "initial";
  30804. }
  30805. if (c === "\n" || c === "\r") {
  30806. return text;
  30807. }
  30808. continue;
  30809. case "double-quotes":
  30810. if (c === '"' && text[i - 1] !== "\\") {
  30811. state = stateToReturnFromQuotes;
  30812. stateToReturnFromQuotes = "initial";
  30813. }
  30814. if (c === "\n" || c === "\r") {
  30815. return text;
  30816. }
  30817. continue;
  30818. case "url":
  30819. if (c === ")") {
  30820. state = "initial";
  30821. }
  30822. if (c === "\n" || c === "\r") {
  30823. return text;
  30824. }
  30825. if (c === "'") {
  30826. state = "single-quotes";
  30827. stateToReturnFromQuotes = "url";
  30828. continue;
  30829. }
  30830. if (c === '"') {
  30831. state = "double-quotes";
  30832. stateToReturnFromQuotes = "url";
  30833. continue;
  30834. }
  30835. continue;
  30836. case "comment-block":
  30837. if (c === "/" && text[i - 1] === "*") {
  30838. state = "initial";
  30839. }
  30840. continue;
  30841. case "comment-inline":
  30842. if (c === '"' || c === "'" || c === "*") {
  30843. inlineCommentContainsQuotes = true;
  30844. }
  30845. if (c === "\n" || c === "\r") {
  30846. if (inlineCommentContainsQuotes) {
  30847. inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
  30848. }
  30849. state = "initial";
  30850. inlineCommentContainsQuotes = false;
  30851. }
  30852. continue;
  30853. }
  30854. }
  30855. for (const [start, end] of inlineCommentsToReplace) {
  30856. text = text.slice(0, start) + text.slice(start, end).replace(/["'*]/g, " ") + text.slice(end);
  30857. }
  30858. return text;
  30859. }
  30860. function locStart(node) {
  30861. return node.source.startOffset;
  30862. }
  30863. function locEnd(node) {
  30864. return node.source.endOffset;
  30865. }
  30866. module2.exports = {
  30867. locStart,
  30868. locEnd,
  30869. calculateLoc,
  30870. replaceQuotesInInlineComments
  30871. };
  30872. }
  30873. });
  30874. var require_is_less_parser = __commonJS2({
  30875. "src/language-css/utils/is-less-parser.js"(exports2, module2) {
  30876. "use strict";
  30877. function isLessParser(options) {
  30878. return options.parser === "css" || options.parser === "less";
  30879. }
  30880. module2.exports = isLessParser;
  30881. }
  30882. });
  30883. var require_is_scss = __commonJS2({
  30884. "src/language-css/utils/is-scss.js"(exports2, module2) {
  30885. "use strict";
  30886. function isSCSS(parser, text) {
  30887. const hasExplicitParserChoice = parser === "less" || parser === "scss";
  30888. const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
  30889. return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
  30890. }
  30891. module2.exports = isSCSS;
  30892. }
  30893. });
  30894. var require_css_units_evaluate = __commonJS2({
  30895. "src/language-css/utils/css-units.evaluate.js"(exports2, module2) {
  30896. module2.exports = {
  30897. em: "em",
  30898. rem: "rem",
  30899. ex: "ex",
  30900. rex: "rex",
  30901. cap: "cap",
  30902. rcap: "rcap",
  30903. ch: "ch",
  30904. rch: "rch",
  30905. ic: "ic",
  30906. ric: "ric",
  30907. lh: "lh",
  30908. rlh: "rlh",
  30909. vw: "vw",
  30910. svw: "svw",
  30911. lvw: "lvw",
  30912. dvw: "dvw",
  30913. vh: "vh",
  30914. svh: "svh",
  30915. lvh: "lvh",
  30916. dvh: "dvh",
  30917. vi: "vi",
  30918. svi: "svi",
  30919. lvi: "lvi",
  30920. dvi: "dvi",
  30921. vb: "vb",
  30922. svb: "svb",
  30923. lvb: "lvb",
  30924. dvb: "dvb",
  30925. vmin: "vmin",
  30926. svmin: "svmin",
  30927. lvmin: "lvmin",
  30928. dvmin: "dvmin",
  30929. vmax: "vmax",
  30930. svmax: "svmax",
  30931. lvmax: "lvmax",
  30932. dvmax: "dvmax",
  30933. cm: "cm",
  30934. mm: "mm",
  30935. q: "Q",
  30936. in: "in",
  30937. pt: "pt",
  30938. pc: "pc",
  30939. px: "px",
  30940. deg: "deg",
  30941. grad: "grad",
  30942. rad: "rad",
  30943. turn: "turn",
  30944. s: "s",
  30945. ms: "ms",
  30946. hz: "Hz",
  30947. khz: "kHz",
  30948. dpi: "dpi",
  30949. dpcm: "dpcm",
  30950. dppx: "dppx",
  30951. x: "x"
  30952. };
  30953. }
  30954. });
  30955. var require_print_unit = __commonJS2({
  30956. "src/language-css/utils/print-unit.js"(exports2, module2) {
  30957. "use strict";
  30958. var CSS_UNITS = require_css_units_evaluate();
  30959. function printUnit(unit) {
  30960. const lowercased = unit.toLowerCase();
  30961. return Object.prototype.hasOwnProperty.call(CSS_UNITS, lowercased) ? CSS_UNITS[lowercased] : unit;
  30962. }
  30963. module2.exports = printUnit;
  30964. }
  30965. });
  30966. var require_printer_postcss = __commonJS2({
  30967. "src/language-css/printer-postcss.js"(exports2, module2) {
  30968. "use strict";
  30969. var getLast = require_get_last();
  30970. var {
  30971. printNumber,
  30972. printString,
  30973. hasNewline,
  30974. isFrontMatterNode,
  30975. isNextLineEmpty,
  30976. isNonEmptyArray
  30977. } = require_util();
  30978. var {
  30979. builders: {
  30980. join,
  30981. line,
  30982. hardline,
  30983. softline,
  30984. group,
  30985. fill,
  30986. indent,
  30987. dedent,
  30988. ifBreak,
  30989. breakParent
  30990. },
  30991. utils: {
  30992. removeLines,
  30993. getDocParts
  30994. }
  30995. } = require("./doc.js");
  30996. var clean = require_clean2();
  30997. var embed = require_embed2();
  30998. var {
  30999. insertPragma
  31000. } = require_pragma2();
  31001. var {
  31002. getAncestorNode,
  31003. getPropOfDeclNode,
  31004. maybeToLowerCase,
  31005. insideValueFunctionNode,
  31006. insideICSSRuleNode,
  31007. insideAtRuleNode,
  31008. insideURLFunctionInImportAtRuleNode,
  31009. isKeyframeAtRuleKeywords,
  31010. isWideKeywords,
  31011. isLastNode,
  31012. isSCSSControlDirectiveNode,
  31013. isDetachedRulesetDeclarationNode,
  31014. isRelationalOperatorNode,
  31015. isEqualityOperatorNode,
  31016. isMultiplicationNode,
  31017. isDivisionNode,
  31018. isAdditionNode,
  31019. isSubtractionNode,
  31020. isMathOperatorNode,
  31021. isEachKeywordNode,
  31022. isForKeywordNode,
  31023. isURLFunctionNode,
  31024. isIfElseKeywordNode,
  31025. hasComposesNode,
  31026. hasParensAroundNode,
  31027. hasEmptyRawBefore,
  31028. isKeyValuePairNode,
  31029. isKeyInValuePairNode,
  31030. isDetachedRulesetCallNode,
  31031. isTemplatePlaceholderNode,
  31032. isTemplatePropNode,
  31033. isPostcssSimpleVarNode,
  31034. isSCSSMapItemNode,
  31035. isInlineValueCommentNode,
  31036. isHashNode,
  31037. isLeftCurlyBraceNode,
  31038. isRightCurlyBraceNode,
  31039. isWordNode,
  31040. isColonNode,
  31041. isMediaAndSupportsKeywords,
  31042. isColorAdjusterFuncNode,
  31043. lastLineHasInlineComment,
  31044. isAtWordPlaceholderNode,
  31045. isConfigurationNode,
  31046. isParenGroupNode
  31047. } = require_utils8();
  31048. var {
  31049. locStart,
  31050. locEnd
  31051. } = require_loc2();
  31052. var isLessParser = require_is_less_parser();
  31053. var isSCSS = require_is_scss();
  31054. var printUnit = require_print_unit();
  31055. function shouldPrintComma(options) {
  31056. return options.trailingComma === "es5" || options.trailingComma === "all";
  31057. }
  31058. function genericPrint(path, options, print) {
  31059. const node = path.getValue();
  31060. if (!node) {
  31061. return "";
  31062. }
  31063. if (typeof node === "string") {
  31064. return node;
  31065. }
  31066. switch (node.type) {
  31067. case "front-matter":
  31068. return [node.raw, hardline];
  31069. case "css-root": {
  31070. const nodes = printNodeSequence(path, options, print);
  31071. const after = node.raws.after.trim();
  31072. return [nodes, after ? ` ${after}` : "", getDocParts(nodes).length > 0 ? hardline : ""];
  31073. }
  31074. case "css-comment": {
  31075. const isInlineComment = node.inline || node.raws.inline;
  31076. const text = options.originalText.slice(locStart(node), locEnd(node));
  31077. return isInlineComment ? text.trimEnd() : text;
  31078. }
  31079. case "css-rule": {
  31080. return [print("selector"), node.important ? " !important" : "", node.nodes ? [node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment(node.selector.value) ? line : " ", "{", node.nodes.length > 0 ? indent([hardline, printNodeSequence(path, options, print)]) : "", hardline, "}", isDetachedRulesetDeclarationNode(node) ? ";" : ""] : ";"];
  31081. }
  31082. case "css-decl": {
  31083. const parentNode = path.getParentNode();
  31084. const {
  31085. between: rawBetween
  31086. } = node.raws;
  31087. const trimmedBetween = rawBetween.trim();
  31088. const isColon = trimmedBetween === ":";
  31089. let value = hasComposesNode(node) ? removeLines(print("value")) : print("value");
  31090. if (!isColon && lastLineHasInlineComment(trimmedBetween)) {
  31091. value = indent([hardline, dedent(value)]);
  31092. }
  31093. return [node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop), trimmedBetween.startsWith("//") ? " " : "", trimmedBetween, node.extend ? "" : " ", isLessParser(options) && node.extend && node.selector ? ["extend(", print("selector"), ")"] : "", value, node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? [" {", indent([softline, printNodeSequence(path, options, print)]), softline, "}"] : isTemplatePropNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode(path, node) ? ifBreak(";") : ";"];
  31094. }
  31095. case "css-atrule": {
  31096. const parentNode = path.getParentNode();
  31097. const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";";
  31098. if (isLessParser(options)) {
  31099. if (node.mixin) {
  31100. return [print("selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31101. }
  31102. if (node.function) {
  31103. return [node.name, print("params"), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31104. }
  31105. if (node.variable) {
  31106. return ["@", node.name, ": ", node.value ? print("value") : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? ["{", indent([node.nodes.length > 0 ? softline : "", printNodeSequence(path, options, print)]), softline, "}"] : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31107. }
  31108. }
  31109. return ["@", isDetachedRulesetCallNode(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase(node.name), node.params ? [isDetachedRulesetCallNode(node) ? "" : isTemplatePlaceholderNode(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? [hardline, hardline] : /^\s*\n/.test(node.raws.afterName) ? hardline : " " : " ", print("params")] : "", node.selector ? indent([" ", print("selector")]) : "", node.value ? group([" ", print("value"), isSCSSControlDirectiveNode(node) ? hasParensAroundNode(node) ? " " : line : ""]) : node.name === "else" ? " " : "", node.nodes ? [isSCSSControlDirectiveNode(node) ? "" : node.selector && !node.selector.nodes && typeof node.selector.value === "string" && lastLineHasInlineComment(node.selector.value) || !node.selector && typeof node.params === "string" && lastLineHasInlineComment(node.params) ? line : " ", "{", indent([node.nodes.length > 0 ? softline : "", printNodeSequence(path, options, print)]), softline, "}"] : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31110. }
  31111. case "media-query-list": {
  31112. const parts = [];
  31113. path.each((childPath) => {
  31114. const node2 = childPath.getValue();
  31115. if (node2.type === "media-query" && node2.value === "") {
  31116. return;
  31117. }
  31118. parts.push(print());
  31119. }, "nodes");
  31120. return group(indent(join(line, parts)));
  31121. }
  31122. case "media-query": {
  31123. return [join(" ", path.map(print, "nodes")), isLastNode(path, node) ? "" : ","];
  31124. }
  31125. case "media-type": {
  31126. return adjustNumbers(adjustStrings(node.value, options));
  31127. }
  31128. case "media-feature-expression": {
  31129. if (!node.nodes) {
  31130. return node.value;
  31131. }
  31132. return ["(", ...path.map(print, "nodes"), ")"];
  31133. }
  31134. case "media-feature": {
  31135. return maybeToLowerCase(adjustStrings(node.value.replace(/ +/g, " "), options));
  31136. }
  31137. case "media-colon": {
  31138. return [node.value, " "];
  31139. }
  31140. case "media-value": {
  31141. return adjustNumbers(adjustStrings(node.value, options));
  31142. }
  31143. case "media-keyword": {
  31144. return adjustStrings(node.value, options);
  31145. }
  31146. case "media-url": {
  31147. return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/g, ")"), options);
  31148. }
  31149. case "media-unknown": {
  31150. return node.value;
  31151. }
  31152. case "selector-root": {
  31153. return group([insideAtRuleNode(path, "custom-selector") ? [getAncestorNode(path, "css-atrule").customSelector, line] : "", join([",", insideAtRuleNode(path, ["extend", "custom-selector", "nest"]) ? line : hardline], path.map(print, "nodes"))]);
  31154. }
  31155. case "selector-selector": {
  31156. return group(indent(path.map(print, "nodes")));
  31157. }
  31158. case "selector-comment": {
  31159. return node.value;
  31160. }
  31161. case "selector-string": {
  31162. return adjustStrings(node.value, options);
  31163. }
  31164. case "selector-tag": {
  31165. const parentNode = path.getParentNode();
  31166. const index = parentNode && parentNode.nodes.indexOf(node);
  31167. const prevNode = index && parentNode.nodes[index - 1];
  31168. return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords(path, node.value) ? node.value.toLowerCase() : node.value)];
  31169. }
  31170. case "selector-id": {
  31171. return ["#", node.value];
  31172. }
  31173. case "selector-class": {
  31174. return [".", adjustNumbers(adjustStrings(node.value, options))];
  31175. }
  31176. case "selector-attribute": {
  31177. var _node$operator;
  31178. return ["[", node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.attribute.trim(), (_node$operator = node.operator) !== null && _node$operator !== void 0 ? _node$operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"];
  31179. }
  31180. case "selector-combinator": {
  31181. if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
  31182. const parentNode = path.getParentNode();
  31183. const leading2 = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line;
  31184. return [leading2, node.value, isLastNode(path, node) ? "" : " "];
  31185. }
  31186. const leading = node.value.trim().startsWith("(") ? line : "";
  31187. const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line;
  31188. return [leading, value];
  31189. }
  31190. case "selector-universal": {
  31191. return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.value];
  31192. }
  31193. case "selector-pseudo": {
  31194. return [maybeToLowerCase(node.value), isNonEmptyArray(node.nodes) ? group(["(", indent([softline, join([",", line], path.map(print, "nodes"))]), softline, ")"]) : ""];
  31195. }
  31196. case "selector-nesting": {
  31197. return node.value;
  31198. }
  31199. case "selector-unknown": {
  31200. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  31201. if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
  31202. return adjustNumbers(adjustStrings(maybeToLowerCase(node.value), options));
  31203. }
  31204. const parentNode = path.getParentNode();
  31205. if (parentNode.raws && parentNode.raws.selector) {
  31206. const start = locStart(parentNode);
  31207. const end = start + parentNode.raws.selector.length;
  31208. return options.originalText.slice(start, end).trim();
  31209. }
  31210. const grandParent = path.getParentNode(1);
  31211. if (parentNode.type === "value-paren_group" && grandParent && grandParent.type === "value-func" && grandParent.value === "selector") {
  31212. const start = locEnd(parentNode.open) + 1;
  31213. const end = locStart(parentNode.close);
  31214. const selector = options.originalText.slice(start, end).trim();
  31215. return lastLineHasInlineComment(selector) ? [breakParent, selector] : selector;
  31216. }
  31217. return node.value;
  31218. }
  31219. case "value-value":
  31220. case "value-root": {
  31221. return print("group");
  31222. }
  31223. case "value-comment": {
  31224. return options.originalText.slice(locStart(node), locEnd(node));
  31225. }
  31226. case "value-comma_group": {
  31227. const parentNode = path.getParentNode();
  31228. const parentParentNode = path.getParentNode(1);
  31229. const declAncestorProp = getPropOfDeclNode(path);
  31230. const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
  31231. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  31232. const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
  31233. const hasInlineComment = node.groups.some((node2) => isInlineValueCommentNode(node2));
  31234. const printed = path.map(print, "groups");
  31235. const parts = [];
  31236. const insideURLFunction = insideValueFunctionNode(path, "url");
  31237. let insideSCSSInterpolationInString = false;
  31238. let didBreak = false;
  31239. for (let i = 0; i < node.groups.length; ++i) {
  31240. var _iNode$value;
  31241. parts.push(printed[i]);
  31242. const iPrevNode = node.groups[i - 1];
  31243. const iNode = node.groups[i];
  31244. const iNextNode = node.groups[i + 1];
  31245. const iNextNextNode = node.groups[i + 2];
  31246. if (insideURLFunction) {
  31247. if (iNextNode && isAdditionNode(iNextNode) || isAdditionNode(iNode)) {
  31248. parts.push(" ");
  31249. }
  31250. continue;
  31251. }
  31252. if (insideAtRuleNode(path, "forward") && iNode.type === "value-word" && iNode.value && iPrevNode !== void 0 && iPrevNode.type === "value-word" && iPrevNode.value === "as" && iNextNode.type === "value-operator" && iNextNode.value === "*") {
  31253. continue;
  31254. }
  31255. if (!iNextNode) {
  31256. continue;
  31257. }
  31258. if (iNode.type === "value-word" && iNode.value.endsWith("-") && isAtWordPlaceholderNode(iNextNode)) {
  31259. continue;
  31260. }
  31261. const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
  31262. const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
  31263. if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
  31264. insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
  31265. continue;
  31266. }
  31267. if (insideSCSSInterpolationInString) {
  31268. continue;
  31269. }
  31270. if (isColonNode(iNode) || isColonNode(iNextNode)) {
  31271. continue;
  31272. }
  31273. if (iNode.type === "value-atword" && iNode.value === "") {
  31274. continue;
  31275. }
  31276. if (iNode.value === "~") {
  31277. continue;
  31278. }
  31279. if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
  31280. continue;
  31281. }
  31282. if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
  31283. continue;
  31284. }
  31285. if (iNode.value === "\\") {
  31286. continue;
  31287. }
  31288. if (isPostcssSimpleVarNode(iNode, iNextNode)) {
  31289. continue;
  31290. }
  31291. if (isHashNode(iNode) || isLeftCurlyBraceNode(iNode) || isRightCurlyBraceNode(iNextNode) || isLeftCurlyBraceNode(iNextNode) && hasEmptyRawBefore(iNextNode) || isRightCurlyBraceNode(iNode) && hasEmptyRawBefore(iNextNode)) {
  31292. continue;
  31293. }
  31294. if (iNode.value === "--" && isHashNode(iNextNode)) {
  31295. continue;
  31296. }
  31297. const isMathOperator = isMathOperatorNode(iNode);
  31298. const isNextMathOperator = isMathOperatorNode(iNextNode);
  31299. if ((isMathOperator && isHashNode(iNextNode) || isNextMathOperator && isRightCurlyBraceNode(iNode)) && hasEmptyRawBefore(iNextNode)) {
  31300. continue;
  31301. }
  31302. if (!iPrevNode && isDivisionNode(iNode)) {
  31303. continue;
  31304. }
  31305. if (insideValueFunctionNode(path, "calc") && (isAdditionNode(iNode) || isAdditionNode(iNextNode) || isSubtractionNode(iNode) || isSubtractionNode(iNextNode)) && hasEmptyRawBefore(iNextNode)) {
  31306. continue;
  31307. }
  31308. const isColorAdjusterNode = (isAdditionNode(iNode) || isSubtractionNode(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode(parentParentNode) && !hasEmptyRawBefore(iNextNode);
  31309. const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode(iNextNextNode) || iNode.type === "value-func" || isWordNode(iNode);
  31310. const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode(iPrevNode);
  31311. if (!(isMultiplicationNode(iNextNode) || isMultiplicationNode(iNode)) && !insideValueFunctionNode(path, "calc") && !isColorAdjusterNode && (isDivisionNode(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode(iNode) && !requireSpaceAfterOperator || isAdditionNode(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode(iNode) && !requireSpaceAfterOperator || isSubtractionNode(iNextNode) || isSubtractionNode(iNode)) && (hasEmptyRawBefore(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode(iPrevNode)))) {
  31312. continue;
  31313. }
  31314. if (isInlineValueCommentNode(iNode)) {
  31315. if (parentNode.type === "value-paren_group") {
  31316. parts.push(dedent(hardline));
  31317. continue;
  31318. }
  31319. parts.push(hardline);
  31320. continue;
  31321. }
  31322. if (isControlDirective && (isEqualityOperatorNode(iNextNode) || isRelationalOperatorNode(iNextNode) || isIfElseKeywordNode(iNextNode) || isEachKeywordNode(iNode) || isForKeywordNode(iNode))) {
  31323. parts.push(" ");
  31324. continue;
  31325. }
  31326. if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
  31327. parts.push(" ");
  31328. continue;
  31329. }
  31330. if (isGridValue) {
  31331. if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
  31332. parts.push(hardline);
  31333. didBreak = true;
  31334. } else {
  31335. parts.push(" ");
  31336. }
  31337. continue;
  31338. }
  31339. if (isNextMathOperator) {
  31340. parts.push(" ");
  31341. continue;
  31342. }
  31343. if (iNextNode && iNextNode.value === "...") {
  31344. continue;
  31345. }
  31346. if (isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && locEnd(iNode) === locStart(iNextNode)) {
  31347. continue;
  31348. }
  31349. if (isAtWordPlaceholderNode(iNode) && isParenGroupNode(iNextNode) && locEnd(iNode) === locStart(iNextNode.open)) {
  31350. parts.push(softline);
  31351. continue;
  31352. }
  31353. if (iNode.value === "with" && isParenGroupNode(iNextNode)) {
  31354. parts.push(" ");
  31355. continue;
  31356. }
  31357. if ((_iNode$value = iNode.value) !== null && _iNode$value !== void 0 && _iNode$value.endsWith("#") && iNextNode.value === "{" && isParenGroupNode(iNextNode.group)) {
  31358. continue;
  31359. }
  31360. parts.push(line);
  31361. }
  31362. if (hasInlineComment) {
  31363. parts.push(breakParent);
  31364. }
  31365. if (didBreak) {
  31366. parts.unshift(hardline);
  31367. }
  31368. if (isControlDirective) {
  31369. return group(indent(parts));
  31370. }
  31371. if (insideURLFunctionInImportAtRuleNode(path)) {
  31372. return group(fill(parts));
  31373. }
  31374. return group(indent(fill(parts)));
  31375. }
  31376. case "value-paren_group": {
  31377. const parentNode = path.getParentNode();
  31378. if (parentNode && isURLFunctionNode(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) {
  31379. return [node.open ? print("open") : "", join(",", path.map(print, "groups")), node.close ? print("close") : ""];
  31380. }
  31381. if (!node.open) {
  31382. const printed2 = path.map(print, "groups");
  31383. const res = [];
  31384. for (let i = 0; i < printed2.length; i++) {
  31385. if (i !== 0) {
  31386. res.push([",", line]);
  31387. }
  31388. res.push(printed2[i]);
  31389. }
  31390. return group(indent(fill(res)));
  31391. }
  31392. const isSCSSMapItem = isSCSSMapItemNode(path);
  31393. const lastItem = getLast(node.groups);
  31394. const isLastItemComment = lastItem && lastItem.type === "value-comment";
  31395. const isKey = isKeyInValuePairNode(node, parentNode);
  31396. const isConfiguration = isConfigurationNode(node, parentNode);
  31397. const shouldBreak = isConfiguration || isSCSSMapItem && !isKey;
  31398. const shouldDedent = isConfiguration || isKey;
  31399. const printed = group([node.open ? print("open") : "", indent([softline, join([line], path.map((childPath, index) => {
  31400. const child = childPath.getValue();
  31401. const isLast = index === node.groups.length - 1;
  31402. const printed2 = [print(), isLast ? "" : ","];
  31403. if (isKeyValuePairNode(child) && child.type === "value-comma_group" && child.groups && child.groups[0].type !== "value-paren_group" && child.groups[2] && child.groups[2].type === "value-paren_group") {
  31404. const parts = getDocParts(printed2[0].contents.contents);
  31405. parts[1] = group(parts[1]);
  31406. return group(dedent(printed2));
  31407. }
  31408. if (!isLast && child.type === "value-comma_group" && isNonEmptyArray(child.groups)) {
  31409. const last = getLast(child.groups);
  31410. if (last.source && isNextLineEmpty(options.originalText, last, locEnd)) {
  31411. printed2.push(hardline);
  31412. }
  31413. }
  31414. return printed2;
  31415. }, "groups"))]), ifBreak(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline, node.close ? print("close") : ""], {
  31416. shouldBreak
  31417. });
  31418. return shouldDedent ? dedent(printed) : printed;
  31419. }
  31420. case "value-func": {
  31421. return [node.value, insideAtRuleNode(path, "supports") && isMediaAndSupportsKeywords(node) ? " " : "", print("group")];
  31422. }
  31423. case "value-paren": {
  31424. return node.value;
  31425. }
  31426. case "value-number": {
  31427. return [printCssNumber(node.value), printUnit(node.unit)];
  31428. }
  31429. case "value-operator": {
  31430. return node.value;
  31431. }
  31432. case "value-word": {
  31433. if (node.isColor && node.isHex || isWideKeywords(node.value)) {
  31434. return node.value.toLowerCase();
  31435. }
  31436. return node.value;
  31437. }
  31438. case "value-colon": {
  31439. const parentNode = path.getParentNode();
  31440. const index = parentNode && parentNode.groups.indexOf(node);
  31441. const prevNode = index && parentNode.groups[index - 1];
  31442. return [node.value, prevNode && typeof prevNode.value === "string" && getLast(prevNode.value) === "\\" || insideValueFunctionNode(path, "url") ? "" : line];
  31443. }
  31444. case "value-comma": {
  31445. return [node.value, " "];
  31446. }
  31447. case "value-string": {
  31448. return printString(node.raws.quote + node.value + node.raws.quote, options);
  31449. }
  31450. case "value-atword": {
  31451. return ["@", node.value];
  31452. }
  31453. case "value-unicode-range": {
  31454. return node.value;
  31455. }
  31456. case "value-unknown": {
  31457. return node.value;
  31458. }
  31459. default:
  31460. throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`);
  31461. }
  31462. }
  31463. function printNodeSequence(path, options, print) {
  31464. const parts = [];
  31465. path.each((pathChild, i, nodes) => {
  31466. const prevNode = nodes[i - 1];
  31467. if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
  31468. const childNode = pathChild.getValue();
  31469. parts.push(options.originalText.slice(locStart(childNode), locEnd(childNode)));
  31470. } else {
  31471. parts.push(print());
  31472. }
  31473. if (i !== nodes.length - 1) {
  31474. if (nodes[i + 1].type === "css-comment" && !hasNewline(options.originalText, locStart(nodes[i + 1]), {
  31475. backwards: true
  31476. }) && !isFrontMatterNode(nodes[i]) || nodes[i + 1].type === "css-atrule" && nodes[i + 1].name === "else" && nodes[i].type !== "css-comment") {
  31477. parts.push(" ");
  31478. } else {
  31479. parts.push(options.__isHTMLStyleAttribute ? line : hardline);
  31480. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd) && !isFrontMatterNode(nodes[i])) {
  31481. parts.push(hardline);
  31482. }
  31483. }
  31484. }
  31485. }, "nodes");
  31486. return parts;
  31487. }
  31488. var STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
  31489. var NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
  31490. var STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
  31491. var WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
  31492. var ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX.source + `|(${WORD_PART_REGEX.source})?(${NUMBER_REGEX.source})(${STANDARD_UNIT_REGEX.source})?`, "g");
  31493. function adjustStrings(value, options) {
  31494. return value.replace(STRING_REGEX, (match) => printString(match, options));
  31495. }
  31496. function quoteAttributeValue(value, options) {
  31497. const quote = options.singleQuote ? "'" : '"';
  31498. return value.includes('"') || value.includes("'") ? value : quote + value + quote;
  31499. }
  31500. function adjustNumbers(value) {
  31501. return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase(unit || "") : match);
  31502. }
  31503. function printCssNumber(rawNumber) {
  31504. return printNumber(rawNumber).replace(/\.0(?=$|e)/, "");
  31505. }
  31506. module2.exports = {
  31507. print: genericPrint,
  31508. embed,
  31509. insertPragma,
  31510. massageAstNode: clean
  31511. };
  31512. }
  31513. });
  31514. var require_options3 = __commonJS2({
  31515. "src/language-css/options.js"(exports2, module2) {
  31516. "use strict";
  31517. var commonOptions = require_common_options();
  31518. module2.exports = {
  31519. singleQuote: commonOptions.singleQuote
  31520. };
  31521. }
  31522. });
  31523. var require_parsers2 = __commonJS2({
  31524. "src/language-css/parsers.js"(exports2, module2) {
  31525. "use strict";
  31526. module2.exports = {
  31527. get css() {
  31528. return require("./parser-postcss.js").parsers.css;
  31529. },
  31530. get less() {
  31531. return require("./parser-postcss.js").parsers.less;
  31532. },
  31533. get scss() {
  31534. return require("./parser-postcss.js").parsers.scss;
  31535. }
  31536. };
  31537. }
  31538. });
  31539. var require_CSS = __commonJS2({
  31540. "node_modules/linguist-languages/data/CSS.json"(exports2, module2) {
  31541. module2.exports = {
  31542. name: "CSS",
  31543. type: "markup",
  31544. tmScope: "source.css",
  31545. aceMode: "css",
  31546. codemirrorMode: "css",
  31547. codemirrorMimeType: "text/css",
  31548. color: "#563d7c",
  31549. extensions: [".css"],
  31550. languageId: 50
  31551. };
  31552. }
  31553. });
  31554. var require_PostCSS = __commonJS2({
  31555. "node_modules/linguist-languages/data/PostCSS.json"(exports2, module2) {
  31556. module2.exports = {
  31557. name: "PostCSS",
  31558. type: "markup",
  31559. color: "#dc3a0c",
  31560. tmScope: "source.postcss",
  31561. group: "CSS",
  31562. extensions: [".pcss", ".postcss"],
  31563. aceMode: "text",
  31564. languageId: 262764437
  31565. };
  31566. }
  31567. });
  31568. var require_Less = __commonJS2({
  31569. "node_modules/linguist-languages/data/Less.json"(exports2, module2) {
  31570. module2.exports = {
  31571. name: "Less",
  31572. type: "markup",
  31573. color: "#1d365d",
  31574. aliases: ["less-css"],
  31575. extensions: [".less"],
  31576. tmScope: "source.css.less",
  31577. aceMode: "less",
  31578. codemirrorMode: "css",
  31579. codemirrorMimeType: "text/css",
  31580. languageId: 198
  31581. };
  31582. }
  31583. });
  31584. var require_SCSS = __commonJS2({
  31585. "node_modules/linguist-languages/data/SCSS.json"(exports2, module2) {
  31586. module2.exports = {
  31587. name: "SCSS",
  31588. type: "markup",
  31589. color: "#c6538c",
  31590. tmScope: "source.css.scss",
  31591. aceMode: "scss",
  31592. codemirrorMode: "css",
  31593. codemirrorMimeType: "text/x-scss",
  31594. extensions: [".scss"],
  31595. languageId: 329
  31596. };
  31597. }
  31598. });
  31599. var require_language_css = __commonJS2({
  31600. "src/language-css/index.js"(exports2, module2) {
  31601. "use strict";
  31602. var createLanguage = require_create_language();
  31603. var printer = require_printer_postcss();
  31604. var options = require_options3();
  31605. var parsers = require_parsers2();
  31606. var languages = [createLanguage(require_CSS(), (data) => ({
  31607. since: "1.4.0",
  31608. parsers: ["css"],
  31609. vscodeLanguageIds: ["css"],
  31610. extensions: [...data.extensions, ".wxss"]
  31611. })), createLanguage(require_PostCSS(), () => ({
  31612. since: "1.4.0",
  31613. parsers: ["css"],
  31614. vscodeLanguageIds: ["postcss"]
  31615. })), createLanguage(require_Less(), () => ({
  31616. since: "1.4.0",
  31617. parsers: ["less"],
  31618. vscodeLanguageIds: ["less"]
  31619. })), createLanguage(require_SCSS(), () => ({
  31620. since: "1.4.0",
  31621. parsers: ["scss"],
  31622. vscodeLanguageIds: ["scss"]
  31623. }))];
  31624. var printers = {
  31625. postcss: printer
  31626. };
  31627. module2.exports = {
  31628. languages,
  31629. options,
  31630. printers,
  31631. parsers
  31632. };
  31633. }
  31634. });
  31635. var require_loc3 = __commonJS2({
  31636. "src/language-handlebars/loc.js"(exports2, module2) {
  31637. "use strict";
  31638. function locStart(node) {
  31639. return node.loc.start.offset;
  31640. }
  31641. function locEnd(node) {
  31642. return node.loc.end.offset;
  31643. }
  31644. module2.exports = {
  31645. locStart,
  31646. locEnd
  31647. };
  31648. }
  31649. });
  31650. var require_clean3 = __commonJS2({
  31651. "src/language-handlebars/clean.js"(exports2, module2) {
  31652. "use strict";
  31653. function clean(ast, newNode) {
  31654. if (ast.type === "TextNode") {
  31655. const trimmed = ast.chars.trim();
  31656. if (!trimmed) {
  31657. return null;
  31658. }
  31659. newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
  31660. }
  31661. if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
  31662. delete newNode.value;
  31663. }
  31664. }
  31665. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "selfClosing"]);
  31666. module2.exports = clean;
  31667. }
  31668. });
  31669. var require_html_void_elements = __commonJS2({
  31670. "vendors/html-void-elements.json"(exports2, module2) {
  31671. module2.exports = {
  31672. htmlVoidElements: ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta", "nextid", "param", "source", "track", "wbr"]
  31673. };
  31674. }
  31675. });
  31676. var require_utils9 = __commonJS2({
  31677. "src/language-handlebars/utils.js"(exports2, module2) {
  31678. "use strict";
  31679. var {
  31680. htmlVoidElements
  31681. } = require_html_void_elements();
  31682. var getLast = require_get_last();
  31683. function isLastNodeOfSiblings(path) {
  31684. const node = path.getValue();
  31685. const parentNode = path.getParentNode(0);
  31686. if (isParentOfSomeType(path, ["ElementNode"]) && getLast(parentNode.children) === node) {
  31687. return true;
  31688. }
  31689. if (isParentOfSomeType(path, ["Block"]) && getLast(parentNode.body) === node) {
  31690. return true;
  31691. }
  31692. return false;
  31693. }
  31694. function isUppercase(string) {
  31695. return string.toUpperCase() === string;
  31696. }
  31697. function isGlimmerComponent(node) {
  31698. return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && !node.tag.startsWith(":") && (isUppercase(node.tag[0]) || node.tag.includes("."));
  31699. }
  31700. var voidTags = new Set(htmlVoidElements);
  31701. function isVoid(node) {
  31702. return voidTags.has(node.tag) || isGlimmerComponent(node) && node.children.every((node2) => isWhitespaceNode(node2));
  31703. }
  31704. function isWhitespaceNode(node) {
  31705. return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
  31706. }
  31707. function isNodeOfSomeType(node, types) {
  31708. return node && types.includes(node.type);
  31709. }
  31710. function isParentOfSomeType(path, types) {
  31711. const parentNode = path.getParentNode(0);
  31712. return isNodeOfSomeType(parentNode, types);
  31713. }
  31714. function isPreviousNodeOfSomeType(path, types) {
  31715. const previousNode = getPreviousNode(path);
  31716. return isNodeOfSomeType(previousNode, types);
  31717. }
  31718. function isNextNodeOfSomeType(path, types) {
  31719. const nextNode = getNextNode(path);
  31720. return isNodeOfSomeType(nextNode, types);
  31721. }
  31722. function getSiblingNode(path, offset) {
  31723. var _path$getParentNode2, _ref7, _ref8, _parentNode$children;
  31724. const node = path.getValue();
  31725. const parentNode = (_path$getParentNode2 = path.getParentNode(0)) !== null && _path$getParentNode2 !== void 0 ? _path$getParentNode2 : {};
  31726. const children = (_ref7 = (_ref8 = (_parentNode$children = parentNode.children) !== null && _parentNode$children !== void 0 ? _parentNode$children : parentNode.body) !== null && _ref8 !== void 0 ? _ref8 : parentNode.parts) !== null && _ref7 !== void 0 ? _ref7 : [];
  31727. const index = children.indexOf(node);
  31728. return index !== -1 && children[index + offset];
  31729. }
  31730. function getPreviousNode(path, lookBack = 1) {
  31731. return getSiblingNode(path, -lookBack);
  31732. }
  31733. function getNextNode(path) {
  31734. return getSiblingNode(path, 1);
  31735. }
  31736. function isPrettierIgnoreNode(node) {
  31737. return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
  31738. }
  31739. function hasPrettierIgnore(path) {
  31740. const node = path.getValue();
  31741. const previousPreviousNode = getPreviousNode(path, 2);
  31742. return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
  31743. }
  31744. module2.exports = {
  31745. getNextNode,
  31746. getPreviousNode,
  31747. hasPrettierIgnore,
  31748. isLastNodeOfSiblings,
  31749. isNextNodeOfSomeType,
  31750. isNodeOfSomeType,
  31751. isParentOfSomeType,
  31752. isPreviousNodeOfSomeType,
  31753. isVoid,
  31754. isWhitespaceNode
  31755. };
  31756. }
  31757. });
  31758. var require_printer_glimmer = __commonJS2({
  31759. "src/language-handlebars/printer-glimmer.js"(exports2, module2) {
  31760. "use strict";
  31761. var {
  31762. builders: {
  31763. dedent,
  31764. fill,
  31765. group,
  31766. hardline,
  31767. ifBreak,
  31768. indent,
  31769. join,
  31770. line,
  31771. softline
  31772. },
  31773. utils: {
  31774. getDocParts,
  31775. replaceTextEndOfLine
  31776. }
  31777. } = require("./doc.js");
  31778. var {
  31779. getPreferredQuote,
  31780. isNonEmptyArray
  31781. } = require_util();
  31782. var {
  31783. locStart,
  31784. locEnd
  31785. } = require_loc3();
  31786. var clean = require_clean3();
  31787. var {
  31788. getNextNode,
  31789. getPreviousNode,
  31790. hasPrettierIgnore,
  31791. isLastNodeOfSiblings,
  31792. isNextNodeOfSomeType,
  31793. isNodeOfSomeType,
  31794. isParentOfSomeType,
  31795. isPreviousNodeOfSomeType,
  31796. isVoid,
  31797. isWhitespaceNode
  31798. } = require_utils9();
  31799. var NEWLINES_TO_PRESERVE_MAX = 2;
  31800. function print(path, options, print2) {
  31801. const node = path.getValue();
  31802. if (!node) {
  31803. return "";
  31804. }
  31805. if (hasPrettierIgnore(path)) {
  31806. return options.originalText.slice(locStart(node), locEnd(node));
  31807. }
  31808. const favoriteQuote = options.singleQuote ? "'" : '"';
  31809. switch (node.type) {
  31810. case "Block":
  31811. case "Program":
  31812. case "Template": {
  31813. return group(path.map(print2, "body"));
  31814. }
  31815. case "ElementNode": {
  31816. const startingTag = group(printStartingTag(path, print2));
  31817. const escapeNextElementNode = options.htmlWhitespaceSensitivity === "ignore" && isNextNodeOfSomeType(path, ["ElementNode"]) ? softline : "";
  31818. if (isVoid(node)) {
  31819. return [startingTag, escapeNextElementNode];
  31820. }
  31821. const endingTag = ["</", node.tag, ">"];
  31822. if (node.children.length === 0) {
  31823. return [startingTag, indent(endingTag), escapeNextElementNode];
  31824. }
  31825. if (options.htmlWhitespaceSensitivity === "ignore") {
  31826. return [startingTag, indent(printChildren(path, options, print2)), hardline, indent(endingTag), escapeNextElementNode];
  31827. }
  31828. return [startingTag, indent(group(printChildren(path, options, print2))), indent(endingTag), escapeNextElementNode];
  31829. }
  31830. case "BlockStatement": {
  31831. const pp = path.getParentNode(1);
  31832. const isElseIfLike = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === node && pp.inverse.body[0].path.parts[0] === pp.path.parts[0];
  31833. if (isElseIfLike) {
  31834. return [printElseIfLikeBlock(path, print2, pp.inverse.body[0].path.parts[0]), printProgram(path, print2, options), printInverse(path, print2, options)];
  31835. }
  31836. return [printOpenBlock(path, print2), group([printProgram(path, print2, options), printInverse(path, print2, options), printCloseBlock(path, print2, options)])];
  31837. }
  31838. case "ElementModifierStatement": {
  31839. return group(["{{", printPathAndParams(path, print2), "}}"]);
  31840. }
  31841. case "MustacheStatement": {
  31842. return group([printOpeningMustache(node), printPathAndParams(path, print2), printClosingMustache(node)]);
  31843. }
  31844. case "SubExpression": {
  31845. return group(["(", printSubExpressionPathAndParams(path, print2), softline, ")"]);
  31846. }
  31847. case "AttrNode": {
  31848. const isText = node.value.type === "TextNode";
  31849. const isEmptyText = isText && node.value.chars === "";
  31850. if (isEmptyText && locStart(node.value) === locEnd(node.value)) {
  31851. return node.name;
  31852. }
  31853. const quote = isText ? getPreferredQuote(node.value.chars, favoriteQuote).quote : node.value.type === "ConcatStatement" ? getPreferredQuote(node.value.parts.filter((part) => part.type === "TextNode").map((part) => part.chars).join(""), favoriteQuote).quote : "";
  31854. const valueDoc = print2("value");
  31855. return [node.name, "=", quote, node.name === "class" && quote ? group(indent(valueDoc)) : valueDoc, quote];
  31856. }
  31857. case "ConcatStatement": {
  31858. return path.map(print2, "parts");
  31859. }
  31860. case "Hash": {
  31861. return join(line, path.map(print2, "pairs"));
  31862. }
  31863. case "HashPair": {
  31864. return [node.key, "=", print2("value")];
  31865. }
  31866. case "TextNode": {
  31867. let text = node.chars.replace(/{{/g, "\\{{");
  31868. const attrName = getCurrentAttributeName(path);
  31869. if (attrName) {
  31870. if (attrName === "class") {
  31871. const formattedClasses = text.trim().split(/\s+/).join(" ");
  31872. let leadingSpace2 = false;
  31873. let trailingSpace2 = false;
  31874. if (isParentOfSomeType(path, ["ConcatStatement"])) {
  31875. if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text)) {
  31876. leadingSpace2 = true;
  31877. }
  31878. if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text) && formattedClasses !== "") {
  31879. trailingSpace2 = true;
  31880. }
  31881. }
  31882. return [leadingSpace2 ? line : "", formattedClasses, trailingSpace2 ? line : ""];
  31883. }
  31884. return replaceTextEndOfLine(text);
  31885. }
  31886. const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
  31887. const isWhitespaceOnly = whitespacesOnlyRE.test(text);
  31888. const isFirstElement = !getPreviousNode(path);
  31889. const isLastElement = !getNextNode(path);
  31890. if (options.htmlWhitespaceSensitivity !== "ignore") {
  31891. const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
  31892. const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
  31893. const shouldTrimTrailingNewlines = isLastElement && isParentOfSomeType(path, ["Template"]);
  31894. const shouldTrimLeadingNewlines = isFirstElement && isParentOfSomeType(path, ["Template"]);
  31895. if (isWhitespaceOnly) {
  31896. if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
  31897. return "";
  31898. }
  31899. let breaks = [line];
  31900. const newlines = countNewLines(text);
  31901. if (newlines) {
  31902. breaks = generateHardlines(newlines);
  31903. }
  31904. if (isLastNodeOfSiblings(path)) {
  31905. breaks = breaks.map((newline) => dedent(newline));
  31906. }
  31907. return breaks;
  31908. }
  31909. const [lead] = text.match(leadingWhitespacesRE);
  31910. const [tail] = text.match(trailingWhitespacesRE);
  31911. let leadBreaks = [];
  31912. if (lead) {
  31913. leadBreaks = [line];
  31914. const leadingNewlines = countNewLines(lead);
  31915. if (leadingNewlines) {
  31916. leadBreaks = generateHardlines(leadingNewlines);
  31917. }
  31918. text = text.replace(leadingWhitespacesRE, "");
  31919. }
  31920. let trailBreaks = [];
  31921. if (tail) {
  31922. if (!shouldTrimTrailingNewlines) {
  31923. trailBreaks = [line];
  31924. const trailingNewlines = countNewLines(tail);
  31925. if (trailingNewlines) {
  31926. trailBreaks = generateHardlines(trailingNewlines);
  31927. }
  31928. if (isLastNodeOfSiblings(path)) {
  31929. trailBreaks = trailBreaks.map((hardline2) => dedent(hardline2));
  31930. }
  31931. }
  31932. text = text.replace(trailingWhitespacesRE, "");
  31933. }
  31934. return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
  31935. }
  31936. const lineBreaksCount = countNewLines(text);
  31937. let leadingLineBreaksCount = countLeadingNewLines(text);
  31938. let trailingLineBreaksCount = countTrailingNewLines(text);
  31939. if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
  31940. return "";
  31941. }
  31942. if (isWhitespaceOnly && lineBreaksCount) {
  31943. leadingLineBreaksCount = Math.min(lineBreaksCount, NEWLINES_TO_PRESERVE_MAX);
  31944. trailingLineBreaksCount = 0;
  31945. } else {
  31946. if (isNextNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  31947. trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
  31948. }
  31949. if (isPreviousNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  31950. leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
  31951. }
  31952. }
  31953. let leadingSpace = "";
  31954. let trailingSpace = "";
  31955. if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType(path, ["MustacheStatement"])) {
  31956. trailingSpace = " ";
  31957. }
  31958. if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
  31959. leadingSpace = " ";
  31960. }
  31961. if (isFirstElement) {
  31962. leadingLineBreaksCount = 0;
  31963. leadingSpace = "";
  31964. }
  31965. if (isLastElement) {
  31966. trailingLineBreaksCount = 0;
  31967. trailingSpace = "";
  31968. }
  31969. text = text.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
  31970. return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(text)), ...generateHardlines(trailingLineBreaksCount)];
  31971. }
  31972. case "MustacheCommentStatement": {
  31973. const start = locStart(node);
  31974. const end = locEnd(node);
  31975. const isLeftWhiteSpaceSensitive = options.originalText.charAt(start + 2) === "~";
  31976. const isRightWhitespaceSensitive = options.originalText.charAt(end - 3) === "~";
  31977. const dashes = node.value.includes("}}") ? "--" : "";
  31978. return ["{{", isLeftWhiteSpaceSensitive ? "~" : "", "!", dashes, node.value, dashes, isRightWhitespaceSensitive ? "~" : "", "}}"];
  31979. }
  31980. case "PathExpression": {
  31981. return node.original;
  31982. }
  31983. case "BooleanLiteral": {
  31984. return String(node.value);
  31985. }
  31986. case "CommentStatement": {
  31987. return ["<!--", node.value, "-->"];
  31988. }
  31989. case "StringLiteral": {
  31990. if (needsOppositeQuote(path)) {
  31991. const printFavoriteQuote = !options.singleQuote ? "'" : '"';
  31992. return printStringLiteral(node.value, printFavoriteQuote);
  31993. }
  31994. return printStringLiteral(node.value, favoriteQuote);
  31995. }
  31996. case "NumberLiteral": {
  31997. return String(node.value);
  31998. }
  31999. case "UndefinedLiteral": {
  32000. return "undefined";
  32001. }
  32002. case "NullLiteral": {
  32003. return "null";
  32004. }
  32005. default:
  32006. throw new Error("unknown glimmer type: " + JSON.stringify(node.type));
  32007. }
  32008. }
  32009. function sortByLoc(a, b) {
  32010. return locStart(a) - locStart(b);
  32011. }
  32012. function printStartingTag(path, print2) {
  32013. const node = path.getValue();
  32014. const types = ["attributes", "modifiers", "comments"].filter((property) => isNonEmptyArray(node[property]));
  32015. const attributes = types.flatMap((type) => node[type]).sort(sortByLoc);
  32016. for (const attributeType of types) {
  32017. path.each((attributePath) => {
  32018. const index = attributes.indexOf(attributePath.getValue());
  32019. attributes.splice(index, 1, [line, print2()]);
  32020. }, attributeType);
  32021. }
  32022. if (isNonEmptyArray(node.blockParams)) {
  32023. attributes.push(line, printBlockParams(node));
  32024. }
  32025. return ["<", node.tag, indent(attributes), printStartingTagEndMarker(node)];
  32026. }
  32027. function printChildren(path, options, print2) {
  32028. const node = path.getValue();
  32029. const isEmpty = node.children.every((node2) => isWhitespaceNode(node2));
  32030. if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
  32031. return "";
  32032. }
  32033. return path.map((childPath, childIndex) => {
  32034. const printedChild = print2();
  32035. if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
  32036. return [softline, printedChild];
  32037. }
  32038. return printedChild;
  32039. }, "children");
  32040. }
  32041. function printStartingTagEndMarker(node) {
  32042. if (isVoid(node)) {
  32043. return ifBreak([softline, "/>"], [" />", softline]);
  32044. }
  32045. return ifBreak([softline, ">"], ">");
  32046. }
  32047. function printOpeningMustache(node) {
  32048. const mustache = node.escaped === false ? "{{{" : "{{";
  32049. const strip = node.strip && node.strip.open ? "~" : "";
  32050. return [mustache, strip];
  32051. }
  32052. function printClosingMustache(node) {
  32053. const mustache = node.escaped === false ? "}}}" : "}}";
  32054. const strip = node.strip && node.strip.close ? "~" : "";
  32055. return [strip, mustache];
  32056. }
  32057. function printOpeningBlockOpeningMustache(node) {
  32058. const opening = printOpeningMustache(node);
  32059. const strip = node.openStrip.open ? "~" : "";
  32060. return [opening, strip, "#"];
  32061. }
  32062. function printOpeningBlockClosingMustache(node) {
  32063. const closing = printClosingMustache(node);
  32064. const strip = node.openStrip.close ? "~" : "";
  32065. return [strip, closing];
  32066. }
  32067. function printClosingBlockOpeningMustache(node) {
  32068. const opening = printOpeningMustache(node);
  32069. const strip = node.closeStrip.open ? "~" : "";
  32070. return [opening, strip, "/"];
  32071. }
  32072. function printClosingBlockClosingMustache(node) {
  32073. const closing = printClosingMustache(node);
  32074. const strip = node.closeStrip.close ? "~" : "";
  32075. return [strip, closing];
  32076. }
  32077. function printInverseBlockOpeningMustache(node) {
  32078. const opening = printOpeningMustache(node);
  32079. const strip = node.inverseStrip.open ? "~" : "";
  32080. return [opening, strip];
  32081. }
  32082. function printInverseBlockClosingMustache(node) {
  32083. const closing = printClosingMustache(node);
  32084. const strip = node.inverseStrip.close ? "~" : "";
  32085. return [strip, closing];
  32086. }
  32087. function printOpenBlock(path, print2) {
  32088. const node = path.getValue();
  32089. const openingMustache = printOpeningBlockOpeningMustache(node);
  32090. const closingMustache = printOpeningBlockClosingMustache(node);
  32091. const attributes = [printPath(path, print2)];
  32092. const params = printParams(path, print2);
  32093. if (params) {
  32094. attributes.push(line, params);
  32095. }
  32096. if (isNonEmptyArray(node.program.blockParams)) {
  32097. const block = printBlockParams(node.program);
  32098. attributes.push(line, block);
  32099. }
  32100. return group([openingMustache, indent(attributes), softline, closingMustache]);
  32101. }
  32102. function printElseBlock(node, options) {
  32103. return [options.htmlWhitespaceSensitivity === "ignore" ? hardline : "", printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)];
  32104. }
  32105. function printElseIfLikeBlock(path, print2, ifLikeKeyword) {
  32106. const parentNode = path.getParentNode(1);
  32107. return [printInverseBlockOpeningMustache(parentNode), "else ", ifLikeKeyword, " ", printParams(path, print2), printInverseBlockClosingMustache(parentNode)];
  32108. }
  32109. function printCloseBlock(path, print2, options) {
  32110. const node = path.getValue();
  32111. if (options.htmlWhitespaceSensitivity === "ignore") {
  32112. const escape = blockStatementHasOnlyWhitespaceInProgram(node) ? softline : hardline;
  32113. return [escape, printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  32114. }
  32115. return [printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  32116. }
  32117. function blockStatementHasOnlyWhitespaceInProgram(node) {
  32118. return isNodeOfSomeType(node, ["BlockStatement"]) && node.program.body.every((node2) => isWhitespaceNode(node2));
  32119. }
  32120. function blockStatementHasElseIfLike(node) {
  32121. return blockStatementHasElse(node) && node.inverse.body.length === 1 && isNodeOfSomeType(node.inverse.body[0], ["BlockStatement"]) && node.inverse.body[0].path.parts[0] === node.path.parts[0];
  32122. }
  32123. function blockStatementHasElse(node) {
  32124. return isNodeOfSomeType(node, ["BlockStatement"]) && node.inverse;
  32125. }
  32126. function printProgram(path, print2, options) {
  32127. const node = path.getValue();
  32128. if (blockStatementHasOnlyWhitespaceInProgram(node)) {
  32129. return "";
  32130. }
  32131. const program = print2("program");
  32132. if (options.htmlWhitespaceSensitivity === "ignore") {
  32133. return indent([hardline, program]);
  32134. }
  32135. return indent(program);
  32136. }
  32137. function printInverse(path, print2, options) {
  32138. const node = path.getValue();
  32139. const inverse = print2("inverse");
  32140. const printed = options.htmlWhitespaceSensitivity === "ignore" ? [hardline, inverse] : inverse;
  32141. if (blockStatementHasElseIfLike(node)) {
  32142. return printed;
  32143. }
  32144. if (blockStatementHasElse(node)) {
  32145. return [printElseBlock(node, options), indent(printed)];
  32146. }
  32147. return "";
  32148. }
  32149. function getTextValueParts(value) {
  32150. return getDocParts(join(line, splitByHtmlWhitespace(value)));
  32151. }
  32152. function splitByHtmlWhitespace(string) {
  32153. return string.split(/[\t\n\f\r ]+/);
  32154. }
  32155. function getCurrentAttributeName(path) {
  32156. for (let depth = 0; depth < 2; depth++) {
  32157. const parentNode = path.getParentNode(depth);
  32158. if (parentNode && parentNode.type === "AttrNode") {
  32159. return parentNode.name.toLowerCase();
  32160. }
  32161. }
  32162. }
  32163. function countNewLines(string) {
  32164. string = typeof string === "string" ? string : "";
  32165. return string.split("\n").length - 1;
  32166. }
  32167. function countLeadingNewLines(string) {
  32168. string = typeof string === "string" ? string : "";
  32169. const newLines = (string.match(/^([^\S\n\r]*[\n\r])+/g) || [])[0] || "";
  32170. return countNewLines(newLines);
  32171. }
  32172. function countTrailingNewLines(string) {
  32173. string = typeof string === "string" ? string : "";
  32174. const newLines = (string.match(/([\n\r][^\S\n\r]*)+$/g) || [])[0] || "";
  32175. return countNewLines(newLines);
  32176. }
  32177. function generateHardlines(number = 0) {
  32178. return Array.from({
  32179. length: Math.min(number, NEWLINES_TO_PRESERVE_MAX)
  32180. }).fill(hardline);
  32181. }
  32182. function printStringLiteral(stringLiteral, favoriteQuote) {
  32183. const {
  32184. quote,
  32185. regex
  32186. } = getPreferredQuote(stringLiteral, favoriteQuote);
  32187. return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
  32188. }
  32189. function needsOppositeQuote(path) {
  32190. let index = 0;
  32191. let parentNode = path.getParentNode(index);
  32192. while (parentNode && isNodeOfSomeType(parentNode, ["SubExpression"])) {
  32193. index++;
  32194. parentNode = path.getParentNode(index);
  32195. }
  32196. if (parentNode && isNodeOfSomeType(path.getParentNode(index + 1), ["ConcatStatement"]) && isNodeOfSomeType(path.getParentNode(index + 2), ["AttrNode"])) {
  32197. return true;
  32198. }
  32199. return false;
  32200. }
  32201. function printSubExpressionPathAndParams(path, print2) {
  32202. const printed = printPath(path, print2);
  32203. const params = printParams(path, print2);
  32204. if (!params) {
  32205. return printed;
  32206. }
  32207. return indent([printed, line, group(params)]);
  32208. }
  32209. function printPathAndParams(path, print2) {
  32210. const p = printPath(path, print2);
  32211. const params = printParams(path, print2);
  32212. if (!params) {
  32213. return p;
  32214. }
  32215. return [indent([p, line, params]), softline];
  32216. }
  32217. function printPath(path, print2) {
  32218. return print2("path");
  32219. }
  32220. function printParams(path, print2) {
  32221. const node = path.getValue();
  32222. const parts = [];
  32223. if (node.params.length > 0) {
  32224. const params = path.map(print2, "params");
  32225. parts.push(...params);
  32226. }
  32227. if (node.hash && node.hash.pairs.length > 0) {
  32228. const hash = print2("hash");
  32229. parts.push(hash);
  32230. }
  32231. if (parts.length === 0) {
  32232. return "";
  32233. }
  32234. return join(line, parts);
  32235. }
  32236. function printBlockParams(node) {
  32237. return ["as |", node.blockParams.join(" "), "|"];
  32238. }
  32239. module2.exports = {
  32240. print,
  32241. massageAstNode: clean
  32242. };
  32243. }
  32244. });
  32245. var require_parsers3 = __commonJS2({
  32246. "src/language-handlebars/parsers.js"(exports2, module2) {
  32247. "use strict";
  32248. module2.exports = {
  32249. get glimmer() {
  32250. return require("./parser-glimmer.js").parsers.glimmer;
  32251. }
  32252. };
  32253. }
  32254. });
  32255. var require_Handlebars = __commonJS2({
  32256. "node_modules/linguist-languages/data/Handlebars.json"(exports2, module2) {
  32257. module2.exports = {
  32258. name: "Handlebars",
  32259. type: "markup",
  32260. color: "#f7931e",
  32261. aliases: ["hbs", "htmlbars"],
  32262. extensions: [".handlebars", ".hbs"],
  32263. tmScope: "text.html.handlebars",
  32264. aceMode: "handlebars",
  32265. languageId: 155
  32266. };
  32267. }
  32268. });
  32269. var require_language_handlebars = __commonJS2({
  32270. "src/language-handlebars/index.js"(exports2, module2) {
  32271. "use strict";
  32272. var createLanguage = require_create_language();
  32273. var printer = require_printer_glimmer();
  32274. var parsers = require_parsers3();
  32275. var languages = [createLanguage(require_Handlebars(), () => ({
  32276. since: "2.3.0",
  32277. parsers: ["glimmer"],
  32278. vscodeLanguageIds: ["handlebars"]
  32279. }))];
  32280. var printers = {
  32281. glimmer: printer
  32282. };
  32283. module2.exports = {
  32284. languages,
  32285. printers,
  32286. parsers
  32287. };
  32288. }
  32289. });
  32290. var require_pragma3 = __commonJS2({
  32291. "src/language-graphql/pragma.js"(exports2, module2) {
  32292. "use strict";
  32293. function hasPragma(text) {
  32294. return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text);
  32295. }
  32296. function insertPragma(text) {
  32297. return "# @format\n\n" + text;
  32298. }
  32299. module2.exports = {
  32300. hasPragma,
  32301. insertPragma
  32302. };
  32303. }
  32304. });
  32305. var require_loc4 = __commonJS2({
  32306. "src/language-graphql/loc.js"(exports2, module2) {
  32307. "use strict";
  32308. function locStart(node) {
  32309. if (typeof node.start === "number") {
  32310. return node.start;
  32311. }
  32312. return node.loc && node.loc.start;
  32313. }
  32314. function locEnd(node) {
  32315. if (typeof node.end === "number") {
  32316. return node.end;
  32317. }
  32318. return node.loc && node.loc.end;
  32319. }
  32320. module2.exports = {
  32321. locStart,
  32322. locEnd
  32323. };
  32324. }
  32325. });
  32326. var require_printer_graphql = __commonJS2({
  32327. "src/language-graphql/printer-graphql.js"(exports2, module2) {
  32328. "use strict";
  32329. var {
  32330. builders: {
  32331. join,
  32332. hardline,
  32333. line,
  32334. softline,
  32335. group,
  32336. indent,
  32337. ifBreak
  32338. }
  32339. } = require("./doc.js");
  32340. var {
  32341. isNextLineEmpty,
  32342. isNonEmptyArray
  32343. } = require_util();
  32344. var {
  32345. insertPragma
  32346. } = require_pragma3();
  32347. var {
  32348. locStart,
  32349. locEnd
  32350. } = require_loc4();
  32351. function genericPrint(path, options, print) {
  32352. const node = path.getValue();
  32353. if (!node) {
  32354. return "";
  32355. }
  32356. if (typeof node === "string") {
  32357. return node;
  32358. }
  32359. switch (node.kind) {
  32360. case "Document": {
  32361. const parts = [];
  32362. path.each((pathChild, index, definitions) => {
  32363. parts.push(print());
  32364. if (index !== definitions.length - 1) {
  32365. parts.push(hardline);
  32366. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd)) {
  32367. parts.push(hardline);
  32368. }
  32369. }
  32370. }, "definitions");
  32371. return [...parts, hardline];
  32372. }
  32373. case "OperationDefinition": {
  32374. const hasOperation = options.originalText[locStart(node)] !== "{";
  32375. const hasName = Boolean(node.name);
  32376. return [hasOperation ? node.operation : "", hasOperation && hasName ? [" ", print("name")] : "", hasOperation && !hasName && isNonEmptyArray(node.variableDefinitions) ? " " : "", isNonEmptyArray(node.variableDefinitions) ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "variableDefinitions"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? !hasOperation && !hasName ? "" : " " : "", print("selectionSet")];
  32377. }
  32378. case "FragmentDefinition": {
  32379. return ["fragment ", print("name"), isNonEmptyArray(node.variableDefinitions) ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "variableDefinitions"))]), softline, ")"]) : "", " on ", print("typeCondition"), printDirectives(path, print, node), " ", print("selectionSet")];
  32380. }
  32381. case "SelectionSet": {
  32382. return ["{", indent([hardline, join(hardline, printSequence(path, options, print, "selections"))]), hardline, "}"];
  32383. }
  32384. case "Field": {
  32385. return group([node.alias ? [print("alias"), ": "] : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? " " : "", print("selectionSet")]);
  32386. }
  32387. case "Name": {
  32388. return node.value;
  32389. }
  32390. case "StringValue": {
  32391. if (node.block) {
  32392. const lines = node.value.replace(/"""/g, "\\$&").split("\n");
  32393. if (lines.length === 1) {
  32394. lines[0] = lines[0].trim();
  32395. }
  32396. if (lines.every((line2) => line2 === "")) {
  32397. lines.length = 0;
  32398. }
  32399. return join(hardline, ['"""', ...lines, '"""']);
  32400. }
  32401. return ['"', node.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"'];
  32402. }
  32403. case "IntValue":
  32404. case "FloatValue":
  32405. case "EnumValue": {
  32406. return node.value;
  32407. }
  32408. case "BooleanValue": {
  32409. return node.value ? "true" : "false";
  32410. }
  32411. case "NullValue": {
  32412. return "null";
  32413. }
  32414. case "Variable": {
  32415. return ["$", print("name")];
  32416. }
  32417. case "ListValue": {
  32418. return group(["[", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "values"))]), softline, "]"]);
  32419. }
  32420. case "ObjectValue": {
  32421. return group(["{", options.bracketSpacing && node.fields.length > 0 ? " " : "", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "fields"))]), softline, ifBreak("", options.bracketSpacing && node.fields.length > 0 ? " " : ""), "}"]);
  32422. }
  32423. case "ObjectField":
  32424. case "Argument": {
  32425. return [print("name"), ": ", print("value")];
  32426. }
  32427. case "Directive": {
  32428. return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : ""];
  32429. }
  32430. case "NamedType": {
  32431. return print("name");
  32432. }
  32433. case "VariableDefinition": {
  32434. return [print("variable"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  32435. }
  32436. case "ObjectTypeExtension":
  32437. case "ObjectTypeDefinition": {
  32438. return [print("description"), node.description ? hardline : "", node.kind === "ObjectTypeExtension" ? "extend " : "", "type ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
  32439. }
  32440. case "FieldDefinition": {
  32441. return [print("description"), node.description ? hardline : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", ": ", print("type"), printDirectives(path, print, node)];
  32442. }
  32443. case "DirectiveDefinition": {
  32444. return [print("description"), node.description ? hardline : "", "directive ", "@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", node.repeatable ? " repeatable" : "", " on ", join(" | ", path.map(print, "locations"))];
  32445. }
  32446. case "EnumTypeExtension":
  32447. case "EnumTypeDefinition": {
  32448. return [print("description"), node.description ? hardline : "", node.kind === "EnumTypeExtension" ? "extend " : "", "enum ", print("name"), printDirectives(path, print, node), node.values.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "values"))]), hardline, "}"] : ""];
  32449. }
  32450. case "EnumValueDefinition": {
  32451. return [print("description"), node.description ? hardline : "", print("name"), printDirectives(path, print, node)];
  32452. }
  32453. case "InputValueDefinition": {
  32454. return [print("description"), node.description ? node.description.block ? hardline : line : "", print("name"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  32455. }
  32456. case "InputObjectTypeExtension":
  32457. case "InputObjectTypeDefinition": {
  32458. return [print("description"), node.description ? hardline : "", node.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", print("name"), printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
  32459. }
  32460. case "SchemaExtension": {
  32461. return ["extend schema", printDirectives(path, print, node), ...node.operationTypes.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]), hardline, "}"] : []];
  32462. }
  32463. case "SchemaDefinition": {
  32464. return [print("description"), node.description ? hardline : "", "schema", printDirectives(path, print, node), " {", node.operationTypes.length > 0 ? indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]) : "", hardline, "}"];
  32465. }
  32466. case "OperationTypeDefinition": {
  32467. return [print("operation"), ": ", print("type")];
  32468. }
  32469. case "InterfaceTypeExtension":
  32470. case "InterfaceTypeDefinition": {
  32471. return [print("description"), node.description ? hardline : "", node.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
  32472. }
  32473. case "FragmentSpread": {
  32474. return ["...", print("name"), printDirectives(path, print, node)];
  32475. }
  32476. case "InlineFragment": {
  32477. return ["...", node.typeCondition ? [" on ", print("typeCondition")] : "", printDirectives(path, print, node), " ", print("selectionSet")];
  32478. }
  32479. case "UnionTypeExtension":
  32480. case "UnionTypeDefinition": {
  32481. return group([print("description"), node.description ? hardline : "", group([node.kind === "UnionTypeExtension" ? "extend " : "", "union ", print("name"), printDirectives(path, print, node), node.types.length > 0 ? [" =", ifBreak("", " "), indent([ifBreak([line, " "]), join([line, "| "], path.map(print, "types"))])] : ""])]);
  32482. }
  32483. case "ScalarTypeExtension":
  32484. case "ScalarTypeDefinition": {
  32485. return [print("description"), node.description ? hardline : "", node.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", print("name"), printDirectives(path, print, node)];
  32486. }
  32487. case "NonNullType": {
  32488. return [print("type"), "!"];
  32489. }
  32490. case "ListType": {
  32491. return ["[", print("type"), "]"];
  32492. }
  32493. default:
  32494. throw new Error("unknown graphql type: " + JSON.stringify(node.kind));
  32495. }
  32496. }
  32497. function printDirectives(path, print, node) {
  32498. if (node.directives.length === 0) {
  32499. return "";
  32500. }
  32501. const printed = join(line, path.map(print, "directives"));
  32502. if (node.kind === "FragmentDefinition" || node.kind === "OperationDefinition") {
  32503. return group([line, printed]);
  32504. }
  32505. return [" ", group(indent([softline, printed]))];
  32506. }
  32507. function printSequence(path, options, print, property) {
  32508. return path.map((path2, index, sequence) => {
  32509. const printed = print();
  32510. if (index < sequence.length - 1 && isNextLineEmpty(options.originalText, path2.getValue(), locEnd)) {
  32511. return [printed, hardline];
  32512. }
  32513. return printed;
  32514. }, property);
  32515. }
  32516. function canAttachComment(node) {
  32517. return node.kind && node.kind !== "Comment";
  32518. }
  32519. function printComment(commentPath) {
  32520. const comment = commentPath.getValue();
  32521. if (comment.kind === "Comment") {
  32522. return "#" + comment.value.trimEnd();
  32523. }
  32524. throw new Error("Not a comment: " + JSON.stringify(comment));
  32525. }
  32526. function printInterfaces(path, options, print) {
  32527. const node = path.getNode();
  32528. const parts = [];
  32529. const {
  32530. interfaces
  32531. } = node;
  32532. const printed = path.map((node2) => print(node2), "interfaces");
  32533. for (let index = 0; index < interfaces.length; index++) {
  32534. const interfaceNode = interfaces[index];
  32535. parts.push(printed[index]);
  32536. const nextInterfaceNode = interfaces[index + 1];
  32537. if (nextInterfaceNode) {
  32538. const textBetween = options.originalText.slice(interfaceNode.loc.end, nextInterfaceNode.loc.start);
  32539. const hasComment = textBetween.includes("#");
  32540. const separator = textBetween.replace(/#.*/g, "").trim();
  32541. parts.push(separator === "," ? "," : " &", hasComment ? line : " ");
  32542. }
  32543. }
  32544. return parts;
  32545. }
  32546. function clean(node, newNode) {
  32547. if (node.kind === "StringValue" && node.block && !node.value.includes("\n")) {
  32548. newNode.value = newNode.value.trim();
  32549. }
  32550. }
  32551. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
  32552. function hasPrettierIgnore(path) {
  32553. var _node$comments;
  32554. const node = path.getValue();
  32555. return node === null || node === void 0 ? void 0 : (_node$comments = node.comments) === null || _node$comments === void 0 ? void 0 : _node$comments.some((comment) => comment.value.trim() === "prettier-ignore");
  32556. }
  32557. module2.exports = {
  32558. print: genericPrint,
  32559. massageAstNode: clean,
  32560. hasPrettierIgnore,
  32561. insertPragma,
  32562. printComment,
  32563. canAttachComment
  32564. };
  32565. }
  32566. });
  32567. var require_options4 = __commonJS2({
  32568. "src/language-graphql/options.js"(exports2, module2) {
  32569. "use strict";
  32570. var commonOptions = require_common_options();
  32571. module2.exports = {
  32572. bracketSpacing: commonOptions.bracketSpacing
  32573. };
  32574. }
  32575. });
  32576. var require_parsers4 = __commonJS2({
  32577. "src/language-graphql/parsers.js"(exports2, module2) {
  32578. "use strict";
  32579. module2.exports = {
  32580. get graphql() {
  32581. return require("./parser-graphql.js").parsers.graphql;
  32582. }
  32583. };
  32584. }
  32585. });
  32586. var require_GraphQL = __commonJS2({
  32587. "node_modules/linguist-languages/data/GraphQL.json"(exports2, module2) {
  32588. module2.exports = {
  32589. name: "GraphQL",
  32590. type: "data",
  32591. color: "#e10098",
  32592. extensions: [".graphql", ".gql", ".graphqls"],
  32593. tmScope: "source.graphql",
  32594. aceMode: "text",
  32595. languageId: 139
  32596. };
  32597. }
  32598. });
  32599. var require_language_graphql = __commonJS2({
  32600. "src/language-graphql/index.js"(exports2, module2) {
  32601. "use strict";
  32602. var createLanguage = require_create_language();
  32603. var printer = require_printer_graphql();
  32604. var options = require_options4();
  32605. var parsers = require_parsers4();
  32606. var languages = [createLanguage(require_GraphQL(), () => ({
  32607. since: "1.5.0",
  32608. parsers: ["graphql"],
  32609. vscodeLanguageIds: ["graphql"]
  32610. }))];
  32611. var printers = {
  32612. graphql: printer
  32613. };
  32614. module2.exports = {
  32615. languages,
  32616. options,
  32617. printers,
  32618. parsers
  32619. };
  32620. }
  32621. });
  32622. var require_loc5 = __commonJS2({
  32623. "src/language-markdown/loc.js"(exports2, module2) {
  32624. "use strict";
  32625. function locStart(node) {
  32626. return node.position.start.offset;
  32627. }
  32628. function locEnd(node) {
  32629. return node.position.end.offset;
  32630. }
  32631. module2.exports = {
  32632. locStart,
  32633. locEnd
  32634. };
  32635. }
  32636. });
  32637. var require_constants_evaluate = __commonJS2({
  32638. "src/language-markdown/constants.evaluate.js"(exports2, module2) {
  32639. module2.exports = {
  32640. cjkPattern: "(?:[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fef\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e\\udd50-\\udd52\\udd64-\\udd67]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d])(?:[\\ufe00-\\ufe0f]|\\udb40[\\udd00-\\uddef])?",
  32641. kPattern: "[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]",
  32642. punctuationPattern: "[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0a76\\u0af0\\u0c77\\u0c84\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e4f\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud803[\\udf55-\\udf59]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc8\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\udc3b\\udde2\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71\\udef7-\\udef8\\udfff]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud81b[\\ude97-\\ude9a\\udfe2]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]"
  32643. };
  32644. }
  32645. });
  32646. var require_utils10 = __commonJS2({
  32647. "src/language-markdown/utils.js"(exports2, module2) {
  32648. "use strict";
  32649. var {
  32650. getLast
  32651. } = require_util();
  32652. var {
  32653. locStart,
  32654. locEnd
  32655. } = require_loc5();
  32656. var {
  32657. cjkPattern,
  32658. kPattern,
  32659. punctuationPattern
  32660. } = require_constants_evaluate();
  32661. var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
  32662. var INLINE_NODE_WRAPPER_TYPES = [...INLINE_NODE_TYPES, "tableCell", "paragraph", "heading"];
  32663. var kRegex = new RegExp(kPattern);
  32664. var punctuationRegex = new RegExp(punctuationPattern);
  32665. function splitText(text, options) {
  32666. const KIND_NON_CJK = "non-cjk";
  32667. const KIND_CJ_LETTER = "cj-letter";
  32668. const KIND_K_LETTER = "k-letter";
  32669. const KIND_CJK_PUNCTUATION = "cjk-punctuation";
  32670. const nodes = [];
  32671. const tokens = (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})
  32672. (${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
  32673. for (const [index, token] of tokens.entries()) {
  32674. if (index % 2 === 1) {
  32675. nodes.push({
  32676. type: "whitespace",
  32677. value: /\n/.test(token) ? "\n" : " "
  32678. });
  32679. continue;
  32680. }
  32681. if ((index === 0 || index === tokens.length - 1) && token === "") {
  32682. continue;
  32683. }
  32684. const innerTokens = token.split(new RegExp(`(${cjkPattern})`));
  32685. for (const [innerIndex, innerToken] of innerTokens.entries()) {
  32686. if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
  32687. continue;
  32688. }
  32689. if (innerIndex % 2 === 0) {
  32690. if (innerToken !== "") {
  32691. appendNode({
  32692. type: "word",
  32693. value: innerToken,
  32694. kind: KIND_NON_CJK,
  32695. hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
  32696. hasTrailingPunctuation: punctuationRegex.test(getLast(innerToken))
  32697. });
  32698. }
  32699. continue;
  32700. }
  32701. appendNode(punctuationRegex.test(innerToken) ? {
  32702. type: "word",
  32703. value: innerToken,
  32704. kind: KIND_CJK_PUNCTUATION,
  32705. hasLeadingPunctuation: true,
  32706. hasTrailingPunctuation: true
  32707. } : {
  32708. type: "word",
  32709. value: innerToken,
  32710. kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
  32711. hasLeadingPunctuation: false,
  32712. hasTrailingPunctuation: false
  32713. });
  32714. }
  32715. }
  32716. return nodes;
  32717. function appendNode(node) {
  32718. const lastNode = getLast(nodes);
  32719. if (lastNode && lastNode.type === "word") {
  32720. if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
  32721. nodes.push({
  32722. type: "whitespace",
  32723. value: " "
  32724. });
  32725. } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && ![lastNode.value, node.value].some((value) => /\u3000/.test(value))) {
  32726. nodes.push({
  32727. type: "whitespace",
  32728. value: ""
  32729. });
  32730. }
  32731. }
  32732. nodes.push(node);
  32733. function isBetween(kind1, kind2) {
  32734. return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
  32735. }
  32736. }
  32737. }
  32738. function getOrderedListItemInfo(orderListItem, originalText) {
  32739. const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
  32740. return {
  32741. numberText,
  32742. marker,
  32743. leadingSpaces
  32744. };
  32745. }
  32746. function hasGitDiffFriendlyOrderedList(node, options) {
  32747. if (!node.ordered) {
  32748. return false;
  32749. }
  32750. if (node.children.length < 2) {
  32751. return false;
  32752. }
  32753. const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
  32754. const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
  32755. if (firstNumber === 0 && node.children.length > 2) {
  32756. const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
  32757. return secondNumber === 1 && thirdNumber === 1;
  32758. }
  32759. return secondNumber === 1;
  32760. }
  32761. function getFencedCodeBlockValue(node, originalText) {
  32762. const {
  32763. value
  32764. } = node;
  32765. if (node.position.end.offset === originalText.length && value.endsWith("\n") && originalText.endsWith("\n")) {
  32766. return value.slice(0, -1);
  32767. }
  32768. return value;
  32769. }
  32770. function mapAst(ast, handler) {
  32771. return function preorder(node, index, parentStack) {
  32772. const newNode = Object.assign({}, handler(node, index, parentStack));
  32773. if (newNode.children) {
  32774. newNode.children = newNode.children.map((child, index2) => preorder(child, index2, [newNode, ...parentStack]));
  32775. }
  32776. return newNode;
  32777. }(ast, null, []);
  32778. }
  32779. function isAutolink(node) {
  32780. if ((node === null || node === void 0 ? void 0 : node.type) !== "link" || node.children.length !== 1) {
  32781. return false;
  32782. }
  32783. const [child] = node.children;
  32784. return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
  32785. }
  32786. module2.exports = {
  32787. mapAst,
  32788. splitText,
  32789. punctuationPattern,
  32790. getFencedCodeBlockValue,
  32791. getOrderedListItemInfo,
  32792. hasGitDiffFriendlyOrderedList,
  32793. INLINE_NODE_TYPES,
  32794. INLINE_NODE_WRAPPER_TYPES,
  32795. isAutolink
  32796. };
  32797. }
  32798. });
  32799. var require_embed3 = __commonJS2({
  32800. "src/language-markdown/embed.js"(exports2, module2) {
  32801. "use strict";
  32802. var {
  32803. inferParserByLanguage,
  32804. getMaxContinuousCount
  32805. } = require_util();
  32806. var {
  32807. builders: {
  32808. hardline,
  32809. markAsRoot
  32810. },
  32811. utils: {
  32812. replaceEndOfLine
  32813. }
  32814. } = require("./doc.js");
  32815. var printFrontMatter = require_print();
  32816. var {
  32817. getFencedCodeBlockValue
  32818. } = require_utils10();
  32819. function embed(path, print, textToDoc, options) {
  32820. const node = path.getValue();
  32821. if (node.type === "code" && node.lang !== null) {
  32822. const parser = inferParserByLanguage(node.lang, options);
  32823. if (parser) {
  32824. const styleUnit = options.__inJsTemplate ? "~" : "`";
  32825. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  32826. const newOptions = {
  32827. parser
  32828. };
  32829. if (node.lang === "tsx") {
  32830. newOptions.filepath = "dummy.tsx";
  32831. }
  32832. const doc2 = textToDoc(getFencedCodeBlockValue(node, options.originalText), newOptions, {
  32833. stripTrailingHardline: true
  32834. });
  32835. return markAsRoot([style, node.lang, node.meta ? " " + node.meta : "", hardline, replaceEndOfLine(doc2), hardline, style]);
  32836. }
  32837. }
  32838. switch (node.type) {
  32839. case "front-matter":
  32840. return printFrontMatter(node, textToDoc);
  32841. case "importExport":
  32842. return [textToDoc(node.value, {
  32843. parser: "babel"
  32844. }, {
  32845. stripTrailingHardline: true
  32846. }), hardline];
  32847. case "jsx":
  32848. return textToDoc(`<$>${node.value}</$>`, {
  32849. parser: "__js_expression",
  32850. rootMarker: "mdx"
  32851. }, {
  32852. stripTrailingHardline: true
  32853. });
  32854. }
  32855. return null;
  32856. }
  32857. module2.exports = embed;
  32858. }
  32859. });
  32860. var require_pragma4 = __commonJS2({
  32861. "src/language-markdown/pragma.js"(exports2, module2) {
  32862. "use strict";
  32863. var parseFrontMatter = require_parse4();
  32864. var pragmas = ["format", "prettier"];
  32865. function startWithPragma(text) {
  32866. const pragma = `@(${pragmas.join("|")})`;
  32867. const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?
  32868. [\\s\\S]*(^|
  32869. )[^\\S
  32870. ]*${pragma}[^\\S
  32871. ]*($|
  32872. )[\\s\\S]*
  32873. .*-->`].join("|"), "m");
  32874. const matched = text.match(regex);
  32875. return (matched === null || matched === void 0 ? void 0 : matched.index) === 0;
  32876. }
  32877. module2.exports = {
  32878. startWithPragma,
  32879. hasPragma: (text) => startWithPragma(parseFrontMatter(text).content.trimStart()),
  32880. insertPragma: (text) => {
  32881. const extracted = parseFrontMatter(text);
  32882. const pragma = `<!-- @${pragmas[0]} -->`;
  32883. return extracted.frontMatter ? `${extracted.frontMatter.raw}
  32884. ${pragma}
  32885. ${extracted.content}` : `${pragma}
  32886. ${extracted.content}`;
  32887. }
  32888. };
  32889. }
  32890. });
  32891. var require_print_preprocess2 = __commonJS2({
  32892. "src/language-markdown/print-preprocess.js"(exports2, module2) {
  32893. "use strict";
  32894. var getLast = require_get_last();
  32895. var {
  32896. getOrderedListItemInfo,
  32897. mapAst,
  32898. splitText
  32899. } = require_utils10();
  32900. var isSingleCharRegex = /^.$/su;
  32901. function preprocess(ast, options) {
  32902. ast = restoreUnescapedCharacter(ast, options);
  32903. ast = mergeContinuousTexts(ast);
  32904. ast = transformInlineCode(ast, options);
  32905. ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
  32906. ast = markAlignedList(ast, options);
  32907. ast = splitTextIntoSentences(ast, options);
  32908. ast = transformImportExport(ast);
  32909. ast = mergeContinuousImportExport(ast);
  32910. return ast;
  32911. }
  32912. function transformImportExport(ast) {
  32913. return mapAst(ast, (node) => {
  32914. if (node.type !== "import" && node.type !== "export") {
  32915. return node;
  32916. }
  32917. return Object.assign(Object.assign({}, node), {}, {
  32918. type: "importExport"
  32919. });
  32920. });
  32921. }
  32922. function transformInlineCode(ast, options) {
  32923. return mapAst(ast, (node) => {
  32924. if (node.type !== "inlineCode" || options.proseWrap === "preserve") {
  32925. return node;
  32926. }
  32927. return Object.assign(Object.assign({}, node), {}, {
  32928. value: node.value.replace(/\s+/g, " ")
  32929. });
  32930. });
  32931. }
  32932. function restoreUnescapedCharacter(ast, options) {
  32933. return mapAst(ast, (node) => node.type !== "text" || node.value === "*" || node.value === "_" || !isSingleCharRegex.test(node.value) || node.position.end.offset - node.position.start.offset === node.value.length ? node : Object.assign(Object.assign({}, node), {}, {
  32934. value: options.originalText.slice(node.position.start.offset, node.position.end.offset)
  32935. }));
  32936. }
  32937. function mergeContinuousImportExport(ast) {
  32938. return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
  32939. type: "importExport",
  32940. value: prevNode.value + "\n\n" + node.value,
  32941. position: {
  32942. start: prevNode.position.start,
  32943. end: node.position.end
  32944. }
  32945. }));
  32946. }
  32947. function mergeChildren(ast, shouldMerge, mergeNode) {
  32948. return mapAst(ast, (node) => {
  32949. if (!node.children) {
  32950. return node;
  32951. }
  32952. const children = node.children.reduce((current, child) => {
  32953. const lastChild = getLast(current);
  32954. if (lastChild && shouldMerge(lastChild, child)) {
  32955. current.splice(-1, 1, mergeNode(lastChild, child));
  32956. } else {
  32957. current.push(child);
  32958. }
  32959. return current;
  32960. }, []);
  32961. return Object.assign(Object.assign({}, node), {}, {
  32962. children
  32963. });
  32964. });
  32965. }
  32966. function mergeContinuousTexts(ast) {
  32967. return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
  32968. type: "text",
  32969. value: prevNode.value + node.value,
  32970. position: {
  32971. start: prevNode.position.start,
  32972. end: node.position.end
  32973. }
  32974. }));
  32975. }
  32976. function splitTextIntoSentences(ast, options) {
  32977. return mapAst(ast, (node, index, [parentNode]) => {
  32978. if (node.type !== "text") {
  32979. return node;
  32980. }
  32981. let {
  32982. value
  32983. } = node;
  32984. if (parentNode.type === "paragraph") {
  32985. if (index === 0) {
  32986. value = value.trimStart();
  32987. }
  32988. if (index === parentNode.children.length - 1) {
  32989. value = value.trimEnd();
  32990. }
  32991. }
  32992. return {
  32993. type: "sentence",
  32994. position: node.position,
  32995. children: splitText(value, options)
  32996. };
  32997. });
  32998. }
  32999. function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
  33000. return mapAst(ast, (node, index, parentStack) => {
  33001. if (node.type === "code") {
  33002. const isIndented = /^\n?(?: {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
  33003. node.isIndented = isIndented;
  33004. if (isIndented) {
  33005. for (let i = 0; i < parentStack.length; i++) {
  33006. const parent = parentStack[i];
  33007. if (parent.hasIndentedCodeblock) {
  33008. break;
  33009. }
  33010. if (parent.type === "list") {
  33011. parent.hasIndentedCodeblock = true;
  33012. }
  33013. }
  33014. }
  33015. }
  33016. return node;
  33017. });
  33018. }
  33019. function markAlignedList(ast, options) {
  33020. return mapAst(ast, (node, index, parentStack) => {
  33021. if (node.type === "list" && node.children.length > 0) {
  33022. for (let i = 0; i < parentStack.length; i++) {
  33023. const parent = parentStack[i];
  33024. if (parent.type === "list" && !parent.isAligned) {
  33025. node.isAligned = false;
  33026. return node;
  33027. }
  33028. }
  33029. node.isAligned = isAligned(node);
  33030. }
  33031. return node;
  33032. });
  33033. function getListItemStart(listItem) {
  33034. return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
  33035. }
  33036. function isAligned(list) {
  33037. if (!list.ordered) {
  33038. return true;
  33039. }
  33040. const [firstItem, secondItem] = list.children;
  33041. const firstInfo = getOrderedListItemInfo(firstItem, options.originalText);
  33042. if (firstInfo.leadingSpaces.length > 1) {
  33043. return true;
  33044. }
  33045. const firstStart = getListItemStart(firstItem);
  33046. if (firstStart === -1) {
  33047. return false;
  33048. }
  33049. if (list.children.length === 1) {
  33050. return firstStart % options.tabWidth === 0;
  33051. }
  33052. const secondStart = getListItemStart(secondItem);
  33053. if (firstStart !== secondStart) {
  33054. return false;
  33055. }
  33056. if (firstStart % options.tabWidth === 0) {
  33057. return true;
  33058. }
  33059. const secondInfo = getOrderedListItemInfo(secondItem, options.originalText);
  33060. return secondInfo.leadingSpaces.length > 1;
  33061. }
  33062. }
  33063. module2.exports = preprocess;
  33064. }
  33065. });
  33066. var require_clean4 = __commonJS2({
  33067. "src/language-markdown/clean.js"(exports2, module2) {
  33068. "use strict";
  33069. var {
  33070. isFrontMatterNode
  33071. } = require_util();
  33072. var {
  33073. startWithPragma
  33074. } = require_pragma4();
  33075. var ignoredProperties = /* @__PURE__ */ new Set(["position", "raw"]);
  33076. function clean(ast, newObj, parent) {
  33077. if (ast.type === "front-matter" || ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
  33078. delete newObj.value;
  33079. }
  33080. if (ast.type === "list") {
  33081. delete newObj.isAligned;
  33082. }
  33083. if (ast.type === "list" || ast.type === "listItem") {
  33084. delete newObj.spread;
  33085. delete newObj.loose;
  33086. }
  33087. if (ast.type === "text") {
  33088. return null;
  33089. }
  33090. if (ast.type === "inlineCode") {
  33091. newObj.value = ast.value.replace(/[\t\n ]+/g, " ");
  33092. }
  33093. if (ast.type === "wikiLink") {
  33094. newObj.value = ast.value.trim().replace(/[\t\n]+/g, " ");
  33095. }
  33096. if (ast.type === "definition" || ast.type === "linkReference") {
  33097. newObj.label = ast.label.trim().replace(/[\t\n ]+/g, " ").toLowerCase();
  33098. }
  33099. if ((ast.type === "definition" || ast.type === "link" || ast.type === "image") && ast.title) {
  33100. newObj.title = ast.title.replace(/\\(["')])/g, "$1");
  33101. }
  33102. if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || isFrontMatterNode(parent.children[0]) && parent.children[1] === ast) && ast.type === "html" && startWithPragma(ast.value)) {
  33103. return null;
  33104. }
  33105. }
  33106. clean.ignoredProperties = ignoredProperties;
  33107. module2.exports = clean;
  33108. }
  33109. });
  33110. var require_printer_markdown = __commonJS2({
  33111. "src/language-markdown/printer-markdown.js"(exports2, module2) {
  33112. "use strict";
  33113. var {
  33114. getLast,
  33115. getMinNotPresentContinuousCount,
  33116. getMaxContinuousCount,
  33117. getStringWidth,
  33118. isNonEmptyArray
  33119. } = require_util();
  33120. var {
  33121. builders: {
  33122. breakParent,
  33123. join,
  33124. line,
  33125. literalline,
  33126. markAsRoot,
  33127. hardline,
  33128. softline,
  33129. ifBreak,
  33130. fill,
  33131. align,
  33132. indent,
  33133. group,
  33134. hardlineWithoutBreakParent
  33135. },
  33136. utils: {
  33137. normalizeDoc,
  33138. replaceTextEndOfLine
  33139. },
  33140. printer: {
  33141. printDocToString
  33142. }
  33143. } = require("./doc.js");
  33144. var embed = require_embed3();
  33145. var {
  33146. insertPragma
  33147. } = require_pragma4();
  33148. var {
  33149. locStart,
  33150. locEnd
  33151. } = require_loc5();
  33152. var preprocess = require_print_preprocess2();
  33153. var clean = require_clean4();
  33154. var {
  33155. getFencedCodeBlockValue,
  33156. hasGitDiffFriendlyOrderedList,
  33157. splitText,
  33158. punctuationPattern,
  33159. INLINE_NODE_TYPES,
  33160. INLINE_NODE_WRAPPER_TYPES,
  33161. isAutolink
  33162. } = require_utils10();
  33163. var TRAILING_HARDLINE_NODES = /* @__PURE__ */ new Set(["importExport"]);
  33164. var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link", "wikiLink"];
  33165. var SIBLING_NODE_TYPES = /* @__PURE__ */ new Set(["listItem", "definition", "footnoteDefinition"]);
  33166. function genericPrint(path, options, print) {
  33167. const node = path.getValue();
  33168. if (shouldRemainTheSameContent(path)) {
  33169. return splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map((node2) => node2.type === "word" ? node2.value : node2.value === "" ? "" : printLine(path, node2.value, options));
  33170. }
  33171. switch (node.type) {
  33172. case "front-matter":
  33173. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  33174. case "root":
  33175. if (node.children.length === 0) {
  33176. return "";
  33177. }
  33178. return [normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode(node).type) ? hardline : ""];
  33179. case "paragraph":
  33180. return printChildren(path, options, print, {
  33181. postprocessor: fill
  33182. });
  33183. case "sentence":
  33184. return printChildren(path, options, print);
  33185. case "word": {
  33186. let escapedValue = node.value.replace(/\*/g, "\\$&").replace(new RegExp([`(^|${punctuationPattern})(_+)`, `(_+)(${punctuationPattern}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_"));
  33187. const isFirstSentence = (node2, name, index) => node2.type === "sentence" && index === 0;
  33188. const isLastChildAutolink = (node2, name, index) => isAutolink(node2.children[index - 1]);
  33189. if (escapedValue !== node.value && (path.match(void 0, isFirstSentence, isLastChildAutolink) || path.match(void 0, isFirstSentence, (node2, name, index) => node2.type === "emphasis" && index === 0, isLastChildAutolink))) {
  33190. escapedValue = escapedValue.replace(/^(\\?[*_])+/, (prefix) => prefix.replace(/\\/g, ""));
  33191. }
  33192. return escapedValue;
  33193. }
  33194. case "whitespace": {
  33195. const parentNode = path.getParentNode();
  33196. const index = parentNode.children.indexOf(node);
  33197. const nextNode = parentNode.children[index + 1];
  33198. const proseWrap = nextNode && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(nextNode.value) ? "never" : options.proseWrap;
  33199. return printLine(path, node.value, {
  33200. proseWrap
  33201. });
  33202. }
  33203. case "emphasis": {
  33204. let style;
  33205. if (isAutolink(node.children[0])) {
  33206. style = options.originalText[node.position.start.offset];
  33207. } else {
  33208. const parentNode = path.getParentNode();
  33209. const index = parentNode.children.indexOf(node);
  33210. const prevNode = parentNode.children[index - 1];
  33211. const nextNode = parentNode.children[index + 1];
  33212. const hasPrevOrNextWord = prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && getLast(prevNode.children).type === "word" && !getLast(prevNode.children).hasTrailingPunctuation || nextNode && nextNode.type === "sentence" && nextNode.children.length > 0 && nextNode.children[0].type === "word" && !nextNode.children[0].hasLeadingPunctuation;
  33213. style = hasPrevOrNextWord || getAncestorNode(path, "emphasis") ? "*" : "_";
  33214. }
  33215. return [style, printChildren(path, options, print), style];
  33216. }
  33217. case "strong":
  33218. return ["**", printChildren(path, options, print), "**"];
  33219. case "delete":
  33220. return ["~~", printChildren(path, options, print), "~~"];
  33221. case "inlineCode": {
  33222. const backtickCount = getMinNotPresentContinuousCount(node.value, "`");
  33223. const style = "`".repeat(backtickCount || 1);
  33224. const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
  33225. return [style, gap, node.value, gap, style];
  33226. }
  33227. case "wikiLink": {
  33228. let contents = "";
  33229. if (options.proseWrap === "preserve") {
  33230. contents = node.value;
  33231. } else {
  33232. contents = node.value.replace(/[\t\n]+/g, " ");
  33233. }
  33234. return ["[[", contents, "]]"];
  33235. }
  33236. case "link":
  33237. switch (options.originalText[node.position.start.offset]) {
  33238. case "<": {
  33239. const mailto = "mailto:";
  33240. const url = node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
  33241. return ["<", url, ">"];
  33242. }
  33243. case "[":
  33244. return ["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  33245. default:
  33246. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  33247. }
  33248. case "image":
  33249. return ["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  33250. case "blockquote":
  33251. return ["> ", align("> ", printChildren(path, options, print))];
  33252. case "heading":
  33253. return ["#".repeat(node.depth) + " ", printChildren(path, options, print)];
  33254. case "code": {
  33255. if (node.isIndented) {
  33256. const alignment = " ".repeat(4);
  33257. return align(alignment, [alignment, ...replaceTextEndOfLine(node.value, hardline)]);
  33258. }
  33259. const styleUnit = options.__inJsTemplate ? "~" : "`";
  33260. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  33261. return [style, node.lang || "", node.meta ? " " + node.meta : "", hardline, ...replaceTextEndOfLine(getFencedCodeBlockValue(node, options.originalText), hardline), hardline, style];
  33262. }
  33263. case "html": {
  33264. const parentNode = path.getParentNode();
  33265. const value = parentNode.type === "root" && getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
  33266. const isHtmlComment = /^<!--.*-->$/s.test(value);
  33267. return replaceTextEndOfLine(value, isHtmlComment ? hardline : markAsRoot(literalline));
  33268. }
  33269. case "list": {
  33270. const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
  33271. const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(node, options);
  33272. return printChildren(path, options, print, {
  33273. processor: (childPath, index) => {
  33274. const prefix = getPrefix();
  33275. const childNode = childPath.getValue();
  33276. if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
  33277. return [prefix, printListItem(childPath, options, print, prefix)];
  33278. }
  33279. return [prefix, align(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))];
  33280. function getPrefix() {
  33281. const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
  33282. return node.isAligned || node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
  33283. }
  33284. }
  33285. });
  33286. }
  33287. case "thematicBreak": {
  33288. const counter = getAncestorCounter(path, "list");
  33289. if (counter === -1) {
  33290. return "---";
  33291. }
  33292. const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
  33293. return nthSiblingIndex % 2 === 0 ? "***" : "---";
  33294. }
  33295. case "linkReference":
  33296. return ["[", printChildren(path, options, print), "]", node.referenceType === "full" ? ["[", node.identifier, "]"] : node.referenceType === "collapsed" ? "[]" : ""];
  33297. case "imageReference":
  33298. switch (node.referenceType) {
  33299. case "full":
  33300. return ["![", node.alt || "", "][", node.identifier, "]"];
  33301. default:
  33302. return ["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""];
  33303. }
  33304. case "definition": {
  33305. const lineOrSpace = options.proseWrap === "always" ? line : " ";
  33306. return group(["[", node.identifier, "]:", indent([lineOrSpace, printUrl(node.url), node.title === null ? "" : [lineOrSpace, printTitle(node.title, options, false)]])]);
  33307. }
  33308. case "footnote":
  33309. return ["[^", printChildren(path, options, print), "]"];
  33310. case "footnoteReference":
  33311. return ["[^", node.identifier, "]"];
  33312. case "footnoteDefinition": {
  33313. const nextNode = path.getParentNode().children[path.getName() + 1];
  33314. const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line);
  33315. return ["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren(path, options, print) : group([align(" ".repeat(4), printChildren(path, options, print, {
  33316. processor: (childPath, index) => index === 0 ? group([softline, print()]) : print()
  33317. })), nextNode && nextNode.type === "footnoteDefinition" ? softline : ""])];
  33318. }
  33319. case "table":
  33320. return printTable(path, options, print);
  33321. case "tableCell":
  33322. return printChildren(path, options, print);
  33323. case "break":
  33324. return /\s/.test(options.originalText[node.position.start.offset]) ? [" ", markAsRoot(literalline)] : ["\\", hardline];
  33325. case "liquidNode":
  33326. return replaceTextEndOfLine(node.value, hardline);
  33327. case "importExport":
  33328. return [node.value, hardline];
  33329. case "esComment":
  33330. return ["{/* ", node.value, " */}"];
  33331. case "jsx":
  33332. return node.value;
  33333. case "math":
  33334. return ["$$", hardline, node.value ? [...replaceTextEndOfLine(node.value, hardline), hardline] : "", "$$"];
  33335. case "inlineMath": {
  33336. return options.originalText.slice(locStart(node), locEnd(node));
  33337. }
  33338. case "tableRow":
  33339. case "listItem":
  33340. default:
  33341. throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`);
  33342. }
  33343. }
  33344. function printListItem(path, options, print, listPrefix) {
  33345. const node = path.getValue();
  33346. const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
  33347. return [prefix, printChildren(path, options, print, {
  33348. processor: (childPath, index) => {
  33349. if (index === 0 && childPath.getValue().type !== "list") {
  33350. return align(" ".repeat(prefix.length), print());
  33351. }
  33352. const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3));
  33353. return [alignment, align(alignment, print())];
  33354. }
  33355. })];
  33356. }
  33357. function alignListPrefix(prefix, options) {
  33358. const additionalSpaces = getAdditionalSpaces();
  33359. return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces);
  33360. function getAdditionalSpaces() {
  33361. const restSpaces = prefix.length % options.tabWidth;
  33362. return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
  33363. }
  33364. }
  33365. function getNthListSiblingIndex(node, parentNode) {
  33366. return getNthSiblingIndex(node, parentNode, (siblingNode) => siblingNode.ordered === node.ordered);
  33367. }
  33368. function getNthSiblingIndex(node, parentNode, condition) {
  33369. let index = -1;
  33370. for (const childNode of parentNode.children) {
  33371. if (childNode.type === node.type && condition(childNode)) {
  33372. index++;
  33373. } else {
  33374. index = -1;
  33375. }
  33376. if (childNode === node) {
  33377. return index;
  33378. }
  33379. }
  33380. }
  33381. function getAncestorCounter(path, typeOrTypes) {
  33382. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  33383. let counter = -1;
  33384. let ancestorNode;
  33385. while (ancestorNode = path.getParentNode(++counter)) {
  33386. if (types.includes(ancestorNode.type)) {
  33387. return counter;
  33388. }
  33389. }
  33390. return -1;
  33391. }
  33392. function getAncestorNode(path, typeOrTypes) {
  33393. const counter = getAncestorCounter(path, typeOrTypes);
  33394. return counter === -1 ? null : path.getParentNode(counter);
  33395. }
  33396. function printLine(path, value, options) {
  33397. if (options.proseWrap === "preserve" && value === "\n") {
  33398. return hardline;
  33399. }
  33400. const isBreakable = options.proseWrap === "always" && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
  33401. return value !== "" ? isBreakable ? line : " " : isBreakable ? softline : "";
  33402. }
  33403. function printTable(path, options, print) {
  33404. const node = path.getValue();
  33405. const columnMaxWidths = [];
  33406. const contents = path.map((rowPath) => rowPath.map((cellPath, columnIndex) => {
  33407. const text = printDocToString(print(), options).formatted;
  33408. const width = getStringWidth(text);
  33409. columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, width);
  33410. return {
  33411. text,
  33412. width
  33413. };
  33414. }, "children"), "children");
  33415. const alignedTable = printTableContents(false);
  33416. if (options.proseWrap !== "never") {
  33417. return [breakParent, alignedTable];
  33418. }
  33419. const compactTable = printTableContents(true);
  33420. return [breakParent, group(ifBreak(compactTable, alignedTable))];
  33421. function printTableContents(isCompact) {
  33422. const parts = [printRow(contents[0], isCompact), printAlign(isCompact)];
  33423. if (contents.length > 1) {
  33424. parts.push(join(hardlineWithoutBreakParent, contents.slice(1).map((rowContents) => printRow(rowContents, isCompact))));
  33425. }
  33426. return join(hardlineWithoutBreakParent, parts);
  33427. }
  33428. function printAlign(isCompact) {
  33429. const align2 = columnMaxWidths.map((width, index) => {
  33430. const align3 = node.align[index];
  33431. const first = align3 === "center" || align3 === "left" ? ":" : "-";
  33432. const last = align3 === "center" || align3 === "right" ? ":" : "-";
  33433. const middle = isCompact ? "-" : "-".repeat(width - 2);
  33434. return `${first}${middle}${last}`;
  33435. });
  33436. return `| ${align2.join(" | ")} |`;
  33437. }
  33438. function printRow(rowContents, isCompact) {
  33439. const columns = rowContents.map(({
  33440. text,
  33441. width
  33442. }, columnIndex) => {
  33443. if (isCompact) {
  33444. return text;
  33445. }
  33446. const spaces = columnMaxWidths[columnIndex] - width;
  33447. const align2 = node.align[columnIndex];
  33448. let before = 0;
  33449. if (align2 === "right") {
  33450. before = spaces;
  33451. } else if (align2 === "center") {
  33452. before = Math.floor(spaces / 2);
  33453. }
  33454. const after = spaces - before;
  33455. return `${" ".repeat(before)}${text}${" ".repeat(after)}`;
  33456. });
  33457. return `| ${columns.join(" | ")} |`;
  33458. }
  33459. }
  33460. function printRoot(path, options, print) {
  33461. const ignoreRanges = [];
  33462. let ignoreStart = null;
  33463. const {
  33464. children
  33465. } = path.getValue();
  33466. for (const [index, childNode] of children.entries()) {
  33467. switch (isPrettierIgnore(childNode)) {
  33468. case "start":
  33469. if (ignoreStart === null) {
  33470. ignoreStart = {
  33471. index,
  33472. offset: childNode.position.end.offset
  33473. };
  33474. }
  33475. break;
  33476. case "end":
  33477. if (ignoreStart !== null) {
  33478. ignoreRanges.push({
  33479. start: ignoreStart,
  33480. end: {
  33481. index,
  33482. offset: childNode.position.start.offset
  33483. }
  33484. });
  33485. ignoreStart = null;
  33486. }
  33487. break;
  33488. default:
  33489. break;
  33490. }
  33491. }
  33492. return printChildren(path, options, print, {
  33493. processor: (childPath, index) => {
  33494. if (ignoreRanges.length > 0) {
  33495. const ignoreRange = ignoreRanges[0];
  33496. if (index === ignoreRange.start.index) {
  33497. return [printIgnoreComment(children[ignoreRange.start.index]), options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), printIgnoreComment(children[ignoreRange.end.index])];
  33498. }
  33499. if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
  33500. return false;
  33501. }
  33502. if (index === ignoreRange.end.index) {
  33503. ignoreRanges.shift();
  33504. return false;
  33505. }
  33506. }
  33507. return print();
  33508. }
  33509. });
  33510. }
  33511. function printChildren(path, options, print, events = {}) {
  33512. const {
  33513. postprocessor
  33514. } = events;
  33515. const processor = events.processor || (() => print());
  33516. const node = path.getValue();
  33517. const parts = [];
  33518. let lastChildNode;
  33519. path.each((childPath, index) => {
  33520. const childNode = childPath.getValue();
  33521. const result = processor(childPath, index);
  33522. if (result !== false) {
  33523. const data = {
  33524. parts,
  33525. prevNode: lastChildNode,
  33526. parentNode: node,
  33527. options
  33528. };
  33529. if (shouldPrePrintHardline(childNode, data)) {
  33530. parts.push(hardline);
  33531. if (lastChildNode && TRAILING_HARDLINE_NODES.has(lastChildNode.type)) {
  33532. if (shouldPrePrintTripleHardline(childNode, data)) {
  33533. parts.push(hardline);
  33534. }
  33535. } else {
  33536. if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
  33537. parts.push(hardline);
  33538. }
  33539. if (shouldPrePrintTripleHardline(childNode, data)) {
  33540. parts.push(hardline);
  33541. }
  33542. }
  33543. }
  33544. parts.push(result);
  33545. lastChildNode = childNode;
  33546. }
  33547. }, "children");
  33548. return postprocessor ? postprocessor(parts) : parts;
  33549. }
  33550. function printIgnoreComment(node) {
  33551. if (node.type === "html") {
  33552. return node.value;
  33553. }
  33554. if (node.type === "paragraph" && Array.isArray(node.children) && node.children.length === 1 && node.children[0].type === "esComment") {
  33555. return ["{/* ", node.children[0].value, " */}"];
  33556. }
  33557. }
  33558. function getLastDescendantNode(node) {
  33559. let current = node;
  33560. while (isNonEmptyArray(current.children)) {
  33561. current = getLast(current.children);
  33562. }
  33563. return current;
  33564. }
  33565. function isPrettierIgnore(node) {
  33566. let match;
  33567. if (node.type === "html") {
  33568. match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
  33569. } else {
  33570. let comment;
  33571. if (node.type === "esComment") {
  33572. comment = node;
  33573. } else if (node.type === "paragraph" && node.children.length === 1 && node.children[0].type === "esComment") {
  33574. comment = node.children[0];
  33575. }
  33576. if (comment) {
  33577. match = comment.value.match(/^prettier-ignore(?:-(start|end))?$/);
  33578. }
  33579. }
  33580. return match ? match[1] || "next" : false;
  33581. }
  33582. function shouldPrePrintHardline(node, data) {
  33583. const isFirstNode = data.parts.length === 0;
  33584. const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
  33585. const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
  33586. return !isFirstNode && !isInlineNode && !isInlineHTML;
  33587. }
  33588. function shouldPrePrintDoubleHardline(node, data) {
  33589. var _data$prevNode, _data$prevNode2, _data$prevNode3;
  33590. const isSequence = (data.prevNode && data.prevNode.type) === node.type;
  33591. const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
  33592. const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
  33593. const isPrevNodeLooseListItem = ((_data$prevNode = data.prevNode) === null || _data$prevNode === void 0 ? void 0 : _data$prevNode.type) === "listItem" && data.prevNode.loose;
  33594. const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
  33595. const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && ((_data$prevNode2 = data.prevNode) === null || _data$prevNode2 === void 0 ? void 0 : _data$prevNode2.type) === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
  33596. const isHtmlDirectAfterListItem = node.type === "html" && data.parentNode.type === "listItem" && ((_data$prevNode3 = data.prevNode) === null || _data$prevNode3 === void 0 ? void 0 : _data$prevNode3.type) === "paragraph" && data.prevNode.position.end.line + 1 === node.position.start.line;
  33597. return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
  33598. }
  33599. function shouldPrePrintTripleHardline(node, data) {
  33600. const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
  33601. const isIndentedCode = node.type === "code" && node.isIndented;
  33602. return isPrevNodeList && isIndentedCode;
  33603. }
  33604. function shouldRemainTheSameContent(path) {
  33605. const ancestorNode = getAncestorNode(path, ["linkReference", "imageReference"]);
  33606. return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
  33607. }
  33608. function printUrl(url, dangerousCharOrChars = []) {
  33609. const dangerousChars = [" ", ...Array.isArray(dangerousCharOrChars) ? dangerousCharOrChars : [dangerousCharOrChars]];
  33610. return new RegExp(dangerousChars.map((x) => `\\${x}`).join("|")).test(url) ? `<${url}>` : url;
  33611. }
  33612. function printTitle(title, options, printSpace = true) {
  33613. if (!title) {
  33614. return "";
  33615. }
  33616. if (printSpace) {
  33617. return " " + printTitle(title, options, false);
  33618. }
  33619. title = title.replace(/\\(["')])/g, "$1");
  33620. if (title.includes('"') && title.includes("'") && !title.includes(")")) {
  33621. return `(${title})`;
  33622. }
  33623. const singleCount = title.split("'").length - 1;
  33624. const doubleCount = title.split('"').length - 1;
  33625. const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
  33626. title = title.replace(/\\/, "\\\\");
  33627. title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
  33628. return `${quote}${title}${quote}`;
  33629. }
  33630. function clamp(value, min, max) {
  33631. return value < min ? min : value > max ? max : value;
  33632. }
  33633. function hasPrettierIgnore(path) {
  33634. const index = Number(path.getName());
  33635. if (index === 0) {
  33636. return false;
  33637. }
  33638. const prevNode = path.getParentNode().children[index - 1];
  33639. return isPrettierIgnore(prevNode) === "next";
  33640. }
  33641. module2.exports = {
  33642. preprocess,
  33643. print: genericPrint,
  33644. embed,
  33645. massageAstNode: clean,
  33646. hasPrettierIgnore,
  33647. insertPragma
  33648. };
  33649. }
  33650. });
  33651. var require_options5 = __commonJS2({
  33652. "src/language-markdown/options.js"(exports2, module2) {
  33653. "use strict";
  33654. var commonOptions = require_common_options();
  33655. module2.exports = {
  33656. proseWrap: commonOptions.proseWrap,
  33657. singleQuote: commonOptions.singleQuote
  33658. };
  33659. }
  33660. });
  33661. var require_parsers5 = __commonJS2({
  33662. "src/language-markdown/parsers.js"(exports2, module2) {
  33663. "use strict";
  33664. module2.exports = {
  33665. get remark() {
  33666. return require("./parser-markdown.js").parsers.remark;
  33667. },
  33668. get markdown() {
  33669. return require("./parser-markdown.js").parsers.remark;
  33670. },
  33671. get mdx() {
  33672. return require("./parser-markdown.js").parsers.mdx;
  33673. }
  33674. };
  33675. }
  33676. });
  33677. var require_Markdown = __commonJS2({
  33678. "node_modules/linguist-languages/data/Markdown.json"(exports2, module2) {
  33679. module2.exports = {
  33680. name: "Markdown",
  33681. type: "prose",
  33682. color: "#083fa1",
  33683. aliases: ["pandoc"],
  33684. aceMode: "markdown",
  33685. codemirrorMode: "gfm",
  33686. codemirrorMimeType: "text/x-gfm",
  33687. wrap: true,
  33688. extensions: [".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"],
  33689. filenames: ["contents.lr"],
  33690. tmScope: "source.gfm",
  33691. languageId: 222
  33692. };
  33693. }
  33694. });
  33695. var require_language_markdown = __commonJS2({
  33696. "src/language-markdown/index.js"(exports2, module2) {
  33697. "use strict";
  33698. var createLanguage = require_create_language();
  33699. var printer = require_printer_markdown();
  33700. var options = require_options5();
  33701. var parsers = require_parsers5();
  33702. var languages = [createLanguage(require_Markdown(), (data) => ({
  33703. since: "1.8.0",
  33704. parsers: ["markdown"],
  33705. vscodeLanguageIds: ["markdown"],
  33706. filenames: [...data.filenames, "README"],
  33707. extensions: data.extensions.filter((extension) => extension !== ".mdx")
  33708. })), createLanguage(require_Markdown(), () => ({
  33709. name: "MDX",
  33710. since: "1.15.0",
  33711. parsers: ["mdx"],
  33712. vscodeLanguageIds: ["mdx"],
  33713. filenames: [],
  33714. extensions: [".mdx"]
  33715. }))];
  33716. var printers = {
  33717. mdast: printer
  33718. };
  33719. module2.exports = {
  33720. languages,
  33721. options,
  33722. printers,
  33723. parsers
  33724. };
  33725. }
  33726. });
  33727. var require_clean5 = __commonJS2({
  33728. "src/language-html/clean.js"(exports2, module2) {
  33729. "use strict";
  33730. var {
  33731. isFrontMatterNode
  33732. } = require_util();
  33733. var ignoredProperties = /* @__PURE__ */ new Set(["sourceSpan", "startSourceSpan", "endSourceSpan", "nameSpan", "valueSpan"]);
  33734. function clean(ast, newNode) {
  33735. if (ast.type === "text" || ast.type === "comment") {
  33736. return null;
  33737. }
  33738. if (isFrontMatterNode(ast) || ast.type === "yaml" || ast.type === "toml") {
  33739. return null;
  33740. }
  33741. if (ast.type === "attribute") {
  33742. delete newNode.value;
  33743. }
  33744. if (ast.type === "docType") {
  33745. delete newNode.value;
  33746. }
  33747. }
  33748. clean.ignoredProperties = ignoredProperties;
  33749. module2.exports = clean;
  33750. }
  33751. });
  33752. var require_constants_evaluate2 = __commonJS2({
  33753. "src/language-html/constants.evaluate.js"(exports2, module2) {
  33754. module2.exports = {
  33755. CSS_DISPLAY_TAGS: {
  33756. area: "none",
  33757. base: "none",
  33758. basefont: "none",
  33759. datalist: "none",
  33760. head: "none",
  33761. link: "none",
  33762. meta: "none",
  33763. noembed: "none",
  33764. noframes: "none",
  33765. param: "block",
  33766. rp: "none",
  33767. script: "block",
  33768. source: "block",
  33769. style: "none",
  33770. template: "inline",
  33771. track: "block",
  33772. title: "none",
  33773. html: "block",
  33774. body: "block",
  33775. address: "block",
  33776. blockquote: "block",
  33777. center: "block",
  33778. div: "block",
  33779. figure: "block",
  33780. figcaption: "block",
  33781. footer: "block",
  33782. form: "block",
  33783. header: "block",
  33784. hr: "block",
  33785. legend: "block",
  33786. listing: "block",
  33787. main: "block",
  33788. p: "block",
  33789. plaintext: "block",
  33790. pre: "block",
  33791. xmp: "block",
  33792. slot: "contents",
  33793. ruby: "ruby",
  33794. rt: "ruby-text",
  33795. article: "block",
  33796. aside: "block",
  33797. h1: "block",
  33798. h2: "block",
  33799. h3: "block",
  33800. h4: "block",
  33801. h5: "block",
  33802. h6: "block",
  33803. hgroup: "block",
  33804. nav: "block",
  33805. section: "block",
  33806. dir: "block",
  33807. dd: "block",
  33808. dl: "block",
  33809. dt: "block",
  33810. ol: "block",
  33811. ul: "block",
  33812. li: "list-item",
  33813. table: "table",
  33814. caption: "table-caption",
  33815. colgroup: "table-column-group",
  33816. col: "table-column",
  33817. thead: "table-header-group",
  33818. tbody: "table-row-group",
  33819. tfoot: "table-footer-group",
  33820. tr: "table-row",
  33821. td: "table-cell",
  33822. th: "table-cell",
  33823. fieldset: "block",
  33824. button: "inline-block",
  33825. details: "block",
  33826. summary: "block",
  33827. dialog: "block",
  33828. meter: "inline-block",
  33829. progress: "inline-block",
  33830. object: "inline-block",
  33831. video: "inline-block",
  33832. audio: "inline-block",
  33833. select: "inline-block",
  33834. option: "block",
  33835. optgroup: "block"
  33836. },
  33837. CSS_DISPLAY_DEFAULT: "inline",
  33838. CSS_WHITE_SPACE_TAGS: {
  33839. listing: "pre",
  33840. plaintext: "pre",
  33841. pre: "pre",
  33842. xmp: "pre",
  33843. nobr: "nowrap",
  33844. table: "initial",
  33845. textarea: "pre-wrap"
  33846. },
  33847. CSS_WHITE_SPACE_DEFAULT: "normal"
  33848. };
  33849. }
  33850. });
  33851. var require_is_unknown_namespace = __commonJS2({
  33852. "src/language-html/utils/is-unknown-namespace.js"(exports2, module2) {
  33853. "use strict";
  33854. function isUnknownNamespace(node) {
  33855. return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
  33856. }
  33857. module2.exports = isUnknownNamespace;
  33858. }
  33859. });
  33860. var require_utils11 = __commonJS2({
  33861. "src/language-html/utils/index.js"(exports2, module2) {
  33862. "use strict";
  33863. var {
  33864. inferParserByLanguage,
  33865. isFrontMatterNode
  33866. } = require_util();
  33867. var {
  33868. builders: {
  33869. line,
  33870. hardline,
  33871. join
  33872. },
  33873. utils: {
  33874. getDocParts,
  33875. replaceTextEndOfLine
  33876. }
  33877. } = require("./doc.js");
  33878. var {
  33879. CSS_DISPLAY_TAGS,
  33880. CSS_DISPLAY_DEFAULT,
  33881. CSS_WHITE_SPACE_TAGS,
  33882. CSS_WHITE_SPACE_DEFAULT
  33883. } = require_constants_evaluate2();
  33884. var isUnknownNamespace = require_is_unknown_namespace();
  33885. var HTML_WHITESPACE = /* @__PURE__ */ new Set([" ", "\n", "\f", "\r", " "]);
  33886. var htmlTrimStart = (string) => string.replace(/^[\t\n\f\r ]+/, "");
  33887. var htmlTrimEnd = (string) => string.replace(/[\t\n\f\r ]+$/, "");
  33888. var htmlTrim = (string) => htmlTrimStart(htmlTrimEnd(string));
  33889. var htmlTrimLeadingBlankLines = (string) => string.replace(/^[\t\f\r ]*\n/g, "");
  33890. var htmlTrimPreserveIndentation = (string) => htmlTrimLeadingBlankLines(htmlTrimEnd(string));
  33891. var splitByHtmlWhitespace = (string) => string.split(/[\t\n\f\r ]+/);
  33892. var getLeadingHtmlWhitespace = (string) => string.match(/^[\t\n\f\r ]*/)[0];
  33893. var getLeadingAndTrailingHtmlWhitespace = (string) => {
  33894. const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
  33895. return {
  33896. leadingWhitespace,
  33897. trailingWhitespace,
  33898. text
  33899. };
  33900. };
  33901. var hasHtmlWhitespace = (string) => /[\t\n\f\r ]/.test(string);
  33902. function shouldPreserveContent(node, options) {
  33903. if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
  33904. return true;
  33905. }
  33906. if (node.type === "ieConditionalComment" && !node.complete) {
  33907. return true;
  33908. }
  33909. if (isPreLikeNode(node) && node.children.some((child) => child.type !== "text" && child.type !== "interpolation")) {
  33910. return true;
  33911. }
  33912. if (isVueNonHtmlBlock(node, options) && !isScriptLikeTag(node) && node.type !== "interpolation") {
  33913. return true;
  33914. }
  33915. return false;
  33916. }
  33917. function hasPrettierIgnore(node) {
  33918. if (node.type === "attribute") {
  33919. return false;
  33920. }
  33921. if (!node.parent) {
  33922. return false;
  33923. }
  33924. if (!node.prev) {
  33925. return false;
  33926. }
  33927. return isPrettierIgnore(node.prev);
  33928. }
  33929. function isPrettierIgnore(node) {
  33930. return node.type === "comment" && node.value.trim() === "prettier-ignore";
  33931. }
  33932. function isTextLikeNode(node) {
  33933. return node.type === "text" || node.type === "comment";
  33934. }
  33935. function isScriptLikeTag(node) {
  33936. return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
  33937. }
  33938. function canHaveInterpolation(node) {
  33939. return node.children && !isScriptLikeTag(node);
  33940. }
  33941. function isWhitespaceSensitiveNode(node) {
  33942. return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
  33943. }
  33944. function isIndentationSensitiveNode(node) {
  33945. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  33946. }
  33947. function isLeadingSpaceSensitiveNode(node, options) {
  33948. const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
  33949. if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
  33950. return node.type === "interpolation";
  33951. }
  33952. return isLeadingSpaceSensitive;
  33953. function _isLeadingSpaceSensitiveNode() {
  33954. if (isFrontMatterNode(node)) {
  33955. return false;
  33956. }
  33957. if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
  33958. return true;
  33959. }
  33960. if (!node.parent || node.parent.cssDisplay === "none") {
  33961. return false;
  33962. }
  33963. if (isPreLikeNode(node.parent)) {
  33964. return true;
  33965. }
  33966. if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  33967. return false;
  33968. }
  33969. if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
  33970. return false;
  33971. }
  33972. return true;
  33973. }
  33974. }
  33975. function isTrailingSpaceSensitiveNode(node, options) {
  33976. if (isFrontMatterNode(node)) {
  33977. return false;
  33978. }
  33979. if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
  33980. return true;
  33981. }
  33982. if (!node.parent || node.parent.cssDisplay === "none") {
  33983. return false;
  33984. }
  33985. if (isPreLikeNode(node.parent)) {
  33986. return true;
  33987. }
  33988. if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  33989. return false;
  33990. }
  33991. if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
  33992. return false;
  33993. }
  33994. return true;
  33995. }
  33996. function isDanglingSpaceSensitiveNode(node) {
  33997. return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
  33998. }
  33999. function forceNextEmptyLine(node) {
  34000. return isFrontMatterNode(node) || node.next && node.sourceSpan.end && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
  34001. }
  34002. function forceBreakContent(node) {
  34003. return forceBreakChildren(node) || node.type === "element" && node.children.length > 0 && (["body", "script", "style"].includes(node.name) || node.children.some((child) => hasNonTextChild(child))) || node.firstChild && node.firstChild === node.lastChild && node.firstChild.type !== "text" && hasLeadingLineBreak(node.firstChild) && (!node.lastChild.isTrailingSpaceSensitive || hasTrailingLineBreak(node.lastChild));
  34004. }
  34005. function forceBreakChildren(node) {
  34006. return node.type === "element" && node.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
  34007. }
  34008. function preferHardlineAsLeadingSpaces(node) {
  34009. return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
  34010. }
  34011. function preferHardlineAsTrailingSpaces(node) {
  34012. return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
  34013. }
  34014. function hasSurroundingLineBreak(node) {
  34015. return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
  34016. }
  34017. function hasLeadingLineBreak(node) {
  34018. return node.hasLeadingSpaces && (node.prev ? node.prev.sourceSpan.end.line < node.sourceSpan.start.line : node.parent.type === "root" || node.parent.startSourceSpan.end.line < node.sourceSpan.start.line);
  34019. }
  34020. function hasTrailingLineBreak(node) {
  34021. return node.hasTrailingSpaces && (node.next ? node.next.sourceSpan.start.line > node.sourceSpan.end.line : node.parent.type === "root" || node.parent.endSourceSpan && node.parent.endSourceSpan.start.line > node.sourceSpan.end.line);
  34022. }
  34023. function preferHardlineAsSurroundingSpaces(node) {
  34024. switch (node.type) {
  34025. case "ieConditionalComment":
  34026. case "comment":
  34027. case "directive":
  34028. return true;
  34029. case "element":
  34030. return ["script", "select"].includes(node.name);
  34031. }
  34032. return false;
  34033. }
  34034. function getLastDescendant(node) {
  34035. return node.lastChild ? getLastDescendant(node.lastChild) : node;
  34036. }
  34037. function hasNonTextChild(node) {
  34038. return node.children && node.children.some((child) => child.type !== "text");
  34039. }
  34040. function _inferScriptParser(node) {
  34041. const {
  34042. type,
  34043. lang
  34044. } = node.attrMap;
  34045. if (type === "module" || type === "text/javascript" || type === "text/babel" || type === "application/javascript" || lang === "jsx") {
  34046. return "babel";
  34047. }
  34048. if (type === "application/x-typescript" || lang === "ts" || lang === "tsx") {
  34049. return "typescript";
  34050. }
  34051. if (type === "text/markdown") {
  34052. return "markdown";
  34053. }
  34054. if (type === "text/html") {
  34055. return "html";
  34056. }
  34057. if (type && (type.endsWith("json") || type.endsWith("importmap")) || type === "speculationrules") {
  34058. return "json";
  34059. }
  34060. if (type === "text/x-handlebars-template") {
  34061. return "glimmer";
  34062. }
  34063. }
  34064. function inferStyleParser(node, options) {
  34065. const {
  34066. lang
  34067. } = node.attrMap;
  34068. if (!lang || lang === "postcss" || lang === "css") {
  34069. return "css";
  34070. }
  34071. if (lang === "scss") {
  34072. return "scss";
  34073. }
  34074. if (lang === "less") {
  34075. return "less";
  34076. }
  34077. if (lang === "stylus") {
  34078. return inferParserByLanguage("stylus", options);
  34079. }
  34080. }
  34081. function inferScriptParser(node, options) {
  34082. if (node.name === "script" && !node.attrMap.src) {
  34083. if (!node.attrMap.lang && !node.attrMap.type) {
  34084. return "babel";
  34085. }
  34086. return _inferScriptParser(node);
  34087. }
  34088. if (node.name === "style") {
  34089. return inferStyleParser(node, options);
  34090. }
  34091. if (options && isVueNonHtmlBlock(node, options)) {
  34092. return _inferScriptParser(node) || !("src" in node.attrMap) && inferParserByLanguage(node.attrMap.lang, options);
  34093. }
  34094. }
  34095. function isBlockLikeCssDisplay(cssDisplay) {
  34096. return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
  34097. }
  34098. function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  34099. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34100. }
  34101. function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  34102. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34103. }
  34104. function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  34105. return !isBlockLikeCssDisplay(cssDisplay);
  34106. }
  34107. function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  34108. return !isBlockLikeCssDisplay(cssDisplay);
  34109. }
  34110. function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
  34111. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34112. }
  34113. function isPreLikeNode(node) {
  34114. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  34115. }
  34116. function countParents(path, predicate) {
  34117. let counter = 0;
  34118. for (let i = path.stack.length - 1; i >= 0; i--) {
  34119. const value = path.stack[i];
  34120. if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
  34121. counter++;
  34122. }
  34123. }
  34124. return counter;
  34125. }
  34126. function hasParent(node, fn) {
  34127. let current = node;
  34128. while (current) {
  34129. if (fn(current)) {
  34130. return true;
  34131. }
  34132. current = current.parent;
  34133. }
  34134. return false;
  34135. }
  34136. function getNodeCssStyleDisplay(node, options) {
  34137. if (node.prev && node.prev.type === "comment") {
  34138. const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
  34139. if (match) {
  34140. return match[1];
  34141. }
  34142. }
  34143. let isInSvgForeignObject = false;
  34144. if (node.type === "element" && node.namespace === "svg") {
  34145. if (hasParent(node, (parent) => parent.fullName === "svg:foreignObject")) {
  34146. isInSvgForeignObject = true;
  34147. } else {
  34148. return node.name === "svg" ? "inline-block" : "block";
  34149. }
  34150. }
  34151. switch (options.htmlWhitespaceSensitivity) {
  34152. case "strict":
  34153. return "inline";
  34154. case "ignore":
  34155. return "block";
  34156. default: {
  34157. if (options.parser === "vue" && node.parent && node.parent.type === "root") {
  34158. return "block";
  34159. }
  34160. return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
  34161. }
  34162. }
  34163. }
  34164. function getNodeCssStyleWhiteSpace(node) {
  34165. return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
  34166. }
  34167. function getMinIndentation(text) {
  34168. let minIndentation = Number.POSITIVE_INFINITY;
  34169. for (const lineText of text.split("\n")) {
  34170. if (lineText.length === 0) {
  34171. continue;
  34172. }
  34173. if (!HTML_WHITESPACE.has(lineText[0])) {
  34174. return 0;
  34175. }
  34176. const indentation = getLeadingHtmlWhitespace(lineText).length;
  34177. if (lineText.length === indentation) {
  34178. continue;
  34179. }
  34180. if (indentation < minIndentation) {
  34181. minIndentation = indentation;
  34182. }
  34183. }
  34184. return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
  34185. }
  34186. function dedentString(text, minIndent = getMinIndentation(text)) {
  34187. return minIndent === 0 ? text : text.split("\n").map((lineText) => lineText.slice(minIndent)).join("\n");
  34188. }
  34189. function countChars(text, char) {
  34190. let counter = 0;
  34191. for (let i = 0; i < text.length; i++) {
  34192. if (text[i] === char) {
  34193. counter++;
  34194. }
  34195. }
  34196. return counter;
  34197. }
  34198. function unescapeQuoteEntities(text) {
  34199. return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  34200. }
  34201. var vueRootElementsSet = /* @__PURE__ */ new Set(["template", "style", "script"]);
  34202. function isVueCustomBlock(node, options) {
  34203. return isVueSfcBlock(node, options) && !vueRootElementsSet.has(node.fullName);
  34204. }
  34205. function isVueSfcBlock(node, options) {
  34206. return options.parser === "vue" && node.type === "element" && node.parent.type === "root" && node.fullName.toLowerCase() !== "html";
  34207. }
  34208. function isVueNonHtmlBlock(node, options) {
  34209. return isVueSfcBlock(node, options) && (isVueCustomBlock(node, options) || node.attrMap.lang && node.attrMap.lang !== "html");
  34210. }
  34211. function isVueSlotAttribute(attribute) {
  34212. const attributeName = attribute.fullName;
  34213. return attributeName.charAt(0) === "#" || attributeName === "slot-scope" || attributeName === "v-slot" || attributeName.startsWith("v-slot:");
  34214. }
  34215. function isVueSfcBindingsAttribute(attribute, options) {
  34216. const element = attribute.parent;
  34217. if (!isVueSfcBlock(element, options)) {
  34218. return false;
  34219. }
  34220. const tagName = element.fullName;
  34221. const attributeName = attribute.fullName;
  34222. return tagName === "script" && attributeName === "setup" || tagName === "style" && attributeName === "vars";
  34223. }
  34224. function getTextValueParts(node, value = node.value) {
  34225. return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceTextEndOfLine(value) : replaceTextEndOfLine(dedentString(htmlTrimPreserveIndentation(value)), hardline) : getDocParts(join(line, splitByHtmlWhitespace(value)));
  34226. }
  34227. function isVueScriptTag(node, options) {
  34228. return isVueSfcBlock(node, options) && node.name === "script";
  34229. }
  34230. module2.exports = {
  34231. htmlTrim,
  34232. htmlTrimPreserveIndentation,
  34233. hasHtmlWhitespace,
  34234. getLeadingAndTrailingHtmlWhitespace,
  34235. canHaveInterpolation,
  34236. countChars,
  34237. countParents,
  34238. dedentString,
  34239. forceBreakChildren,
  34240. forceBreakContent,
  34241. forceNextEmptyLine,
  34242. getLastDescendant,
  34243. getNodeCssStyleDisplay,
  34244. getNodeCssStyleWhiteSpace,
  34245. hasPrettierIgnore,
  34246. inferScriptParser,
  34247. isVueCustomBlock,
  34248. isVueNonHtmlBlock,
  34249. isVueScriptTag,
  34250. isVueSlotAttribute,
  34251. isVueSfcBindingsAttribute,
  34252. isVueSfcBlock,
  34253. isDanglingSpaceSensitiveNode,
  34254. isIndentationSensitiveNode,
  34255. isLeadingSpaceSensitiveNode,
  34256. isPreLikeNode,
  34257. isScriptLikeTag,
  34258. isTextLikeNode,
  34259. isTrailingSpaceSensitiveNode,
  34260. isWhitespaceSensitiveNode,
  34261. isUnknownNamespace,
  34262. preferHardlineAsLeadingSpaces,
  34263. preferHardlineAsTrailingSpaces,
  34264. shouldPreserveContent,
  34265. unescapeQuoteEntities,
  34266. getTextValueParts
  34267. };
  34268. }
  34269. });
  34270. var require_chars = __commonJS2({
  34271. "node_modules/angular-html-parser/lib/compiler/src/chars.js"(exports2) {
  34272. "use strict";
  34273. Object.defineProperty(exports2, "__esModule", {
  34274. value: true
  34275. });
  34276. exports2.$EOF = 0;
  34277. exports2.$BSPACE = 8;
  34278. exports2.$TAB = 9;
  34279. exports2.$LF = 10;
  34280. exports2.$VTAB = 11;
  34281. exports2.$FF = 12;
  34282. exports2.$CR = 13;
  34283. exports2.$SPACE = 32;
  34284. exports2.$BANG = 33;
  34285. exports2.$DQ = 34;
  34286. exports2.$HASH = 35;
  34287. exports2.$$ = 36;
  34288. exports2.$PERCENT = 37;
  34289. exports2.$AMPERSAND = 38;
  34290. exports2.$SQ = 39;
  34291. exports2.$LPAREN = 40;
  34292. exports2.$RPAREN = 41;
  34293. exports2.$STAR = 42;
  34294. exports2.$PLUS = 43;
  34295. exports2.$COMMA = 44;
  34296. exports2.$MINUS = 45;
  34297. exports2.$PERIOD = 46;
  34298. exports2.$SLASH = 47;
  34299. exports2.$COLON = 58;
  34300. exports2.$SEMICOLON = 59;
  34301. exports2.$LT = 60;
  34302. exports2.$EQ = 61;
  34303. exports2.$GT = 62;
  34304. exports2.$QUESTION = 63;
  34305. exports2.$0 = 48;
  34306. exports2.$7 = 55;
  34307. exports2.$9 = 57;
  34308. exports2.$A = 65;
  34309. exports2.$E = 69;
  34310. exports2.$F = 70;
  34311. exports2.$X = 88;
  34312. exports2.$Z = 90;
  34313. exports2.$LBRACKET = 91;
  34314. exports2.$BACKSLASH = 92;
  34315. exports2.$RBRACKET = 93;
  34316. exports2.$CARET = 94;
  34317. exports2.$_ = 95;
  34318. exports2.$a = 97;
  34319. exports2.$b = 98;
  34320. exports2.$e = 101;
  34321. exports2.$f = 102;
  34322. exports2.$n = 110;
  34323. exports2.$r = 114;
  34324. exports2.$t = 116;
  34325. exports2.$u = 117;
  34326. exports2.$v = 118;
  34327. exports2.$x = 120;
  34328. exports2.$z = 122;
  34329. exports2.$LBRACE = 123;
  34330. exports2.$BAR = 124;
  34331. exports2.$RBRACE = 125;
  34332. exports2.$NBSP = 160;
  34333. exports2.$PIPE = 124;
  34334. exports2.$TILDA = 126;
  34335. exports2.$AT = 64;
  34336. exports2.$BT = 96;
  34337. function isWhitespace(code) {
  34338. return code >= exports2.$TAB && code <= exports2.$SPACE || code == exports2.$NBSP;
  34339. }
  34340. exports2.isWhitespace = isWhitespace;
  34341. function isDigit(code) {
  34342. return exports2.$0 <= code && code <= exports2.$9;
  34343. }
  34344. exports2.isDigit = isDigit;
  34345. function isAsciiLetter(code) {
  34346. return code >= exports2.$a && code <= exports2.$z || code >= exports2.$A && code <= exports2.$Z;
  34347. }
  34348. exports2.isAsciiLetter = isAsciiLetter;
  34349. function isAsciiHexDigit(code) {
  34350. return code >= exports2.$a && code <= exports2.$f || code >= exports2.$A && code <= exports2.$F || isDigit(code);
  34351. }
  34352. exports2.isAsciiHexDigit = isAsciiHexDigit;
  34353. function isNewLine(code) {
  34354. return code === exports2.$LF || code === exports2.$CR;
  34355. }
  34356. exports2.isNewLine = isNewLine;
  34357. function isOctalDigit(code) {
  34358. return exports2.$0 <= code && code <= exports2.$7;
  34359. }
  34360. exports2.isOctalDigit = isOctalDigit;
  34361. }
  34362. });
  34363. var require_static_symbol = __commonJS2({
  34364. "node_modules/angular-html-parser/lib/compiler/src/aot/static_symbol.js"(exports2) {
  34365. "use strict";
  34366. Object.defineProperty(exports2, "__esModule", {
  34367. value: true
  34368. });
  34369. var StaticSymbol = class {
  34370. constructor(filePath, name, members) {
  34371. this.filePath = filePath;
  34372. this.name = name;
  34373. this.members = members;
  34374. }
  34375. assertNoMembers() {
  34376. if (this.members.length) {
  34377. throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`);
  34378. }
  34379. }
  34380. };
  34381. exports2.StaticSymbol = StaticSymbol;
  34382. var StaticSymbolCache = class {
  34383. constructor() {
  34384. this.cache = /* @__PURE__ */ new Map();
  34385. }
  34386. get(declarationFile, name, members) {
  34387. members = members || [];
  34388. const memberSuffix = members.length ? `.${members.join(".")}` : "";
  34389. const key = `"${declarationFile}".${name}${memberSuffix}`;
  34390. let result = this.cache.get(key);
  34391. if (!result) {
  34392. result = new StaticSymbol(declarationFile, name, members);
  34393. this.cache.set(key, result);
  34394. }
  34395. return result;
  34396. }
  34397. };
  34398. exports2.StaticSymbolCache = StaticSymbolCache;
  34399. }
  34400. });
  34401. var require_util3 = __commonJS2({
  34402. "node_modules/angular-html-parser/lib/compiler/src/util.js"(exports2) {
  34403. "use strict";
  34404. Object.defineProperty(exports2, "__esModule", {
  34405. value: true
  34406. });
  34407. var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
  34408. function dashCaseToCamelCase(input) {
  34409. return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
  34410. }
  34411. exports2.dashCaseToCamelCase = dashCaseToCamelCase;
  34412. function splitAtColon(input, defaultValues) {
  34413. return _splitAt(input, ":", defaultValues);
  34414. }
  34415. exports2.splitAtColon = splitAtColon;
  34416. function splitAtPeriod(input, defaultValues) {
  34417. return _splitAt(input, ".", defaultValues);
  34418. }
  34419. exports2.splitAtPeriod = splitAtPeriod;
  34420. function _splitAt(input, character, defaultValues) {
  34421. const characterIndex = input.indexOf(character);
  34422. if (characterIndex == -1)
  34423. return defaultValues;
  34424. return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
  34425. }
  34426. function visitValue(value, visitor, context) {
  34427. if (Array.isArray(value)) {
  34428. return visitor.visitArray(value, context);
  34429. }
  34430. if (isStrictStringMap(value)) {
  34431. return visitor.visitStringMap(value, context);
  34432. }
  34433. if (value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean") {
  34434. return visitor.visitPrimitive(value, context);
  34435. }
  34436. return visitor.visitOther(value, context);
  34437. }
  34438. exports2.visitValue = visitValue;
  34439. function isDefined(val) {
  34440. return val !== null && val !== void 0;
  34441. }
  34442. exports2.isDefined = isDefined;
  34443. function noUndefined(val) {
  34444. return val === void 0 ? null : val;
  34445. }
  34446. exports2.noUndefined = noUndefined;
  34447. var ValueTransformer = class {
  34448. visitArray(arr, context) {
  34449. return arr.map((value) => visitValue(value, this, context));
  34450. }
  34451. visitStringMap(map, context) {
  34452. const result = {};
  34453. Object.keys(map).forEach((key) => {
  34454. result[key] = visitValue(map[key], this, context);
  34455. });
  34456. return result;
  34457. }
  34458. visitPrimitive(value, context) {
  34459. return value;
  34460. }
  34461. visitOther(value, context) {
  34462. return value;
  34463. }
  34464. };
  34465. exports2.ValueTransformer = ValueTransformer;
  34466. exports2.SyncAsync = {
  34467. assertSync: (value) => {
  34468. if (isPromise(value)) {
  34469. throw new Error(`Illegal state: value cannot be a promise`);
  34470. }
  34471. return value;
  34472. },
  34473. then: (value, cb) => {
  34474. return isPromise(value) ? value.then(cb) : cb(value);
  34475. },
  34476. all: (syncAsyncValues) => {
  34477. return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
  34478. }
  34479. };
  34480. function error(msg) {
  34481. throw new Error(`Internal Error: ${msg}`);
  34482. }
  34483. exports2.error = error;
  34484. function syntaxError(msg, parseErrors) {
  34485. const error2 = Error(msg);
  34486. error2[ERROR_SYNTAX_ERROR] = true;
  34487. if (parseErrors)
  34488. error2[ERROR_PARSE_ERRORS] = parseErrors;
  34489. return error2;
  34490. }
  34491. exports2.syntaxError = syntaxError;
  34492. var ERROR_SYNTAX_ERROR = "ngSyntaxError";
  34493. var ERROR_PARSE_ERRORS = "ngParseErrors";
  34494. function isSyntaxError(error2) {
  34495. return error2[ERROR_SYNTAX_ERROR];
  34496. }
  34497. exports2.isSyntaxError = isSyntaxError;
  34498. function getParseErrors(error2) {
  34499. return error2[ERROR_PARSE_ERRORS] || [];
  34500. }
  34501. exports2.getParseErrors = getParseErrors;
  34502. function escapeRegExp(s) {
  34503. return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
  34504. }
  34505. exports2.escapeRegExp = escapeRegExp;
  34506. var STRING_MAP_PROTO = Object.getPrototypeOf({});
  34507. function isStrictStringMap(obj) {
  34508. return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
  34509. }
  34510. function utf8Encode(str) {
  34511. let encoded = "";
  34512. for (let index = 0; index < str.length; index++) {
  34513. let codePoint = str.charCodeAt(index);
  34514. if (codePoint >= 55296 && codePoint <= 56319 && str.length > index + 1) {
  34515. const low = str.charCodeAt(index + 1);
  34516. if (low >= 56320 && low <= 57343) {
  34517. index++;
  34518. codePoint = (codePoint - 55296 << 10) + low - 56320 + 65536;
  34519. }
  34520. }
  34521. if (codePoint <= 127) {
  34522. encoded += String.fromCharCode(codePoint);
  34523. } else if (codePoint <= 2047) {
  34524. encoded += String.fromCharCode(codePoint >> 6 & 31 | 192, codePoint & 63 | 128);
  34525. } else if (codePoint <= 65535) {
  34526. encoded += String.fromCharCode(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  34527. } else if (codePoint <= 2097151) {
  34528. encoded += String.fromCharCode(codePoint >> 18 & 7 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  34529. }
  34530. }
  34531. return encoded;
  34532. }
  34533. exports2.utf8Encode = utf8Encode;
  34534. function stringify(token) {
  34535. if (typeof token === "string") {
  34536. return token;
  34537. }
  34538. if (token instanceof Array) {
  34539. return "[" + token.map(stringify).join(", ") + "]";
  34540. }
  34541. if (token == null) {
  34542. return "" + token;
  34543. }
  34544. if (token.overriddenName) {
  34545. return `${token.overriddenName}`;
  34546. }
  34547. if (token.name) {
  34548. return `${token.name}`;
  34549. }
  34550. if (!token.toString) {
  34551. return "object";
  34552. }
  34553. const res = token.toString();
  34554. if (res == null) {
  34555. return "" + res;
  34556. }
  34557. const newLineIndex = res.indexOf("\n");
  34558. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  34559. }
  34560. exports2.stringify = stringify;
  34561. function resolveForwardRef(type) {
  34562. if (typeof type === "function" && type.hasOwnProperty("__forward_ref__")) {
  34563. return type();
  34564. } else {
  34565. return type;
  34566. }
  34567. }
  34568. exports2.resolveForwardRef = resolveForwardRef;
  34569. function isPromise(obj) {
  34570. return !!obj && typeof obj.then === "function";
  34571. }
  34572. exports2.isPromise = isPromise;
  34573. var Version = class {
  34574. constructor(full) {
  34575. this.full = full;
  34576. const splits = full.split(".");
  34577. this.major = splits[0];
  34578. this.minor = splits[1];
  34579. this.patch = splits.slice(2).join(".");
  34580. }
  34581. };
  34582. exports2.Version = Version;
  34583. var __window = typeof window !== "undefined" && window;
  34584. var __self = typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self;
  34585. var __global = typeof global !== "undefined" && global;
  34586. var _global = __global || __window || __self;
  34587. exports2.global = _global;
  34588. }
  34589. });
  34590. var require_compile_metadata = __commonJS2({
  34591. "node_modules/angular-html-parser/lib/compiler/src/compile_metadata.js"(exports2) {
  34592. "use strict";
  34593. Object.defineProperty(exports2, "__esModule", {
  34594. value: true
  34595. });
  34596. var static_symbol_1 = require_static_symbol();
  34597. var util_1 = require_util3();
  34598. var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  34599. function sanitizeIdentifier(name) {
  34600. return name.replace(/\W/g, "_");
  34601. }
  34602. exports2.sanitizeIdentifier = sanitizeIdentifier;
  34603. var _anonymousTypeIndex = 0;
  34604. function identifierName(compileIdentifier) {
  34605. if (!compileIdentifier || !compileIdentifier.reference) {
  34606. return null;
  34607. }
  34608. const ref = compileIdentifier.reference;
  34609. if (ref instanceof static_symbol_1.StaticSymbol) {
  34610. return ref.name;
  34611. }
  34612. if (ref["__anonymousType"]) {
  34613. return ref["__anonymousType"];
  34614. }
  34615. let identifier = util_1.stringify(ref);
  34616. if (identifier.indexOf("(") >= 0) {
  34617. identifier = `anonymous_${_anonymousTypeIndex++}`;
  34618. ref["__anonymousType"] = identifier;
  34619. } else {
  34620. identifier = sanitizeIdentifier(identifier);
  34621. }
  34622. return identifier;
  34623. }
  34624. exports2.identifierName = identifierName;
  34625. function identifierModuleUrl(compileIdentifier) {
  34626. const ref = compileIdentifier.reference;
  34627. if (ref instanceof static_symbol_1.StaticSymbol) {
  34628. return ref.filePath;
  34629. }
  34630. return `./${util_1.stringify(ref)}`;
  34631. }
  34632. exports2.identifierModuleUrl = identifierModuleUrl;
  34633. function viewClassName(compType, embeddedTemplateIndex) {
  34634. return `View_${identifierName({
  34635. reference: compType
  34636. })}_${embeddedTemplateIndex}`;
  34637. }
  34638. exports2.viewClassName = viewClassName;
  34639. function rendererTypeName(compType) {
  34640. return `RenderType_${identifierName({
  34641. reference: compType
  34642. })}`;
  34643. }
  34644. exports2.rendererTypeName = rendererTypeName;
  34645. function hostViewClassName(compType) {
  34646. return `HostView_${identifierName({
  34647. reference: compType
  34648. })}`;
  34649. }
  34650. exports2.hostViewClassName = hostViewClassName;
  34651. function componentFactoryName(compType) {
  34652. return `${identifierName({
  34653. reference: compType
  34654. })}NgFactory`;
  34655. }
  34656. exports2.componentFactoryName = componentFactoryName;
  34657. var CompileSummaryKind;
  34658. (function(CompileSummaryKind2) {
  34659. CompileSummaryKind2[CompileSummaryKind2["Pipe"] = 0] = "Pipe";
  34660. CompileSummaryKind2[CompileSummaryKind2["Directive"] = 1] = "Directive";
  34661. CompileSummaryKind2[CompileSummaryKind2["NgModule"] = 2] = "NgModule";
  34662. CompileSummaryKind2[CompileSummaryKind2["Injectable"] = 3] = "Injectable";
  34663. })(CompileSummaryKind = exports2.CompileSummaryKind || (exports2.CompileSummaryKind = {}));
  34664. function tokenName(token) {
  34665. return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
  34666. }
  34667. exports2.tokenName = tokenName;
  34668. function tokenReference(token) {
  34669. if (token.identifier != null) {
  34670. return token.identifier.reference;
  34671. } else {
  34672. return token.value;
  34673. }
  34674. }
  34675. exports2.tokenReference = tokenReference;
  34676. var CompileStylesheetMetadata = class {
  34677. constructor({
  34678. moduleUrl,
  34679. styles,
  34680. styleUrls
  34681. } = {}) {
  34682. this.moduleUrl = moduleUrl || null;
  34683. this.styles = _normalizeArray(styles);
  34684. this.styleUrls = _normalizeArray(styleUrls);
  34685. }
  34686. };
  34687. exports2.CompileStylesheetMetadata = CompileStylesheetMetadata;
  34688. var CompileTemplateMetadata = class {
  34689. constructor({
  34690. encapsulation,
  34691. template,
  34692. templateUrl,
  34693. htmlAst,
  34694. styles,
  34695. styleUrls,
  34696. externalStylesheets,
  34697. animations,
  34698. ngContentSelectors,
  34699. interpolation,
  34700. isInline,
  34701. preserveWhitespaces
  34702. }) {
  34703. this.encapsulation = encapsulation;
  34704. this.template = template;
  34705. this.templateUrl = templateUrl;
  34706. this.htmlAst = htmlAst;
  34707. this.styles = _normalizeArray(styles);
  34708. this.styleUrls = _normalizeArray(styleUrls);
  34709. this.externalStylesheets = _normalizeArray(externalStylesheets);
  34710. this.animations = animations ? flatten(animations) : [];
  34711. this.ngContentSelectors = ngContentSelectors || [];
  34712. if (interpolation && interpolation.length != 2) {
  34713. throw new Error(`'interpolation' should have a start and an end symbol.`);
  34714. }
  34715. this.interpolation = interpolation;
  34716. this.isInline = isInline;
  34717. this.preserveWhitespaces = preserveWhitespaces;
  34718. }
  34719. toSummary() {
  34720. return {
  34721. ngContentSelectors: this.ngContentSelectors,
  34722. encapsulation: this.encapsulation,
  34723. styles: this.styles,
  34724. animations: this.animations
  34725. };
  34726. }
  34727. };
  34728. exports2.CompileTemplateMetadata = CompileTemplateMetadata;
  34729. var CompileDirectiveMetadata = class {
  34730. static create({
  34731. isHost,
  34732. type,
  34733. isComponent,
  34734. selector,
  34735. exportAs,
  34736. changeDetection,
  34737. inputs,
  34738. outputs,
  34739. host,
  34740. providers,
  34741. viewProviders,
  34742. queries,
  34743. guards,
  34744. viewQueries,
  34745. entryComponents,
  34746. template,
  34747. componentViewType,
  34748. rendererType,
  34749. componentFactory
  34750. }) {
  34751. const hostListeners = {};
  34752. const hostProperties = {};
  34753. const hostAttributes = {};
  34754. if (host != null) {
  34755. Object.keys(host).forEach((key) => {
  34756. const value = host[key];
  34757. const matches = key.match(HOST_REG_EXP);
  34758. if (matches === null) {
  34759. hostAttributes[key] = value;
  34760. } else if (matches[1] != null) {
  34761. hostProperties[matches[1]] = value;
  34762. } else if (matches[2] != null) {
  34763. hostListeners[matches[2]] = value;
  34764. }
  34765. });
  34766. }
  34767. const inputsMap = {};
  34768. if (inputs != null) {
  34769. inputs.forEach((bindConfig) => {
  34770. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  34771. inputsMap[parts[0]] = parts[1];
  34772. });
  34773. }
  34774. const outputsMap = {};
  34775. if (outputs != null) {
  34776. outputs.forEach((bindConfig) => {
  34777. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  34778. outputsMap[parts[0]] = parts[1];
  34779. });
  34780. }
  34781. return new CompileDirectiveMetadata({
  34782. isHost,
  34783. type,
  34784. isComponent: !!isComponent,
  34785. selector,
  34786. exportAs,
  34787. changeDetection,
  34788. inputs: inputsMap,
  34789. outputs: outputsMap,
  34790. hostListeners,
  34791. hostProperties,
  34792. hostAttributes,
  34793. providers,
  34794. viewProviders,
  34795. queries,
  34796. guards,
  34797. viewQueries,
  34798. entryComponents,
  34799. template,
  34800. componentViewType,
  34801. rendererType,
  34802. componentFactory
  34803. });
  34804. }
  34805. constructor({
  34806. isHost,
  34807. type,
  34808. isComponent,
  34809. selector,
  34810. exportAs,
  34811. changeDetection,
  34812. inputs,
  34813. outputs,
  34814. hostListeners,
  34815. hostProperties,
  34816. hostAttributes,
  34817. providers,
  34818. viewProviders,
  34819. queries,
  34820. guards,
  34821. viewQueries,
  34822. entryComponents,
  34823. template,
  34824. componentViewType,
  34825. rendererType,
  34826. componentFactory
  34827. }) {
  34828. this.isHost = !!isHost;
  34829. this.type = type;
  34830. this.isComponent = isComponent;
  34831. this.selector = selector;
  34832. this.exportAs = exportAs;
  34833. this.changeDetection = changeDetection;
  34834. this.inputs = inputs;
  34835. this.outputs = outputs;
  34836. this.hostListeners = hostListeners;
  34837. this.hostProperties = hostProperties;
  34838. this.hostAttributes = hostAttributes;
  34839. this.providers = _normalizeArray(providers);
  34840. this.viewProviders = _normalizeArray(viewProviders);
  34841. this.queries = _normalizeArray(queries);
  34842. this.guards = guards;
  34843. this.viewQueries = _normalizeArray(viewQueries);
  34844. this.entryComponents = _normalizeArray(entryComponents);
  34845. this.template = template;
  34846. this.componentViewType = componentViewType;
  34847. this.rendererType = rendererType;
  34848. this.componentFactory = componentFactory;
  34849. }
  34850. toSummary() {
  34851. return {
  34852. summaryKind: CompileSummaryKind.Directive,
  34853. type: this.type,
  34854. isComponent: this.isComponent,
  34855. selector: this.selector,
  34856. exportAs: this.exportAs,
  34857. inputs: this.inputs,
  34858. outputs: this.outputs,
  34859. hostListeners: this.hostListeners,
  34860. hostProperties: this.hostProperties,
  34861. hostAttributes: this.hostAttributes,
  34862. providers: this.providers,
  34863. viewProviders: this.viewProviders,
  34864. queries: this.queries,
  34865. guards: this.guards,
  34866. viewQueries: this.viewQueries,
  34867. entryComponents: this.entryComponents,
  34868. changeDetection: this.changeDetection,
  34869. template: this.template && this.template.toSummary(),
  34870. componentViewType: this.componentViewType,
  34871. rendererType: this.rendererType,
  34872. componentFactory: this.componentFactory
  34873. };
  34874. }
  34875. };
  34876. exports2.CompileDirectiveMetadata = CompileDirectiveMetadata;
  34877. var CompilePipeMetadata = class {
  34878. constructor({
  34879. type,
  34880. name,
  34881. pure
  34882. }) {
  34883. this.type = type;
  34884. this.name = name;
  34885. this.pure = !!pure;
  34886. }
  34887. toSummary() {
  34888. return {
  34889. summaryKind: CompileSummaryKind.Pipe,
  34890. type: this.type,
  34891. name: this.name,
  34892. pure: this.pure
  34893. };
  34894. }
  34895. };
  34896. exports2.CompilePipeMetadata = CompilePipeMetadata;
  34897. var CompileShallowModuleMetadata = class {
  34898. };
  34899. exports2.CompileShallowModuleMetadata = CompileShallowModuleMetadata;
  34900. var CompileNgModuleMetadata = class {
  34901. constructor({
  34902. type,
  34903. providers,
  34904. declaredDirectives,
  34905. exportedDirectives,
  34906. declaredPipes,
  34907. exportedPipes,
  34908. entryComponents,
  34909. bootstrapComponents,
  34910. importedModules,
  34911. exportedModules,
  34912. schemas,
  34913. transitiveModule,
  34914. id
  34915. }) {
  34916. this.type = type || null;
  34917. this.declaredDirectives = _normalizeArray(declaredDirectives);
  34918. this.exportedDirectives = _normalizeArray(exportedDirectives);
  34919. this.declaredPipes = _normalizeArray(declaredPipes);
  34920. this.exportedPipes = _normalizeArray(exportedPipes);
  34921. this.providers = _normalizeArray(providers);
  34922. this.entryComponents = _normalizeArray(entryComponents);
  34923. this.bootstrapComponents = _normalizeArray(bootstrapComponents);
  34924. this.importedModules = _normalizeArray(importedModules);
  34925. this.exportedModules = _normalizeArray(exportedModules);
  34926. this.schemas = _normalizeArray(schemas);
  34927. this.id = id || null;
  34928. this.transitiveModule = transitiveModule || null;
  34929. }
  34930. toSummary() {
  34931. const module3 = this.transitiveModule;
  34932. return {
  34933. summaryKind: CompileSummaryKind.NgModule,
  34934. type: this.type,
  34935. entryComponents: module3.entryComponents,
  34936. providers: module3.providers,
  34937. modules: module3.modules,
  34938. exportedDirectives: module3.exportedDirectives,
  34939. exportedPipes: module3.exportedPipes
  34940. };
  34941. }
  34942. };
  34943. exports2.CompileNgModuleMetadata = CompileNgModuleMetadata;
  34944. var TransitiveCompileNgModuleMetadata = class {
  34945. constructor() {
  34946. this.directivesSet = /* @__PURE__ */ new Set();
  34947. this.directives = [];
  34948. this.exportedDirectivesSet = /* @__PURE__ */ new Set();
  34949. this.exportedDirectives = [];
  34950. this.pipesSet = /* @__PURE__ */ new Set();
  34951. this.pipes = [];
  34952. this.exportedPipesSet = /* @__PURE__ */ new Set();
  34953. this.exportedPipes = [];
  34954. this.modulesSet = /* @__PURE__ */ new Set();
  34955. this.modules = [];
  34956. this.entryComponentsSet = /* @__PURE__ */ new Set();
  34957. this.entryComponents = [];
  34958. this.providers = [];
  34959. }
  34960. addProvider(provider, module3) {
  34961. this.providers.push({
  34962. provider,
  34963. module: module3
  34964. });
  34965. }
  34966. addDirective(id) {
  34967. if (!this.directivesSet.has(id.reference)) {
  34968. this.directivesSet.add(id.reference);
  34969. this.directives.push(id);
  34970. }
  34971. }
  34972. addExportedDirective(id) {
  34973. if (!this.exportedDirectivesSet.has(id.reference)) {
  34974. this.exportedDirectivesSet.add(id.reference);
  34975. this.exportedDirectives.push(id);
  34976. }
  34977. }
  34978. addPipe(id) {
  34979. if (!this.pipesSet.has(id.reference)) {
  34980. this.pipesSet.add(id.reference);
  34981. this.pipes.push(id);
  34982. }
  34983. }
  34984. addExportedPipe(id) {
  34985. if (!this.exportedPipesSet.has(id.reference)) {
  34986. this.exportedPipesSet.add(id.reference);
  34987. this.exportedPipes.push(id);
  34988. }
  34989. }
  34990. addModule(id) {
  34991. if (!this.modulesSet.has(id.reference)) {
  34992. this.modulesSet.add(id.reference);
  34993. this.modules.push(id);
  34994. }
  34995. }
  34996. addEntryComponent(ec) {
  34997. if (!this.entryComponentsSet.has(ec.componentType)) {
  34998. this.entryComponentsSet.add(ec.componentType);
  34999. this.entryComponents.push(ec);
  35000. }
  35001. }
  35002. };
  35003. exports2.TransitiveCompileNgModuleMetadata = TransitiveCompileNgModuleMetadata;
  35004. function _normalizeArray(obj) {
  35005. return obj || [];
  35006. }
  35007. var ProviderMeta = class {
  35008. constructor(token, {
  35009. useClass,
  35010. useValue,
  35011. useExisting,
  35012. useFactory,
  35013. deps,
  35014. multi
  35015. }) {
  35016. this.token = token;
  35017. this.useClass = useClass || null;
  35018. this.useValue = useValue;
  35019. this.useExisting = useExisting;
  35020. this.useFactory = useFactory || null;
  35021. this.dependencies = deps || null;
  35022. this.multi = !!multi;
  35023. }
  35024. };
  35025. exports2.ProviderMeta = ProviderMeta;
  35026. function flatten(list) {
  35027. return list.reduce((flat, item) => {
  35028. const flatItem = Array.isArray(item) ? flatten(item) : item;
  35029. return flat.concat(flatItem);
  35030. }, []);
  35031. }
  35032. exports2.flatten = flatten;
  35033. function jitSourceUrl(url) {
  35034. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, "ng:///");
  35035. }
  35036. function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
  35037. let url;
  35038. if (templateMeta.isInline) {
  35039. if (compMeta.type.reference instanceof static_symbol_1.StaticSymbol) {
  35040. url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
  35041. } else {
  35042. url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
  35043. }
  35044. } else {
  35045. url = templateMeta.templateUrl;
  35046. }
  35047. return compMeta.type.reference instanceof static_symbol_1.StaticSymbol ? url : jitSourceUrl(url);
  35048. }
  35049. exports2.templateSourceUrl = templateSourceUrl;
  35050. function sharedStylesheetJitUrl(meta, id) {
  35051. const pathParts = meta.moduleUrl.split(/\/\\/g);
  35052. const baseName = pathParts[pathParts.length - 1];
  35053. return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`);
  35054. }
  35055. exports2.sharedStylesheetJitUrl = sharedStylesheetJitUrl;
  35056. function ngModuleJitUrl(moduleMeta) {
  35057. return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`);
  35058. }
  35059. exports2.ngModuleJitUrl = ngModuleJitUrl;
  35060. function templateJitUrl(ngModuleType, compMeta) {
  35061. return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`);
  35062. }
  35063. exports2.templateJitUrl = templateJitUrl;
  35064. }
  35065. });
  35066. var require_parse_util = __commonJS2({
  35067. "node_modules/angular-html-parser/lib/compiler/src/parse_util.js"(exports2) {
  35068. "use strict";
  35069. Object.defineProperty(exports2, "__esModule", {
  35070. value: true
  35071. });
  35072. var chars = require_chars();
  35073. var compile_metadata_1 = require_compile_metadata();
  35074. var ParseLocation = class {
  35075. constructor(file, offset, line, col) {
  35076. this.file = file;
  35077. this.offset = offset;
  35078. this.line = line;
  35079. this.col = col;
  35080. }
  35081. toString() {
  35082. return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
  35083. }
  35084. moveBy(delta) {
  35085. const source = this.file.content;
  35086. const len = source.length;
  35087. let offset = this.offset;
  35088. let line = this.line;
  35089. let col = this.col;
  35090. while (offset > 0 && delta < 0) {
  35091. offset--;
  35092. delta++;
  35093. const ch = source.charCodeAt(offset);
  35094. if (ch == chars.$LF) {
  35095. line--;
  35096. const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode(chars.$LF));
  35097. col = priorLine > 0 ? offset - priorLine : offset;
  35098. } else {
  35099. col--;
  35100. }
  35101. }
  35102. while (offset < len && delta > 0) {
  35103. const ch = source.charCodeAt(offset);
  35104. offset++;
  35105. delta--;
  35106. if (ch == chars.$LF) {
  35107. line++;
  35108. col = 0;
  35109. } else {
  35110. col++;
  35111. }
  35112. }
  35113. return new ParseLocation(this.file, offset, line, col);
  35114. }
  35115. getContext(maxChars, maxLines) {
  35116. const content = this.file.content;
  35117. let startOffset = this.offset;
  35118. if (startOffset != null) {
  35119. if (startOffset > content.length - 1) {
  35120. startOffset = content.length - 1;
  35121. }
  35122. let endOffset = startOffset;
  35123. let ctxChars = 0;
  35124. let ctxLines = 0;
  35125. while (ctxChars < maxChars && startOffset > 0) {
  35126. startOffset--;
  35127. ctxChars++;
  35128. if (content[startOffset] == "\n") {
  35129. if (++ctxLines == maxLines) {
  35130. break;
  35131. }
  35132. }
  35133. }
  35134. ctxChars = 0;
  35135. ctxLines = 0;
  35136. while (ctxChars < maxChars && endOffset < content.length - 1) {
  35137. endOffset++;
  35138. ctxChars++;
  35139. if (content[endOffset] == "\n") {
  35140. if (++ctxLines == maxLines) {
  35141. break;
  35142. }
  35143. }
  35144. }
  35145. return {
  35146. before: content.substring(startOffset, this.offset),
  35147. after: content.substring(this.offset, endOffset + 1)
  35148. };
  35149. }
  35150. return null;
  35151. }
  35152. };
  35153. exports2.ParseLocation = ParseLocation;
  35154. var ParseSourceFile = class {
  35155. constructor(content, url) {
  35156. this.content = content;
  35157. this.url = url;
  35158. }
  35159. };
  35160. exports2.ParseSourceFile = ParseSourceFile;
  35161. var ParseSourceSpan = class {
  35162. constructor(start, end, details = null) {
  35163. this.start = start;
  35164. this.end = end;
  35165. this.details = details;
  35166. }
  35167. toString() {
  35168. return this.start.file.content.substring(this.start.offset, this.end.offset);
  35169. }
  35170. };
  35171. exports2.ParseSourceSpan = ParseSourceSpan;
  35172. exports2.EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile("", ""), 0, 0, 0);
  35173. exports2.EMPTY_SOURCE_SPAN = new ParseSourceSpan(exports2.EMPTY_PARSE_LOCATION, exports2.EMPTY_PARSE_LOCATION);
  35174. var ParseErrorLevel;
  35175. (function(ParseErrorLevel2) {
  35176. ParseErrorLevel2[ParseErrorLevel2["WARNING"] = 0] = "WARNING";
  35177. ParseErrorLevel2[ParseErrorLevel2["ERROR"] = 1] = "ERROR";
  35178. })(ParseErrorLevel = exports2.ParseErrorLevel || (exports2.ParseErrorLevel = {}));
  35179. var ParseError = class {
  35180. constructor(span, msg, level = ParseErrorLevel.ERROR) {
  35181. this.span = span;
  35182. this.msg = msg;
  35183. this.level = level;
  35184. }
  35185. contextualMessage() {
  35186. const ctx = this.span.start.getContext(100, 3);
  35187. return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
  35188. }
  35189. toString() {
  35190. const details = this.span.details ? `, ${this.span.details}` : "";
  35191. return `${this.contextualMessage()}: ${this.span.start}${details}`;
  35192. }
  35193. };
  35194. exports2.ParseError = ParseError;
  35195. function typeSourceSpan(kind, type) {
  35196. const moduleUrl = compile_metadata_1.identifierModuleUrl(type);
  35197. const sourceFileName = moduleUrl != null ? `in ${kind} ${compile_metadata_1.identifierName(type)} in ${moduleUrl}` : `in ${kind} ${compile_metadata_1.identifierName(type)}`;
  35198. const sourceFile = new ParseSourceFile("", sourceFileName);
  35199. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  35200. }
  35201. exports2.typeSourceSpan = typeSourceSpan;
  35202. function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
  35203. const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
  35204. const sourceFile = new ParseSourceFile("", sourceFileName);
  35205. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  35206. }
  35207. exports2.r3JitTypeSourceSpan = r3JitTypeSourceSpan;
  35208. }
  35209. });
  35210. var require_print_preprocess3 = __commonJS2({
  35211. "src/language-html/print-preprocess.js"(exports2, module2) {
  35212. "use strict";
  35213. var {
  35214. ParseSourceSpan
  35215. } = require_parse_util();
  35216. var {
  35217. htmlTrim,
  35218. getLeadingAndTrailingHtmlWhitespace,
  35219. hasHtmlWhitespace,
  35220. canHaveInterpolation,
  35221. getNodeCssStyleDisplay,
  35222. isDanglingSpaceSensitiveNode,
  35223. isIndentationSensitiveNode,
  35224. isLeadingSpaceSensitiveNode,
  35225. isTrailingSpaceSensitiveNode,
  35226. isWhitespaceSensitiveNode,
  35227. isVueScriptTag
  35228. } = require_utils11();
  35229. var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIfConditionalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText, markTsScript];
  35230. function preprocess(ast, options) {
  35231. for (const fn of PREPROCESS_PIPELINE) {
  35232. fn(ast, options);
  35233. }
  35234. return ast;
  35235. }
  35236. function removeIgnorableFirstLf(ast) {
  35237. ast.walk((node) => {
  35238. if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
  35239. const text = node.children[0];
  35240. if (text.value.length === 1) {
  35241. node.removeChild(text);
  35242. } else {
  35243. text.value = text.value.slice(1);
  35244. }
  35245. }
  35246. });
  35247. }
  35248. function mergeIfConditionalStartEndCommentIntoElementOpeningTag(ast) {
  35249. const isTarget = (node) => node.type === "element" && node.prev && node.prev.type === "ieConditionalStartComment" && node.prev.sourceSpan.end.offset === node.startSourceSpan.start.offset && node.firstChild && node.firstChild.type === "ieConditionalEndComment" && node.firstChild.sourceSpan.start.offset === node.startSourceSpan.end.offset;
  35250. ast.walk((node) => {
  35251. if (node.children) {
  35252. for (let i = 0; i < node.children.length; i++) {
  35253. const child = node.children[i];
  35254. if (!isTarget(child)) {
  35255. continue;
  35256. }
  35257. const ieConditionalStartComment = child.prev;
  35258. const ieConditionalEndComment = child.firstChild;
  35259. node.removeChild(ieConditionalStartComment);
  35260. i--;
  35261. const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
  35262. const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
  35263. child.condition = ieConditionalStartComment.condition;
  35264. child.sourceSpan = sourceSpan;
  35265. child.startSourceSpan = startSourceSpan;
  35266. child.removeChild(ieConditionalEndComment);
  35267. }
  35268. }
  35269. });
  35270. }
  35271. function mergeNodeIntoText(ast, shouldMerge, getValue) {
  35272. ast.walk((node) => {
  35273. if (node.children) {
  35274. for (let i = 0; i < node.children.length; i++) {
  35275. const child = node.children[i];
  35276. if (child.type !== "text" && !shouldMerge(child)) {
  35277. continue;
  35278. }
  35279. if (child.type !== "text") {
  35280. child.type = "text";
  35281. child.value = getValue(child);
  35282. }
  35283. const prevChild = child.prev;
  35284. if (!prevChild || prevChild.type !== "text") {
  35285. continue;
  35286. }
  35287. prevChild.value += child.value;
  35288. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, child.sourceSpan.end);
  35289. node.removeChild(child);
  35290. i--;
  35291. }
  35292. }
  35293. });
  35294. }
  35295. function mergeCdataIntoText(ast) {
  35296. return mergeNodeIntoText(ast, (node) => node.type === "cdata", (node) => `<![CDATA[${node.value}]]>`);
  35297. }
  35298. function mergeSimpleElementIntoText(ast) {
  35299. const isSimpleElement = (node) => node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && !hasHtmlWhitespace(node.children[0].value) && !node.firstChild.hasLeadingSpaces && !node.firstChild.hasTrailingSpaces && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces && node.prev && node.prev.type === "text" && node.next && node.next.type === "text";
  35300. ast.walk((node) => {
  35301. if (node.children) {
  35302. for (let i = 0; i < node.children.length; i++) {
  35303. const child = node.children[i];
  35304. if (!isSimpleElement(child)) {
  35305. continue;
  35306. }
  35307. const prevChild = child.prev;
  35308. const nextChild = child.next;
  35309. prevChild.value += `<${child.rawName}>` + child.firstChild.value + `</${child.rawName}>` + nextChild.value;
  35310. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, nextChild.sourceSpan.end);
  35311. prevChild.isTrailingSpaceSensitive = nextChild.isTrailingSpaceSensitive;
  35312. prevChild.hasTrailingSpaces = nextChild.hasTrailingSpaces;
  35313. node.removeChild(child);
  35314. i--;
  35315. node.removeChild(nextChild);
  35316. }
  35317. }
  35318. });
  35319. }
  35320. function extractInterpolation(ast, options) {
  35321. if (options.parser === "html") {
  35322. return;
  35323. }
  35324. const interpolationRegex = /{{(.+?)}}/s;
  35325. ast.walk((node) => {
  35326. if (!canHaveInterpolation(node)) {
  35327. return;
  35328. }
  35329. for (const child of node.children) {
  35330. if (child.type !== "text") {
  35331. continue;
  35332. }
  35333. let startSourceSpan = child.sourceSpan.start;
  35334. let endSourceSpan = null;
  35335. const components = child.value.split(interpolationRegex);
  35336. for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
  35337. const value = components[i];
  35338. if (i % 2 === 0) {
  35339. endSourceSpan = startSourceSpan.moveBy(value.length);
  35340. if (value.length > 0) {
  35341. node.insertChildBefore(child, {
  35342. type: "text",
  35343. value,
  35344. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
  35345. });
  35346. }
  35347. continue;
  35348. }
  35349. endSourceSpan = startSourceSpan.moveBy(value.length + 4);
  35350. node.insertChildBefore(child, {
  35351. type: "interpolation",
  35352. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
  35353. children: value.length === 0 ? [] : [{
  35354. type: "text",
  35355. value,
  35356. sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
  35357. }]
  35358. });
  35359. }
  35360. node.removeChild(child);
  35361. }
  35362. });
  35363. }
  35364. function extractWhitespaces(ast) {
  35365. ast.walk((node) => {
  35366. if (!node.children) {
  35367. return;
  35368. }
  35369. if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim(node.children[0].value).length === 0) {
  35370. node.hasDanglingSpaces = node.children.length > 0;
  35371. node.children = [];
  35372. return;
  35373. }
  35374. const isWhitespaceSensitive = isWhitespaceSensitiveNode(node);
  35375. const isIndentationSensitive = isIndentationSensitiveNode(node);
  35376. if (!isWhitespaceSensitive) {
  35377. for (let i = 0; i < node.children.length; i++) {
  35378. const child = node.children[i];
  35379. if (child.type !== "text") {
  35380. continue;
  35381. }
  35382. const {
  35383. leadingWhitespace,
  35384. text,
  35385. trailingWhitespace
  35386. } = getLeadingAndTrailingHtmlWhitespace(child.value);
  35387. const prevChild = child.prev;
  35388. const nextChild = child.next;
  35389. if (!text) {
  35390. node.removeChild(child);
  35391. i--;
  35392. if (leadingWhitespace || trailingWhitespace) {
  35393. if (prevChild) {
  35394. prevChild.hasTrailingSpaces = true;
  35395. }
  35396. if (nextChild) {
  35397. nextChild.hasLeadingSpaces = true;
  35398. }
  35399. }
  35400. } else {
  35401. child.value = text;
  35402. child.sourceSpan = new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length));
  35403. if (leadingWhitespace) {
  35404. if (prevChild) {
  35405. prevChild.hasTrailingSpaces = true;
  35406. }
  35407. child.hasLeadingSpaces = true;
  35408. }
  35409. if (trailingWhitespace) {
  35410. child.hasTrailingSpaces = true;
  35411. if (nextChild) {
  35412. nextChild.hasLeadingSpaces = true;
  35413. }
  35414. }
  35415. }
  35416. }
  35417. }
  35418. node.isWhitespaceSensitive = isWhitespaceSensitive;
  35419. node.isIndentationSensitive = isIndentationSensitive;
  35420. });
  35421. }
  35422. function addIsSelfClosing(ast) {
  35423. ast.walk((node) => {
  35424. node.isSelfClosing = !node.children || node.type === "element" && (node.tagDefinition.isVoid || node.startSourceSpan === node.endSourceSpan);
  35425. });
  35426. }
  35427. function addHasHtmComponentClosingTag(ast, options) {
  35428. ast.walk((node) => {
  35429. if (node.type !== "element") {
  35430. return;
  35431. }
  35432. node.hasHtmComponentClosingTag = node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset));
  35433. });
  35434. }
  35435. function addCssDisplay(ast, options) {
  35436. ast.walk((node) => {
  35437. node.cssDisplay = getNodeCssStyleDisplay(node, options);
  35438. });
  35439. }
  35440. function addIsSpaceSensitive(ast, options) {
  35441. ast.walk((node) => {
  35442. const {
  35443. children
  35444. } = node;
  35445. if (!children) {
  35446. return;
  35447. }
  35448. if (children.length === 0) {
  35449. node.isDanglingSpaceSensitive = isDanglingSpaceSensitiveNode(node);
  35450. return;
  35451. }
  35452. for (const child of children) {
  35453. child.isLeadingSpaceSensitive = isLeadingSpaceSensitiveNode(child, options);
  35454. child.isTrailingSpaceSensitive = isTrailingSpaceSensitiveNode(child, options);
  35455. }
  35456. for (let index = 0; index < children.length; index++) {
  35457. const child = children[index];
  35458. child.isLeadingSpaceSensitive = index === 0 ? child.isLeadingSpaceSensitive : child.prev.isTrailingSpaceSensitive && child.isLeadingSpaceSensitive;
  35459. child.isTrailingSpaceSensitive = index === children.length - 1 ? child.isTrailingSpaceSensitive : child.next.isLeadingSpaceSensitive && child.isTrailingSpaceSensitive;
  35460. }
  35461. });
  35462. }
  35463. function markTsScript(ast, options) {
  35464. if (options.parser === "vue") {
  35465. const vueScriptTag = ast.children.find((child) => isVueScriptTag(child, options));
  35466. if (!vueScriptTag) {
  35467. return;
  35468. }
  35469. const {
  35470. lang
  35471. } = vueScriptTag.attrMap;
  35472. if (lang === "ts" || lang === "typescript") {
  35473. options.__should_parse_vue_template_with_ts = true;
  35474. }
  35475. }
  35476. }
  35477. module2.exports = preprocess;
  35478. }
  35479. });
  35480. var require_pragma5 = __commonJS2({
  35481. "src/language-html/pragma.js"(exports2, module2) {
  35482. "use strict";
  35483. function hasPragma(text) {
  35484. return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text);
  35485. }
  35486. function insertPragma(text) {
  35487. return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
  35488. }
  35489. module2.exports = {
  35490. hasPragma,
  35491. insertPragma
  35492. };
  35493. }
  35494. });
  35495. var require_loc6 = __commonJS2({
  35496. "src/language-html/loc.js"(exports2, module2) {
  35497. "use strict";
  35498. function locStart(node) {
  35499. return node.sourceSpan.start.offset;
  35500. }
  35501. function locEnd(node) {
  35502. return node.sourceSpan.end.offset;
  35503. }
  35504. module2.exports = {
  35505. locStart,
  35506. locEnd
  35507. };
  35508. }
  35509. });
  35510. var require_tag = __commonJS2({
  35511. "src/language-html/print/tag.js"(exports2, module2) {
  35512. "use strict";
  35513. var assert = require("assert");
  35514. var {
  35515. isNonEmptyArray
  35516. } = require_util();
  35517. var {
  35518. builders: {
  35519. indent,
  35520. join,
  35521. line,
  35522. softline,
  35523. hardline
  35524. },
  35525. utils: {
  35526. replaceTextEndOfLine
  35527. }
  35528. } = require("./doc.js");
  35529. var {
  35530. locStart,
  35531. locEnd
  35532. } = require_loc6();
  35533. var {
  35534. isTextLikeNode,
  35535. getLastDescendant,
  35536. isPreLikeNode,
  35537. hasPrettierIgnore,
  35538. shouldPreserveContent,
  35539. isVueSfcBlock
  35540. } = require_utils11();
  35541. function printClosingTag(node, options) {
  35542. return [node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)];
  35543. }
  35544. function printClosingTagStart(node, options) {
  35545. return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : [printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)];
  35546. }
  35547. function printClosingTagEnd(node, options) {
  35548. return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : [printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)];
  35549. }
  35550. function printClosingTagPrefix(node, options) {
  35551. return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
  35552. }
  35553. function printClosingTagSuffix(node, options) {
  35554. return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
  35555. }
  35556. function printClosingTagStartMarker(node, options) {
  35557. assert(!node.isSelfClosing);
  35558. if (shouldNotPrintClosingTag(node, options)) {
  35559. return "";
  35560. }
  35561. switch (node.type) {
  35562. case "ieConditionalComment":
  35563. return "<!";
  35564. case "element":
  35565. if (node.hasHtmComponentClosingTag) {
  35566. return "<//";
  35567. }
  35568. default:
  35569. return `</${node.rawName}`;
  35570. }
  35571. }
  35572. function printClosingTagEndMarker(node, options) {
  35573. if (shouldNotPrintClosingTag(node, options)) {
  35574. return "";
  35575. }
  35576. switch (node.type) {
  35577. case "ieConditionalComment":
  35578. case "ieConditionalEndComment":
  35579. return "[endif]-->";
  35580. case "ieConditionalStartComment":
  35581. return "]><!-->";
  35582. case "interpolation":
  35583. return "}}";
  35584. case "element":
  35585. if (node.isSelfClosing) {
  35586. return "/>";
  35587. }
  35588. default:
  35589. return ">";
  35590. }
  35591. }
  35592. function shouldNotPrintClosingTag(node, options) {
  35593. return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore(node) || shouldPreserveContent(node.parent, options));
  35594. }
  35595. function needsToBorrowPrevClosingTagEndMarker(node) {
  35596. return node.prev && node.prev.type !== "docType" && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  35597. }
  35598. function needsToBorrowLastChildClosingTagEndMarker(node) {
  35599. return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild)) && !isPreLikeNode(node);
  35600. }
  35601. function needsToBorrowParentClosingTagStartMarker(node) {
  35602. return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
  35603. }
  35604. function needsToBorrowNextOpeningTagStartMarker(node) {
  35605. return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
  35606. }
  35607. function getPrettierIgnoreAttributeCommentData(value) {
  35608. const match = value.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);
  35609. if (!match) {
  35610. return false;
  35611. }
  35612. if (!match[1]) {
  35613. return true;
  35614. }
  35615. return match[1].split(/\s+/);
  35616. }
  35617. function needsToBorrowParentOpeningTagEndMarker(node) {
  35618. return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  35619. }
  35620. function printAttributes(path, options, print) {
  35621. const node = path.getValue();
  35622. if (!isNonEmptyArray(node.attrs)) {
  35623. return node.isSelfClosing ? " " : "";
  35624. }
  35625. const ignoreAttributeData = node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData(node.prev.value);
  35626. const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? (attribute) => ignoreAttributeData.includes(attribute.rawName) : () => false;
  35627. const printedAttributes = path.map((attributePath) => {
  35628. const attribute = attributePath.getValue();
  35629. return hasPrettierIgnoreAttribute(attribute) ? replaceTextEndOfLine(options.originalText.slice(locStart(attribute), locEnd(attribute))) : print();
  35630. }, "attrs");
  35631. const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
  35632. const shouldPrintAttributePerLine = options.singleAttributePerLine && node.attrs.length > 1 && !isVueSfcBlock(node, options);
  35633. const attributeLine = shouldPrintAttributePerLine ? hardline : line;
  35634. const parts = [indent([forceNotToBreakAttrContent ? " " : line, join(attributeLine, printedAttributes)])];
  35635. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) || node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) || forceNotToBreakAttrContent) {
  35636. parts.push(node.isSelfClosing ? " " : "");
  35637. } else {
  35638. parts.push(options.bracketSameLine ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? line : softline);
  35639. }
  35640. return parts;
  35641. }
  35642. function printOpeningTagEnd(node) {
  35643. return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
  35644. }
  35645. function printOpeningTag(path, options, print) {
  35646. const node = path.getValue();
  35647. return [printOpeningTagStart(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)];
  35648. }
  35649. function printOpeningTagStart(node, options) {
  35650. return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : [printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)];
  35651. }
  35652. function printOpeningTagPrefix(node, options) {
  35653. return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
  35654. }
  35655. function printOpeningTagStartMarker(node) {
  35656. switch (node.type) {
  35657. case "ieConditionalComment":
  35658. case "ieConditionalStartComment":
  35659. return `<!--[if ${node.condition}`;
  35660. case "ieConditionalEndComment":
  35661. return "<!--<!";
  35662. case "interpolation":
  35663. return "{{";
  35664. case "docType":
  35665. return "<!DOCTYPE";
  35666. case "element":
  35667. if (node.condition) {
  35668. return `<!--[if ${node.condition}]><!--><${node.rawName}`;
  35669. }
  35670. default:
  35671. return `<${node.rawName}`;
  35672. }
  35673. }
  35674. function printOpeningTagEndMarker(node) {
  35675. assert(!node.isSelfClosing);
  35676. switch (node.type) {
  35677. case "ieConditionalComment":
  35678. return "]>";
  35679. case "element":
  35680. if (node.condition) {
  35681. return "><!--<![endif]-->";
  35682. }
  35683. default:
  35684. return ">";
  35685. }
  35686. }
  35687. module2.exports = {
  35688. printClosingTag,
  35689. printClosingTagStart,
  35690. printClosingTagStartMarker,
  35691. printClosingTagEndMarker,
  35692. printClosingTagSuffix,
  35693. printClosingTagEnd,
  35694. needsToBorrowLastChildClosingTagEndMarker,
  35695. needsToBorrowParentClosingTagStartMarker,
  35696. needsToBorrowPrevClosingTagEndMarker,
  35697. printOpeningTag,
  35698. printOpeningTagStart,
  35699. printOpeningTagPrefix,
  35700. printOpeningTagStartMarker,
  35701. printOpeningTagEndMarker,
  35702. needsToBorrowNextOpeningTagStartMarker,
  35703. needsToBorrowParentOpeningTagEndMarker
  35704. };
  35705. }
  35706. });
  35707. var require_parse_srcset = __commonJS2({
  35708. "node_modules/parse-srcset/src/parse-srcset.js"(exports2, module2) {
  35709. (function(root, factory) {
  35710. if (typeof define === "function" && define.amd) {
  35711. define([], factory);
  35712. } else if (typeof module2 === "object" && module2.exports) {
  35713. module2.exports = factory();
  35714. } else {
  35715. root.parseSrcset = factory();
  35716. }
  35717. })(exports2, function() {
  35718. return function(input, options) {
  35719. var logger = options && options.logger || console;
  35720. function isSpace(c2) {
  35721. return c2 === " " || c2 === " " || c2 === "\n" || c2 === "\f" || c2 === "\r";
  35722. }
  35723. function collectCharacters(regEx) {
  35724. var chars, match = regEx.exec(input.substring(pos));
  35725. if (match) {
  35726. chars = match[0];
  35727. pos += chars.length;
  35728. return chars;
  35729. }
  35730. }
  35731. var inputLength = input.length, regexLeadingSpaces = /^[ \t\n\r\u000c]+/, regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/, regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/, regexTrailingCommas = /[,]+$/, regexNonNegativeInteger = /^\d+$/, regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/, url, descriptors, currentDescriptor, state, c, pos = 0, candidates = [];
  35732. while (true) {
  35733. collectCharacters(regexLeadingCommasOrSpaces);
  35734. if (pos >= inputLength) {
  35735. return candidates;
  35736. }
  35737. url = collectCharacters(regexLeadingNotSpaces);
  35738. descriptors = [];
  35739. if (url.slice(-1) === ",") {
  35740. url = url.replace(regexTrailingCommas, "");
  35741. parseDescriptors();
  35742. } else {
  35743. tokenize();
  35744. }
  35745. }
  35746. function tokenize() {
  35747. collectCharacters(regexLeadingSpaces);
  35748. currentDescriptor = "";
  35749. state = "in descriptor";
  35750. while (true) {
  35751. c = input.charAt(pos);
  35752. if (state === "in descriptor") {
  35753. if (isSpace(c)) {
  35754. if (currentDescriptor) {
  35755. descriptors.push(currentDescriptor);
  35756. currentDescriptor = "";
  35757. state = "after descriptor";
  35758. }
  35759. } else if (c === ",") {
  35760. pos += 1;
  35761. if (currentDescriptor) {
  35762. descriptors.push(currentDescriptor);
  35763. }
  35764. parseDescriptors();
  35765. return;
  35766. } else if (c === "(") {
  35767. currentDescriptor = currentDescriptor + c;
  35768. state = "in parens";
  35769. } else if (c === "") {
  35770. if (currentDescriptor) {
  35771. descriptors.push(currentDescriptor);
  35772. }
  35773. parseDescriptors();
  35774. return;
  35775. } else {
  35776. currentDescriptor = currentDescriptor + c;
  35777. }
  35778. } else if (state === "in parens") {
  35779. if (c === ")") {
  35780. currentDescriptor = currentDescriptor + c;
  35781. state = "in descriptor";
  35782. } else if (c === "") {
  35783. descriptors.push(currentDescriptor);
  35784. parseDescriptors();
  35785. return;
  35786. } else {
  35787. currentDescriptor = currentDescriptor + c;
  35788. }
  35789. } else if (state === "after descriptor") {
  35790. if (isSpace(c)) {
  35791. } else if (c === "") {
  35792. parseDescriptors();
  35793. return;
  35794. } else {
  35795. state = "in descriptor";
  35796. pos -= 1;
  35797. }
  35798. }
  35799. pos += 1;
  35800. }
  35801. }
  35802. function parseDescriptors() {
  35803. var pError = false, w, d, h, i, candidate = {}, desc, lastChar, value, intVal, floatVal;
  35804. for (i = 0; i < descriptors.length; i++) {
  35805. desc = descriptors[i];
  35806. lastChar = desc[desc.length - 1];
  35807. value = desc.substring(0, desc.length - 1);
  35808. intVal = parseInt(value, 10);
  35809. floatVal = parseFloat(value);
  35810. if (regexNonNegativeInteger.test(value) && lastChar === "w") {
  35811. if (w || d) {
  35812. pError = true;
  35813. }
  35814. if (intVal === 0) {
  35815. pError = true;
  35816. } else {
  35817. w = intVal;
  35818. }
  35819. } else if (regexFloatingPoint.test(value) && lastChar === "x") {
  35820. if (w || d || h) {
  35821. pError = true;
  35822. }
  35823. if (floatVal < 0) {
  35824. pError = true;
  35825. } else {
  35826. d = floatVal;
  35827. }
  35828. } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
  35829. if (h || d) {
  35830. pError = true;
  35831. }
  35832. if (intVal === 0) {
  35833. pError = true;
  35834. } else {
  35835. h = intVal;
  35836. }
  35837. } else {
  35838. pError = true;
  35839. }
  35840. }
  35841. if (!pError) {
  35842. candidate.url = url;
  35843. if (w) {
  35844. candidate.w = w;
  35845. }
  35846. if (d) {
  35847. candidate.d = d;
  35848. }
  35849. if (h) {
  35850. candidate.h = h;
  35851. }
  35852. candidates.push(candidate);
  35853. } else if (logger && logger.error) {
  35854. logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
  35855. }
  35856. }
  35857. };
  35858. });
  35859. }
  35860. });
  35861. var require_syntax_attribute = __commonJS2({
  35862. "src/language-html/syntax-attribute.js"(exports2, module2) {
  35863. "use strict";
  35864. var parseSrcset = require_parse_srcset();
  35865. var {
  35866. builders: {
  35867. ifBreak,
  35868. join,
  35869. line
  35870. }
  35871. } = require("./doc.js");
  35872. function printImgSrcset(value) {
  35873. const srcset = parseSrcset(value, {
  35874. logger: {
  35875. error(message) {
  35876. throw new Error(message);
  35877. }
  35878. }
  35879. });
  35880. const hasW = srcset.some(({
  35881. w
  35882. }) => w);
  35883. const hasH = srcset.some(({
  35884. h
  35885. }) => h);
  35886. const hasX = srcset.some(({
  35887. d
  35888. }) => d);
  35889. if (hasW + hasH + hasX > 1) {
  35890. throw new Error("Mixed descriptor in srcset is not supported");
  35891. }
  35892. const key = hasW ? "w" : hasH ? "h" : "d";
  35893. const unit = hasW ? "w" : hasH ? "h" : "x";
  35894. const getMax = (values) => Math.max(...values);
  35895. const urls = srcset.map((src) => src.url);
  35896. const maxUrlLength = getMax(urls.map((url) => url.length));
  35897. const descriptors = srcset.map((src) => src[key]).map((descriptor) => descriptor ? descriptor.toString() : "");
  35898. const descriptorLeftLengths = descriptors.map((descriptor) => {
  35899. const index = descriptor.indexOf(".");
  35900. return index === -1 ? descriptor.length : index;
  35901. });
  35902. const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
  35903. return join([",", line], urls.map((url, index) => {
  35904. const parts = [url];
  35905. const descriptor = descriptors[index];
  35906. if (descriptor) {
  35907. const urlPadding = maxUrlLength - url.length + 1;
  35908. const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
  35909. const alignment = " ".repeat(urlPadding + descriptorPadding);
  35910. parts.push(ifBreak(alignment, " "), descriptor + unit);
  35911. }
  35912. return parts;
  35913. }));
  35914. }
  35915. function printClassNames(value) {
  35916. return value.trim().split(/\s+/).join(" ");
  35917. }
  35918. module2.exports = {
  35919. printImgSrcset,
  35920. printClassNames
  35921. };
  35922. }
  35923. });
  35924. var require_syntax_vue = __commonJS2({
  35925. "src/language-html/syntax-vue.js"(exports2, module2) {
  35926. "use strict";
  35927. var {
  35928. builders: {
  35929. group
  35930. }
  35931. } = require("./doc.js");
  35932. function printVueFor(value, textToDoc) {
  35933. const {
  35934. left,
  35935. operator,
  35936. right
  35937. } = parseVueFor(value);
  35938. return [group(textToDoc(`function _(${left}) {}`, {
  35939. parser: "babel",
  35940. __isVueForBindingLeft: true
  35941. })), " ", operator, " ", textToDoc(right, {
  35942. parser: "__js_expression"
  35943. }, {
  35944. stripTrailingHardline: true
  35945. })];
  35946. }
  35947. function parseVueFor(value) {
  35948. const forAliasRE = /(.*?)\s+(in|of)\s+(.*)/s;
  35949. const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/;
  35950. const stripParensRE = /^\(|\)$/g;
  35951. const inMatch = value.match(forAliasRE);
  35952. if (!inMatch) {
  35953. return;
  35954. }
  35955. const res = {};
  35956. res.for = inMatch[3].trim();
  35957. if (!res.for) {
  35958. return;
  35959. }
  35960. const alias = inMatch[1].trim().replace(stripParensRE, "");
  35961. const iteratorMatch = alias.match(forIteratorRE);
  35962. if (iteratorMatch) {
  35963. res.alias = alias.replace(forIteratorRE, "");
  35964. res.iterator1 = iteratorMatch[1].trim();
  35965. if (iteratorMatch[2]) {
  35966. res.iterator2 = iteratorMatch[2].trim();
  35967. }
  35968. } else {
  35969. res.alias = alias;
  35970. }
  35971. const left = [res.alias, res.iterator1, res.iterator2];
  35972. if (left.some((part, index) => !part && (index === 0 || left.slice(index + 1).some(Boolean)))) {
  35973. return;
  35974. }
  35975. return {
  35976. left: left.filter(Boolean).join(","),
  35977. operator: inMatch[2],
  35978. right: res.for
  35979. };
  35980. }
  35981. function printVueBindings(value, textToDoc) {
  35982. return textToDoc(`function _(${value}) {}`, {
  35983. parser: "babel",
  35984. __isVueBindings: true
  35985. });
  35986. }
  35987. function isVueEventBindingExpression(eventBindingValue) {
  35988. const fnExpRE = /^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/;
  35989. const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
  35990. const value = eventBindingValue.trim();
  35991. return fnExpRE.test(value) || simplePathRE.test(value);
  35992. }
  35993. module2.exports = {
  35994. isVueEventBindingExpression,
  35995. printVueFor,
  35996. printVueBindings
  35997. };
  35998. }
  35999. });
  36000. var require_get_node_content = __commonJS2({
  36001. "src/language-html/get-node-content.js"(exports2, module2) {
  36002. "use strict";
  36003. var {
  36004. needsToBorrowParentClosingTagStartMarker,
  36005. printClosingTagStartMarker,
  36006. needsToBorrowLastChildClosingTagEndMarker,
  36007. printClosingTagEndMarker,
  36008. needsToBorrowParentOpeningTagEndMarker,
  36009. printOpeningTagEndMarker
  36010. } = require_tag();
  36011. function getNodeContent(node, options) {
  36012. let start = node.startSourceSpan.end.offset;
  36013. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild)) {
  36014. start -= printOpeningTagEndMarker(node).length;
  36015. }
  36016. let end = node.endSourceSpan.start.offset;
  36017. if (node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild)) {
  36018. end += printClosingTagStartMarker(node, options).length;
  36019. } else if (needsToBorrowLastChildClosingTagEndMarker(node)) {
  36020. end -= printClosingTagEndMarker(node.lastChild, options).length;
  36021. }
  36022. return options.originalText.slice(start, end);
  36023. }
  36024. module2.exports = getNodeContent;
  36025. }
  36026. });
  36027. var require_embed4 = __commonJS2({
  36028. "src/language-html/embed.js"(exports2, module2) {
  36029. "use strict";
  36030. var {
  36031. builders: {
  36032. breakParent,
  36033. group,
  36034. hardline,
  36035. indent,
  36036. line,
  36037. fill,
  36038. softline
  36039. },
  36040. utils: {
  36041. mapDoc,
  36042. replaceTextEndOfLine
  36043. }
  36044. } = require("./doc.js");
  36045. var printFrontMatter = require_print();
  36046. var {
  36047. printClosingTag,
  36048. printClosingTagSuffix,
  36049. needsToBorrowPrevClosingTagEndMarker,
  36050. printOpeningTagPrefix,
  36051. printOpeningTag
  36052. } = require_tag();
  36053. var {
  36054. printImgSrcset,
  36055. printClassNames
  36056. } = require_syntax_attribute();
  36057. var {
  36058. printVueFor,
  36059. printVueBindings,
  36060. isVueEventBindingExpression
  36061. } = require_syntax_vue();
  36062. var {
  36063. isScriptLikeTag,
  36064. isVueNonHtmlBlock,
  36065. inferScriptParser,
  36066. htmlTrimPreserveIndentation,
  36067. dedentString,
  36068. unescapeQuoteEntities,
  36069. isVueSlotAttribute,
  36070. isVueSfcBindingsAttribute,
  36071. getTextValueParts
  36072. } = require_utils11();
  36073. var getNodeContent = require_get_node_content();
  36074. function printEmbeddedAttributeValue(node, htmlTextToDoc, options) {
  36075. const isKeyMatched = (patterns) => new RegExp(patterns.join("|")).test(node.fullName);
  36076. const getValue = () => unescapeQuoteEntities(node.value);
  36077. let shouldHug = false;
  36078. const __onHtmlBindingRoot = (root, options2) => {
  36079. const rootNode = root.type === "NGRoot" ? root.node.type === "NGMicrosyntax" && root.node.body.length === 1 && root.node.body[0].type === "NGMicrosyntaxExpression" ? root.node.body[0].expression : root.node : root.type === "JsExpressionRoot" ? root.node : root;
  36080. if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options2.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
  36081. shouldHug = true;
  36082. }
  36083. };
  36084. const printHug = (doc2) => group(doc2);
  36085. const printExpand = (doc2, canHaveTrailingWhitespace = true) => group([indent([softline, doc2]), canHaveTrailingWhitespace ? softline : ""]);
  36086. const printMaybeHug = (doc2) => shouldHug ? printHug(doc2) : printExpand(doc2);
  36087. const attributeTextToDoc = (code, opts) => htmlTextToDoc(code, Object.assign({
  36088. __onHtmlBindingRoot,
  36089. __embeddedInHtml: true
  36090. }, opts));
  36091. if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
  36092. return printExpand(printImgSrcset(getValue()));
  36093. }
  36094. if (node.fullName === "class" && !options.parentParser) {
  36095. const value = getValue();
  36096. if (!value.includes("{{")) {
  36097. return printClassNames(value);
  36098. }
  36099. }
  36100. if (node.fullName === "style" && !options.parentParser) {
  36101. const value = getValue();
  36102. if (!value.includes("{{")) {
  36103. return printExpand(attributeTextToDoc(value, {
  36104. parser: "css",
  36105. __isHTMLStyleAttribute: true
  36106. }));
  36107. }
  36108. }
  36109. if (options.parser === "vue") {
  36110. if (node.fullName === "v-for") {
  36111. return printVueFor(getValue(), attributeTextToDoc);
  36112. }
  36113. if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
  36114. return printVueBindings(getValue(), attributeTextToDoc);
  36115. }
  36116. const vueEventBindingPatterns = ["^@", "^v-on:"];
  36117. const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
  36118. const jsExpressionBindingPatterns = ["^v-"];
  36119. if (isKeyMatched(vueEventBindingPatterns)) {
  36120. const value = getValue();
  36121. const parser = isVueEventBindingExpression(value) ? "__js_expression" : options.__should_parse_vue_template_with_ts ? "__vue_ts_event_binding" : "__vue_event_binding";
  36122. return printMaybeHug(attributeTextToDoc(value, {
  36123. parser
  36124. }));
  36125. }
  36126. if (isKeyMatched(vueExpressionBindingPatterns)) {
  36127. return printMaybeHug(attributeTextToDoc(getValue(), {
  36128. parser: "__vue_expression"
  36129. }));
  36130. }
  36131. if (isKeyMatched(jsExpressionBindingPatterns)) {
  36132. return printMaybeHug(attributeTextToDoc(getValue(), {
  36133. parser: "__js_expression"
  36134. }));
  36135. }
  36136. }
  36137. if (options.parser === "angular") {
  36138. const ngTextToDoc = (code, opts) => attributeTextToDoc(code, Object.assign(Object.assign({}, opts), {}, {
  36139. trailingComma: "none"
  36140. }));
  36141. const ngDirectiveBindingPatterns = ["^\\*"];
  36142. const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
  36143. const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", "^ng-(if|show|hide|class|style)$"];
  36144. const ngI18nPatterns = ["^i18n(-.+)?$"];
  36145. if (isKeyMatched(ngStatementBindingPatterns)) {
  36146. return printMaybeHug(ngTextToDoc(getValue(), {
  36147. parser: "__ng_action"
  36148. }));
  36149. }
  36150. if (isKeyMatched(ngExpressionBindingPatterns)) {
  36151. return printMaybeHug(ngTextToDoc(getValue(), {
  36152. parser: "__ng_binding"
  36153. }));
  36154. }
  36155. if (isKeyMatched(ngI18nPatterns)) {
  36156. const value2 = getValue().trim();
  36157. return printExpand(fill(getTextValueParts(node, value2)), !value2.includes("@@"));
  36158. }
  36159. if (isKeyMatched(ngDirectiveBindingPatterns)) {
  36160. return printMaybeHug(ngTextToDoc(getValue(), {
  36161. parser: "__ng_directive"
  36162. }));
  36163. }
  36164. const interpolationRegex = /{{(.+?)}}/s;
  36165. const value = getValue();
  36166. if (interpolationRegex.test(value)) {
  36167. const parts = [];
  36168. for (const [index, part] of value.split(interpolationRegex).entries()) {
  36169. if (index % 2 === 0) {
  36170. parts.push(replaceTextEndOfLine(part));
  36171. } else {
  36172. try {
  36173. parts.push(group(["{{", indent([line, ngTextToDoc(part, {
  36174. parser: "__ng_interpolation",
  36175. __isInHtmlInterpolation: true
  36176. })]), line, "}}"]));
  36177. } catch {
  36178. parts.push("{{", replaceTextEndOfLine(part), "}}");
  36179. }
  36180. }
  36181. }
  36182. return group(parts);
  36183. }
  36184. }
  36185. return null;
  36186. }
  36187. function embed(path, print, textToDoc, options) {
  36188. const node = path.getValue();
  36189. switch (node.type) {
  36190. case "element": {
  36191. if (isScriptLikeTag(node) || node.type === "interpolation") {
  36192. return;
  36193. }
  36194. if (!node.isSelfClosing && isVueNonHtmlBlock(node, options)) {
  36195. const parser = inferScriptParser(node, options);
  36196. if (!parser) {
  36197. return;
  36198. }
  36199. const content = getNodeContent(node, options);
  36200. let isEmpty = /^\s*$/.test(content);
  36201. let doc2 = "";
  36202. if (!isEmpty) {
  36203. doc2 = textToDoc(htmlTrimPreserveIndentation(content), {
  36204. parser,
  36205. __embeddedInHtml: true
  36206. }, {
  36207. stripTrailingHardline: true
  36208. });
  36209. isEmpty = doc2 === "";
  36210. }
  36211. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), isEmpty ? "" : hardline, doc2, isEmpty ? "" : hardline, printClosingTag(node, options), printClosingTagSuffix(node, options)];
  36212. }
  36213. break;
  36214. }
  36215. case "text": {
  36216. if (isScriptLikeTag(node.parent)) {
  36217. const parser = inferScriptParser(node.parent, options);
  36218. if (parser) {
  36219. const value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*\n/, "")) : node.value;
  36220. const textToDocOptions = {
  36221. parser,
  36222. __embeddedInHtml: true
  36223. };
  36224. if (options.parser === "html" && parser === "babel") {
  36225. let sourceType = "script";
  36226. const {
  36227. attrMap
  36228. } = node.parent;
  36229. if (attrMap && (attrMap.type === "module" || attrMap.type === "text/babel" && attrMap["data-type"] === "module")) {
  36230. sourceType = "module";
  36231. }
  36232. textToDocOptions.__babelSourceType = sourceType;
  36233. }
  36234. return [breakParent, printOpeningTagPrefix(node, options), textToDoc(value, textToDocOptions, {
  36235. stripTrailingHardline: true
  36236. }), printClosingTagSuffix(node, options)];
  36237. }
  36238. } else if (node.parent.type === "interpolation") {
  36239. const textToDocOptions = {
  36240. __isInHtmlInterpolation: true,
  36241. __embeddedInHtml: true
  36242. };
  36243. if (options.parser === "angular") {
  36244. textToDocOptions.parser = "__ng_interpolation";
  36245. textToDocOptions.trailingComma = "none";
  36246. } else if (options.parser === "vue") {
  36247. textToDocOptions.parser = options.__should_parse_vue_template_with_ts ? "__vue_ts_expression" : "__vue_expression";
  36248. } else {
  36249. textToDocOptions.parser = "__js_expression";
  36250. }
  36251. return [indent([line, textToDoc(node.value, textToDocOptions, {
  36252. stripTrailingHardline: true
  36253. })]), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line];
  36254. }
  36255. break;
  36256. }
  36257. case "attribute": {
  36258. if (!node.value) {
  36259. break;
  36260. }
  36261. if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  36262. return [node.rawName, "=", node.value];
  36263. }
  36264. if (options.parser === "lwc") {
  36265. const interpolationRegex = /^{.*}$/s;
  36266. if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  36267. return [node.rawName, "=", node.value];
  36268. }
  36269. }
  36270. const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => textToDoc(code, Object.assign({
  36271. __isInHtmlAttribute: true,
  36272. __embeddedInHtml: true
  36273. }, opts), {
  36274. stripTrailingHardline: true
  36275. }), options);
  36276. if (embeddedAttributeValueDoc) {
  36277. return [node.rawName, '="', group(mapDoc(embeddedAttributeValueDoc, (doc2) => typeof doc2 === "string" ? doc2.replace(/"/g, "&quot;") : doc2)), '"'];
  36278. }
  36279. break;
  36280. }
  36281. case "front-matter":
  36282. return printFrontMatter(node, textToDoc);
  36283. }
  36284. }
  36285. module2.exports = embed;
  36286. }
  36287. });
  36288. var require_children = __commonJS2({
  36289. "src/language-html/print/children.js"(exports2, module2) {
  36290. "use strict";
  36291. var {
  36292. builders: {
  36293. breakParent,
  36294. group,
  36295. ifBreak,
  36296. line,
  36297. softline,
  36298. hardline
  36299. },
  36300. utils: {
  36301. replaceTextEndOfLine
  36302. }
  36303. } = require("./doc.js");
  36304. var {
  36305. locStart,
  36306. locEnd
  36307. } = require_loc6();
  36308. var {
  36309. forceBreakChildren,
  36310. forceNextEmptyLine,
  36311. isTextLikeNode,
  36312. hasPrettierIgnore,
  36313. preferHardlineAsLeadingSpaces
  36314. } = require_utils11();
  36315. var {
  36316. printOpeningTagPrefix,
  36317. needsToBorrowNextOpeningTagStartMarker,
  36318. printOpeningTagStartMarker,
  36319. needsToBorrowPrevClosingTagEndMarker,
  36320. printClosingTagEndMarker,
  36321. printClosingTagSuffix,
  36322. needsToBorrowParentClosingTagStartMarker
  36323. } = require_tag();
  36324. function printChild(childPath, options, print) {
  36325. const child = childPath.getValue();
  36326. if (hasPrettierIgnore(child)) {
  36327. return [printOpeningTagPrefix(child, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), locEnd(child) - (child.next && needsToBorrowPrevClosingTagEndMarker(child.next) ? printClosingTagEndMarker(child, options).length : 0))), printClosingTagSuffix(child, options)];
  36328. }
  36329. return print();
  36330. }
  36331. function printBetweenLine(prevNode, nextNode) {
  36332. return isTextLikeNode(prevNode) && isTextLikeNode(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces(nextNode) ? hardline : line : "" : preferHardlineAsLeadingSpaces(nextNode) ? hardline : softline : needsToBorrowNextOpeningTagStartMarker(prevNode) && (hasPrettierIgnore(nextNode) || nextNode.firstChild || nextNode.isSelfClosing || nextNode.type === "element" && nextNode.attrs.length > 0) || prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces(nextNode) || needsToBorrowPrevClosingTagEndMarker(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline : nextNode.hasLeadingSpaces ? line : softline;
  36333. }
  36334. function printChildren(path, options, print) {
  36335. const node = path.getValue();
  36336. if (forceBreakChildren(node)) {
  36337. return [breakParent, ...path.map((childPath) => {
  36338. const childNode = childPath.getValue();
  36339. const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
  36340. return [!prevBetweenLine ? "" : [prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline : ""], printChild(childPath, options, print)];
  36341. }, "children")];
  36342. }
  36343. const groupIds = node.children.map(() => Symbol(""));
  36344. return path.map((childPath, childIndex) => {
  36345. const childNode = childPath.getValue();
  36346. if (isTextLikeNode(childNode)) {
  36347. if (childNode.prev && isTextLikeNode(childNode.prev)) {
  36348. const prevBetweenLine2 = printBetweenLine(childNode.prev, childNode);
  36349. if (prevBetweenLine2) {
  36350. if (forceNextEmptyLine(childNode.prev)) {
  36351. return [hardline, hardline, printChild(childPath, options, print)];
  36352. }
  36353. return [prevBetweenLine2, printChild(childPath, options, print)];
  36354. }
  36355. }
  36356. return printChild(childPath, options, print);
  36357. }
  36358. const prevParts = [];
  36359. const leadingParts = [];
  36360. const trailingParts = [];
  36361. const nextParts = [];
  36362. const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
  36363. const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
  36364. if (prevBetweenLine) {
  36365. if (forceNextEmptyLine(childNode.prev)) {
  36366. prevParts.push(hardline, hardline);
  36367. } else if (prevBetweenLine === hardline) {
  36368. prevParts.push(hardline);
  36369. } else {
  36370. if (isTextLikeNode(childNode.prev)) {
  36371. leadingParts.push(prevBetweenLine);
  36372. } else {
  36373. leadingParts.push(ifBreak("", softline, {
  36374. groupId: groupIds[childIndex - 1]
  36375. }));
  36376. }
  36377. }
  36378. }
  36379. if (nextBetweenLine) {
  36380. if (forceNextEmptyLine(childNode)) {
  36381. if (isTextLikeNode(childNode.next)) {
  36382. nextParts.push(hardline, hardline);
  36383. }
  36384. } else if (nextBetweenLine === hardline) {
  36385. if (isTextLikeNode(childNode.next)) {
  36386. nextParts.push(hardline);
  36387. }
  36388. } else {
  36389. trailingParts.push(nextBetweenLine);
  36390. }
  36391. }
  36392. return [...prevParts, group([...leadingParts, group([printChild(childPath, options, print), ...trailingParts], {
  36393. id: groupIds[childIndex]
  36394. })]), ...nextParts];
  36395. }, "children");
  36396. }
  36397. module2.exports = {
  36398. printChildren
  36399. };
  36400. }
  36401. });
  36402. var require_element = __commonJS2({
  36403. "src/language-html/print/element.js"(exports2, module2) {
  36404. "use strict";
  36405. var {
  36406. builders: {
  36407. breakParent,
  36408. dedentToRoot,
  36409. group,
  36410. ifBreak,
  36411. indentIfBreak,
  36412. indent,
  36413. line,
  36414. softline
  36415. },
  36416. utils: {
  36417. replaceTextEndOfLine
  36418. }
  36419. } = require("./doc.js");
  36420. var getNodeContent = require_get_node_content();
  36421. var {
  36422. shouldPreserveContent,
  36423. isScriptLikeTag,
  36424. isVueCustomBlock,
  36425. countParents,
  36426. forceBreakContent
  36427. } = require_utils11();
  36428. var {
  36429. printOpeningTagPrefix,
  36430. printOpeningTag,
  36431. printClosingTagSuffix,
  36432. printClosingTag,
  36433. needsToBorrowPrevClosingTagEndMarker,
  36434. needsToBorrowLastChildClosingTagEndMarker
  36435. } = require_tag();
  36436. var {
  36437. printChildren
  36438. } = require_children();
  36439. function printElement(path, options, print) {
  36440. const node = path.getValue();
  36441. if (shouldPreserveContent(node, options)) {
  36442. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), ...replaceTextEndOfLine(getNodeContent(node, options)), ...printClosingTag(node, options), printClosingTagSuffix(node, options)];
  36443. }
  36444. const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
  36445. const attrGroupId = Symbol("element-attr-group-id");
  36446. const printTag = (doc2) => group([group(printOpeningTag(path, options, print), {
  36447. id: attrGroupId
  36448. }), doc2, printClosingTag(node, options)]);
  36449. const printChildrenDoc = (childrenDoc) => {
  36450. if (shouldHugContent) {
  36451. return indentIfBreak(childrenDoc, {
  36452. groupId: attrGroupId
  36453. });
  36454. }
  36455. if ((isScriptLikeTag(node) || isVueCustomBlock(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle) {
  36456. return childrenDoc;
  36457. }
  36458. return indent(childrenDoc);
  36459. };
  36460. const printLineBeforeChildren = () => {
  36461. if (shouldHugContent) {
  36462. return ifBreak(softline, "", {
  36463. groupId: attrGroupId
  36464. });
  36465. }
  36466. if (node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive) {
  36467. return line;
  36468. }
  36469. if (node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) {
  36470. return dedentToRoot(softline);
  36471. }
  36472. return softline;
  36473. };
  36474. const printLineAfterChildren = () => {
  36475. const needsToBorrow = node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent);
  36476. if (needsToBorrow) {
  36477. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  36478. return " ";
  36479. }
  36480. return "";
  36481. }
  36482. if (shouldHugContent) {
  36483. return ifBreak(softline, "", {
  36484. groupId: attrGroupId
  36485. });
  36486. }
  36487. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  36488. return line;
  36489. }
  36490. if ((node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp(`\\n[\\t ]{${options.tabWidth * countParents(path, (node2) => node2.parent && node2.parent.type !== "root")}}$`).test(node.lastChild.value)) {
  36491. return "";
  36492. }
  36493. return softline;
  36494. };
  36495. if (node.children.length === 0) {
  36496. return printTag(node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line : "");
  36497. }
  36498. return printTag([forceBreakContent(node) ? breakParent : "", printChildrenDoc([printLineBeforeChildren(), printChildren(path, options, print)]), printLineAfterChildren()]);
  36499. }
  36500. module2.exports = {
  36501. printElement
  36502. };
  36503. }
  36504. });
  36505. var require_printer_html = __commonJS2({
  36506. "src/language-html/printer-html.js"(exports2, module2) {
  36507. "use strict";
  36508. var {
  36509. builders: {
  36510. fill,
  36511. group,
  36512. hardline,
  36513. literalline
  36514. },
  36515. utils: {
  36516. cleanDoc,
  36517. getDocParts,
  36518. isConcat,
  36519. replaceTextEndOfLine
  36520. }
  36521. } = require("./doc.js");
  36522. var clean = require_clean5();
  36523. var {
  36524. countChars,
  36525. unescapeQuoteEntities,
  36526. getTextValueParts
  36527. } = require_utils11();
  36528. var preprocess = require_print_preprocess3();
  36529. var {
  36530. insertPragma
  36531. } = require_pragma5();
  36532. var {
  36533. locStart,
  36534. locEnd
  36535. } = require_loc6();
  36536. var embed = require_embed4();
  36537. var {
  36538. printClosingTagSuffix,
  36539. printClosingTagEnd,
  36540. printOpeningTagPrefix,
  36541. printOpeningTagStart
  36542. } = require_tag();
  36543. var {
  36544. printElement
  36545. } = require_element();
  36546. var {
  36547. printChildren
  36548. } = require_children();
  36549. function genericPrint(path, options, print) {
  36550. const node = path.getValue();
  36551. switch (node.type) {
  36552. case "front-matter":
  36553. return replaceTextEndOfLine(node.raw);
  36554. case "root":
  36555. if (options.__onHtmlRoot) {
  36556. options.__onHtmlRoot(node);
  36557. }
  36558. return [group(printChildren(path, options, print)), hardline];
  36559. case "element":
  36560. case "ieConditionalComment": {
  36561. return printElement(path, options, print);
  36562. }
  36563. case "ieConditionalStartComment":
  36564. case "ieConditionalEndComment":
  36565. return [printOpeningTagStart(node), printClosingTagEnd(node)];
  36566. case "interpolation":
  36567. return [printOpeningTagStart(node, options), ...path.map(print, "children"), printClosingTagEnd(node, options)];
  36568. case "text": {
  36569. if (node.parent.type === "interpolation") {
  36570. const trailingNewlineRegex = /\n[^\S\n]*$/;
  36571. const hasTrailingNewline = trailingNewlineRegex.test(node.value);
  36572. const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
  36573. return [...replaceTextEndOfLine(value), hasTrailingNewline ? hardline : ""];
  36574. }
  36575. const printed = cleanDoc([printOpeningTagPrefix(node, options), ...getTextValueParts(node), printClosingTagSuffix(node, options)]);
  36576. if (isConcat(printed) || printed.type === "fill") {
  36577. return fill(getDocParts(printed));
  36578. }
  36579. return printed;
  36580. }
  36581. case "docType":
  36582. return [group([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")]), printClosingTagEnd(node, options)];
  36583. case "comment": {
  36584. return [printOpeningTagPrefix(node, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(node), locEnd(node)), literalline), printClosingTagSuffix(node, options)];
  36585. }
  36586. case "attribute": {
  36587. if (node.value === null) {
  36588. return node.rawName;
  36589. }
  36590. const value = unescapeQuoteEntities(node.value);
  36591. const singleQuoteCount = countChars(value, "'");
  36592. const doubleQuoteCount = countChars(value, '"');
  36593. const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
  36594. return [node.rawName, "=", quote, ...replaceTextEndOfLine(quote === '"' ? value.replace(/"/g, "&quot;") : value.replace(/'/g, "&apos;")), quote];
  36595. }
  36596. default:
  36597. throw new Error(`Unexpected node type ${node.type}`);
  36598. }
  36599. }
  36600. module2.exports = {
  36601. preprocess,
  36602. print: genericPrint,
  36603. insertPragma,
  36604. massageAstNode: clean,
  36605. embed
  36606. };
  36607. }
  36608. });
  36609. var require_options6 = __commonJS2({
  36610. "src/language-html/options.js"(exports2, module2) {
  36611. "use strict";
  36612. var commonOptions = require_common_options();
  36613. var CATEGORY_HTML = "HTML";
  36614. module2.exports = {
  36615. bracketSameLine: commonOptions.bracketSameLine,
  36616. htmlWhitespaceSensitivity: {
  36617. since: "1.15.0",
  36618. category: CATEGORY_HTML,
  36619. type: "choice",
  36620. default: "css",
  36621. description: "How to handle whitespaces in HTML.",
  36622. choices: [{
  36623. value: "css",
  36624. description: "Respect the default value of CSS display property."
  36625. }, {
  36626. value: "strict",
  36627. description: "Whitespaces are considered sensitive."
  36628. }, {
  36629. value: "ignore",
  36630. description: "Whitespaces are considered insensitive."
  36631. }]
  36632. },
  36633. singleAttributePerLine: commonOptions.singleAttributePerLine,
  36634. vueIndentScriptAndStyle: {
  36635. since: "1.19.0",
  36636. category: CATEGORY_HTML,
  36637. type: "boolean",
  36638. default: false,
  36639. description: "Indent script and style tags in Vue files."
  36640. }
  36641. };
  36642. }
  36643. });
  36644. var require_parsers6 = __commonJS2({
  36645. "src/language-html/parsers.js"(exports2, module2) {
  36646. "use strict";
  36647. module2.exports = {
  36648. get html() {
  36649. return require("./parser-html.js").parsers.html;
  36650. },
  36651. get vue() {
  36652. return require("./parser-html.js").parsers.vue;
  36653. },
  36654. get angular() {
  36655. return require("./parser-html.js").parsers.angular;
  36656. },
  36657. get lwc() {
  36658. return require("./parser-html.js").parsers.lwc;
  36659. }
  36660. };
  36661. }
  36662. });
  36663. var require_HTML = __commonJS2({
  36664. "node_modules/linguist-languages/data/HTML.json"(exports2, module2) {
  36665. module2.exports = {
  36666. name: "HTML",
  36667. type: "markup",
  36668. tmScope: "text.html.basic",
  36669. aceMode: "html",
  36670. codemirrorMode: "htmlmixed",
  36671. codemirrorMimeType: "text/html",
  36672. color: "#e34c26",
  36673. aliases: ["xhtml"],
  36674. extensions: [".html", ".hta", ".htm", ".html.hl", ".inc", ".xht", ".xhtml"],
  36675. languageId: 146
  36676. };
  36677. }
  36678. });
  36679. var require_Vue = __commonJS2({
  36680. "node_modules/linguist-languages/data/Vue.json"(exports2, module2) {
  36681. module2.exports = {
  36682. name: "Vue",
  36683. type: "markup",
  36684. color: "#41b883",
  36685. extensions: [".vue"],
  36686. tmScope: "text.html.vue",
  36687. aceMode: "html",
  36688. languageId: 391
  36689. };
  36690. }
  36691. });
  36692. var require_language_html = __commonJS2({
  36693. "src/language-html/index.js"(exports2, module2) {
  36694. "use strict";
  36695. var createLanguage = require_create_language();
  36696. var printer = require_printer_html();
  36697. var options = require_options6();
  36698. var parsers = require_parsers6();
  36699. var languages = [createLanguage(require_HTML(), () => ({
  36700. name: "Angular",
  36701. since: "1.15.0",
  36702. parsers: ["angular"],
  36703. vscodeLanguageIds: ["html"],
  36704. extensions: [".component.html"],
  36705. filenames: []
  36706. })), createLanguage(require_HTML(), (data) => ({
  36707. since: "1.15.0",
  36708. parsers: ["html"],
  36709. vscodeLanguageIds: ["html"],
  36710. extensions: [...data.extensions, ".mjml"]
  36711. })), createLanguage(require_HTML(), () => ({
  36712. name: "Lightning Web Components",
  36713. since: "1.17.0",
  36714. parsers: ["lwc"],
  36715. vscodeLanguageIds: ["html"],
  36716. extensions: [],
  36717. filenames: []
  36718. })), createLanguage(require_Vue(), () => ({
  36719. since: "1.10.0",
  36720. parsers: ["vue"],
  36721. vscodeLanguageIds: ["vue"]
  36722. }))];
  36723. var printers = {
  36724. html: printer
  36725. };
  36726. module2.exports = {
  36727. languages,
  36728. printers,
  36729. options,
  36730. parsers
  36731. };
  36732. }
  36733. });
  36734. var require_pragma6 = __commonJS2({
  36735. "src/language-yaml/pragma.js"(exports2, module2) {
  36736. "use strict";
  36737. function isPragma(text) {
  36738. return /^\s*@(?:prettier|format)\s*$/.test(text);
  36739. }
  36740. function hasPragma(text) {
  36741. return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text);
  36742. }
  36743. function insertPragma(text) {
  36744. return `# @format
  36745. ${text}`;
  36746. }
  36747. module2.exports = {
  36748. isPragma,
  36749. hasPragma,
  36750. insertPragma
  36751. };
  36752. }
  36753. });
  36754. var require_loc7 = __commonJS2({
  36755. "src/language-yaml/loc.js"(exports2, module2) {
  36756. "use strict";
  36757. function locStart(node) {
  36758. return node.position.start.offset;
  36759. }
  36760. function locEnd(node) {
  36761. return node.position.end.offset;
  36762. }
  36763. module2.exports = {
  36764. locStart,
  36765. locEnd
  36766. };
  36767. }
  36768. });
  36769. var require_embed5 = __commonJS2({
  36770. "src/language-yaml/embed.js"(exports2, module2) {
  36771. "use strict";
  36772. function embed(path, print, textToDoc, options) {
  36773. const node = path.getValue();
  36774. if (node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(options.filepath)) {
  36775. return textToDoc(options.originalText, Object.assign(Object.assign({}, options), {}, {
  36776. parser: "json"
  36777. }));
  36778. }
  36779. }
  36780. module2.exports = embed;
  36781. }
  36782. });
  36783. var require_utils12 = __commonJS2({
  36784. "src/language-yaml/utils.js"(exports2, module2) {
  36785. "use strict";
  36786. var {
  36787. getLast,
  36788. isNonEmptyArray
  36789. } = require_util();
  36790. function getAncestorCount(path, filter) {
  36791. let counter = 0;
  36792. const pathStackLength = path.stack.length - 1;
  36793. for (let i = 0; i < pathStackLength; i++) {
  36794. const value = path.stack[i];
  36795. if (isNode(value) && filter(value)) {
  36796. counter++;
  36797. }
  36798. }
  36799. return counter;
  36800. }
  36801. function isNode(value, types) {
  36802. return value && typeof value.type === "string" && (!types || types.includes(value.type));
  36803. }
  36804. function mapNode(node, callback, parent) {
  36805. return callback("children" in node ? Object.assign(Object.assign({}, node), {}, {
  36806. children: node.children.map((childNode) => mapNode(childNode, callback, node))
  36807. }) : node, parent);
  36808. }
  36809. function defineShortcut(x, key, getter) {
  36810. Object.defineProperty(x, key, {
  36811. get: getter,
  36812. enumerable: false
  36813. });
  36814. }
  36815. function isNextLineEmpty(node, text) {
  36816. let newlineCount = 0;
  36817. const textLength = text.length;
  36818. for (let i = node.position.end.offset - 1; i < textLength; i++) {
  36819. const char = text[i];
  36820. if (char === "\n") {
  36821. newlineCount++;
  36822. }
  36823. if (newlineCount === 1 && /\S/.test(char)) {
  36824. return false;
  36825. }
  36826. if (newlineCount === 2) {
  36827. return true;
  36828. }
  36829. }
  36830. return false;
  36831. }
  36832. function isLastDescendantNode(path) {
  36833. const node = path.getValue();
  36834. switch (node.type) {
  36835. case "tag":
  36836. case "anchor":
  36837. case "comment":
  36838. return false;
  36839. }
  36840. const pathStackLength = path.stack.length;
  36841. for (let i = 1; i < pathStackLength; i++) {
  36842. const item = path.stack[i];
  36843. const parentItem = path.stack[i - 1];
  36844. if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
  36845. return false;
  36846. }
  36847. }
  36848. return true;
  36849. }
  36850. function getLastDescendantNode(node) {
  36851. return isNonEmptyArray(node.children) ? getLastDescendantNode(getLast(node.children)) : node;
  36852. }
  36853. function isPrettierIgnore(comment) {
  36854. return comment.value.trim() === "prettier-ignore";
  36855. }
  36856. function hasPrettierIgnore(path) {
  36857. const node = path.getValue();
  36858. if (node.type === "documentBody") {
  36859. const document = path.getParentNode();
  36860. return hasEndComments(document.head) && isPrettierIgnore(getLast(document.head.endComments));
  36861. }
  36862. return hasLeadingComments(node) && isPrettierIgnore(getLast(node.leadingComments));
  36863. }
  36864. function isEmptyNode(node) {
  36865. return !isNonEmptyArray(node.children) && !hasComments(node);
  36866. }
  36867. function hasComments(node) {
  36868. return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment(node) || hasEndComments(node);
  36869. }
  36870. function hasLeadingComments(node) {
  36871. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.leadingComments);
  36872. }
  36873. function hasMiddleComments(node) {
  36874. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.middleComments);
  36875. }
  36876. function hasIndicatorComment(node) {
  36877. return node === null || node === void 0 ? void 0 : node.indicatorComment;
  36878. }
  36879. function hasTrailingComment(node) {
  36880. return node === null || node === void 0 ? void 0 : node.trailingComment;
  36881. }
  36882. function hasEndComments(node) {
  36883. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.endComments);
  36884. }
  36885. function splitWithSingleSpace(text) {
  36886. const parts = [];
  36887. let lastPart;
  36888. for (const part of text.split(/( +)/)) {
  36889. if (part !== " ") {
  36890. if (lastPart === " ") {
  36891. parts.push(part);
  36892. } else {
  36893. parts.push((parts.pop() || "") + part);
  36894. }
  36895. } else if (lastPart === void 0) {
  36896. parts.unshift("");
  36897. }
  36898. lastPart = part;
  36899. }
  36900. if (lastPart === " ") {
  36901. parts.push((parts.pop() || "") + " ");
  36902. }
  36903. if (parts[0] === "") {
  36904. parts.shift();
  36905. parts.unshift(" " + (parts.shift() || ""));
  36906. }
  36907. return parts;
  36908. }
  36909. function getFlowScalarLineContents(nodeType, content, options) {
  36910. const rawLineContents = content.split("\n").map((lineContent, index, lineContents) => index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimEnd() : lineContent.trimStart());
  36911. if (options.proseWrap === "preserve") {
  36912. return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]);
  36913. }
  36914. return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !(nodeType === "quoteDouble" && getLast(getLast(reduced)).endsWith("\\")) ? [...reduced.slice(0, -1), [...getLast(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map((lineContentWords) => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords);
  36915. }
  36916. function getBlockValueLineContents(node, {
  36917. parentIndent,
  36918. isLastDescendant,
  36919. options
  36920. }) {
  36921. const content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset).match(/^[^\n]*\n(.*)$/s)[1];
  36922. let leadingSpaceCount;
  36923. if (node.indent === null) {
  36924. const matches = content.match(/^(?<leadingSpace> *)[^\n\r ]/m);
  36925. leadingSpaceCount = matches ? matches.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
  36926. } else {
  36927. leadingSpaceCount = node.indent - 1 + parentIndent;
  36928. }
  36929. const rawLineContents = content.split("\n").map((lineContent) => lineContent.slice(leadingSpaceCount));
  36930. if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
  36931. return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]));
  36932. }
  36933. return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast(reduced)) ? [...reduced.slice(0, -1), [...getLast(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map((lineContentWords) => lineContentWords.reduce((reduced, word) => reduced.length > 0 && /\s$/.test(getLast(reduced)) ? [...reduced.slice(0, -1), getLast(reduced) + " " + word] : [...reduced, word], [])).map((lineContentWords) => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords));
  36934. function removeUnnecessaryTrailingNewlines(lineContents) {
  36935. if (node.chomping === "keep") {
  36936. return getLast(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
  36937. }
  36938. let trailingNewlineCount = 0;
  36939. for (let i = lineContents.length - 1; i >= 0; i--) {
  36940. if (lineContents[i].length === 0) {
  36941. trailingNewlineCount++;
  36942. } else {
  36943. break;
  36944. }
  36945. }
  36946. return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
  36947. }
  36948. }
  36949. function isInlineNode(node) {
  36950. if (!node) {
  36951. return true;
  36952. }
  36953. switch (node.type) {
  36954. case "plain":
  36955. case "quoteDouble":
  36956. case "quoteSingle":
  36957. case "alias":
  36958. case "flowMapping":
  36959. case "flowSequence":
  36960. return true;
  36961. default:
  36962. return false;
  36963. }
  36964. }
  36965. module2.exports = {
  36966. getLast,
  36967. getAncestorCount,
  36968. isNode,
  36969. isEmptyNode,
  36970. isInlineNode,
  36971. mapNode,
  36972. defineShortcut,
  36973. isNextLineEmpty,
  36974. isLastDescendantNode,
  36975. getBlockValueLineContents,
  36976. getFlowScalarLineContents,
  36977. getLastDescendantNode,
  36978. hasPrettierIgnore,
  36979. hasLeadingComments,
  36980. hasMiddleComments,
  36981. hasIndicatorComment,
  36982. hasTrailingComment,
  36983. hasEndComments
  36984. };
  36985. }
  36986. });
  36987. var require_print_preprocess4 = __commonJS2({
  36988. "src/language-yaml/print-preprocess.js"(exports2, module2) {
  36989. "use strict";
  36990. var {
  36991. defineShortcut,
  36992. mapNode
  36993. } = require_utils12();
  36994. function preprocess(ast) {
  36995. return mapNode(ast, defineShortcuts);
  36996. }
  36997. function defineShortcuts(node) {
  36998. switch (node.type) {
  36999. case "document":
  37000. defineShortcut(node, "head", () => node.children[0]);
  37001. defineShortcut(node, "body", () => node.children[1]);
  37002. break;
  37003. case "documentBody":
  37004. case "sequenceItem":
  37005. case "flowSequenceItem":
  37006. case "mappingKey":
  37007. case "mappingValue":
  37008. defineShortcut(node, "content", () => node.children[0]);
  37009. break;
  37010. case "mappingItem":
  37011. case "flowMappingItem":
  37012. defineShortcut(node, "key", () => node.children[0]);
  37013. defineShortcut(node, "value", () => node.children[1]);
  37014. break;
  37015. }
  37016. return node;
  37017. }
  37018. module2.exports = preprocess;
  37019. }
  37020. });
  37021. var require_misc2 = __commonJS2({
  37022. "src/language-yaml/print/misc.js"(exports2, module2) {
  37023. "use strict";
  37024. var {
  37025. builders: {
  37026. softline,
  37027. align
  37028. }
  37029. } = require("./doc.js");
  37030. var {
  37031. hasEndComments,
  37032. isNextLineEmpty,
  37033. isNode
  37034. } = require_utils12();
  37035. var printedEmptyLineCache = /* @__PURE__ */ new WeakMap();
  37036. function printNextEmptyLine(path, originalText) {
  37037. const node = path.getValue();
  37038. const root = path.stack[0];
  37039. let isNextEmptyLinePrintedSet;
  37040. if (printedEmptyLineCache.has(root)) {
  37041. isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root);
  37042. } else {
  37043. isNextEmptyLinePrintedSet = /* @__PURE__ */ new Set();
  37044. printedEmptyLineCache.set(root, isNextEmptyLinePrintedSet);
  37045. }
  37046. if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
  37047. isNextEmptyLinePrintedSet.add(node.position.end.line);
  37048. if (isNextLineEmpty(node, originalText) && !shouldPrintEndComments(path.getParentNode())) {
  37049. return softline;
  37050. }
  37051. }
  37052. return "";
  37053. }
  37054. function shouldPrintEndComments(node) {
  37055. return hasEndComments(node) && !isNode(node, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
  37056. }
  37057. function alignWithSpaces(width, doc2) {
  37058. return align(" ".repeat(width), doc2);
  37059. }
  37060. module2.exports = {
  37061. alignWithSpaces,
  37062. shouldPrintEndComments,
  37063. printNextEmptyLine
  37064. };
  37065. }
  37066. });
  37067. var require_flow_mapping_sequence = __commonJS2({
  37068. "src/language-yaml/print/flow-mapping-sequence.js"(exports2, module2) {
  37069. "use strict";
  37070. var {
  37071. builders: {
  37072. ifBreak,
  37073. line,
  37074. softline,
  37075. hardline,
  37076. join
  37077. }
  37078. } = require("./doc.js");
  37079. var {
  37080. isEmptyNode,
  37081. getLast,
  37082. hasEndComments
  37083. } = require_utils12();
  37084. var {
  37085. printNextEmptyLine,
  37086. alignWithSpaces
  37087. } = require_misc2();
  37088. function printFlowMapping(path, print, options) {
  37089. const node = path.getValue();
  37090. const isMapping = node.type === "flowMapping";
  37091. const openMarker = isMapping ? "{" : "[";
  37092. const closeMarker = isMapping ? "}" : "]";
  37093. let bracketSpacing = softline;
  37094. if (isMapping && node.children.length > 0 && options.bracketSpacing) {
  37095. bracketSpacing = line;
  37096. }
  37097. const lastItem = getLast(node.children);
  37098. const isLastItemEmptyMappingItem = lastItem && lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
  37099. return [openMarker, alignWithSpaces(options.tabWidth, [bracketSpacing, printChildren(path, print, options), options.trailingComma === "none" ? "" : ifBreak(","), hasEndComments(node) ? [hardline, join(hardline, path.map(print, "endComments"))] : ""]), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker];
  37100. }
  37101. function printChildren(path, print, options) {
  37102. const node = path.getValue();
  37103. const parts = path.map((childPath, index) => [print(), index === node.children.length - 1 ? "" : [",", line, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""]], "children");
  37104. return parts;
  37105. }
  37106. module2.exports = {
  37107. printFlowMapping,
  37108. printFlowSequence: printFlowMapping
  37109. };
  37110. }
  37111. });
  37112. var require_mapping_item = __commonJS2({
  37113. "src/language-yaml/print/mapping-item.js"(exports2, module2) {
  37114. "use strict";
  37115. var {
  37116. builders: {
  37117. conditionalGroup,
  37118. group,
  37119. hardline,
  37120. ifBreak,
  37121. join,
  37122. line
  37123. }
  37124. } = require("./doc.js");
  37125. var {
  37126. hasLeadingComments,
  37127. hasMiddleComments,
  37128. hasTrailingComment,
  37129. hasEndComments,
  37130. isNode,
  37131. isEmptyNode,
  37132. isInlineNode
  37133. } = require_utils12();
  37134. var {
  37135. alignWithSpaces
  37136. } = require_misc2();
  37137. function printMappingItem(node, parentNode, path, print, options) {
  37138. const {
  37139. key,
  37140. value
  37141. } = node;
  37142. const isEmptyMappingKey = isEmptyNode(key);
  37143. const isEmptyMappingValue = isEmptyNode(value);
  37144. if (isEmptyMappingKey && isEmptyMappingValue) {
  37145. return ": ";
  37146. }
  37147. const printedKey = print("key");
  37148. const spaceBeforeColon = needsSpaceInFrontOfMappingValue(node) ? " " : "";
  37149. if (isEmptyMappingValue) {
  37150. if (node.type === "flowMappingItem" && parentNode.type === "flowMapping") {
  37151. return printedKey;
  37152. }
  37153. if (node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasTrailingComment(key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set")) {
  37154. return [printedKey, spaceBeforeColon, ":"];
  37155. }
  37156. return ["? ", alignWithSpaces(2, printedKey)];
  37157. }
  37158. const printedValue = print("value");
  37159. if (isEmptyMappingKey) {
  37160. return [": ", alignWithSpaces(2, printedValue)];
  37161. }
  37162. if (hasLeadingComments(value) || !isInlineNode(key.content)) {
  37163. return ["? ", alignWithSpaces(2, printedKey), hardline, join("", path.map(print, "value", "leadingComments").map((comment) => [comment, hardline])), ": ", alignWithSpaces(2, printedValue)];
  37164. }
  37165. if (isSingleLineNode(key.content) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasTrailingComment(key.content) && !hasEndComments(key) && !hasLeadingComments(value.content) && !hasMiddleComments(value.content) && !hasEndComments(value) && isAbsolutelyPrintedAsSingleLineNode(value.content, options)) {
  37166. return [printedKey, spaceBeforeColon, ": ", printedValue];
  37167. }
  37168. const groupId = Symbol("mappingKey");
  37169. const groupedKey = group([ifBreak("? "), group(alignWithSpaces(2, printedKey), {
  37170. id: groupId
  37171. })]);
  37172. const explicitMappingValue = [hardline, ": ", alignWithSpaces(2, printedValue)];
  37173. const implicitMappingValueParts = [spaceBeforeColon, ":"];
  37174. if (hasLeadingComments(value.content) || hasEndComments(value) && value.content && !isNode(value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment(key.content) && isInlineNode(value.content) || isNode(value.content, ["mapping", "sequence"]) && value.content.tag === null && value.content.anchor === null) {
  37175. implicitMappingValueParts.push(hardline);
  37176. } else if (value.content) {
  37177. implicitMappingValueParts.push(line);
  37178. }
  37179. implicitMappingValueParts.push(printedValue);
  37180. const implicitMappingValue = alignWithSpaces(options.tabWidth, implicitMappingValueParts);
  37181. if (isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasEndComments(key)) {
  37182. return conditionalGroup([[printedKey, implicitMappingValue]]);
  37183. }
  37184. return conditionalGroup([[groupedKey, ifBreak(explicitMappingValue, implicitMappingValue, {
  37185. groupId
  37186. })]]);
  37187. }
  37188. function isAbsolutelyPrintedAsSingleLineNode(node, options) {
  37189. if (!node) {
  37190. return true;
  37191. }
  37192. switch (node.type) {
  37193. case "plain":
  37194. case "quoteSingle":
  37195. case "quoteDouble":
  37196. break;
  37197. case "alias":
  37198. return true;
  37199. default:
  37200. return false;
  37201. }
  37202. if (options.proseWrap === "preserve") {
  37203. return node.position.start.line === node.position.end.line;
  37204. }
  37205. if (/\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
  37206. return false;
  37207. }
  37208. switch (options.proseWrap) {
  37209. case "never":
  37210. return !node.value.includes("\n");
  37211. case "always":
  37212. return !/[\n ]/.test(node.value);
  37213. default:
  37214. return false;
  37215. }
  37216. }
  37217. function needsSpaceInFrontOfMappingValue(node) {
  37218. return node.key.content && node.key.content.type === "alias";
  37219. }
  37220. function isSingleLineNode(node) {
  37221. if (!node) {
  37222. return true;
  37223. }
  37224. switch (node.type) {
  37225. case "plain":
  37226. case "quoteDouble":
  37227. case "quoteSingle":
  37228. return node.position.start.line === node.position.end.line;
  37229. case "alias":
  37230. return true;
  37231. default:
  37232. return false;
  37233. }
  37234. }
  37235. module2.exports = printMappingItem;
  37236. }
  37237. });
  37238. var require_block2 = __commonJS2({
  37239. "src/language-yaml/print/block.js"(exports2, module2) {
  37240. "use strict";
  37241. var {
  37242. builders: {
  37243. dedent,
  37244. dedentToRoot,
  37245. fill,
  37246. hardline,
  37247. join,
  37248. line,
  37249. literalline,
  37250. markAsRoot
  37251. },
  37252. utils: {
  37253. getDocParts
  37254. }
  37255. } = require("./doc.js");
  37256. var {
  37257. getAncestorCount,
  37258. getBlockValueLineContents,
  37259. hasIndicatorComment,
  37260. isLastDescendantNode,
  37261. isNode
  37262. } = require_utils12();
  37263. var {
  37264. alignWithSpaces
  37265. } = require_misc2();
  37266. function printBlock(path, print, options) {
  37267. const node = path.getValue();
  37268. const parentIndent = getAncestorCount(path, (ancestorNode) => isNode(ancestorNode, ["sequence", "mapping"]));
  37269. const isLastDescendant = isLastDescendantNode(path);
  37270. const parts = [node.type === "blockFolded" ? ">" : "|"];
  37271. if (node.indent !== null) {
  37272. parts.push(node.indent.toString());
  37273. }
  37274. if (node.chomping !== "clip") {
  37275. parts.push(node.chomping === "keep" ? "+" : "-");
  37276. }
  37277. if (hasIndicatorComment(node)) {
  37278. parts.push(" ", print("indicatorComment"));
  37279. }
  37280. const lineContents = getBlockValueLineContents(node, {
  37281. parentIndent,
  37282. isLastDescendant,
  37283. options
  37284. });
  37285. const contentsParts = [];
  37286. for (const [index, lineWords] of lineContents.entries()) {
  37287. if (index === 0) {
  37288. contentsParts.push(hardline);
  37289. }
  37290. contentsParts.push(fill(getDocParts(join(line, lineWords))));
  37291. if (index !== lineContents.length - 1) {
  37292. contentsParts.push(lineWords.length === 0 ? hardline : markAsRoot(literalline));
  37293. } else if (node.chomping === "keep" && isLastDescendant) {
  37294. contentsParts.push(dedentToRoot(lineWords.length === 0 ? hardline : literalline));
  37295. }
  37296. }
  37297. if (node.indent === null) {
  37298. parts.push(dedent(alignWithSpaces(options.tabWidth, contentsParts)));
  37299. } else {
  37300. parts.push(dedentToRoot(alignWithSpaces(node.indent - 1 + parentIndent, contentsParts)));
  37301. }
  37302. return parts;
  37303. }
  37304. module2.exports = printBlock;
  37305. }
  37306. });
  37307. var require_printer_yaml = __commonJS2({
  37308. "src/language-yaml/printer-yaml.js"(exports2, module2) {
  37309. "use strict";
  37310. var {
  37311. builders: {
  37312. breakParent,
  37313. fill,
  37314. group,
  37315. hardline,
  37316. join,
  37317. line,
  37318. lineSuffix,
  37319. literalline
  37320. },
  37321. utils: {
  37322. getDocParts,
  37323. replaceTextEndOfLine
  37324. }
  37325. } = require("./doc.js");
  37326. var {
  37327. isPreviousLineEmpty
  37328. } = require_util();
  37329. var {
  37330. insertPragma,
  37331. isPragma
  37332. } = require_pragma6();
  37333. var {
  37334. locStart
  37335. } = require_loc7();
  37336. var embed = require_embed5();
  37337. var {
  37338. getFlowScalarLineContents,
  37339. getLastDescendantNode,
  37340. hasLeadingComments,
  37341. hasMiddleComments,
  37342. hasTrailingComment,
  37343. hasEndComments,
  37344. hasPrettierIgnore,
  37345. isLastDescendantNode,
  37346. isNode,
  37347. isInlineNode
  37348. } = require_utils12();
  37349. var preprocess = require_print_preprocess4();
  37350. var {
  37351. alignWithSpaces,
  37352. printNextEmptyLine,
  37353. shouldPrintEndComments
  37354. } = require_misc2();
  37355. var {
  37356. printFlowMapping,
  37357. printFlowSequence
  37358. } = require_flow_mapping_sequence();
  37359. var printMappingItem = require_mapping_item();
  37360. var printBlock = require_block2();
  37361. function genericPrint(path, options, print) {
  37362. const node = path.getValue();
  37363. const parts = [];
  37364. if (node.type !== "mappingValue" && hasLeadingComments(node)) {
  37365. parts.push([join(hardline, path.map(print, "leadingComments")), hardline]);
  37366. }
  37367. const {
  37368. tag,
  37369. anchor
  37370. } = node;
  37371. if (tag) {
  37372. parts.push(print("tag"));
  37373. }
  37374. if (tag && anchor) {
  37375. parts.push(" ");
  37376. }
  37377. if (anchor) {
  37378. parts.push(print("anchor"));
  37379. }
  37380. let nextEmptyLine = "";
  37381. if (isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path)) {
  37382. nextEmptyLine = printNextEmptyLine(path, options.originalText);
  37383. }
  37384. if (tag || anchor) {
  37385. if (isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node)) {
  37386. parts.push(hardline);
  37387. } else {
  37388. parts.push(" ");
  37389. }
  37390. }
  37391. if (hasMiddleComments(node)) {
  37392. parts.push([node.middleComments.length === 1 ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline]);
  37393. }
  37394. const parentNode = path.getParentNode();
  37395. if (hasPrettierIgnore(path)) {
  37396. parts.push(replaceTextEndOfLine(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline));
  37397. } else {
  37398. parts.push(group(printNode(node, parentNode, path, options, print)));
  37399. }
  37400. if (hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])) {
  37401. parts.push(lineSuffix([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent, print("trailingComment")]));
  37402. }
  37403. if (shouldPrintEndComments(node)) {
  37404. parts.push(alignWithSpaces(node.type === "sequenceItem" ? 2 : 0, [hardline, join(hardline, path.map((path2) => [isPreviousLineEmpty(options.originalText, path2.getValue(), locStart) ? hardline : "", print()], "endComments"))]));
  37405. }
  37406. parts.push(nextEmptyLine);
  37407. return parts;
  37408. }
  37409. function printNode(node, parentNode, path, options, print) {
  37410. switch (node.type) {
  37411. case "root": {
  37412. const {
  37413. children
  37414. } = node;
  37415. const parts = [];
  37416. path.each((childPath, index) => {
  37417. const document = children[index];
  37418. const nextDocument = children[index + 1];
  37419. if (index !== 0) {
  37420. parts.push(hardline);
  37421. }
  37422. parts.push(print());
  37423. if (shouldPrintDocumentEndMarker(document, nextDocument)) {
  37424. parts.push(hardline, "...");
  37425. if (hasTrailingComment(document)) {
  37426. parts.push(" ", print("trailingComment"));
  37427. }
  37428. } else if (nextDocument && !hasTrailingComment(nextDocument.head)) {
  37429. parts.push(hardline, "---");
  37430. }
  37431. }, "children");
  37432. const lastDescendantNode = getLastDescendantNode(node);
  37433. if (!isNode(lastDescendantNode, ["blockLiteral", "blockFolded"]) || lastDescendantNode.chomping !== "keep") {
  37434. parts.push(hardline);
  37435. }
  37436. return parts;
  37437. }
  37438. case "document": {
  37439. const nextDocument = parentNode.children[path.getName() + 1];
  37440. const parts = [];
  37441. if (shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head") {
  37442. if (node.head.children.length > 0 || node.head.endComments.length > 0) {
  37443. parts.push(print("head"));
  37444. }
  37445. if (hasTrailingComment(node.head)) {
  37446. parts.push(["---", " ", print(["head", "trailingComment"])]);
  37447. } else {
  37448. parts.push("---");
  37449. }
  37450. }
  37451. if (shouldPrintDocumentBody(node)) {
  37452. parts.push(print("body"));
  37453. }
  37454. return join(hardline, parts);
  37455. }
  37456. case "documentHead":
  37457. return join(hardline, [...path.map(print, "children"), ...path.map(print, "endComments")]);
  37458. case "documentBody": {
  37459. const {
  37460. children,
  37461. endComments
  37462. } = node;
  37463. let separator = "";
  37464. if (children.length > 0 && endComments.length > 0) {
  37465. const lastDescendantNode = getLastDescendantNode(node);
  37466. if (isNode(lastDescendantNode, ["blockFolded", "blockLiteral"])) {
  37467. if (lastDescendantNode.chomping !== "keep") {
  37468. separator = [hardline, hardline];
  37469. }
  37470. } else {
  37471. separator = hardline;
  37472. }
  37473. }
  37474. return [join(hardline, path.map(print, "children")), separator, join(hardline, path.map(print, "endComments"))];
  37475. }
  37476. case "directive":
  37477. return ["%", join(" ", [node.name, ...node.parameters])];
  37478. case "comment":
  37479. return ["#", node.value];
  37480. case "alias":
  37481. return ["*", node.value];
  37482. case "tag":
  37483. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  37484. case "anchor":
  37485. return ["&", node.value];
  37486. case "plain":
  37487. return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
  37488. case "quoteDouble":
  37489. case "quoteSingle": {
  37490. const singleQuote = "'";
  37491. const doubleQuote = '"';
  37492. const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
  37493. if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
  37494. const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
  37495. return [originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote];
  37496. }
  37497. if (raw.includes(doubleQuote)) {
  37498. return [singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw.replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote];
  37499. }
  37500. if (raw.includes(singleQuote)) {
  37501. return [doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? raw.replace(/''/g, singleQuote) : raw, options), doubleQuote];
  37502. }
  37503. const quote = options.singleQuote ? singleQuote : doubleQuote;
  37504. return [quote, printFlowScalarContent(node.type, raw, options), quote];
  37505. }
  37506. case "blockFolded":
  37507. case "blockLiteral": {
  37508. return printBlock(path, print, options);
  37509. }
  37510. case "mapping":
  37511. case "sequence":
  37512. return join(hardline, path.map(print, "children"));
  37513. case "sequenceItem":
  37514. return ["- ", alignWithSpaces(2, node.content ? print("content") : "")];
  37515. case "mappingKey":
  37516. case "mappingValue":
  37517. return !node.content ? "" : print("content");
  37518. case "mappingItem":
  37519. case "flowMappingItem": {
  37520. return printMappingItem(node, parentNode, path, print, options);
  37521. }
  37522. case "flowMapping":
  37523. return printFlowMapping(path, print, options);
  37524. case "flowSequence":
  37525. return printFlowSequence(path, print, options);
  37526. case "flowSequenceItem":
  37527. return print("content");
  37528. default:
  37529. throw new Error(`Unexpected node type ${node.type}`);
  37530. }
  37531. }
  37532. function shouldPrintDocumentBody(document) {
  37533. return document.body.children.length > 0 || hasEndComments(document.body);
  37534. }
  37535. function shouldPrintDocumentEndMarker(document, nextDocument) {
  37536. return hasTrailingComment(document) || nextDocument && (nextDocument.head.children.length > 0 || hasEndComments(nextDocument.head));
  37537. }
  37538. function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
  37539. if (root.children[0] === document && /---(?:\s|$)/.test(options.originalText.slice(locStart(document), locStart(document) + 4)) || document.head.children.length > 0 || hasEndComments(document.head) || hasTrailingComment(document.head)) {
  37540. return "head";
  37541. }
  37542. if (shouldPrintDocumentEndMarker(document, nextDocument)) {
  37543. return false;
  37544. }
  37545. return nextDocument ? "root" : false;
  37546. }
  37547. function printFlowScalarContent(nodeType, content, options) {
  37548. const lineContents = getFlowScalarLineContents(nodeType, content, options);
  37549. return join(hardline, lineContents.map((lineContentWords) => fill(getDocParts(join(line, lineContentWords)))));
  37550. }
  37551. function clean(node, newNode) {
  37552. if (isNode(newNode)) {
  37553. delete newNode.position;
  37554. switch (newNode.type) {
  37555. case "comment":
  37556. if (isPragma(newNode.value)) {
  37557. return null;
  37558. }
  37559. break;
  37560. case "quoteDouble":
  37561. case "quoteSingle":
  37562. newNode.type = "quote";
  37563. break;
  37564. }
  37565. }
  37566. }
  37567. module2.exports = {
  37568. preprocess,
  37569. embed,
  37570. print: genericPrint,
  37571. massageAstNode: clean,
  37572. insertPragma
  37573. };
  37574. }
  37575. });
  37576. var require_options7 = __commonJS2({
  37577. "src/language-yaml/options.js"(exports2, module2) {
  37578. "use strict";
  37579. var commonOptions = require_common_options();
  37580. module2.exports = {
  37581. bracketSpacing: commonOptions.bracketSpacing,
  37582. singleQuote: commonOptions.singleQuote,
  37583. proseWrap: commonOptions.proseWrap
  37584. };
  37585. }
  37586. });
  37587. var require_parsers7 = __commonJS2({
  37588. "src/language-yaml/parsers.js"(exports2, module2) {
  37589. "use strict";
  37590. module2.exports = {
  37591. get yaml() {
  37592. return require("./parser-yaml.js").parsers.yaml;
  37593. }
  37594. };
  37595. }
  37596. });
  37597. var require_YAML = __commonJS2({
  37598. "node_modules/linguist-languages/data/YAML.json"(exports2, module2) {
  37599. module2.exports = {
  37600. name: "YAML",
  37601. type: "data",
  37602. color: "#cb171e",
  37603. tmScope: "source.yaml",
  37604. aliases: ["yml"],
  37605. extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"],
  37606. filenames: [".clang-format", ".clang-tidy", ".gemrc", "CITATION.cff", "glide.lock", "yarn.lock"],
  37607. aceMode: "yaml",
  37608. codemirrorMode: "yaml",
  37609. codemirrorMimeType: "text/x-yaml",
  37610. languageId: 407
  37611. };
  37612. }
  37613. });
  37614. var require_language_yaml = __commonJS2({
  37615. "src/language-yaml/index.js"(exports2, module2) {
  37616. "use strict";
  37617. var createLanguage = require_create_language();
  37618. var printer = require_printer_yaml();
  37619. var options = require_options7();
  37620. var parsers = require_parsers7();
  37621. var languages = [createLanguage(require_YAML(), (data) => ({
  37622. since: "1.14.0",
  37623. parsers: ["yaml"],
  37624. vscodeLanguageIds: ["yaml", "ansible", "home-assistant"],
  37625. filenames: [...data.filenames.filter((filename) => filename !== "yarn.lock"), ".prettierrc", ".stylelintrc", ".lintstagedrc"]
  37626. }))];
  37627. module2.exports = {
  37628. languages,
  37629. printers: {
  37630. yaml: printer
  37631. },
  37632. options,
  37633. parsers
  37634. };
  37635. }
  37636. });
  37637. var require_languages = __commonJS2({
  37638. "src/languages.js"(exports2, module2) {
  37639. "use strict";
  37640. module2.exports = [require_language_js(), require_language_css(), require_language_handlebars(), require_language_graphql(), require_language_markdown(), require_language_html(), require_language_yaml()];
  37641. }
  37642. });
  37643. var require_load_plugins = __commonJS2({
  37644. "src/common/load-plugins.js"(exports2, module2) {
  37645. "use strict";
  37646. var fs = require("fs");
  37647. var path = require("path");
  37648. var fastGlob = require_out4();
  37649. var partition = require_partition();
  37650. var uniqByKey = require_uniq_by_key();
  37651. var internalPlugins = require_languages();
  37652. var {
  37653. default: mem2,
  37654. memClear: memClear2
  37655. } = (init_dist(), __toCommonJS(dist_exports));
  37656. var thirdParty = require("./third-party.js");
  37657. var resolve = require_resolve2();
  37658. var memoizedLoad = mem2(load, {
  37659. cacheKey: JSON.stringify
  37660. });
  37661. var memoizedSearch = mem2(findPluginsInNodeModules);
  37662. var clearCache = () => {
  37663. memClear2(memoizedLoad);
  37664. memClear2(memoizedSearch);
  37665. };
  37666. function load(plugins2, pluginSearchDirs) {
  37667. if (!plugins2) {
  37668. plugins2 = [];
  37669. }
  37670. if (pluginSearchDirs === false) {
  37671. pluginSearchDirs = [];
  37672. } else {
  37673. pluginSearchDirs = pluginSearchDirs || [];
  37674. if (pluginSearchDirs.length === 0) {
  37675. const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
  37676. if (autoLoadDir) {
  37677. pluginSearchDirs = [autoLoadDir];
  37678. }
  37679. }
  37680. }
  37681. const [externalPluginNames, externalPluginInstances] = partition(plugins2, (plugin) => typeof plugin === "string");
  37682. const externalManualLoadPluginInfos = externalPluginNames.map((pluginName) => {
  37683. let requirePath;
  37684. try {
  37685. requirePath = resolve(path.resolve(process.cwd(), pluginName));
  37686. } catch {
  37687. requirePath = resolve(pluginName, {
  37688. paths: [process.cwd()]
  37689. });
  37690. }
  37691. return {
  37692. name: pluginName,
  37693. requirePath
  37694. };
  37695. });
  37696. const externalAutoLoadPluginInfos = pluginSearchDirs.flatMap((pluginSearchDir) => {
  37697. const resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
  37698. const nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules");
  37699. if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
  37700. throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
  37701. }
  37702. return memoizedSearch(nodeModulesDir).map((pluginName) => ({
  37703. name: pluginName,
  37704. requirePath: resolve(pluginName, {
  37705. paths: [resolvedPluginSearchDir]
  37706. })
  37707. }));
  37708. });
  37709. const externalPlugins = [...uniqByKey([...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos], "requirePath").map((externalPluginInfo) => Object.assign({
  37710. name: externalPluginInfo.name
  37711. }, require(externalPluginInfo.requirePath))), ...externalPluginInstances];
  37712. return [...internalPlugins, ...externalPlugins];
  37713. }
  37714. function findPluginsInNodeModules(nodeModulesDir) {
  37715. const pluginPackageJsonPaths = fastGlob.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
  37716. cwd: nodeModulesDir
  37717. });
  37718. return pluginPackageJsonPaths.map(path.dirname);
  37719. }
  37720. function isDirectory(dir) {
  37721. try {
  37722. return fs.statSync(dir).isDirectory();
  37723. } catch {
  37724. return false;
  37725. }
  37726. }
  37727. module2.exports = {
  37728. loadPlugins: memoizedLoad,
  37729. clearCache
  37730. };
  37731. }
  37732. });
  37733. var {
  37734. version
  37735. } = require("./package.json");
  37736. var core = require_core();
  37737. var {
  37738. getSupportInfo
  37739. } = require_support();
  37740. var getFileInfo = require_get_file_info();
  37741. var sharedUtil = require_util_shared();
  37742. var plugins = require_load_plugins();
  37743. var config = require_resolve_config();
  37744. var doc = require("./doc.js");
  37745. function _withPlugins(fn, optsArgIdx = 1) {
  37746. return (...args) => {
  37747. const opts = args[optsArgIdx] || {};
  37748. args[optsArgIdx] = Object.assign(Object.assign({}, opts), {}, {
  37749. plugins: plugins.loadPlugins(opts.plugins, opts.pluginSearchDirs)
  37750. });
  37751. return fn(...args);
  37752. };
  37753. }
  37754. function withPlugins(fn, optsArgIdx) {
  37755. const resultingFn = _withPlugins(fn, optsArgIdx);
  37756. if (fn.sync) {
  37757. resultingFn.sync = _withPlugins(fn.sync, optsArgIdx);
  37758. }
  37759. return resultingFn;
  37760. }
  37761. var formatWithCursor = withPlugins(core.formatWithCursor);
  37762. module.exports = {
  37763. formatWithCursor,
  37764. format(text, opts) {
  37765. return formatWithCursor(text, opts).formatted;
  37766. },
  37767. check(text, opts) {
  37768. const {
  37769. formatted
  37770. } = formatWithCursor(text, opts);
  37771. return formatted === text;
  37772. },
  37773. doc,
  37774. resolveConfig: config.resolveConfig,
  37775. resolveConfigFile: config.resolveConfigFile,
  37776. clearConfigCache() {
  37777. config.clearCache();
  37778. plugins.clearCache();
  37779. },
  37780. getFileInfo: withPlugins(getFileInfo),
  37781. getSupportInfo: withPlugins(getSupportInfo, 0),
  37782. version,
  37783. util: sharedUtil,
  37784. __internal: {
  37785. errors: require_errors(),
  37786. coreOptions: require_core_options(),
  37787. createIgnorer: require_create_ignorer(),
  37788. optionsModule: require_options(),
  37789. optionsNormalizer: require_options_normalizer(),
  37790. utils: {
  37791. arrayify: require_arrayify(),
  37792. getLast: require_get_last(),
  37793. partition: require_partition(),
  37794. isNonEmptyArray: require_util().isNonEmptyArray
  37795. }
  37796. },
  37797. __debug: {
  37798. parse: withPlugins(core.parse),
  37799. formatAST: withPlugins(core.formatAST),
  37800. formatDoc: withPlugins(core.formatDoc),
  37801. printToDoc: withPlugins(core.printToDoc),
  37802. printDocToString: withPlugins(core.printDocToString)
  37803. }
  37804. };