index.js 1.4 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236
  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 call = FunctionPrototype.call;
  93. var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype.bind.bind(call, call);
  94. module2.exports = NATIVE_BIND ? uncurryThisWithBind : function(fn) {
  95. return function() {
  96. return call.apply(fn, arguments);
  97. };
  98. };
  99. }
  100. });
  101. // node_modules/core-js/internals/classof-raw.js
  102. var require_classof_raw = __commonJS({
  103. "node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
  104. var uncurryThis = require_function_uncurry_this();
  105. var toString = uncurryThis({}.toString);
  106. var stringSlice = uncurryThis("".slice);
  107. module2.exports = function(it) {
  108. return stringSlice(toString(it), 8, -1);
  109. };
  110. }
  111. });
  112. // node_modules/core-js/internals/indexed-object.js
  113. var require_indexed_object = __commonJS({
  114. "node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
  115. var uncurryThis = require_function_uncurry_this();
  116. var fails = require_fails();
  117. var classof = require_classof_raw();
  118. var $Object = Object;
  119. var split = uncurryThis("".split);
  120. module2.exports = fails(function() {
  121. return !$Object("z").propertyIsEnumerable(0);
  122. }) ? function(it) {
  123. return classof(it) == "String" ? split(it, "") : $Object(it);
  124. } : $Object;
  125. }
  126. });
  127. // node_modules/core-js/internals/is-null-or-undefined.js
  128. var require_is_null_or_undefined = __commonJS({
  129. "node_modules/core-js/internals/is-null-or-undefined.js"(exports2, module2) {
  130. module2.exports = function(it) {
  131. return it === null || it === void 0;
  132. };
  133. }
  134. });
  135. // node_modules/core-js/internals/require-object-coercible.js
  136. var require_require_object_coercible = __commonJS({
  137. "node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
  138. var isNullOrUndefined = require_is_null_or_undefined();
  139. var $TypeError = TypeError;
  140. module2.exports = function(it) {
  141. if (isNullOrUndefined(it))
  142. throw $TypeError("Can't call method on " + it);
  143. return it;
  144. };
  145. }
  146. });
  147. // node_modules/core-js/internals/to-indexed-object.js
  148. var require_to_indexed_object = __commonJS({
  149. "node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
  150. var IndexedObject = require_indexed_object();
  151. var requireObjectCoercible = require_require_object_coercible();
  152. module2.exports = function(it) {
  153. return IndexedObject(requireObjectCoercible(it));
  154. };
  155. }
  156. });
  157. // node_modules/core-js/internals/document-all.js
  158. var require_document_all = __commonJS({
  159. "node_modules/core-js/internals/document-all.js"(exports2, module2) {
  160. var documentAll = typeof document == "object" && document.all;
  161. var IS_HTMLDDA = typeof documentAll == "undefined" && documentAll !== void 0;
  162. module2.exports = {
  163. all: documentAll,
  164. IS_HTMLDDA
  165. };
  166. }
  167. });
  168. // node_modules/core-js/internals/is-callable.js
  169. var require_is_callable = __commonJS({
  170. "node_modules/core-js/internals/is-callable.js"(exports2, module2) {
  171. var $documentAll = require_document_all();
  172. var documentAll = $documentAll.all;
  173. module2.exports = $documentAll.IS_HTMLDDA ? function(argument) {
  174. return typeof argument == "function" || argument === documentAll;
  175. } : function(argument) {
  176. return typeof argument == "function";
  177. };
  178. }
  179. });
  180. // node_modules/core-js/internals/is-object.js
  181. var require_is_object = __commonJS({
  182. "node_modules/core-js/internals/is-object.js"(exports2, module2) {
  183. var isCallable = require_is_callable();
  184. var $documentAll = require_document_all();
  185. var documentAll = $documentAll.all;
  186. module2.exports = $documentAll.IS_HTMLDDA ? function(it) {
  187. return typeof it == "object" ? it !== null : isCallable(it) || it === documentAll;
  188. } : function(it) {
  189. return typeof it == "object" ? it !== null : isCallable(it);
  190. };
  191. }
  192. });
  193. // node_modules/core-js/internals/get-built-in.js
  194. var require_get_built_in = __commonJS({
  195. "node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
  196. var global2 = require_global();
  197. var isCallable = require_is_callable();
  198. var aFunction = function(argument) {
  199. return isCallable(argument) ? argument : void 0;
  200. };
  201. module2.exports = function(namespace, method) {
  202. return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
  203. };
  204. }
  205. });
  206. // node_modules/core-js/internals/object-is-prototype-of.js
  207. var require_object_is_prototype_of = __commonJS({
  208. "node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
  209. var uncurryThis = require_function_uncurry_this();
  210. module2.exports = uncurryThis({}.isPrototypeOf);
  211. }
  212. });
  213. // node_modules/core-js/internals/engine-user-agent.js
  214. var require_engine_user_agent = __commonJS({
  215. "node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
  216. var getBuiltIn = require_get_built_in();
  217. module2.exports = getBuiltIn("navigator", "userAgent") || "";
  218. }
  219. });
  220. // node_modules/core-js/internals/engine-v8-version.js
  221. var require_engine_v8_version = __commonJS({
  222. "node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
  223. var global2 = require_global();
  224. var userAgent = require_engine_user_agent();
  225. var process2 = global2.process;
  226. var Deno = global2.Deno;
  227. var versions = process2 && process2.versions || Deno && Deno.version;
  228. var v8 = versions && versions.v8;
  229. var match;
  230. var version2;
  231. if (v8) {
  232. match = v8.split(".");
  233. version2 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  234. }
  235. if (!version2 && userAgent) {
  236. match = userAgent.match(/Edge\/(\d+)/);
  237. if (!match || match[1] >= 74) {
  238. match = userAgent.match(/Chrome\/(\d+)/);
  239. if (match)
  240. version2 = +match[1];
  241. }
  242. }
  243. module2.exports = version2;
  244. }
  245. });
  246. // node_modules/core-js/internals/symbol-constructor-detection.js
  247. var require_symbol_constructor_detection = __commonJS({
  248. "node_modules/core-js/internals/symbol-constructor-detection.js"(exports2, module2) {
  249. var V8_VERSION = require_engine_v8_version();
  250. var fails = require_fails();
  251. module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
  252. var symbol = Symbol();
  253. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  254. });
  255. }
  256. });
  257. // node_modules/core-js/internals/use-symbol-as-uid.js
  258. var require_use_symbol_as_uid = __commonJS({
  259. "node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
  260. var NATIVE_SYMBOL = require_symbol_constructor_detection();
  261. module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
  262. }
  263. });
  264. // node_modules/core-js/internals/is-symbol.js
  265. var require_is_symbol = __commonJS({
  266. "node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
  267. var getBuiltIn = require_get_built_in();
  268. var isCallable = require_is_callable();
  269. var isPrototypeOf = require_object_is_prototype_of();
  270. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  271. var $Object = Object;
  272. module2.exports = USE_SYMBOL_AS_UID ? function(it) {
  273. return typeof it == "symbol";
  274. } : function(it) {
  275. var $Symbol = getBuiltIn("Symbol");
  276. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, $Object(it));
  277. };
  278. }
  279. });
  280. // node_modules/core-js/internals/try-to-string.js
  281. var require_try_to_string = __commonJS({
  282. "node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
  283. var $String = String;
  284. module2.exports = function(argument) {
  285. try {
  286. return $String(argument);
  287. } catch (error) {
  288. return "Object";
  289. }
  290. };
  291. }
  292. });
  293. // node_modules/core-js/internals/a-callable.js
  294. var require_a_callable = __commonJS({
  295. "node_modules/core-js/internals/a-callable.js"(exports2, module2) {
  296. var isCallable = require_is_callable();
  297. var tryToString = require_try_to_string();
  298. var $TypeError = TypeError;
  299. module2.exports = function(argument) {
  300. if (isCallable(argument))
  301. return argument;
  302. throw $TypeError(tryToString(argument) + " is not a function");
  303. };
  304. }
  305. });
  306. // node_modules/core-js/internals/get-method.js
  307. var require_get_method = __commonJS({
  308. "node_modules/core-js/internals/get-method.js"(exports2, module2) {
  309. var aCallable = require_a_callable();
  310. var isNullOrUndefined = require_is_null_or_undefined();
  311. module2.exports = function(V, P) {
  312. var func = V[P];
  313. return isNullOrUndefined(func) ? void 0 : aCallable(func);
  314. };
  315. }
  316. });
  317. // node_modules/core-js/internals/ordinary-to-primitive.js
  318. var require_ordinary_to_primitive = __commonJS({
  319. "node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
  320. var call = require_function_call();
  321. var isCallable = require_is_callable();
  322. var isObject = require_is_object();
  323. var $TypeError = TypeError;
  324. module2.exports = function(input, pref) {
  325. var fn, val;
  326. if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  327. return val;
  328. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  329. return val;
  330. if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  331. return val;
  332. throw $TypeError("Can't convert object to primitive value");
  333. };
  334. }
  335. });
  336. // node_modules/core-js/internals/is-pure.js
  337. var require_is_pure = __commonJS({
  338. "node_modules/core-js/internals/is-pure.js"(exports2, module2) {
  339. module2.exports = false;
  340. }
  341. });
  342. // node_modules/core-js/internals/define-global-property.js
  343. var require_define_global_property = __commonJS({
  344. "node_modules/core-js/internals/define-global-property.js"(exports2, module2) {
  345. var global2 = require_global();
  346. var defineProperty = Object.defineProperty;
  347. module2.exports = function(key, value) {
  348. try {
  349. defineProperty(global2, key, { value, configurable: true, writable: true });
  350. } catch (error) {
  351. global2[key] = value;
  352. }
  353. return value;
  354. };
  355. }
  356. });
  357. // node_modules/core-js/internals/shared-store.js
  358. var require_shared_store = __commonJS({
  359. "node_modules/core-js/internals/shared-store.js"(exports2, module2) {
  360. var global2 = require_global();
  361. var defineGlobalProperty = require_define_global_property();
  362. var SHARED = "__core-js_shared__";
  363. var store = global2[SHARED] || defineGlobalProperty(SHARED, {});
  364. module2.exports = store;
  365. }
  366. });
  367. // node_modules/core-js/internals/shared.js
  368. var require_shared = __commonJS({
  369. "node_modules/core-js/internals/shared.js"(exports2, module2) {
  370. var IS_PURE = require_is_pure();
  371. var store = require_shared_store();
  372. (module2.exports = function(key, value) {
  373. return store[key] || (store[key] = value !== void 0 ? value : {});
  374. })("versions", []).push({
  375. version: "3.26.1",
  376. mode: IS_PURE ? "pure" : "global",
  377. copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
  378. license: "https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",
  379. source: "https://github.com/zloirock/core-js"
  380. });
  381. }
  382. });
  383. // node_modules/core-js/internals/to-object.js
  384. var require_to_object = __commonJS({
  385. "node_modules/core-js/internals/to-object.js"(exports2, module2) {
  386. var requireObjectCoercible = require_require_object_coercible();
  387. var $Object = Object;
  388. module2.exports = function(argument) {
  389. return $Object(requireObjectCoercible(argument));
  390. };
  391. }
  392. });
  393. // node_modules/core-js/internals/has-own-property.js
  394. var require_has_own_property = __commonJS({
  395. "node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
  396. var uncurryThis = require_function_uncurry_this();
  397. var toObject = require_to_object();
  398. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  399. module2.exports = Object.hasOwn || function hasOwn(it, key) {
  400. return hasOwnProperty(toObject(it), key);
  401. };
  402. }
  403. });
  404. // node_modules/core-js/internals/uid.js
  405. var require_uid = __commonJS({
  406. "node_modules/core-js/internals/uid.js"(exports2, module2) {
  407. var uncurryThis = require_function_uncurry_this();
  408. var id = 0;
  409. var postfix = Math.random();
  410. var toString = uncurryThis(1 .toString);
  411. module2.exports = function(key) {
  412. return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
  413. };
  414. }
  415. });
  416. // node_modules/core-js/internals/well-known-symbol.js
  417. var require_well_known_symbol = __commonJS({
  418. "node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
  419. var global2 = require_global();
  420. var shared = require_shared();
  421. var hasOwn = require_has_own_property();
  422. var uid = require_uid();
  423. var NATIVE_SYMBOL = require_symbol_constructor_detection();
  424. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  425. var WellKnownSymbolsStore = shared("wks");
  426. var Symbol2 = global2.Symbol;
  427. var symbolFor = Symbol2 && Symbol2["for"];
  428. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
  429. module2.exports = function(name) {
  430. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
  431. var description = "Symbol." + name;
  432. if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
  433. WellKnownSymbolsStore[name] = Symbol2[name];
  434. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  435. WellKnownSymbolsStore[name] = symbolFor(description);
  436. } else {
  437. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  438. }
  439. }
  440. return WellKnownSymbolsStore[name];
  441. };
  442. }
  443. });
  444. // node_modules/core-js/internals/to-primitive.js
  445. var require_to_primitive = __commonJS({
  446. "node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
  447. var call = require_function_call();
  448. var isObject = require_is_object();
  449. var isSymbol = require_is_symbol();
  450. var getMethod = require_get_method();
  451. var ordinaryToPrimitive = require_ordinary_to_primitive();
  452. var wellKnownSymbol = require_well_known_symbol();
  453. var $TypeError = TypeError;
  454. var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
  455. module2.exports = function(input, pref) {
  456. if (!isObject(input) || isSymbol(input))
  457. return input;
  458. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  459. var result;
  460. if (exoticToPrim) {
  461. if (pref === void 0)
  462. pref = "default";
  463. result = call(exoticToPrim, input, pref);
  464. if (!isObject(result) || isSymbol(result))
  465. return result;
  466. throw $TypeError("Can't convert object to primitive value");
  467. }
  468. if (pref === void 0)
  469. pref = "number";
  470. return ordinaryToPrimitive(input, pref);
  471. };
  472. }
  473. });
  474. // node_modules/core-js/internals/to-property-key.js
  475. var require_to_property_key = __commonJS({
  476. "node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
  477. var toPrimitive = require_to_primitive();
  478. var isSymbol = require_is_symbol();
  479. module2.exports = function(argument) {
  480. var key = toPrimitive(argument, "string");
  481. return isSymbol(key) ? key : key + "";
  482. };
  483. }
  484. });
  485. // node_modules/core-js/internals/document-create-element.js
  486. var require_document_create_element = __commonJS({
  487. "node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
  488. var global2 = require_global();
  489. var isObject = require_is_object();
  490. var document2 = global2.document;
  491. var EXISTS = isObject(document2) && isObject(document2.createElement);
  492. module2.exports = function(it) {
  493. return EXISTS ? document2.createElement(it) : {};
  494. };
  495. }
  496. });
  497. // node_modules/core-js/internals/ie8-dom-define.js
  498. var require_ie8_dom_define = __commonJS({
  499. "node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
  500. var DESCRIPTORS = require_descriptors();
  501. var fails = require_fails();
  502. var createElement = require_document_create_element();
  503. module2.exports = !DESCRIPTORS && !fails(function() {
  504. return Object.defineProperty(createElement("div"), "a", {
  505. get: function() {
  506. return 7;
  507. }
  508. }).a != 7;
  509. });
  510. }
  511. });
  512. // node_modules/core-js/internals/object-get-own-property-descriptor.js
  513. var require_object_get_own_property_descriptor = __commonJS({
  514. "node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
  515. var DESCRIPTORS = require_descriptors();
  516. var call = require_function_call();
  517. var propertyIsEnumerableModule = require_object_property_is_enumerable();
  518. var createPropertyDescriptor = require_create_property_descriptor();
  519. var toIndexedObject = require_to_indexed_object();
  520. var toPropertyKey = require_to_property_key();
  521. var hasOwn = require_has_own_property();
  522. var IE8_DOM_DEFINE = require_ie8_dom_define();
  523. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  524. exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  525. O = toIndexedObject(O);
  526. P = toPropertyKey(P);
  527. if (IE8_DOM_DEFINE)
  528. try {
  529. return $getOwnPropertyDescriptor(O, P);
  530. } catch (error) {
  531. }
  532. if (hasOwn(O, P))
  533. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  534. };
  535. }
  536. });
  537. // node_modules/core-js/internals/v8-prototype-define-bug.js
  538. var require_v8_prototype_define_bug = __commonJS({
  539. "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
  540. var DESCRIPTORS = require_descriptors();
  541. var fails = require_fails();
  542. module2.exports = DESCRIPTORS && fails(function() {
  543. return Object.defineProperty(function() {
  544. }, "prototype", {
  545. value: 42,
  546. writable: false
  547. }).prototype != 42;
  548. });
  549. }
  550. });
  551. // node_modules/core-js/internals/an-object.js
  552. var require_an_object = __commonJS({
  553. "node_modules/core-js/internals/an-object.js"(exports2, module2) {
  554. var isObject = require_is_object();
  555. var $String = String;
  556. var $TypeError = TypeError;
  557. module2.exports = function(argument) {
  558. if (isObject(argument))
  559. return argument;
  560. throw $TypeError($String(argument) + " is not an object");
  561. };
  562. }
  563. });
  564. // node_modules/core-js/internals/object-define-property.js
  565. var require_object_define_property = __commonJS({
  566. "node_modules/core-js/internals/object-define-property.js"(exports2) {
  567. var DESCRIPTORS = require_descriptors();
  568. var IE8_DOM_DEFINE = require_ie8_dom_define();
  569. var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
  570. var anObject = require_an_object();
  571. var toPropertyKey = require_to_property_key();
  572. var $TypeError = TypeError;
  573. var $defineProperty = Object.defineProperty;
  574. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  575. var ENUMERABLE = "enumerable";
  576. var CONFIGURABLE = "configurable";
  577. var WRITABLE = "writable";
  578. exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  579. anObject(O);
  580. P = toPropertyKey(P);
  581. anObject(Attributes);
  582. if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  583. var current = $getOwnPropertyDescriptor(O, P);
  584. if (current && current[WRITABLE]) {
  585. O[P] = Attributes.value;
  586. Attributes = {
  587. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  588. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  589. writable: false
  590. };
  591. }
  592. }
  593. return $defineProperty(O, P, Attributes);
  594. } : $defineProperty : function defineProperty(O, P, Attributes) {
  595. anObject(O);
  596. P = toPropertyKey(P);
  597. anObject(Attributes);
  598. if (IE8_DOM_DEFINE)
  599. try {
  600. return $defineProperty(O, P, Attributes);
  601. } catch (error) {
  602. }
  603. if ("get" in Attributes || "set" in Attributes)
  604. throw $TypeError("Accessors not supported");
  605. if ("value" in Attributes)
  606. O[P] = Attributes.value;
  607. return O;
  608. };
  609. }
  610. });
  611. // node_modules/core-js/internals/create-non-enumerable-property.js
  612. var require_create_non_enumerable_property = __commonJS({
  613. "node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
  614. var DESCRIPTORS = require_descriptors();
  615. var definePropertyModule = require_object_define_property();
  616. var createPropertyDescriptor = require_create_property_descriptor();
  617. module2.exports = DESCRIPTORS ? function(object, key, value) {
  618. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  619. } : function(object, key, value) {
  620. object[key] = value;
  621. return object;
  622. };
  623. }
  624. });
  625. // node_modules/core-js/internals/function-name.js
  626. var require_function_name = __commonJS({
  627. "node_modules/core-js/internals/function-name.js"(exports2, module2) {
  628. var DESCRIPTORS = require_descriptors();
  629. var hasOwn = require_has_own_property();
  630. var FunctionPrototype = Function.prototype;
  631. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  632. var EXISTS = hasOwn(FunctionPrototype, "name");
  633. var PROPER = EXISTS && function something() {
  634. }.name === "something";
  635. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
  636. module2.exports = {
  637. EXISTS,
  638. PROPER,
  639. CONFIGURABLE
  640. };
  641. }
  642. });
  643. // node_modules/core-js/internals/inspect-source.js
  644. var require_inspect_source = __commonJS({
  645. "node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
  646. var uncurryThis = require_function_uncurry_this();
  647. var isCallable = require_is_callable();
  648. var store = require_shared_store();
  649. var functionToString = uncurryThis(Function.toString);
  650. if (!isCallable(store.inspectSource)) {
  651. store.inspectSource = function(it) {
  652. return functionToString(it);
  653. };
  654. }
  655. module2.exports = store.inspectSource;
  656. }
  657. });
  658. // node_modules/core-js/internals/weak-map-basic-detection.js
  659. var require_weak_map_basic_detection = __commonJS({
  660. "node_modules/core-js/internals/weak-map-basic-detection.js"(exports2, module2) {
  661. var global2 = require_global();
  662. var isCallable = require_is_callable();
  663. var WeakMap2 = global2.WeakMap;
  664. module2.exports = isCallable(WeakMap2) && /native code/.test(String(WeakMap2));
  665. }
  666. });
  667. // node_modules/core-js/internals/shared-key.js
  668. var require_shared_key = __commonJS({
  669. "node_modules/core-js/internals/shared-key.js"(exports2, module2) {
  670. var shared = require_shared();
  671. var uid = require_uid();
  672. var keys = shared("keys");
  673. module2.exports = function(key) {
  674. return keys[key] || (keys[key] = uid(key));
  675. };
  676. }
  677. });
  678. // node_modules/core-js/internals/hidden-keys.js
  679. var require_hidden_keys = __commonJS({
  680. "node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
  681. module2.exports = {};
  682. }
  683. });
  684. // node_modules/core-js/internals/internal-state.js
  685. var require_internal_state = __commonJS({
  686. "node_modules/core-js/internals/internal-state.js"(exports2, module2) {
  687. var NATIVE_WEAK_MAP = require_weak_map_basic_detection();
  688. var global2 = require_global();
  689. var isObject = require_is_object();
  690. var createNonEnumerableProperty = require_create_non_enumerable_property();
  691. var hasOwn = require_has_own_property();
  692. var shared = require_shared_store();
  693. var sharedKey = require_shared_key();
  694. var hiddenKeys = require_hidden_keys();
  695. var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
  696. var TypeError2 = global2.TypeError;
  697. var WeakMap2 = global2.WeakMap;
  698. var set;
  699. var get;
  700. var has;
  701. var enforce = function(it) {
  702. return has(it) ? get(it) : set(it, {});
  703. };
  704. var getterFor = function(TYPE) {
  705. return function(it) {
  706. var state;
  707. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  708. throw TypeError2("Incompatible receiver, " + TYPE + " required");
  709. }
  710. return state;
  711. };
  712. };
  713. if (NATIVE_WEAK_MAP || shared.state) {
  714. store = shared.state || (shared.state = new WeakMap2());
  715. store.get = store.get;
  716. store.has = store.has;
  717. store.set = store.set;
  718. set = function(it, metadata) {
  719. if (store.has(it))
  720. throw TypeError2(OBJECT_ALREADY_INITIALIZED);
  721. metadata.facade = it;
  722. store.set(it, metadata);
  723. return metadata;
  724. };
  725. get = function(it) {
  726. return store.get(it) || {};
  727. };
  728. has = function(it) {
  729. return store.has(it);
  730. };
  731. } else {
  732. STATE = sharedKey("state");
  733. hiddenKeys[STATE] = true;
  734. set = function(it, metadata) {
  735. if (hasOwn(it, STATE))
  736. throw TypeError2(OBJECT_ALREADY_INITIALIZED);
  737. metadata.facade = it;
  738. createNonEnumerableProperty(it, STATE, metadata);
  739. return metadata;
  740. };
  741. get = function(it) {
  742. return hasOwn(it, STATE) ? it[STATE] : {};
  743. };
  744. has = function(it) {
  745. return hasOwn(it, STATE);
  746. };
  747. }
  748. var store;
  749. var STATE;
  750. module2.exports = {
  751. set,
  752. get,
  753. has,
  754. enforce,
  755. getterFor
  756. };
  757. }
  758. });
  759. // node_modules/core-js/internals/make-built-in.js
  760. var require_make_built_in = __commonJS({
  761. "node_modules/core-js/internals/make-built-in.js"(exports2, module2) {
  762. var fails = require_fails();
  763. var isCallable = require_is_callable();
  764. var hasOwn = require_has_own_property();
  765. var DESCRIPTORS = require_descriptors();
  766. var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
  767. var inspectSource = require_inspect_source();
  768. var InternalStateModule = require_internal_state();
  769. var enforceInternalState = InternalStateModule.enforce;
  770. var getInternalState = InternalStateModule.get;
  771. var defineProperty = Object.defineProperty;
  772. var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
  773. return defineProperty(function() {
  774. }, "length", { value: 8 }).length !== 8;
  775. });
  776. var TEMPLATE = String(String).split("String");
  777. var makeBuiltIn = module2.exports = function(value, name, options) {
  778. if (String(name).slice(0, 7) === "Symbol(") {
  779. name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
  780. }
  781. if (options && options.getter)
  782. name = "get " + name;
  783. if (options && options.setter)
  784. name = "set " + name;
  785. if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  786. if (DESCRIPTORS)
  787. defineProperty(value, "name", { value: name, configurable: true });
  788. else
  789. value.name = name;
  790. }
  791. if (CONFIGURABLE_LENGTH && options && hasOwn(options, "arity") && value.length !== options.arity) {
  792. defineProperty(value, "length", { value: options.arity });
  793. }
  794. try {
  795. if (options && hasOwn(options, "constructor") && options.constructor) {
  796. if (DESCRIPTORS)
  797. defineProperty(value, "prototype", { writable: false });
  798. } else if (value.prototype)
  799. value.prototype = void 0;
  800. } catch (error) {
  801. }
  802. var state = enforceInternalState(value);
  803. if (!hasOwn(state, "source")) {
  804. state.source = TEMPLATE.join(typeof name == "string" ? name : "");
  805. }
  806. return value;
  807. };
  808. Function.prototype.toString = makeBuiltIn(function toString() {
  809. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  810. }, "toString");
  811. }
  812. });
  813. // node_modules/core-js/internals/define-built-in.js
  814. var require_define_built_in = __commonJS({
  815. "node_modules/core-js/internals/define-built-in.js"(exports2, module2) {
  816. var isCallable = require_is_callable();
  817. var definePropertyModule = require_object_define_property();
  818. var makeBuiltIn = require_make_built_in();
  819. var defineGlobalProperty = require_define_global_property();
  820. module2.exports = function(O, key, value, options) {
  821. if (!options)
  822. options = {};
  823. var simple = options.enumerable;
  824. var name = options.name !== void 0 ? options.name : key;
  825. if (isCallable(value))
  826. makeBuiltIn(value, name, options);
  827. if (options.global) {
  828. if (simple)
  829. O[key] = value;
  830. else
  831. defineGlobalProperty(key, value);
  832. } else {
  833. try {
  834. if (!options.unsafe)
  835. delete O[key];
  836. else if (O[key])
  837. simple = true;
  838. } catch (error) {
  839. }
  840. if (simple)
  841. O[key] = value;
  842. else
  843. definePropertyModule.f(O, key, {
  844. value,
  845. enumerable: false,
  846. configurable: !options.nonConfigurable,
  847. writable: !options.nonWritable
  848. });
  849. }
  850. return O;
  851. };
  852. }
  853. });
  854. // node_modules/core-js/internals/math-trunc.js
  855. var require_math_trunc = __commonJS({
  856. "node_modules/core-js/internals/math-trunc.js"(exports2, module2) {
  857. var ceil = Math.ceil;
  858. var floor = Math.floor;
  859. module2.exports = Math.trunc || function trunc(x) {
  860. var n = +x;
  861. return (n > 0 ? floor : ceil)(n);
  862. };
  863. }
  864. });
  865. // node_modules/core-js/internals/to-integer-or-infinity.js
  866. var require_to_integer_or_infinity = __commonJS({
  867. "node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
  868. var trunc = require_math_trunc();
  869. module2.exports = function(argument) {
  870. var number = +argument;
  871. return number !== number || number === 0 ? 0 : trunc(number);
  872. };
  873. }
  874. });
  875. // node_modules/core-js/internals/to-absolute-index.js
  876. var require_to_absolute_index = __commonJS({
  877. "node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
  878. var toIntegerOrInfinity = require_to_integer_or_infinity();
  879. var max = Math.max;
  880. var min = Math.min;
  881. module2.exports = function(index, length) {
  882. var integer = toIntegerOrInfinity(index);
  883. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  884. };
  885. }
  886. });
  887. // node_modules/core-js/internals/to-length.js
  888. var require_to_length = __commonJS({
  889. "node_modules/core-js/internals/to-length.js"(exports2, module2) {
  890. var toIntegerOrInfinity = require_to_integer_or_infinity();
  891. var min = Math.min;
  892. module2.exports = function(argument) {
  893. return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
  894. };
  895. }
  896. });
  897. // node_modules/core-js/internals/length-of-array-like.js
  898. var require_length_of_array_like = __commonJS({
  899. "node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
  900. var toLength = require_to_length();
  901. module2.exports = function(obj) {
  902. return toLength(obj.length);
  903. };
  904. }
  905. });
  906. // node_modules/core-js/internals/array-includes.js
  907. var require_array_includes = __commonJS({
  908. "node_modules/core-js/internals/array-includes.js"(exports2, module2) {
  909. var toIndexedObject = require_to_indexed_object();
  910. var toAbsoluteIndex = require_to_absolute_index();
  911. var lengthOfArrayLike = require_length_of_array_like();
  912. var createMethod = function(IS_INCLUDES) {
  913. return function($this, el, fromIndex) {
  914. var O = toIndexedObject($this);
  915. var length = lengthOfArrayLike(O);
  916. var index = toAbsoluteIndex(fromIndex, length);
  917. var value;
  918. if (IS_INCLUDES && el != el)
  919. while (length > index) {
  920. value = O[index++];
  921. if (value != value)
  922. return true;
  923. }
  924. else
  925. for (; length > index; index++) {
  926. if ((IS_INCLUDES || index in O) && O[index] === el)
  927. return IS_INCLUDES || index || 0;
  928. }
  929. return !IS_INCLUDES && -1;
  930. };
  931. };
  932. module2.exports = {
  933. includes: createMethod(true),
  934. indexOf: createMethod(false)
  935. };
  936. }
  937. });
  938. // node_modules/core-js/internals/object-keys-internal.js
  939. var require_object_keys_internal = __commonJS({
  940. "node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
  941. var uncurryThis = require_function_uncurry_this();
  942. var hasOwn = require_has_own_property();
  943. var toIndexedObject = require_to_indexed_object();
  944. var indexOf = require_array_includes().indexOf;
  945. var hiddenKeys = require_hidden_keys();
  946. var push = uncurryThis([].push);
  947. module2.exports = function(object, names) {
  948. var O = toIndexedObject(object);
  949. var i = 0;
  950. var result = [];
  951. var key;
  952. for (key in O)
  953. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  954. while (names.length > i)
  955. if (hasOwn(O, key = names[i++])) {
  956. ~indexOf(result, key) || push(result, key);
  957. }
  958. return result;
  959. };
  960. }
  961. });
  962. // node_modules/core-js/internals/enum-bug-keys.js
  963. var require_enum_bug_keys = __commonJS({
  964. "node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
  965. module2.exports = [
  966. "constructor",
  967. "hasOwnProperty",
  968. "isPrototypeOf",
  969. "propertyIsEnumerable",
  970. "toLocaleString",
  971. "toString",
  972. "valueOf"
  973. ];
  974. }
  975. });
  976. // node_modules/core-js/internals/object-get-own-property-names.js
  977. var require_object_get_own_property_names = __commonJS({
  978. "node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
  979. var internalObjectKeys = require_object_keys_internal();
  980. var enumBugKeys = require_enum_bug_keys();
  981. var hiddenKeys = enumBugKeys.concat("length", "prototype");
  982. exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  983. return internalObjectKeys(O, hiddenKeys);
  984. };
  985. }
  986. });
  987. // node_modules/core-js/internals/object-get-own-property-symbols.js
  988. var require_object_get_own_property_symbols = __commonJS({
  989. "node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
  990. exports2.f = Object.getOwnPropertySymbols;
  991. }
  992. });
  993. // node_modules/core-js/internals/own-keys.js
  994. var require_own_keys = __commonJS({
  995. "node_modules/core-js/internals/own-keys.js"(exports2, module2) {
  996. var getBuiltIn = require_get_built_in();
  997. var uncurryThis = require_function_uncurry_this();
  998. var getOwnPropertyNamesModule = require_object_get_own_property_names();
  999. var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
  1000. var anObject = require_an_object();
  1001. var concat = uncurryThis([].concat);
  1002. module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
  1003. var keys = getOwnPropertyNamesModule.f(anObject(it));
  1004. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  1005. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  1006. };
  1007. }
  1008. });
  1009. // node_modules/core-js/internals/copy-constructor-properties.js
  1010. var require_copy_constructor_properties = __commonJS({
  1011. "node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
  1012. var hasOwn = require_has_own_property();
  1013. var ownKeys = require_own_keys();
  1014. var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
  1015. var definePropertyModule = require_object_define_property();
  1016. module2.exports = function(target, source, exceptions) {
  1017. var keys = ownKeys(source);
  1018. var defineProperty = definePropertyModule.f;
  1019. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  1020. for (var i = 0; i < keys.length; i++) {
  1021. var key = keys[i];
  1022. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  1023. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  1024. }
  1025. }
  1026. };
  1027. }
  1028. });
  1029. // node_modules/core-js/internals/is-forced.js
  1030. var require_is_forced = __commonJS({
  1031. "node_modules/core-js/internals/is-forced.js"(exports2, module2) {
  1032. var fails = require_fails();
  1033. var isCallable = require_is_callable();
  1034. var replacement = /#|\.prototype\./;
  1035. var isForced = function(feature, detection) {
  1036. var value = data[normalize(feature)];
  1037. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  1038. };
  1039. var normalize = isForced.normalize = function(string) {
  1040. return String(string).replace(replacement, ".").toLowerCase();
  1041. };
  1042. var data = isForced.data = {};
  1043. var NATIVE = isForced.NATIVE = "N";
  1044. var POLYFILL = isForced.POLYFILL = "P";
  1045. module2.exports = isForced;
  1046. }
  1047. });
  1048. // node_modules/core-js/internals/export.js
  1049. var require_export = __commonJS({
  1050. "node_modules/core-js/internals/export.js"(exports2, module2) {
  1051. var global2 = require_global();
  1052. var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
  1053. var createNonEnumerableProperty = require_create_non_enumerable_property();
  1054. var defineBuiltIn = require_define_built_in();
  1055. var defineGlobalProperty = require_define_global_property();
  1056. var copyConstructorProperties = require_copy_constructor_properties();
  1057. var isForced = require_is_forced();
  1058. module2.exports = function(options, source) {
  1059. var TARGET = options.target;
  1060. var GLOBAL = options.global;
  1061. var STATIC = options.stat;
  1062. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  1063. if (GLOBAL) {
  1064. target = global2;
  1065. } else if (STATIC) {
  1066. target = global2[TARGET] || defineGlobalProperty(TARGET, {});
  1067. } else {
  1068. target = (global2[TARGET] || {}).prototype;
  1069. }
  1070. if (target)
  1071. for (key in source) {
  1072. sourceProperty = source[key];
  1073. if (options.dontCallGetSet) {
  1074. descriptor = getOwnPropertyDescriptor(target, key);
  1075. targetProperty = descriptor && descriptor.value;
  1076. } else
  1077. targetProperty = target[key];
  1078. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
  1079. if (!FORCED && targetProperty !== void 0) {
  1080. if (typeof sourceProperty == typeof targetProperty)
  1081. continue;
  1082. copyConstructorProperties(sourceProperty, targetProperty);
  1083. }
  1084. if (options.sham || targetProperty && targetProperty.sham) {
  1085. createNonEnumerableProperty(sourceProperty, "sham", true);
  1086. }
  1087. defineBuiltIn(target, key, sourceProperty, options);
  1088. }
  1089. };
  1090. }
  1091. });
  1092. // node_modules/core-js/internals/is-array.js
  1093. var require_is_array = __commonJS({
  1094. "node_modules/core-js/internals/is-array.js"(exports2, module2) {
  1095. var classof = require_classof_raw();
  1096. module2.exports = Array.isArray || function isArray(argument) {
  1097. return classof(argument) == "Array";
  1098. };
  1099. }
  1100. });
  1101. // node_modules/core-js/internals/does-not-exceed-safe-integer.js
  1102. var require_does_not_exceed_safe_integer = __commonJS({
  1103. "node_modules/core-js/internals/does-not-exceed-safe-integer.js"(exports2, module2) {
  1104. var $TypeError = TypeError;
  1105. var MAX_SAFE_INTEGER = 9007199254740991;
  1106. module2.exports = function(it) {
  1107. if (it > MAX_SAFE_INTEGER)
  1108. throw $TypeError("Maximum allowed index exceeded");
  1109. return it;
  1110. };
  1111. }
  1112. });
  1113. // node_modules/core-js/internals/function-uncurry-this-clause.js
  1114. var require_function_uncurry_this_clause = __commonJS({
  1115. "node_modules/core-js/internals/function-uncurry-this-clause.js"(exports2, module2) {
  1116. var classofRaw = require_classof_raw();
  1117. var uncurryThis = require_function_uncurry_this();
  1118. module2.exports = function(fn) {
  1119. if (classofRaw(fn) === "Function")
  1120. return uncurryThis(fn);
  1121. };
  1122. }
  1123. });
  1124. // node_modules/core-js/internals/function-bind-context.js
  1125. var require_function_bind_context = __commonJS({
  1126. "node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
  1127. var uncurryThis = require_function_uncurry_this_clause();
  1128. var aCallable = require_a_callable();
  1129. var NATIVE_BIND = require_function_bind_native();
  1130. var bind = uncurryThis(uncurryThis.bind);
  1131. module2.exports = function(fn, that) {
  1132. aCallable(fn);
  1133. return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
  1134. return fn.apply(that, arguments);
  1135. };
  1136. };
  1137. }
  1138. });
  1139. // node_modules/core-js/internals/flatten-into-array.js
  1140. var require_flatten_into_array = __commonJS({
  1141. "node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
  1142. "use strict";
  1143. var isArray = require_is_array();
  1144. var lengthOfArrayLike = require_length_of_array_like();
  1145. var doesNotExceedSafeInteger = require_does_not_exceed_safe_integer();
  1146. var bind = require_function_bind_context();
  1147. var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
  1148. var targetIndex = start;
  1149. var sourceIndex = 0;
  1150. var mapFn = mapper ? bind(mapper, thisArg) : false;
  1151. var element, elementLen;
  1152. while (sourceIndex < sourceLen) {
  1153. if (sourceIndex in source) {
  1154. element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
  1155. if (depth > 0 && isArray(element)) {
  1156. elementLen = lengthOfArrayLike(element);
  1157. targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
  1158. } else {
  1159. doesNotExceedSafeInteger(targetIndex + 1);
  1160. target[targetIndex] = element;
  1161. }
  1162. targetIndex++;
  1163. }
  1164. sourceIndex++;
  1165. }
  1166. return targetIndex;
  1167. };
  1168. module2.exports = flattenIntoArray;
  1169. }
  1170. });
  1171. // node_modules/core-js/internals/to-string-tag-support.js
  1172. var require_to_string_tag_support = __commonJS({
  1173. "node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
  1174. var wellKnownSymbol = require_well_known_symbol();
  1175. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1176. var test = {};
  1177. test[TO_STRING_TAG] = "z";
  1178. module2.exports = String(test) === "[object z]";
  1179. }
  1180. });
  1181. // node_modules/core-js/internals/classof.js
  1182. var require_classof = __commonJS({
  1183. "node_modules/core-js/internals/classof.js"(exports2, module2) {
  1184. var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
  1185. var isCallable = require_is_callable();
  1186. var classofRaw = require_classof_raw();
  1187. var wellKnownSymbol = require_well_known_symbol();
  1188. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1189. var $Object = Object;
  1190. var CORRECT_ARGUMENTS = classofRaw(function() {
  1191. return arguments;
  1192. }()) == "Arguments";
  1193. var tryGet = function(it, key) {
  1194. try {
  1195. return it[key];
  1196. } catch (error) {
  1197. }
  1198. };
  1199. module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
  1200. var O, tag, result;
  1201. return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
  1202. };
  1203. }
  1204. });
  1205. // node_modules/core-js/internals/is-constructor.js
  1206. var require_is_constructor = __commonJS({
  1207. "node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
  1208. var uncurryThis = require_function_uncurry_this();
  1209. var fails = require_fails();
  1210. var isCallable = require_is_callable();
  1211. var classof = require_classof();
  1212. var getBuiltIn = require_get_built_in();
  1213. var inspectSource = require_inspect_source();
  1214. var noop = function() {
  1215. };
  1216. var empty = [];
  1217. var construct = getBuiltIn("Reflect", "construct");
  1218. var constructorRegExp = /^\s*(?:class|function)\b/;
  1219. var exec = uncurryThis(constructorRegExp.exec);
  1220. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  1221. var isConstructorModern = function isConstructor(argument) {
  1222. if (!isCallable(argument))
  1223. return false;
  1224. try {
  1225. construct(noop, empty, argument);
  1226. return true;
  1227. } catch (error) {
  1228. return false;
  1229. }
  1230. };
  1231. var isConstructorLegacy = function isConstructor(argument) {
  1232. if (!isCallable(argument))
  1233. return false;
  1234. switch (classof(argument)) {
  1235. case "AsyncFunction":
  1236. case "GeneratorFunction":
  1237. case "AsyncGeneratorFunction":
  1238. return false;
  1239. }
  1240. try {
  1241. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  1242. } catch (error) {
  1243. return true;
  1244. }
  1245. };
  1246. isConstructorLegacy.sham = true;
  1247. module2.exports = !construct || fails(function() {
  1248. var called;
  1249. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
  1250. called = true;
  1251. }) || called;
  1252. }) ? isConstructorLegacy : isConstructorModern;
  1253. }
  1254. });
  1255. // node_modules/core-js/internals/array-species-constructor.js
  1256. var require_array_species_constructor = __commonJS({
  1257. "node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
  1258. var isArray = require_is_array();
  1259. var isConstructor = require_is_constructor();
  1260. var isObject = require_is_object();
  1261. var wellKnownSymbol = require_well_known_symbol();
  1262. var SPECIES = wellKnownSymbol("species");
  1263. var $Array = Array;
  1264. module2.exports = function(originalArray) {
  1265. var C;
  1266. if (isArray(originalArray)) {
  1267. C = originalArray.constructor;
  1268. if (isConstructor(C) && (C === $Array || isArray(C.prototype)))
  1269. C = void 0;
  1270. else if (isObject(C)) {
  1271. C = C[SPECIES];
  1272. if (C === null)
  1273. C = void 0;
  1274. }
  1275. }
  1276. return C === void 0 ? $Array : C;
  1277. };
  1278. }
  1279. });
  1280. // node_modules/core-js/internals/array-species-create.js
  1281. var require_array_species_create = __commonJS({
  1282. "node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
  1283. var arraySpeciesConstructor = require_array_species_constructor();
  1284. module2.exports = function(originalArray, length) {
  1285. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  1286. };
  1287. }
  1288. });
  1289. // node_modules/core-js/modules/es.array.flat-map.js
  1290. var require_es_array_flat_map = __commonJS({
  1291. "node_modules/core-js/modules/es.array.flat-map.js"() {
  1292. "use strict";
  1293. var $ = require_export();
  1294. var flattenIntoArray = require_flatten_into_array();
  1295. var aCallable = require_a_callable();
  1296. var toObject = require_to_object();
  1297. var lengthOfArrayLike = require_length_of_array_like();
  1298. var arraySpeciesCreate = require_array_species_create();
  1299. $({ target: "Array", proto: true }, {
  1300. flatMap: function flatMap(callbackfn) {
  1301. var O = toObject(this);
  1302. var sourceLen = lengthOfArrayLike(O);
  1303. var A;
  1304. aCallable(callbackfn);
  1305. A = arraySpeciesCreate(O, 0);
  1306. A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
  1307. return A;
  1308. }
  1309. });
  1310. }
  1311. });
  1312. // node_modules/core-js/internals/iterators.js
  1313. var require_iterators = __commonJS({
  1314. "node_modules/core-js/internals/iterators.js"(exports2, module2) {
  1315. module2.exports = {};
  1316. }
  1317. });
  1318. // node_modules/core-js/internals/is-array-iterator-method.js
  1319. var require_is_array_iterator_method = __commonJS({
  1320. "node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
  1321. var wellKnownSymbol = require_well_known_symbol();
  1322. var Iterators = require_iterators();
  1323. var ITERATOR = wellKnownSymbol("iterator");
  1324. var ArrayPrototype = Array.prototype;
  1325. module2.exports = function(it) {
  1326. return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  1327. };
  1328. }
  1329. });
  1330. // node_modules/core-js/internals/get-iterator-method.js
  1331. var require_get_iterator_method = __commonJS({
  1332. "node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
  1333. var classof = require_classof();
  1334. var getMethod = require_get_method();
  1335. var isNullOrUndefined = require_is_null_or_undefined();
  1336. var Iterators = require_iterators();
  1337. var wellKnownSymbol = require_well_known_symbol();
  1338. var ITERATOR = wellKnownSymbol("iterator");
  1339. module2.exports = function(it) {
  1340. if (!isNullOrUndefined(it))
  1341. return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
  1342. };
  1343. }
  1344. });
  1345. // node_modules/core-js/internals/get-iterator.js
  1346. var require_get_iterator = __commonJS({
  1347. "node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
  1348. var call = require_function_call();
  1349. var aCallable = require_a_callable();
  1350. var anObject = require_an_object();
  1351. var tryToString = require_try_to_string();
  1352. var getIteratorMethod = require_get_iterator_method();
  1353. var $TypeError = TypeError;
  1354. module2.exports = function(argument, usingIterator) {
  1355. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  1356. if (aCallable(iteratorMethod))
  1357. return anObject(call(iteratorMethod, argument));
  1358. throw $TypeError(tryToString(argument) + " is not iterable");
  1359. };
  1360. }
  1361. });
  1362. // node_modules/core-js/internals/iterator-close.js
  1363. var require_iterator_close = __commonJS({
  1364. "node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
  1365. var call = require_function_call();
  1366. var anObject = require_an_object();
  1367. var getMethod = require_get_method();
  1368. module2.exports = function(iterator, kind, value) {
  1369. var innerResult, innerError;
  1370. anObject(iterator);
  1371. try {
  1372. innerResult = getMethod(iterator, "return");
  1373. if (!innerResult) {
  1374. if (kind === "throw")
  1375. throw value;
  1376. return value;
  1377. }
  1378. innerResult = call(innerResult, iterator);
  1379. } catch (error) {
  1380. innerError = true;
  1381. innerResult = error;
  1382. }
  1383. if (kind === "throw")
  1384. throw value;
  1385. if (innerError)
  1386. throw innerResult;
  1387. anObject(innerResult);
  1388. return value;
  1389. };
  1390. }
  1391. });
  1392. // node_modules/core-js/internals/iterate.js
  1393. var require_iterate = __commonJS({
  1394. "node_modules/core-js/internals/iterate.js"(exports2, module2) {
  1395. var bind = require_function_bind_context();
  1396. var call = require_function_call();
  1397. var anObject = require_an_object();
  1398. var tryToString = require_try_to_string();
  1399. var isArrayIteratorMethod = require_is_array_iterator_method();
  1400. var lengthOfArrayLike = require_length_of_array_like();
  1401. var isPrototypeOf = require_object_is_prototype_of();
  1402. var getIterator = require_get_iterator();
  1403. var getIteratorMethod = require_get_iterator_method();
  1404. var iteratorClose = require_iterator_close();
  1405. var $TypeError = TypeError;
  1406. var Result = function(stopped, result) {
  1407. this.stopped = stopped;
  1408. this.result = result;
  1409. };
  1410. var ResultPrototype = Result.prototype;
  1411. module2.exports = function(iterable, unboundFunction, options) {
  1412. var that = options && options.that;
  1413. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1414. var IS_RECORD = !!(options && options.IS_RECORD);
  1415. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1416. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1417. var fn = bind(unboundFunction, that);
  1418. var iterator, iterFn, index, length, result, next, step;
  1419. var stop = function(condition) {
  1420. if (iterator)
  1421. iteratorClose(iterator, "normal", condition);
  1422. return new Result(true, condition);
  1423. };
  1424. var callFn = function(value) {
  1425. if (AS_ENTRIES) {
  1426. anObject(value);
  1427. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1428. }
  1429. return INTERRUPTED ? fn(value, stop) : fn(value);
  1430. };
  1431. if (IS_RECORD) {
  1432. iterator = iterable.iterator;
  1433. } else if (IS_ITERATOR) {
  1434. iterator = iterable;
  1435. } else {
  1436. iterFn = getIteratorMethod(iterable);
  1437. if (!iterFn)
  1438. throw $TypeError(tryToString(iterable) + " is not iterable");
  1439. if (isArrayIteratorMethod(iterFn)) {
  1440. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1441. result = callFn(iterable[index]);
  1442. if (result && isPrototypeOf(ResultPrototype, result))
  1443. return result;
  1444. }
  1445. return new Result(false);
  1446. }
  1447. iterator = getIterator(iterable, iterFn);
  1448. }
  1449. next = IS_RECORD ? iterable.next : iterator.next;
  1450. while (!(step = call(next, iterator)).done) {
  1451. try {
  1452. result = callFn(step.value);
  1453. } catch (error) {
  1454. iteratorClose(iterator, "throw", error);
  1455. }
  1456. if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
  1457. return result;
  1458. }
  1459. return new Result(false);
  1460. };
  1461. }
  1462. });
  1463. // node_modules/core-js/internals/create-property.js
  1464. var require_create_property = __commonJS({
  1465. "node_modules/core-js/internals/create-property.js"(exports2, module2) {
  1466. "use strict";
  1467. var toPropertyKey = require_to_property_key();
  1468. var definePropertyModule = require_object_define_property();
  1469. var createPropertyDescriptor = require_create_property_descriptor();
  1470. module2.exports = function(object, key, value) {
  1471. var propertyKey = toPropertyKey(key);
  1472. if (propertyKey in object)
  1473. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  1474. else
  1475. object[propertyKey] = value;
  1476. };
  1477. }
  1478. });
  1479. // node_modules/core-js/modules/es.object.from-entries.js
  1480. var require_es_object_from_entries = __commonJS({
  1481. "node_modules/core-js/modules/es.object.from-entries.js"() {
  1482. var $ = require_export();
  1483. var iterate = require_iterate();
  1484. var createProperty = require_create_property();
  1485. $({ target: "Object", stat: true }, {
  1486. fromEntries: function fromEntries(iterable) {
  1487. var obj = {};
  1488. iterate(iterable, function(k, v) {
  1489. createProperty(obj, k, v);
  1490. }, { AS_ENTRIES: true });
  1491. return obj;
  1492. }
  1493. });
  1494. }
  1495. });
  1496. // node_modules/core-js/internals/define-built-in-accessor.js
  1497. var require_define_built_in_accessor = __commonJS({
  1498. "node_modules/core-js/internals/define-built-in-accessor.js"(exports2, module2) {
  1499. var makeBuiltIn = require_make_built_in();
  1500. var defineProperty = require_object_define_property();
  1501. module2.exports = function(target, name, descriptor) {
  1502. if (descriptor.get)
  1503. makeBuiltIn(descriptor.get, name, { getter: true });
  1504. if (descriptor.set)
  1505. makeBuiltIn(descriptor.set, name, { setter: true });
  1506. return defineProperty.f(target, name, descriptor);
  1507. };
  1508. }
  1509. });
  1510. // node_modules/core-js/internals/regexp-flags.js
  1511. var require_regexp_flags = __commonJS({
  1512. "node_modules/core-js/internals/regexp-flags.js"(exports2, module2) {
  1513. "use strict";
  1514. var anObject = require_an_object();
  1515. module2.exports = function() {
  1516. var that = anObject(this);
  1517. var result = "";
  1518. if (that.hasIndices)
  1519. result += "d";
  1520. if (that.global)
  1521. result += "g";
  1522. if (that.ignoreCase)
  1523. result += "i";
  1524. if (that.multiline)
  1525. result += "m";
  1526. if (that.dotAll)
  1527. result += "s";
  1528. if (that.unicode)
  1529. result += "u";
  1530. if (that.unicodeSets)
  1531. result += "v";
  1532. if (that.sticky)
  1533. result += "y";
  1534. return result;
  1535. };
  1536. }
  1537. });
  1538. // node_modules/core-js/modules/es.regexp.flags.js
  1539. var require_es_regexp_flags = __commonJS({
  1540. "node_modules/core-js/modules/es.regexp.flags.js"() {
  1541. var global2 = require_global();
  1542. var DESCRIPTORS = require_descriptors();
  1543. var defineBuiltInAccessor = require_define_built_in_accessor();
  1544. var regExpFlags = require_regexp_flags();
  1545. var fails = require_fails();
  1546. var RegExp2 = global2.RegExp;
  1547. var RegExpPrototype = RegExp2.prototype;
  1548. var FORCED = DESCRIPTORS && fails(function() {
  1549. var INDICES_SUPPORT = true;
  1550. try {
  1551. RegExp2(".", "d");
  1552. } catch (error) {
  1553. INDICES_SUPPORT = false;
  1554. }
  1555. var O = {};
  1556. var calls = "";
  1557. var expected = INDICES_SUPPORT ? "dgimsy" : "gimsy";
  1558. var addGetter = function(key2, chr) {
  1559. Object.defineProperty(O, key2, { get: function() {
  1560. calls += chr;
  1561. return true;
  1562. } });
  1563. };
  1564. var pairs = {
  1565. dotAll: "s",
  1566. global: "g",
  1567. ignoreCase: "i",
  1568. multiline: "m",
  1569. sticky: "y"
  1570. };
  1571. if (INDICES_SUPPORT)
  1572. pairs.hasIndices = "d";
  1573. for (var key in pairs)
  1574. addGetter(key, pairs[key]);
  1575. var result = Object.getOwnPropertyDescriptor(RegExpPrototype, "flags").get.call(O);
  1576. return result !== expected || calls !== expected;
  1577. });
  1578. if (FORCED)
  1579. defineBuiltInAccessor(RegExpPrototype, "flags", {
  1580. configurable: true,
  1581. get: regExpFlags
  1582. });
  1583. }
  1584. });
  1585. // node_modules/core-js/modules/es.array.flat.js
  1586. var require_es_array_flat = __commonJS({
  1587. "node_modules/core-js/modules/es.array.flat.js"() {
  1588. "use strict";
  1589. var $ = require_export();
  1590. var flattenIntoArray = require_flatten_into_array();
  1591. var toObject = require_to_object();
  1592. var lengthOfArrayLike = require_length_of_array_like();
  1593. var toIntegerOrInfinity = require_to_integer_or_infinity();
  1594. var arraySpeciesCreate = require_array_species_create();
  1595. $({ target: "Array", proto: true }, {
  1596. flat: function flat() {
  1597. var depthArg = arguments.length ? arguments[0] : void 0;
  1598. var O = toObject(this);
  1599. var sourceLen = lengthOfArrayLike(O);
  1600. var A = arraySpeciesCreate(O, 0);
  1601. A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
  1602. return A;
  1603. }
  1604. });
  1605. }
  1606. });
  1607. // dist/_index.js.cjs.js
  1608. var _excluded = ["cliName", "cliCategory", "cliDescription"];
  1609. var _excluded2 = ["_"];
  1610. var _excluded3 = ["overrides"];
  1611. var _excluded4 = ["languageId"];
  1612. function _objectWithoutProperties(source, excluded) {
  1613. if (source == null)
  1614. return {};
  1615. var target = _objectWithoutPropertiesLoose(source, excluded);
  1616. var key, i;
  1617. if (Object.getOwnPropertySymbols) {
  1618. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  1619. for (i = 0; i < sourceSymbolKeys.length; i++) {
  1620. key = sourceSymbolKeys[i];
  1621. if (excluded.indexOf(key) >= 0)
  1622. continue;
  1623. if (!Object.prototype.propertyIsEnumerable.call(source, key))
  1624. continue;
  1625. target[key] = source[key];
  1626. }
  1627. }
  1628. return target;
  1629. }
  1630. function _objectWithoutPropertiesLoose(source, excluded) {
  1631. if (source == null)
  1632. return {};
  1633. var target = {};
  1634. var sourceKeys = Object.keys(source);
  1635. var key, i;
  1636. for (i = 0; i < sourceKeys.length; i++) {
  1637. key = sourceKeys[i];
  1638. if (excluded.indexOf(key) >= 0)
  1639. continue;
  1640. target[key] = source[key];
  1641. }
  1642. return target;
  1643. }
  1644. require_es_array_flat_map();
  1645. require_es_object_from_entries();
  1646. require_es_regexp_flags();
  1647. require_es_array_flat();
  1648. var __create = Object.create;
  1649. var __defProp = Object.defineProperty;
  1650. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  1651. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  1652. var __getProtoOf = Object.getPrototypeOf;
  1653. var __hasOwnProp = Object.prototype.hasOwnProperty;
  1654. var __esm = (fn, res) => function __init() {
  1655. return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
  1656. };
  1657. var __commonJS2 = (cb, mod) => function __require() {
  1658. return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
  1659. exports: {}
  1660. }).exports, mod), mod.exports;
  1661. };
  1662. var __export = (target, all) => {
  1663. for (var name in all)
  1664. __defProp(target, name, {
  1665. get: all[name],
  1666. enumerable: true
  1667. });
  1668. };
  1669. var __copyProps = (to, from, except, desc) => {
  1670. if (from && typeof from === "object" || typeof from === "function") {
  1671. for (let key of __getOwnPropNames2(from))
  1672. if (!__hasOwnProp.call(to, key) && key !== except)
  1673. __defProp(to, key, {
  1674. get: () => from[key],
  1675. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  1676. });
  1677. }
  1678. return to;
  1679. };
  1680. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  1681. value: mod,
  1682. enumerable: true
  1683. }) : target, mod));
  1684. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
  1685. value: true
  1686. }), mod);
  1687. var require_base = __commonJS2({
  1688. "node_modules/diff/lib/diff/base.js"(exports2) {
  1689. "use strict";
  1690. Object.defineProperty(exports2, "__esModule", {
  1691. value: true
  1692. });
  1693. exports2["default"] = Diff;
  1694. function Diff() {
  1695. }
  1696. Diff.prototype = {
  1697. diff: function diff(oldString, newString) {
  1698. var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  1699. var callback = options.callback;
  1700. if (typeof options === "function") {
  1701. callback = options;
  1702. options = {};
  1703. }
  1704. this.options = options;
  1705. var self2 = this;
  1706. function done(value) {
  1707. if (callback) {
  1708. setTimeout(function() {
  1709. callback(void 0, value);
  1710. }, 0);
  1711. return true;
  1712. } else {
  1713. return value;
  1714. }
  1715. }
  1716. oldString = this.castInput(oldString);
  1717. newString = this.castInput(newString);
  1718. oldString = this.removeEmpty(this.tokenize(oldString));
  1719. newString = this.removeEmpty(this.tokenize(newString));
  1720. var newLen = newString.length, oldLen = oldString.length;
  1721. var editLength = 1;
  1722. var maxEditLength = newLen + oldLen;
  1723. var bestPath = [{
  1724. newPos: -1,
  1725. components: []
  1726. }];
  1727. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  1728. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  1729. return done([{
  1730. value: this.join(newString),
  1731. count: newString.length
  1732. }]);
  1733. }
  1734. function execEditLength() {
  1735. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  1736. var basePath = void 0;
  1737. var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  1738. if (addPath) {
  1739. bestPath[diagonalPath - 1] = void 0;
  1740. }
  1741. var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  1742. if (!canAdd && !canRemove) {
  1743. bestPath[diagonalPath] = void 0;
  1744. continue;
  1745. }
  1746. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  1747. basePath = clonePath(removePath);
  1748. self2.pushComponent(basePath.components, void 0, true);
  1749. } else {
  1750. basePath = addPath;
  1751. basePath.newPos++;
  1752. self2.pushComponent(basePath.components, true, void 0);
  1753. }
  1754. _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
  1755. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  1756. return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
  1757. } else {
  1758. bestPath[diagonalPath] = basePath;
  1759. }
  1760. }
  1761. editLength++;
  1762. }
  1763. if (callback) {
  1764. (function exec() {
  1765. setTimeout(function() {
  1766. if (editLength > maxEditLength) {
  1767. return callback();
  1768. }
  1769. if (!execEditLength()) {
  1770. exec();
  1771. }
  1772. }, 0);
  1773. })();
  1774. } else {
  1775. while (editLength <= maxEditLength) {
  1776. var ret = execEditLength();
  1777. if (ret) {
  1778. return ret;
  1779. }
  1780. }
  1781. }
  1782. },
  1783. pushComponent: function pushComponent(components, added, removed) {
  1784. var last = components[components.length - 1];
  1785. if (last && last.added === added && last.removed === removed) {
  1786. components[components.length - 1] = {
  1787. count: last.count + 1,
  1788. added,
  1789. removed
  1790. };
  1791. } else {
  1792. components.push({
  1793. count: 1,
  1794. added,
  1795. removed
  1796. });
  1797. }
  1798. },
  1799. extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  1800. var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
  1801. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  1802. newPos++;
  1803. oldPos++;
  1804. commonCount++;
  1805. }
  1806. if (commonCount) {
  1807. basePath.components.push({
  1808. count: commonCount
  1809. });
  1810. }
  1811. basePath.newPos = newPos;
  1812. return oldPos;
  1813. },
  1814. equals: function equals(left, right) {
  1815. if (this.options.comparator) {
  1816. return this.options.comparator(left, right);
  1817. } else {
  1818. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  1819. }
  1820. },
  1821. removeEmpty: function removeEmpty(array) {
  1822. var ret = [];
  1823. for (var i = 0; i < array.length; i++) {
  1824. if (array[i]) {
  1825. ret.push(array[i]);
  1826. }
  1827. }
  1828. return ret;
  1829. },
  1830. castInput: function castInput(value) {
  1831. return value;
  1832. },
  1833. tokenize: function tokenize(value) {
  1834. return value.split("");
  1835. },
  1836. join: function join(chars) {
  1837. return chars.join("");
  1838. }
  1839. };
  1840. function buildValues(diff, components, newString, oldString, useLongestToken) {
  1841. var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
  1842. for (; componentPos < componentLen; componentPos++) {
  1843. var component = components[componentPos];
  1844. if (!component.removed) {
  1845. if (!component.added && useLongestToken) {
  1846. var value = newString.slice(newPos, newPos + component.count);
  1847. value = value.map(function(value2, i) {
  1848. var oldValue = oldString[oldPos + i];
  1849. return oldValue.length > value2.length ? oldValue : value2;
  1850. });
  1851. component.value = diff.join(value);
  1852. } else {
  1853. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  1854. }
  1855. newPos += component.count;
  1856. if (!component.added) {
  1857. oldPos += component.count;
  1858. }
  1859. } else {
  1860. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  1861. oldPos += component.count;
  1862. if (componentPos && components[componentPos - 1].added) {
  1863. var tmp = components[componentPos - 1];
  1864. components[componentPos - 1] = components[componentPos];
  1865. components[componentPos] = tmp;
  1866. }
  1867. }
  1868. }
  1869. var lastComponent = components[componentLen - 1];
  1870. if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
  1871. components[componentLen - 2].value += lastComponent.value;
  1872. components.pop();
  1873. }
  1874. return components;
  1875. }
  1876. function clonePath(path) {
  1877. return {
  1878. newPos: path.newPos,
  1879. components: path.components.slice(0)
  1880. };
  1881. }
  1882. }
  1883. });
  1884. var require_array = __commonJS2({
  1885. "node_modules/diff/lib/diff/array.js"(exports2) {
  1886. "use strict";
  1887. Object.defineProperty(exports2, "__esModule", {
  1888. value: true
  1889. });
  1890. exports2.diffArrays = diffArrays;
  1891. exports2.arrayDiff = void 0;
  1892. var _base = _interopRequireDefault(require_base());
  1893. function _interopRequireDefault(obj) {
  1894. return obj && obj.__esModule ? obj : {
  1895. "default": obj
  1896. };
  1897. }
  1898. var arrayDiff = new _base["default"]();
  1899. exports2.arrayDiff = arrayDiff;
  1900. arrayDiff.tokenize = function(value) {
  1901. return value.slice();
  1902. };
  1903. arrayDiff.join = arrayDiff.removeEmpty = function(value) {
  1904. return value;
  1905. };
  1906. function diffArrays(oldArr, newArr, callback) {
  1907. return arrayDiff.diff(oldArr, newArr, callback);
  1908. }
  1909. }
  1910. });
  1911. var escape_string_regexp_exports = {};
  1912. __export(escape_string_regexp_exports, {
  1913. default: () => escapeStringRegexp
  1914. });
  1915. function escapeStringRegexp(string) {
  1916. if (typeof string !== "string") {
  1917. throw new TypeError("Expected a string");
  1918. }
  1919. return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  1920. }
  1921. var init_escape_string_regexp = __esm({
  1922. "node_modules/escape-string-regexp/index.js"() {
  1923. }
  1924. });
  1925. var require_get_last = __commonJS2({
  1926. "src/utils/get-last.js"(exports2, module2) {
  1927. "use strict";
  1928. var getLast = (arr) => arr[arr.length - 1];
  1929. module2.exports = getLast;
  1930. }
  1931. });
  1932. var require_debug = __commonJS2({
  1933. "node_modules/semver/internal/debug.js"(exports2, module2) {
  1934. var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
  1935. };
  1936. module2.exports = debug;
  1937. }
  1938. });
  1939. var require_constants = __commonJS2({
  1940. "node_modules/semver/internal/constants.js"(exports2, module2) {
  1941. var SEMVER_SPEC_VERSION = "2.0.0";
  1942. var MAX_LENGTH = 256;
  1943. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  1944. var MAX_SAFE_COMPONENT_LENGTH = 16;
  1945. module2.exports = {
  1946. SEMVER_SPEC_VERSION,
  1947. MAX_LENGTH,
  1948. MAX_SAFE_INTEGER,
  1949. MAX_SAFE_COMPONENT_LENGTH
  1950. };
  1951. }
  1952. });
  1953. var require_re = __commonJS2({
  1954. "node_modules/semver/internal/re.js"(exports2, module2) {
  1955. var {
  1956. MAX_SAFE_COMPONENT_LENGTH
  1957. } = require_constants();
  1958. var debug = require_debug();
  1959. exports2 = module2.exports = {};
  1960. var re = exports2.re = [];
  1961. var src = exports2.src = [];
  1962. var t = exports2.t = {};
  1963. var R = 0;
  1964. var createToken = (name, value, isGlobal) => {
  1965. const index = R++;
  1966. debug(name, index, value);
  1967. t[name] = index;
  1968. src[index] = value;
  1969. re[index] = new RegExp(value, isGlobal ? "g" : void 0);
  1970. };
  1971. createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
  1972. createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
  1973. createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
  1974. createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
  1975. createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
  1976. createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1977. createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1978. createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
  1979. createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
  1980. createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
  1981. createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
  1982. createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
  1983. createToken("FULL", `^${src[t.FULLPLAIN]}$`);
  1984. createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
  1985. createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
  1986. createToken("GTLT", "((?:<|>)?=?)");
  1987. createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
  1988. createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
  1989. createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
  1990. createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
  1991. createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
  1992. createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
  1993. createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
  1994. createToken("COERCERTL", src[t.COERCE], true);
  1995. createToken("LONETILDE", "(?:~>?)");
  1996. createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
  1997. exports2.tildeTrimReplace = "$1~";
  1998. createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
  1999. createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
  2000. createToken("LONECARET", "(?:\\^)");
  2001. createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
  2002. exports2.caretTrimReplace = "$1^";
  2003. createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
  2004. createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
  2005. createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
  2006. createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
  2007. createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
  2008. exports2.comparatorTrimReplace = "$1$2$3";
  2009. createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
  2010. createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
  2011. createToken("STAR", "(<|>)?=?\\s*\\*");
  2012. createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
  2013. createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
  2014. }
  2015. });
  2016. var require_parse_options = __commonJS2({
  2017. "node_modules/semver/internal/parse-options.js"(exports2, module2) {
  2018. var opts = ["includePrerelease", "loose", "rtl"];
  2019. var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {
  2020. loose: true
  2021. } : opts.filter((k) => options[k]).reduce((o, k) => {
  2022. o[k] = true;
  2023. return o;
  2024. }, {});
  2025. module2.exports = parseOptions;
  2026. }
  2027. });
  2028. var require_identifiers = __commonJS2({
  2029. "node_modules/semver/internal/identifiers.js"(exports2, module2) {
  2030. var numeric = /^[0-9]+$/;
  2031. var compareIdentifiers = (a, b) => {
  2032. const anum = numeric.test(a);
  2033. const bnum = numeric.test(b);
  2034. if (anum && bnum) {
  2035. a = +a;
  2036. b = +b;
  2037. }
  2038. return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
  2039. };
  2040. var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
  2041. module2.exports = {
  2042. compareIdentifiers,
  2043. rcompareIdentifiers
  2044. };
  2045. }
  2046. });
  2047. var require_semver = __commonJS2({
  2048. "node_modules/semver/classes/semver.js"(exports2, module2) {
  2049. var debug = require_debug();
  2050. var {
  2051. MAX_LENGTH,
  2052. MAX_SAFE_INTEGER
  2053. } = require_constants();
  2054. var {
  2055. re,
  2056. t
  2057. } = require_re();
  2058. var parseOptions = require_parse_options();
  2059. var {
  2060. compareIdentifiers
  2061. } = require_identifiers();
  2062. var SemVer = class {
  2063. constructor(version2, options) {
  2064. options = parseOptions(options);
  2065. if (version2 instanceof SemVer) {
  2066. if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
  2067. return version2;
  2068. } else {
  2069. version2 = version2.version;
  2070. }
  2071. } else if (typeof version2 !== "string") {
  2072. throw new TypeError(`Invalid Version: ${version2}`);
  2073. }
  2074. if (version2.length > MAX_LENGTH) {
  2075. throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
  2076. }
  2077. debug("SemVer", version2, options);
  2078. this.options = options;
  2079. this.loose = !!options.loose;
  2080. this.includePrerelease = !!options.includePrerelease;
  2081. const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
  2082. if (!m) {
  2083. throw new TypeError(`Invalid Version: ${version2}`);
  2084. }
  2085. this.raw = version2;
  2086. this.major = +m[1];
  2087. this.minor = +m[2];
  2088. this.patch = +m[3];
  2089. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  2090. throw new TypeError("Invalid major version");
  2091. }
  2092. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  2093. throw new TypeError("Invalid minor version");
  2094. }
  2095. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  2096. throw new TypeError("Invalid patch version");
  2097. }
  2098. if (!m[4]) {
  2099. this.prerelease = [];
  2100. } else {
  2101. this.prerelease = m[4].split(".").map((id) => {
  2102. if (/^[0-9]+$/.test(id)) {
  2103. const num = +id;
  2104. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  2105. return num;
  2106. }
  2107. }
  2108. return id;
  2109. });
  2110. }
  2111. this.build = m[5] ? m[5].split(".") : [];
  2112. this.format();
  2113. }
  2114. format() {
  2115. this.version = `${this.major}.${this.minor}.${this.patch}`;
  2116. if (this.prerelease.length) {
  2117. this.version += `-${this.prerelease.join(".")}`;
  2118. }
  2119. return this.version;
  2120. }
  2121. toString() {
  2122. return this.version;
  2123. }
  2124. compare(other) {
  2125. debug("SemVer.compare", this.version, this.options, other);
  2126. if (!(other instanceof SemVer)) {
  2127. if (typeof other === "string" && other === this.version) {
  2128. return 0;
  2129. }
  2130. other = new SemVer(other, this.options);
  2131. }
  2132. if (other.version === this.version) {
  2133. return 0;
  2134. }
  2135. return this.compareMain(other) || this.comparePre(other);
  2136. }
  2137. compareMain(other) {
  2138. if (!(other instanceof SemVer)) {
  2139. other = new SemVer(other, this.options);
  2140. }
  2141. return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
  2142. }
  2143. comparePre(other) {
  2144. if (!(other instanceof SemVer)) {
  2145. other = new SemVer(other, this.options);
  2146. }
  2147. if (this.prerelease.length && !other.prerelease.length) {
  2148. return -1;
  2149. } else if (!this.prerelease.length && other.prerelease.length) {
  2150. return 1;
  2151. } else if (!this.prerelease.length && !other.prerelease.length) {
  2152. return 0;
  2153. }
  2154. let i = 0;
  2155. do {
  2156. const a = this.prerelease[i];
  2157. const b = other.prerelease[i];
  2158. debug("prerelease compare", i, a, b);
  2159. if (a === void 0 && b === void 0) {
  2160. return 0;
  2161. } else if (b === void 0) {
  2162. return 1;
  2163. } else if (a === void 0) {
  2164. return -1;
  2165. } else if (a === b) {
  2166. continue;
  2167. } else {
  2168. return compareIdentifiers(a, b);
  2169. }
  2170. } while (++i);
  2171. }
  2172. compareBuild(other) {
  2173. if (!(other instanceof SemVer)) {
  2174. other = new SemVer(other, this.options);
  2175. }
  2176. let i = 0;
  2177. do {
  2178. const a = this.build[i];
  2179. const b = other.build[i];
  2180. debug("prerelease compare", i, a, b);
  2181. if (a === void 0 && b === void 0) {
  2182. return 0;
  2183. } else if (b === void 0) {
  2184. return 1;
  2185. } else if (a === void 0) {
  2186. return -1;
  2187. } else if (a === b) {
  2188. continue;
  2189. } else {
  2190. return compareIdentifiers(a, b);
  2191. }
  2192. } while (++i);
  2193. }
  2194. inc(release, identifier) {
  2195. switch (release) {
  2196. case "premajor":
  2197. this.prerelease.length = 0;
  2198. this.patch = 0;
  2199. this.minor = 0;
  2200. this.major++;
  2201. this.inc("pre", identifier);
  2202. break;
  2203. case "preminor":
  2204. this.prerelease.length = 0;
  2205. this.patch = 0;
  2206. this.minor++;
  2207. this.inc("pre", identifier);
  2208. break;
  2209. case "prepatch":
  2210. this.prerelease.length = 0;
  2211. this.inc("patch", identifier);
  2212. this.inc("pre", identifier);
  2213. break;
  2214. case "prerelease":
  2215. if (this.prerelease.length === 0) {
  2216. this.inc("patch", identifier);
  2217. }
  2218. this.inc("pre", identifier);
  2219. break;
  2220. case "major":
  2221. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
  2222. this.major++;
  2223. }
  2224. this.minor = 0;
  2225. this.patch = 0;
  2226. this.prerelease = [];
  2227. break;
  2228. case "minor":
  2229. if (this.patch !== 0 || this.prerelease.length === 0) {
  2230. this.minor++;
  2231. }
  2232. this.patch = 0;
  2233. this.prerelease = [];
  2234. break;
  2235. case "patch":
  2236. if (this.prerelease.length === 0) {
  2237. this.patch++;
  2238. }
  2239. this.prerelease = [];
  2240. break;
  2241. case "pre":
  2242. if (this.prerelease.length === 0) {
  2243. this.prerelease = [0];
  2244. } else {
  2245. let i = this.prerelease.length;
  2246. while (--i >= 0) {
  2247. if (typeof this.prerelease[i] === "number") {
  2248. this.prerelease[i]++;
  2249. i = -2;
  2250. }
  2251. }
  2252. if (i === -1) {
  2253. this.prerelease.push(0);
  2254. }
  2255. }
  2256. if (identifier) {
  2257. if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
  2258. if (isNaN(this.prerelease[1])) {
  2259. this.prerelease = [identifier, 0];
  2260. }
  2261. } else {
  2262. this.prerelease = [identifier, 0];
  2263. }
  2264. }
  2265. break;
  2266. default:
  2267. throw new Error(`invalid increment argument: ${release}`);
  2268. }
  2269. this.format();
  2270. this.raw = this.version;
  2271. return this;
  2272. }
  2273. };
  2274. module2.exports = SemVer;
  2275. }
  2276. });
  2277. var require_compare = __commonJS2({
  2278. "node_modules/semver/functions/compare.js"(exports2, module2) {
  2279. var SemVer = require_semver();
  2280. var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
  2281. module2.exports = compare;
  2282. }
  2283. });
  2284. var require_lt = __commonJS2({
  2285. "node_modules/semver/functions/lt.js"(exports2, module2) {
  2286. var compare = require_compare();
  2287. var lt = (a, b, loose) => compare(a, b, loose) < 0;
  2288. module2.exports = lt;
  2289. }
  2290. });
  2291. var require_gte = __commonJS2({
  2292. "node_modules/semver/functions/gte.js"(exports2, module2) {
  2293. var compare = require_compare();
  2294. var gte = (a, b, loose) => compare(a, b, loose) >= 0;
  2295. module2.exports = gte;
  2296. }
  2297. });
  2298. var require_arrayify = __commonJS2({
  2299. "src/utils/arrayify.js"(exports2, module2) {
  2300. "use strict";
  2301. module2.exports = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
  2302. [keyName]: key
  2303. }, value));
  2304. }
  2305. });
  2306. var require_lib = __commonJS2({
  2307. "node_modules/outdent/lib/index.js"(exports2, module2) {
  2308. "use strict";
  2309. Object.defineProperty(exports2, "__esModule", {
  2310. value: true
  2311. });
  2312. exports2.outdent = void 0;
  2313. function noop() {
  2314. var args = [];
  2315. for (var _i = 0; _i < arguments.length; _i++) {
  2316. args[_i] = arguments[_i];
  2317. }
  2318. }
  2319. function createWeakMap() {
  2320. if (typeof WeakMap !== "undefined") {
  2321. return /* @__PURE__ */ new WeakMap();
  2322. } else {
  2323. return fakeSetOrMap();
  2324. }
  2325. }
  2326. function fakeSetOrMap() {
  2327. return {
  2328. add: noop,
  2329. delete: noop,
  2330. get: noop,
  2331. set: noop,
  2332. has: function(k) {
  2333. return false;
  2334. }
  2335. };
  2336. }
  2337. var hop = Object.prototype.hasOwnProperty;
  2338. var has = function(obj, prop) {
  2339. return hop.call(obj, prop);
  2340. };
  2341. function extend(target, source) {
  2342. for (var prop in source) {
  2343. if (has(source, prop)) {
  2344. target[prop] = source[prop];
  2345. }
  2346. }
  2347. return target;
  2348. }
  2349. var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
  2350. var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
  2351. var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
  2352. var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
  2353. var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
  2354. function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
  2355. var indentationLevel = 0;
  2356. var match = strings[0].match(reDetectIndentation);
  2357. if (match) {
  2358. indentationLevel = match[1].length;
  2359. }
  2360. var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
  2361. var reMatchIndent = new RegExp(reSource, "g");
  2362. if (firstInterpolatedValueSetsIndentationLevel) {
  2363. strings = strings.slice(1);
  2364. }
  2365. var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
  2366. var normalizeNewlines = typeof newline === "string";
  2367. var l = strings.length;
  2368. var outdentedStrings = strings.map(function(v, i) {
  2369. v = v.replace(reMatchIndent, "$1");
  2370. if (i === 0 && trimLeadingNewline) {
  2371. v = v.replace(reLeadingNewline, "");
  2372. }
  2373. if (i === l - 1 && trimTrailingNewline) {
  2374. v = v.replace(reTrailingNewline, "");
  2375. }
  2376. if (normalizeNewlines) {
  2377. v = v.replace(/\r\n|\n|\r/g, function(_) {
  2378. return newline;
  2379. });
  2380. }
  2381. return v;
  2382. });
  2383. return outdentedStrings;
  2384. }
  2385. function concatStringsAndValues(strings, values) {
  2386. var ret = "";
  2387. for (var i = 0, l = strings.length; i < l; i++) {
  2388. ret += strings[i];
  2389. if (i < l - 1) {
  2390. ret += values[i];
  2391. }
  2392. }
  2393. return ret;
  2394. }
  2395. function isTemplateStringsArray(v) {
  2396. return has(v, "raw") && has(v, "length");
  2397. }
  2398. function createInstance(options) {
  2399. var arrayAutoIndentCache = createWeakMap();
  2400. var arrayFirstInterpSetsIndentCache = createWeakMap();
  2401. function outdent(stringsOrOptions) {
  2402. var values = [];
  2403. for (var _i = 1; _i < arguments.length; _i++) {
  2404. values[_i - 1] = arguments[_i];
  2405. }
  2406. if (isTemplateStringsArray(stringsOrOptions)) {
  2407. var strings = stringsOrOptions;
  2408. var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
  2409. var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
  2410. var renderedArray = cache.get(strings);
  2411. if (!renderedArray) {
  2412. renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
  2413. cache.set(strings, renderedArray);
  2414. }
  2415. if (values.length === 0) {
  2416. return renderedArray[0];
  2417. }
  2418. var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
  2419. return rendered;
  2420. } else {
  2421. return createInstance(extend(extend({}, options), stringsOrOptions || {}));
  2422. }
  2423. }
  2424. var fullOutdent = extend(outdent, {
  2425. string: function(str) {
  2426. return _outdentArray([str], false, options)[0];
  2427. }
  2428. });
  2429. return fullOutdent;
  2430. }
  2431. var defaultOutdent = createInstance({
  2432. trimLeadingNewline: true,
  2433. trimTrailingNewline: true
  2434. });
  2435. exports2.outdent = defaultOutdent;
  2436. exports2.default = defaultOutdent;
  2437. if (typeof module2 !== "undefined") {
  2438. try {
  2439. module2.exports = defaultOutdent;
  2440. Object.defineProperty(defaultOutdent, "__esModule", {
  2441. value: true
  2442. });
  2443. defaultOutdent.default = defaultOutdent;
  2444. defaultOutdent.outdent = defaultOutdent;
  2445. } catch (e) {
  2446. }
  2447. }
  2448. }
  2449. });
  2450. var require_core_options = __commonJS2({
  2451. "src/main/core-options.js"(exports2, module2) {
  2452. "use strict";
  2453. var {
  2454. outdent
  2455. } = require_lib();
  2456. var CATEGORY_CONFIG = "Config";
  2457. var CATEGORY_EDITOR = "Editor";
  2458. var CATEGORY_FORMAT = "Format";
  2459. var CATEGORY_OTHER = "Other";
  2460. var CATEGORY_OUTPUT = "Output";
  2461. var CATEGORY_GLOBAL = "Global";
  2462. var CATEGORY_SPECIAL = "Special";
  2463. var options = {
  2464. cursorOffset: {
  2465. since: "1.4.0",
  2466. category: CATEGORY_SPECIAL,
  2467. type: "int",
  2468. default: -1,
  2469. range: {
  2470. start: -1,
  2471. end: Number.POSITIVE_INFINITY,
  2472. step: 1
  2473. },
  2474. description: outdent`
  2475. Print (to stderr) where a cursor at the given position would move to after formatting.
  2476. This option cannot be used with --range-start and --range-end.
  2477. `,
  2478. cliCategory: CATEGORY_EDITOR
  2479. },
  2480. endOfLine: {
  2481. since: "1.15.0",
  2482. category: CATEGORY_GLOBAL,
  2483. type: "choice",
  2484. default: [{
  2485. since: "1.15.0",
  2486. value: "auto"
  2487. }, {
  2488. since: "2.0.0",
  2489. value: "lf"
  2490. }],
  2491. description: "Which end of line characters to apply.",
  2492. choices: [{
  2493. value: "lf",
  2494. description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
  2495. }, {
  2496. value: "crlf",
  2497. description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
  2498. }, {
  2499. value: "cr",
  2500. description: "Carriage Return character only (\\r), used very rarely"
  2501. }, {
  2502. value: "auto",
  2503. description: outdent`
  2504. Maintain existing
  2505. (mixed values within one file are normalised by looking at what's used after the first line)
  2506. `
  2507. }]
  2508. },
  2509. filepath: {
  2510. since: "1.4.0",
  2511. category: CATEGORY_SPECIAL,
  2512. type: "path",
  2513. description: "Specify the input filepath. This will be used to do parser inference.",
  2514. cliName: "stdin-filepath",
  2515. cliCategory: CATEGORY_OTHER,
  2516. cliDescription: "Path to the file to pretend that stdin comes from."
  2517. },
  2518. insertPragma: {
  2519. since: "1.8.0",
  2520. category: CATEGORY_SPECIAL,
  2521. type: "boolean",
  2522. default: false,
  2523. description: "Insert @format pragma into file's first docblock comment.",
  2524. cliCategory: CATEGORY_OTHER
  2525. },
  2526. parser: {
  2527. since: "0.0.10",
  2528. category: CATEGORY_GLOBAL,
  2529. type: "choice",
  2530. default: [{
  2531. since: "0.0.10",
  2532. value: "babylon"
  2533. }, {
  2534. since: "1.13.0",
  2535. value: void 0
  2536. }],
  2537. description: "Which parser to use.",
  2538. exception: (value) => typeof value === "string" || typeof value === "function",
  2539. choices: [{
  2540. value: "flow",
  2541. description: "Flow"
  2542. }, {
  2543. value: "babel",
  2544. since: "1.16.0",
  2545. description: "JavaScript"
  2546. }, {
  2547. value: "babel-flow",
  2548. since: "1.16.0",
  2549. description: "Flow"
  2550. }, {
  2551. value: "babel-ts",
  2552. since: "2.0.0",
  2553. description: "TypeScript"
  2554. }, {
  2555. value: "typescript",
  2556. since: "1.4.0",
  2557. description: "TypeScript"
  2558. }, {
  2559. value: "acorn",
  2560. since: "2.6.0",
  2561. description: "JavaScript"
  2562. }, {
  2563. value: "espree",
  2564. since: "2.2.0",
  2565. description: "JavaScript"
  2566. }, {
  2567. value: "meriyah",
  2568. since: "2.2.0",
  2569. description: "JavaScript"
  2570. }, {
  2571. value: "css",
  2572. since: "1.7.1",
  2573. description: "CSS"
  2574. }, {
  2575. value: "less",
  2576. since: "1.7.1",
  2577. description: "Less"
  2578. }, {
  2579. value: "scss",
  2580. since: "1.7.1",
  2581. description: "SCSS"
  2582. }, {
  2583. value: "json",
  2584. since: "1.5.0",
  2585. description: "JSON"
  2586. }, {
  2587. value: "json5",
  2588. since: "1.13.0",
  2589. description: "JSON5"
  2590. }, {
  2591. value: "json-stringify",
  2592. since: "1.13.0",
  2593. description: "JSON.stringify"
  2594. }, {
  2595. value: "graphql",
  2596. since: "1.5.0",
  2597. description: "GraphQL"
  2598. }, {
  2599. value: "markdown",
  2600. since: "1.8.0",
  2601. description: "Markdown"
  2602. }, {
  2603. value: "mdx",
  2604. since: "1.15.0",
  2605. description: "MDX"
  2606. }, {
  2607. value: "vue",
  2608. since: "1.10.0",
  2609. description: "Vue"
  2610. }, {
  2611. value: "yaml",
  2612. since: "1.14.0",
  2613. description: "YAML"
  2614. }, {
  2615. value: "glimmer",
  2616. since: "2.3.0",
  2617. description: "Ember / Handlebars"
  2618. }, {
  2619. value: "html",
  2620. since: "1.15.0",
  2621. description: "HTML"
  2622. }, {
  2623. value: "angular",
  2624. since: "1.15.0",
  2625. description: "Angular"
  2626. }, {
  2627. value: "lwc",
  2628. since: "1.17.0",
  2629. description: "Lightning Web Components"
  2630. }]
  2631. },
  2632. plugins: {
  2633. since: "1.10.0",
  2634. type: "path",
  2635. array: true,
  2636. default: [{
  2637. value: []
  2638. }],
  2639. category: CATEGORY_GLOBAL,
  2640. description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
  2641. exception: (value) => typeof value === "string" || typeof value === "object",
  2642. cliName: "plugin",
  2643. cliCategory: CATEGORY_CONFIG
  2644. },
  2645. pluginSearchDirs: {
  2646. since: "1.13.0",
  2647. type: "path",
  2648. array: true,
  2649. default: [{
  2650. value: []
  2651. }],
  2652. category: CATEGORY_GLOBAL,
  2653. description: outdent`
  2654. Custom directory that contains prettier plugins in node_modules subdirectory.
  2655. Overrides default behavior when plugins are searched relatively to the location of Prettier.
  2656. Multiple values are accepted.
  2657. `,
  2658. exception: (value) => typeof value === "string" || typeof value === "object",
  2659. cliName: "plugin-search-dir",
  2660. cliCategory: CATEGORY_CONFIG
  2661. },
  2662. printWidth: {
  2663. since: "0.0.0",
  2664. category: CATEGORY_GLOBAL,
  2665. type: "int",
  2666. default: 80,
  2667. description: "The line length where Prettier will try wrap.",
  2668. range: {
  2669. start: 0,
  2670. end: Number.POSITIVE_INFINITY,
  2671. step: 1
  2672. }
  2673. },
  2674. rangeEnd: {
  2675. since: "1.4.0",
  2676. category: CATEGORY_SPECIAL,
  2677. type: "int",
  2678. default: Number.POSITIVE_INFINITY,
  2679. range: {
  2680. start: 0,
  2681. end: Number.POSITIVE_INFINITY,
  2682. step: 1
  2683. },
  2684. description: outdent`
  2685. Format code ending at a given character offset (exclusive).
  2686. The range will extend forwards to the end of the selected statement.
  2687. This option cannot be used with --cursor-offset.
  2688. `,
  2689. cliCategory: CATEGORY_EDITOR
  2690. },
  2691. rangeStart: {
  2692. since: "1.4.0",
  2693. category: CATEGORY_SPECIAL,
  2694. type: "int",
  2695. default: 0,
  2696. range: {
  2697. start: 0,
  2698. end: Number.POSITIVE_INFINITY,
  2699. step: 1
  2700. },
  2701. description: outdent`
  2702. Format code starting at a given character offset.
  2703. The range will extend backwards to the start of the first line containing the selected statement.
  2704. This option cannot be used with --cursor-offset.
  2705. `,
  2706. cliCategory: CATEGORY_EDITOR
  2707. },
  2708. requirePragma: {
  2709. since: "1.7.0",
  2710. category: CATEGORY_SPECIAL,
  2711. type: "boolean",
  2712. default: false,
  2713. description: outdent`
  2714. Require either '@prettier' or '@format' to be present in the file's first docblock comment
  2715. in order for it to be formatted.
  2716. `,
  2717. cliCategory: CATEGORY_OTHER
  2718. },
  2719. tabWidth: {
  2720. type: "int",
  2721. category: CATEGORY_GLOBAL,
  2722. default: 2,
  2723. description: "Number of spaces per indentation level.",
  2724. range: {
  2725. start: 0,
  2726. end: Number.POSITIVE_INFINITY,
  2727. step: 1
  2728. }
  2729. },
  2730. useTabs: {
  2731. since: "1.0.0",
  2732. category: CATEGORY_GLOBAL,
  2733. type: "boolean",
  2734. default: false,
  2735. description: "Indent with tabs instead of spaces."
  2736. },
  2737. embeddedLanguageFormatting: {
  2738. since: "2.1.0",
  2739. category: CATEGORY_GLOBAL,
  2740. type: "choice",
  2741. default: [{
  2742. since: "2.1.0",
  2743. value: "auto"
  2744. }],
  2745. description: "Control how Prettier formats quoted code embedded in the file.",
  2746. choices: [{
  2747. value: "auto",
  2748. description: "Format embedded code if Prettier can automatically identify it."
  2749. }, {
  2750. value: "off",
  2751. description: "Never automatically format embedded code."
  2752. }]
  2753. }
  2754. };
  2755. module2.exports = {
  2756. CATEGORY_CONFIG,
  2757. CATEGORY_EDITOR,
  2758. CATEGORY_FORMAT,
  2759. CATEGORY_OTHER,
  2760. CATEGORY_OUTPUT,
  2761. CATEGORY_GLOBAL,
  2762. CATEGORY_SPECIAL,
  2763. options
  2764. };
  2765. }
  2766. });
  2767. var require_support = __commonJS2({
  2768. "src/main/support.js"(exports2, module2) {
  2769. "use strict";
  2770. var semver = {
  2771. compare: require_compare(),
  2772. lt: require_lt(),
  2773. gte: require_gte()
  2774. };
  2775. var arrayify = require_arrayify();
  2776. var currentVersion = require("./package.json").version;
  2777. var coreOptions = require_core_options().options;
  2778. function getSupportInfo2({
  2779. plugins: plugins2 = [],
  2780. showUnreleased = false,
  2781. showDeprecated = false,
  2782. showInternal = false
  2783. } = {}) {
  2784. const version2 = currentVersion.split("-", 1)[0];
  2785. const languages = plugins2.flatMap((plugin) => plugin.languages || []).filter(filterSince);
  2786. const options = arrayify(Object.assign({}, ...plugins2.map(({
  2787. options: options2
  2788. }) => 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) => {
  2789. option = Object.assign({}, option);
  2790. if (Array.isArray(option.default)) {
  2791. 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;
  2792. }
  2793. if (Array.isArray(option.choices)) {
  2794. option.choices = option.choices.filter((option2) => filterSince(option2) && filterDeprecated(option2));
  2795. if (option.name === "parser") {
  2796. collectParsersFromLanguages(option, languages, plugins2);
  2797. }
  2798. }
  2799. const pluginDefaults = Object.fromEntries(plugins2.filter((plugin) => plugin.defaultOptions && plugin.defaultOptions[option.name] !== void 0).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]]));
  2800. return Object.assign(Object.assign({}, option), {}, {
  2801. pluginDefaults
  2802. });
  2803. });
  2804. return {
  2805. languages,
  2806. options
  2807. };
  2808. function filterSince(object) {
  2809. return showUnreleased || !("since" in object) || object.since && semver.gte(version2, object.since);
  2810. }
  2811. function filterDeprecated(object) {
  2812. return showDeprecated || !("deprecated" in object) || object.deprecated && semver.lt(version2, object.deprecated);
  2813. }
  2814. function mapInternal(object) {
  2815. if (showInternal) {
  2816. return object;
  2817. }
  2818. const {
  2819. cliName,
  2820. cliCategory,
  2821. cliDescription
  2822. } = object, newObject = _objectWithoutProperties(object, _excluded);
  2823. return newObject;
  2824. }
  2825. }
  2826. function collectParsersFromLanguages(option, languages, plugins2) {
  2827. const existingValues = new Set(option.choices.map((choice) => choice.value));
  2828. for (const language of languages) {
  2829. if (language.parsers) {
  2830. for (const value of language.parsers) {
  2831. if (!existingValues.has(value)) {
  2832. existingValues.add(value);
  2833. const plugin = plugins2.find((plugin2) => plugin2.parsers && plugin2.parsers[value]);
  2834. let description = language.name;
  2835. if (plugin && plugin.name) {
  2836. description += ` (plugin: ${plugin.name})`;
  2837. }
  2838. option.choices.push({
  2839. value,
  2840. description
  2841. });
  2842. }
  2843. }
  2844. }
  2845. }
  2846. }
  2847. module2.exports = {
  2848. getSupportInfo: getSupportInfo2
  2849. };
  2850. }
  2851. });
  2852. var require_is_non_empty_array = __commonJS2({
  2853. "src/utils/is-non-empty-array.js"(exports2, module2) {
  2854. "use strict";
  2855. function isNonEmptyArray(object) {
  2856. return Array.isArray(object) && object.length > 0;
  2857. }
  2858. module2.exports = isNonEmptyArray;
  2859. }
  2860. });
  2861. function ansiRegex({
  2862. onlyFirst = false
  2863. } = {}) {
  2864. 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("|");
  2865. return new RegExp(pattern, onlyFirst ? void 0 : "g");
  2866. }
  2867. var init_ansi_regex = __esm({
  2868. "node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
  2869. }
  2870. });
  2871. function stripAnsi(string) {
  2872. if (typeof string !== "string") {
  2873. throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
  2874. }
  2875. return string.replace(ansiRegex(), "");
  2876. }
  2877. var init_strip_ansi = __esm({
  2878. "node_modules/strip-ansi/index.js"() {
  2879. init_ansi_regex();
  2880. }
  2881. });
  2882. function isFullwidthCodePoint(codePoint) {
  2883. if (!Number.isInteger(codePoint)) {
  2884. return false;
  2885. }
  2886. 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);
  2887. }
  2888. var init_is_fullwidth_code_point = __esm({
  2889. "node_modules/is-fullwidth-code-point/index.js"() {
  2890. }
  2891. });
  2892. var require_emoji_regex = __commonJS2({
  2893. "node_modules/emoji-regex/index.js"(exports2, module2) {
  2894. "use strict";
  2895. module2.exports = function() {
  2896. 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;
  2897. };
  2898. }
  2899. });
  2900. var string_width_exports = {};
  2901. __export(string_width_exports, {
  2902. default: () => stringWidth
  2903. });
  2904. function stringWidth(string) {
  2905. if (typeof string !== "string" || string.length === 0) {
  2906. return 0;
  2907. }
  2908. string = stripAnsi(string);
  2909. if (string.length === 0) {
  2910. return 0;
  2911. }
  2912. string = string.replace((0, import_emoji_regex.default)(), " ");
  2913. let width = 0;
  2914. for (let index = 0; index < string.length; index++) {
  2915. const codePoint = string.codePointAt(index);
  2916. if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
  2917. continue;
  2918. }
  2919. if (codePoint >= 768 && codePoint <= 879) {
  2920. continue;
  2921. }
  2922. if (codePoint > 65535) {
  2923. index++;
  2924. }
  2925. width += isFullwidthCodePoint(codePoint) ? 2 : 1;
  2926. }
  2927. return width;
  2928. }
  2929. var import_emoji_regex;
  2930. var init_string_width = __esm({
  2931. "node_modules/string-width/index.js"() {
  2932. init_strip_ansi();
  2933. init_is_fullwidth_code_point();
  2934. import_emoji_regex = __toESM(require_emoji_regex());
  2935. }
  2936. });
  2937. var require_get_string_width = __commonJS2({
  2938. "src/utils/get-string-width.js"(exports2, module2) {
  2939. "use strict";
  2940. var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
  2941. var notAsciiRegex = /[^\x20-\x7F]/;
  2942. function getStringWidth(text) {
  2943. if (!text) {
  2944. return 0;
  2945. }
  2946. if (!notAsciiRegex.test(text)) {
  2947. return text.length;
  2948. }
  2949. return stringWidth2(text);
  2950. }
  2951. module2.exports = getStringWidth;
  2952. }
  2953. });
  2954. var require_skip = __commonJS2({
  2955. "src/utils/text/skip.js"(exports2, module2) {
  2956. "use strict";
  2957. function skip(chars) {
  2958. return (text, index, opts) => {
  2959. const backwards = opts && opts.backwards;
  2960. if (index === false) {
  2961. return false;
  2962. }
  2963. const {
  2964. length
  2965. } = text;
  2966. let cursor = index;
  2967. while (cursor >= 0 && cursor < length) {
  2968. const c = text.charAt(cursor);
  2969. if (chars instanceof RegExp) {
  2970. if (!chars.test(c)) {
  2971. return cursor;
  2972. }
  2973. } else if (!chars.includes(c)) {
  2974. return cursor;
  2975. }
  2976. backwards ? cursor-- : cursor++;
  2977. }
  2978. if (cursor === -1 || cursor === length) {
  2979. return cursor;
  2980. }
  2981. return false;
  2982. };
  2983. }
  2984. var skipWhitespace = skip(/\s/);
  2985. var skipSpaces = skip(" ");
  2986. var skipToLineEnd = skip(",; ");
  2987. var skipEverythingButNewLine = skip(/[^\n\r]/);
  2988. module2.exports = {
  2989. skipWhitespace,
  2990. skipSpaces,
  2991. skipToLineEnd,
  2992. skipEverythingButNewLine
  2993. };
  2994. }
  2995. });
  2996. var require_skip_inline_comment = __commonJS2({
  2997. "src/utils/text/skip-inline-comment.js"(exports2, module2) {
  2998. "use strict";
  2999. function skipInlineComment(text, index) {
  3000. if (index === false) {
  3001. return false;
  3002. }
  3003. if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
  3004. for (let i = index + 2; i < text.length; ++i) {
  3005. if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
  3006. return i + 2;
  3007. }
  3008. }
  3009. }
  3010. return index;
  3011. }
  3012. module2.exports = skipInlineComment;
  3013. }
  3014. });
  3015. var require_skip_trailing_comment = __commonJS2({
  3016. "src/utils/text/skip-trailing-comment.js"(exports2, module2) {
  3017. "use strict";
  3018. var {
  3019. skipEverythingButNewLine
  3020. } = require_skip();
  3021. function skipTrailingComment(text, index) {
  3022. if (index === false) {
  3023. return false;
  3024. }
  3025. if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
  3026. return skipEverythingButNewLine(text, index);
  3027. }
  3028. return index;
  3029. }
  3030. module2.exports = skipTrailingComment;
  3031. }
  3032. });
  3033. var require_skip_newline = __commonJS2({
  3034. "src/utils/text/skip-newline.js"(exports2, module2) {
  3035. "use strict";
  3036. function skipNewline(text, index, opts) {
  3037. const backwards = opts && opts.backwards;
  3038. if (index === false) {
  3039. return false;
  3040. }
  3041. const atIndex = text.charAt(index);
  3042. if (backwards) {
  3043. if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
  3044. return index - 2;
  3045. }
  3046. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  3047. return index - 1;
  3048. }
  3049. } else {
  3050. if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
  3051. return index + 2;
  3052. }
  3053. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  3054. return index + 1;
  3055. }
  3056. }
  3057. return index;
  3058. }
  3059. module2.exports = skipNewline;
  3060. }
  3061. });
  3062. var require_get_next_non_space_non_comment_character_index_with_start_index = __commonJS2({
  3063. "src/utils/text/get-next-non-space-non-comment-character-index-with-start-index.js"(exports2, module2) {
  3064. "use strict";
  3065. var skipInlineComment = require_skip_inline_comment();
  3066. var skipNewline = require_skip_newline();
  3067. var skipTrailingComment = require_skip_trailing_comment();
  3068. var {
  3069. skipSpaces
  3070. } = require_skip();
  3071. function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
  3072. let oldIdx = null;
  3073. let nextIdx = idx;
  3074. while (nextIdx !== oldIdx) {
  3075. oldIdx = nextIdx;
  3076. nextIdx = skipSpaces(text, nextIdx);
  3077. nextIdx = skipInlineComment(text, nextIdx);
  3078. nextIdx = skipTrailingComment(text, nextIdx);
  3079. nextIdx = skipNewline(text, nextIdx);
  3080. }
  3081. return nextIdx;
  3082. }
  3083. module2.exports = getNextNonSpaceNonCommentCharacterIndexWithStartIndex;
  3084. }
  3085. });
  3086. var require_util = __commonJS2({
  3087. "src/common/util.js"(exports2, module2) {
  3088. "use strict";
  3089. var {
  3090. default: escapeStringRegexp2
  3091. } = (init_escape_string_regexp(), __toCommonJS(escape_string_regexp_exports));
  3092. var getLast = require_get_last();
  3093. var {
  3094. getSupportInfo: getSupportInfo2
  3095. } = require_support();
  3096. var isNonEmptyArray = require_is_non_empty_array();
  3097. var getStringWidth = require_get_string_width();
  3098. var {
  3099. skipWhitespace,
  3100. skipSpaces,
  3101. skipToLineEnd,
  3102. skipEverythingButNewLine
  3103. } = require_skip();
  3104. var skipInlineComment = require_skip_inline_comment();
  3105. var skipTrailingComment = require_skip_trailing_comment();
  3106. var skipNewline = require_skip_newline();
  3107. var getNextNonSpaceNonCommentCharacterIndexWithStartIndex = require_get_next_non_space_non_comment_character_index_with_start_index();
  3108. var getPenultimate = (arr) => arr[arr.length - 2];
  3109. function skip(chars) {
  3110. return (text, index, opts) => {
  3111. const backwards = opts && opts.backwards;
  3112. if (index === false) {
  3113. return false;
  3114. }
  3115. const {
  3116. length
  3117. } = text;
  3118. let cursor = index;
  3119. while (cursor >= 0 && cursor < length) {
  3120. const c = text.charAt(cursor);
  3121. if (chars instanceof RegExp) {
  3122. if (!chars.test(c)) {
  3123. return cursor;
  3124. }
  3125. } else if (!chars.includes(c)) {
  3126. return cursor;
  3127. }
  3128. backwards ? cursor-- : cursor++;
  3129. }
  3130. if (cursor === -1 || cursor === length) {
  3131. return cursor;
  3132. }
  3133. return false;
  3134. };
  3135. }
  3136. function hasNewline(text, index, opts = {}) {
  3137. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  3138. const idx2 = skipNewline(text, idx, opts);
  3139. return idx !== idx2;
  3140. }
  3141. function hasNewlineInRange(text, start, end) {
  3142. for (let i = start; i < end; ++i) {
  3143. if (text.charAt(i) === "\n") {
  3144. return true;
  3145. }
  3146. }
  3147. return false;
  3148. }
  3149. function isPreviousLineEmpty(text, node, locStart) {
  3150. let idx = locStart(node) - 1;
  3151. idx = skipSpaces(text, idx, {
  3152. backwards: true
  3153. });
  3154. idx = skipNewline(text, idx, {
  3155. backwards: true
  3156. });
  3157. idx = skipSpaces(text, idx, {
  3158. backwards: true
  3159. });
  3160. const idx2 = skipNewline(text, idx, {
  3161. backwards: true
  3162. });
  3163. return idx !== idx2;
  3164. }
  3165. function isNextLineEmptyAfterIndex(text, index) {
  3166. let oldIdx = null;
  3167. let idx = index;
  3168. while (idx !== oldIdx) {
  3169. oldIdx = idx;
  3170. idx = skipToLineEnd(text, idx);
  3171. idx = skipInlineComment(text, idx);
  3172. idx = skipSpaces(text, idx);
  3173. }
  3174. idx = skipTrailingComment(text, idx);
  3175. idx = skipNewline(text, idx);
  3176. return idx !== false && hasNewline(text, idx);
  3177. }
  3178. function isNextLineEmpty(text, node, locEnd) {
  3179. return isNextLineEmptyAfterIndex(text, locEnd(node));
  3180. }
  3181. function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
  3182. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
  3183. }
  3184. function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
  3185. return text.charAt(getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
  3186. }
  3187. function hasSpaces(text, index, opts = {}) {
  3188. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  3189. return idx !== index;
  3190. }
  3191. function getAlignmentSize(value, tabWidth, startIndex = 0) {
  3192. let size = 0;
  3193. for (let i = startIndex; i < value.length; ++i) {
  3194. if (value[i] === " ") {
  3195. size = size + tabWidth - size % tabWidth;
  3196. } else {
  3197. size++;
  3198. }
  3199. }
  3200. return size;
  3201. }
  3202. function getIndentSize(value, tabWidth) {
  3203. const lastNewlineIndex = value.lastIndexOf("\n");
  3204. if (lastNewlineIndex === -1) {
  3205. return 0;
  3206. }
  3207. return getAlignmentSize(value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
  3208. }
  3209. function getPreferredQuote(rawContent, preferredQuote) {
  3210. const double = {
  3211. quote: '"',
  3212. regex: /"/g,
  3213. escaped: "&quot;"
  3214. };
  3215. const single = {
  3216. quote: "'",
  3217. regex: /'/g,
  3218. escaped: "&apos;"
  3219. };
  3220. const preferred = preferredQuote === "'" ? single : double;
  3221. const alternate = preferred === single ? double : single;
  3222. let result = preferred;
  3223. if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
  3224. const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
  3225. const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
  3226. result = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;
  3227. }
  3228. return result;
  3229. }
  3230. function printString(raw, options) {
  3231. const rawContent = raw.slice(1, -1);
  3232. const enclosingQuote = options.parser === "json" || options.parser === "json5" && options.quoteProps === "preserve" && !options.singleQuote ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(rawContent, options.singleQuote ? "'" : '"').quote;
  3233. return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.__embeddedInHtml));
  3234. }
  3235. function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
  3236. const otherQuote = enclosingQuote === '"' ? "'" : '"';
  3237. const regex = /\\(.)|(["'])/gs;
  3238. const newContent = rawContent.replace(regex, (match, escaped, quote) => {
  3239. if (escaped === otherQuote) {
  3240. return escaped;
  3241. }
  3242. if (quote === enclosingQuote) {
  3243. return "\\" + quote;
  3244. }
  3245. if (quote) {
  3246. return quote;
  3247. }
  3248. return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
  3249. });
  3250. return enclosingQuote + newContent + enclosingQuote;
  3251. }
  3252. function printNumber(rawNumber) {
  3253. 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|$)/, "");
  3254. }
  3255. function getMaxContinuousCount(str, target) {
  3256. const results = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3257. if (results === null) {
  3258. return 0;
  3259. }
  3260. return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
  3261. }
  3262. function getMinNotPresentContinuousCount(str, target) {
  3263. const matches = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3264. if (matches === null) {
  3265. return 0;
  3266. }
  3267. const countPresent = /* @__PURE__ */ new Map();
  3268. let max = 0;
  3269. for (const match of matches) {
  3270. const count = match.length / target.length;
  3271. countPresent.set(count, true);
  3272. if (count > max) {
  3273. max = count;
  3274. }
  3275. }
  3276. for (let i = 1; i < max; i++) {
  3277. if (!countPresent.get(i)) {
  3278. return i;
  3279. }
  3280. }
  3281. return max + 1;
  3282. }
  3283. function addCommentHelper(node, comment) {
  3284. const comments = node.comments || (node.comments = []);
  3285. comments.push(comment);
  3286. comment.printed = false;
  3287. comment.nodeDescription = describeNodeForDebugging(node);
  3288. }
  3289. function addLeadingComment(node, comment) {
  3290. comment.leading = true;
  3291. comment.trailing = false;
  3292. addCommentHelper(node, comment);
  3293. }
  3294. function addDanglingComment(node, comment, marker) {
  3295. comment.leading = false;
  3296. comment.trailing = false;
  3297. if (marker) {
  3298. comment.marker = marker;
  3299. }
  3300. addCommentHelper(node, comment);
  3301. }
  3302. function addTrailingComment(node, comment) {
  3303. comment.leading = false;
  3304. comment.trailing = true;
  3305. addCommentHelper(node, comment);
  3306. }
  3307. function inferParserByLanguage(language, options) {
  3308. const {
  3309. languages
  3310. } = getSupportInfo2({
  3311. plugins: options.plugins
  3312. });
  3313. const matched = languages.find(({
  3314. name
  3315. }) => name.toLowerCase() === language) || languages.find(({
  3316. aliases
  3317. }) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
  3318. extensions
  3319. }) => Array.isArray(extensions) && extensions.includes(`.${language}`));
  3320. return matched && matched.parsers[0];
  3321. }
  3322. function isFrontMatterNode(node) {
  3323. return node && node.type === "front-matter";
  3324. }
  3325. function createGroupIdMapper(description) {
  3326. const groupIds = /* @__PURE__ */ new WeakMap();
  3327. return function(node) {
  3328. if (!groupIds.has(node)) {
  3329. groupIds.set(node, Symbol(description));
  3330. }
  3331. return groupIds.get(node);
  3332. };
  3333. }
  3334. function describeNodeForDebugging(node) {
  3335. const nodeType = node.type || node.kind || "(unknown type)";
  3336. 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 || "");
  3337. if (nodeName.length > 20) {
  3338. nodeName = nodeName.slice(0, 19) + "\u2026";
  3339. }
  3340. return nodeType + (nodeName ? " " + nodeName : "");
  3341. }
  3342. module2.exports = {
  3343. inferParserByLanguage,
  3344. getStringWidth,
  3345. getMaxContinuousCount,
  3346. getMinNotPresentContinuousCount,
  3347. getPenultimate,
  3348. getLast,
  3349. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  3350. getNextNonSpaceNonCommentCharacterIndex,
  3351. getNextNonSpaceNonCommentCharacter,
  3352. skip,
  3353. skipWhitespace,
  3354. skipSpaces,
  3355. skipToLineEnd,
  3356. skipEverythingButNewLine,
  3357. skipInlineComment,
  3358. skipTrailingComment,
  3359. skipNewline,
  3360. isNextLineEmptyAfterIndex,
  3361. isNextLineEmpty,
  3362. isPreviousLineEmpty,
  3363. hasNewline,
  3364. hasNewlineInRange,
  3365. hasSpaces,
  3366. getAlignmentSize,
  3367. getIndentSize,
  3368. getPreferredQuote,
  3369. printString,
  3370. printNumber,
  3371. makeString,
  3372. addLeadingComment,
  3373. addDanglingComment,
  3374. addTrailingComment,
  3375. isFrontMatterNode,
  3376. isNonEmptyArray,
  3377. createGroupIdMapper
  3378. };
  3379. }
  3380. });
  3381. var require_end_of_line = __commonJS2({
  3382. "src/common/end-of-line.js"(exports2, module2) {
  3383. "use strict";
  3384. function guessEndOfLine(text) {
  3385. const index = text.indexOf("\r");
  3386. if (index >= 0) {
  3387. return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
  3388. }
  3389. return "lf";
  3390. }
  3391. function convertEndOfLineToChars(value) {
  3392. switch (value) {
  3393. case "cr":
  3394. return "\r";
  3395. case "crlf":
  3396. return "\r\n";
  3397. default:
  3398. return "\n";
  3399. }
  3400. }
  3401. function countEndOfLineChars(text, eol) {
  3402. let regex;
  3403. switch (eol) {
  3404. case "\n":
  3405. regex = /\n/g;
  3406. break;
  3407. case "\r":
  3408. regex = /\r/g;
  3409. break;
  3410. case "\r\n":
  3411. regex = /\r\n/g;
  3412. break;
  3413. default:
  3414. throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
  3415. }
  3416. const endOfLines = text.match(regex);
  3417. return endOfLines ? endOfLines.length : 0;
  3418. }
  3419. function normalizeEndOfLine(text) {
  3420. return text.replace(/\r\n?/g, "\n");
  3421. }
  3422. module2.exports = {
  3423. guessEndOfLine,
  3424. convertEndOfLineToChars,
  3425. countEndOfLineChars,
  3426. normalizeEndOfLine
  3427. };
  3428. }
  3429. });
  3430. var require_errors = __commonJS2({
  3431. "src/common/errors.js"(exports2, module2) {
  3432. "use strict";
  3433. var ConfigError = class extends Error {
  3434. };
  3435. var DebugError = class extends Error {
  3436. };
  3437. var UndefinedParserError = class extends Error {
  3438. };
  3439. var ArgExpansionBailout = class extends Error {
  3440. };
  3441. module2.exports = {
  3442. ConfigError,
  3443. DebugError,
  3444. UndefinedParserError,
  3445. ArgExpansionBailout
  3446. };
  3447. }
  3448. });
  3449. var tslib_es6_exports = {};
  3450. __export(tslib_es6_exports, {
  3451. __assign: () => __assign,
  3452. __asyncDelegator: () => __asyncDelegator,
  3453. __asyncGenerator: () => __asyncGenerator,
  3454. __asyncValues: () => __asyncValues,
  3455. __await: () => __await,
  3456. __awaiter: () => __awaiter,
  3457. __classPrivateFieldGet: () => __classPrivateFieldGet,
  3458. __classPrivateFieldSet: () => __classPrivateFieldSet,
  3459. __createBinding: () => __createBinding,
  3460. __decorate: () => __decorate,
  3461. __exportStar: () => __exportStar,
  3462. __extends: () => __extends,
  3463. __generator: () => __generator,
  3464. __importDefault: () => __importDefault,
  3465. __importStar: () => __importStar,
  3466. __makeTemplateObject: () => __makeTemplateObject,
  3467. __metadata: () => __metadata,
  3468. __param: () => __param,
  3469. __read: () => __read,
  3470. __rest: () => __rest,
  3471. __spread: () => __spread,
  3472. __spreadArrays: () => __spreadArrays,
  3473. __values: () => __values
  3474. });
  3475. function __extends(d, b) {
  3476. extendStatics(d, b);
  3477. function __() {
  3478. this.constructor = d;
  3479. }
  3480. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3481. }
  3482. function __rest(s, e) {
  3483. var t = {};
  3484. for (var p in s)
  3485. if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  3486. t[p] = s[p];
  3487. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  3488. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  3489. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  3490. t[p[i]] = s[p[i]];
  3491. }
  3492. return t;
  3493. }
  3494. function __decorate(decorators, target, key, desc) {
  3495. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3496. if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
  3497. r = Reflect.decorate(decorators, target, key, desc);
  3498. else
  3499. for (var i = decorators.length - 1; i >= 0; i--)
  3500. if (d = decorators[i])
  3501. r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3502. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3503. }
  3504. function __param(paramIndex, decorator) {
  3505. return function(target, key) {
  3506. decorator(target, key, paramIndex);
  3507. };
  3508. }
  3509. function __metadata(metadataKey, metadataValue) {
  3510. if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
  3511. return Reflect.metadata(metadataKey, metadataValue);
  3512. }
  3513. function __awaiter(thisArg, _arguments, P, generator) {
  3514. function adopt(value) {
  3515. return value instanceof P ? value : new P(function(resolve) {
  3516. resolve(value);
  3517. });
  3518. }
  3519. return new (P || (P = Promise))(function(resolve, reject) {
  3520. function fulfilled(value) {
  3521. try {
  3522. step(generator.next(value));
  3523. } catch (e) {
  3524. reject(e);
  3525. }
  3526. }
  3527. function rejected(value) {
  3528. try {
  3529. step(generator["throw"](value));
  3530. } catch (e) {
  3531. reject(e);
  3532. }
  3533. }
  3534. function step(result) {
  3535. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  3536. }
  3537. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3538. });
  3539. }
  3540. function __generator(thisArg, body) {
  3541. var _ = {
  3542. label: 0,
  3543. sent: function() {
  3544. if (t[0] & 1)
  3545. throw t[1];
  3546. return t[1];
  3547. },
  3548. trys: [],
  3549. ops: []
  3550. }, f, y, t, g;
  3551. return g = {
  3552. next: verb(0),
  3553. "throw": verb(1),
  3554. "return": verb(2)
  3555. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  3556. return this;
  3557. }), g;
  3558. function verb(n) {
  3559. return function(v) {
  3560. return step([n, v]);
  3561. };
  3562. }
  3563. function step(op) {
  3564. if (f)
  3565. throw new TypeError("Generator is already executing.");
  3566. while (_)
  3567. try {
  3568. 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)
  3569. return t;
  3570. if (y = 0, t)
  3571. op = [op[0] & 2, t.value];
  3572. switch (op[0]) {
  3573. case 0:
  3574. case 1:
  3575. t = op;
  3576. break;
  3577. case 4:
  3578. _.label++;
  3579. return {
  3580. value: op[1],
  3581. done: false
  3582. };
  3583. case 5:
  3584. _.label++;
  3585. y = op[1];
  3586. op = [0];
  3587. continue;
  3588. case 7:
  3589. op = _.ops.pop();
  3590. _.trys.pop();
  3591. continue;
  3592. default:
  3593. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  3594. _ = 0;
  3595. continue;
  3596. }
  3597. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  3598. _.label = op[1];
  3599. break;
  3600. }
  3601. if (op[0] === 6 && _.label < t[1]) {
  3602. _.label = t[1];
  3603. t = op;
  3604. break;
  3605. }
  3606. if (t && _.label < t[2]) {
  3607. _.label = t[2];
  3608. _.ops.push(op);
  3609. break;
  3610. }
  3611. if (t[2])
  3612. _.ops.pop();
  3613. _.trys.pop();
  3614. continue;
  3615. }
  3616. op = body.call(thisArg, _);
  3617. } catch (e) {
  3618. op = [6, e];
  3619. y = 0;
  3620. } finally {
  3621. f = t = 0;
  3622. }
  3623. if (op[0] & 5)
  3624. throw op[1];
  3625. return {
  3626. value: op[0] ? op[1] : void 0,
  3627. done: true
  3628. };
  3629. }
  3630. }
  3631. function __createBinding(o, m, k, k2) {
  3632. if (k2 === void 0)
  3633. k2 = k;
  3634. o[k2] = m[k];
  3635. }
  3636. function __exportStar(m, exports2) {
  3637. for (var p in m)
  3638. if (p !== "default" && !exports2.hasOwnProperty(p))
  3639. exports2[p] = m[p];
  3640. }
  3641. function __values(o) {
  3642. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  3643. if (m)
  3644. return m.call(o);
  3645. if (o && typeof o.length === "number")
  3646. return {
  3647. next: function() {
  3648. if (o && i >= o.length)
  3649. o = void 0;
  3650. return {
  3651. value: o && o[i++],
  3652. done: !o
  3653. };
  3654. }
  3655. };
  3656. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  3657. }
  3658. function __read(o, n) {
  3659. var m = typeof Symbol === "function" && o[Symbol.iterator];
  3660. if (!m)
  3661. return o;
  3662. var i = m.call(o), r, ar = [], e;
  3663. try {
  3664. while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
  3665. ar.push(r.value);
  3666. } catch (error) {
  3667. e = {
  3668. error
  3669. };
  3670. } finally {
  3671. try {
  3672. if (r && !r.done && (m = i["return"]))
  3673. m.call(i);
  3674. } finally {
  3675. if (e)
  3676. throw e.error;
  3677. }
  3678. }
  3679. return ar;
  3680. }
  3681. function __spread() {
  3682. for (var ar = [], i = 0; i < arguments.length; i++)
  3683. ar = ar.concat(__read(arguments[i]));
  3684. return ar;
  3685. }
  3686. function __spreadArrays() {
  3687. for (var s = 0, i = 0, il = arguments.length; i < il; i++)
  3688. s += arguments[i].length;
  3689. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  3690. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  3691. r[k] = a[j];
  3692. return r;
  3693. }
  3694. function __await(v) {
  3695. return this instanceof __await ? (this.v = v, this) : new __await(v);
  3696. }
  3697. function __asyncGenerator(thisArg, _arguments, generator) {
  3698. if (!Symbol.asyncIterator)
  3699. throw new TypeError("Symbol.asyncIterator is not defined.");
  3700. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  3701. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  3702. return this;
  3703. }, i;
  3704. function verb(n) {
  3705. if (g[n])
  3706. i[n] = function(v) {
  3707. return new Promise(function(a, b) {
  3708. q.push([n, v, a, b]) > 1 || resume(n, v);
  3709. });
  3710. };
  3711. }
  3712. function resume(n, v) {
  3713. try {
  3714. step(g[n](v));
  3715. } catch (e) {
  3716. settle(q[0][3], e);
  3717. }
  3718. }
  3719. function step(r) {
  3720. r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  3721. }
  3722. function fulfill(value) {
  3723. resume("next", value);
  3724. }
  3725. function reject(value) {
  3726. resume("throw", value);
  3727. }
  3728. function settle(f, v) {
  3729. if (f(v), q.shift(), q.length)
  3730. resume(q[0][0], q[0][1]);
  3731. }
  3732. }
  3733. function __asyncDelegator(o) {
  3734. var i, p;
  3735. return i = {}, verb("next"), verb("throw", function(e) {
  3736. throw e;
  3737. }), verb("return"), i[Symbol.iterator] = function() {
  3738. return this;
  3739. }, i;
  3740. function verb(n, f) {
  3741. i[n] = o[n] ? function(v) {
  3742. return (p = !p) ? {
  3743. value: __await(o[n](v)),
  3744. done: n === "return"
  3745. } : f ? f(v) : v;
  3746. } : f;
  3747. }
  3748. }
  3749. function __asyncValues(o) {
  3750. if (!Symbol.asyncIterator)
  3751. throw new TypeError("Symbol.asyncIterator is not defined.");
  3752. var m = o[Symbol.asyncIterator], i;
  3753. 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() {
  3754. return this;
  3755. }, i);
  3756. function verb(n) {
  3757. i[n] = o[n] && function(v) {
  3758. return new Promise(function(resolve, reject) {
  3759. v = o[n](v), settle(resolve, reject, v.done, v.value);
  3760. });
  3761. };
  3762. }
  3763. function settle(resolve, reject, d, v) {
  3764. Promise.resolve(v).then(function(v2) {
  3765. resolve({
  3766. value: v2,
  3767. done: d
  3768. });
  3769. }, reject);
  3770. }
  3771. }
  3772. function __makeTemplateObject(cooked, raw) {
  3773. if (Object.defineProperty) {
  3774. Object.defineProperty(cooked, "raw", {
  3775. value: raw
  3776. });
  3777. } else {
  3778. cooked.raw = raw;
  3779. }
  3780. return cooked;
  3781. }
  3782. function __importStar(mod) {
  3783. if (mod && mod.__esModule)
  3784. return mod;
  3785. var result = {};
  3786. if (mod != null) {
  3787. for (var k in mod)
  3788. if (Object.hasOwnProperty.call(mod, k))
  3789. result[k] = mod[k];
  3790. }
  3791. result.default = mod;
  3792. return result;
  3793. }
  3794. function __importDefault(mod) {
  3795. return mod && mod.__esModule ? mod : {
  3796. default: mod
  3797. };
  3798. }
  3799. function __classPrivateFieldGet(receiver, privateMap) {
  3800. if (!privateMap.has(receiver)) {
  3801. throw new TypeError("attempted to get private field on non-instance");
  3802. }
  3803. return privateMap.get(receiver);
  3804. }
  3805. function __classPrivateFieldSet(receiver, privateMap, value) {
  3806. if (!privateMap.has(receiver)) {
  3807. throw new TypeError("attempted to set private field on non-instance");
  3808. }
  3809. privateMap.set(receiver, value);
  3810. return value;
  3811. }
  3812. var extendStatics;
  3813. var __assign;
  3814. var init_tslib_es6 = __esm({
  3815. "node_modules/tslib/tslib.es6.js"() {
  3816. extendStatics = function(d, b) {
  3817. extendStatics = Object.setPrototypeOf || {
  3818. __proto__: []
  3819. } instanceof Array && function(d2, b2) {
  3820. d2.__proto__ = b2;
  3821. } || function(d2, b2) {
  3822. for (var p in b2)
  3823. if (b2.hasOwnProperty(p))
  3824. d2[p] = b2[p];
  3825. };
  3826. return extendStatics(d, b);
  3827. };
  3828. __assign = function() {
  3829. __assign = Object.assign || function __assign2(t) {
  3830. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3831. s = arguments[i];
  3832. for (var p in s)
  3833. if (Object.prototype.hasOwnProperty.call(s, p))
  3834. t[p] = s[p];
  3835. }
  3836. return t;
  3837. };
  3838. return __assign.apply(this, arguments);
  3839. };
  3840. }
  3841. });
  3842. var require_api = __commonJS2({
  3843. "node_modules/vnopts/lib/descriptors/api.js"(exports2) {
  3844. "use strict";
  3845. Object.defineProperty(exports2, "__esModule", {
  3846. value: true
  3847. });
  3848. exports2.apiDescriptor = {
  3849. key: (key) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key),
  3850. value(value) {
  3851. if (value === null || typeof value !== "object") {
  3852. return JSON.stringify(value);
  3853. }
  3854. if (Array.isArray(value)) {
  3855. return `[${value.map((subValue) => exports2.apiDescriptor.value(subValue)).join(", ")}]`;
  3856. }
  3857. const keys = Object.keys(value);
  3858. return keys.length === 0 ? "{}" : `{ ${keys.map((key) => `${exports2.apiDescriptor.key(key)}: ${exports2.apiDescriptor.value(value[key])}`).join(", ")} }`;
  3859. },
  3860. pair: ({
  3861. key,
  3862. value
  3863. }) => exports2.apiDescriptor.value({
  3864. [key]: value
  3865. })
  3866. };
  3867. }
  3868. });
  3869. var require_descriptors2 = __commonJS2({
  3870. "node_modules/vnopts/lib/descriptors/index.js"(exports2) {
  3871. "use strict";
  3872. Object.defineProperty(exports2, "__esModule", {
  3873. value: true
  3874. });
  3875. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  3876. tslib_1.__exportStar(require_api(), exports2);
  3877. }
  3878. });
  3879. var require_escape_string_regexp = __commonJS2({
  3880. "node_modules/vnopts/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  3881. "use strict";
  3882. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  3883. module2.exports = function(str) {
  3884. if (typeof str !== "string") {
  3885. throw new TypeError("Expected a string");
  3886. }
  3887. return str.replace(matchOperatorsRe, "\\$&");
  3888. };
  3889. }
  3890. });
  3891. var require_color_name = __commonJS2({
  3892. "node_modules/color-name/index.js"(exports2, module2) {
  3893. "use strict";
  3894. module2.exports = {
  3895. "aliceblue": [240, 248, 255],
  3896. "antiquewhite": [250, 235, 215],
  3897. "aqua": [0, 255, 255],
  3898. "aquamarine": [127, 255, 212],
  3899. "azure": [240, 255, 255],
  3900. "beige": [245, 245, 220],
  3901. "bisque": [255, 228, 196],
  3902. "black": [0, 0, 0],
  3903. "blanchedalmond": [255, 235, 205],
  3904. "blue": [0, 0, 255],
  3905. "blueviolet": [138, 43, 226],
  3906. "brown": [165, 42, 42],
  3907. "burlywood": [222, 184, 135],
  3908. "cadetblue": [95, 158, 160],
  3909. "chartreuse": [127, 255, 0],
  3910. "chocolate": [210, 105, 30],
  3911. "coral": [255, 127, 80],
  3912. "cornflowerblue": [100, 149, 237],
  3913. "cornsilk": [255, 248, 220],
  3914. "crimson": [220, 20, 60],
  3915. "cyan": [0, 255, 255],
  3916. "darkblue": [0, 0, 139],
  3917. "darkcyan": [0, 139, 139],
  3918. "darkgoldenrod": [184, 134, 11],
  3919. "darkgray": [169, 169, 169],
  3920. "darkgreen": [0, 100, 0],
  3921. "darkgrey": [169, 169, 169],
  3922. "darkkhaki": [189, 183, 107],
  3923. "darkmagenta": [139, 0, 139],
  3924. "darkolivegreen": [85, 107, 47],
  3925. "darkorange": [255, 140, 0],
  3926. "darkorchid": [153, 50, 204],
  3927. "darkred": [139, 0, 0],
  3928. "darksalmon": [233, 150, 122],
  3929. "darkseagreen": [143, 188, 143],
  3930. "darkslateblue": [72, 61, 139],
  3931. "darkslategray": [47, 79, 79],
  3932. "darkslategrey": [47, 79, 79],
  3933. "darkturquoise": [0, 206, 209],
  3934. "darkviolet": [148, 0, 211],
  3935. "deeppink": [255, 20, 147],
  3936. "deepskyblue": [0, 191, 255],
  3937. "dimgray": [105, 105, 105],
  3938. "dimgrey": [105, 105, 105],
  3939. "dodgerblue": [30, 144, 255],
  3940. "firebrick": [178, 34, 34],
  3941. "floralwhite": [255, 250, 240],
  3942. "forestgreen": [34, 139, 34],
  3943. "fuchsia": [255, 0, 255],
  3944. "gainsboro": [220, 220, 220],
  3945. "ghostwhite": [248, 248, 255],
  3946. "gold": [255, 215, 0],
  3947. "goldenrod": [218, 165, 32],
  3948. "gray": [128, 128, 128],
  3949. "green": [0, 128, 0],
  3950. "greenyellow": [173, 255, 47],
  3951. "grey": [128, 128, 128],
  3952. "honeydew": [240, 255, 240],
  3953. "hotpink": [255, 105, 180],
  3954. "indianred": [205, 92, 92],
  3955. "indigo": [75, 0, 130],
  3956. "ivory": [255, 255, 240],
  3957. "khaki": [240, 230, 140],
  3958. "lavender": [230, 230, 250],
  3959. "lavenderblush": [255, 240, 245],
  3960. "lawngreen": [124, 252, 0],
  3961. "lemonchiffon": [255, 250, 205],
  3962. "lightblue": [173, 216, 230],
  3963. "lightcoral": [240, 128, 128],
  3964. "lightcyan": [224, 255, 255],
  3965. "lightgoldenrodyellow": [250, 250, 210],
  3966. "lightgray": [211, 211, 211],
  3967. "lightgreen": [144, 238, 144],
  3968. "lightgrey": [211, 211, 211],
  3969. "lightpink": [255, 182, 193],
  3970. "lightsalmon": [255, 160, 122],
  3971. "lightseagreen": [32, 178, 170],
  3972. "lightskyblue": [135, 206, 250],
  3973. "lightslategray": [119, 136, 153],
  3974. "lightslategrey": [119, 136, 153],
  3975. "lightsteelblue": [176, 196, 222],
  3976. "lightyellow": [255, 255, 224],
  3977. "lime": [0, 255, 0],
  3978. "limegreen": [50, 205, 50],
  3979. "linen": [250, 240, 230],
  3980. "magenta": [255, 0, 255],
  3981. "maroon": [128, 0, 0],
  3982. "mediumaquamarine": [102, 205, 170],
  3983. "mediumblue": [0, 0, 205],
  3984. "mediumorchid": [186, 85, 211],
  3985. "mediumpurple": [147, 112, 219],
  3986. "mediumseagreen": [60, 179, 113],
  3987. "mediumslateblue": [123, 104, 238],
  3988. "mediumspringgreen": [0, 250, 154],
  3989. "mediumturquoise": [72, 209, 204],
  3990. "mediumvioletred": [199, 21, 133],
  3991. "midnightblue": [25, 25, 112],
  3992. "mintcream": [245, 255, 250],
  3993. "mistyrose": [255, 228, 225],
  3994. "moccasin": [255, 228, 181],
  3995. "navajowhite": [255, 222, 173],
  3996. "navy": [0, 0, 128],
  3997. "oldlace": [253, 245, 230],
  3998. "olive": [128, 128, 0],
  3999. "olivedrab": [107, 142, 35],
  4000. "orange": [255, 165, 0],
  4001. "orangered": [255, 69, 0],
  4002. "orchid": [218, 112, 214],
  4003. "palegoldenrod": [238, 232, 170],
  4004. "palegreen": [152, 251, 152],
  4005. "paleturquoise": [175, 238, 238],
  4006. "palevioletred": [219, 112, 147],
  4007. "papayawhip": [255, 239, 213],
  4008. "peachpuff": [255, 218, 185],
  4009. "peru": [205, 133, 63],
  4010. "pink": [255, 192, 203],
  4011. "plum": [221, 160, 221],
  4012. "powderblue": [176, 224, 230],
  4013. "purple": [128, 0, 128],
  4014. "rebeccapurple": [102, 51, 153],
  4015. "red": [255, 0, 0],
  4016. "rosybrown": [188, 143, 143],
  4017. "royalblue": [65, 105, 225],
  4018. "saddlebrown": [139, 69, 19],
  4019. "salmon": [250, 128, 114],
  4020. "sandybrown": [244, 164, 96],
  4021. "seagreen": [46, 139, 87],
  4022. "seashell": [255, 245, 238],
  4023. "sienna": [160, 82, 45],
  4024. "silver": [192, 192, 192],
  4025. "skyblue": [135, 206, 235],
  4026. "slateblue": [106, 90, 205],
  4027. "slategray": [112, 128, 144],
  4028. "slategrey": [112, 128, 144],
  4029. "snow": [255, 250, 250],
  4030. "springgreen": [0, 255, 127],
  4031. "steelblue": [70, 130, 180],
  4032. "tan": [210, 180, 140],
  4033. "teal": [0, 128, 128],
  4034. "thistle": [216, 191, 216],
  4035. "tomato": [255, 99, 71],
  4036. "turquoise": [64, 224, 208],
  4037. "violet": [238, 130, 238],
  4038. "wheat": [245, 222, 179],
  4039. "white": [255, 255, 255],
  4040. "whitesmoke": [245, 245, 245],
  4041. "yellow": [255, 255, 0],
  4042. "yellowgreen": [154, 205, 50]
  4043. };
  4044. }
  4045. });
  4046. var require_conversions = __commonJS2({
  4047. "node_modules/color-convert/conversions.js"(exports2, module2) {
  4048. var cssKeywords = require_color_name();
  4049. var reverseKeywords = {};
  4050. for (key in cssKeywords) {
  4051. if (cssKeywords.hasOwnProperty(key)) {
  4052. reverseKeywords[cssKeywords[key]] = key;
  4053. }
  4054. }
  4055. var key;
  4056. var convert = module2.exports = {
  4057. rgb: {
  4058. channels: 3,
  4059. labels: "rgb"
  4060. },
  4061. hsl: {
  4062. channels: 3,
  4063. labels: "hsl"
  4064. },
  4065. hsv: {
  4066. channels: 3,
  4067. labels: "hsv"
  4068. },
  4069. hwb: {
  4070. channels: 3,
  4071. labels: "hwb"
  4072. },
  4073. cmyk: {
  4074. channels: 4,
  4075. labels: "cmyk"
  4076. },
  4077. xyz: {
  4078. channels: 3,
  4079. labels: "xyz"
  4080. },
  4081. lab: {
  4082. channels: 3,
  4083. labels: "lab"
  4084. },
  4085. lch: {
  4086. channels: 3,
  4087. labels: "lch"
  4088. },
  4089. hex: {
  4090. channels: 1,
  4091. labels: ["hex"]
  4092. },
  4093. keyword: {
  4094. channels: 1,
  4095. labels: ["keyword"]
  4096. },
  4097. ansi16: {
  4098. channels: 1,
  4099. labels: ["ansi16"]
  4100. },
  4101. ansi256: {
  4102. channels: 1,
  4103. labels: ["ansi256"]
  4104. },
  4105. hcg: {
  4106. channels: 3,
  4107. labels: ["h", "c", "g"]
  4108. },
  4109. apple: {
  4110. channels: 3,
  4111. labels: ["r16", "g16", "b16"]
  4112. },
  4113. gray: {
  4114. channels: 1,
  4115. labels: ["gray"]
  4116. }
  4117. };
  4118. for (model in convert) {
  4119. if (convert.hasOwnProperty(model)) {
  4120. if (!("channels" in convert[model])) {
  4121. throw new Error("missing channels property: " + model);
  4122. }
  4123. if (!("labels" in convert[model])) {
  4124. throw new Error("missing channel labels property: " + model);
  4125. }
  4126. if (convert[model].labels.length !== convert[model].channels) {
  4127. throw new Error("channel and label counts mismatch: " + model);
  4128. }
  4129. channels = convert[model].channels;
  4130. labels = convert[model].labels;
  4131. delete convert[model].channels;
  4132. delete convert[model].labels;
  4133. Object.defineProperty(convert[model], "channels", {
  4134. value: channels
  4135. });
  4136. Object.defineProperty(convert[model], "labels", {
  4137. value: labels
  4138. });
  4139. }
  4140. }
  4141. var channels;
  4142. var labels;
  4143. var model;
  4144. convert.rgb.hsl = function(rgb) {
  4145. var r = rgb[0] / 255;
  4146. var g = rgb[1] / 255;
  4147. var b = rgb[2] / 255;
  4148. var min = Math.min(r, g, b);
  4149. var max = Math.max(r, g, b);
  4150. var delta = max - min;
  4151. var h;
  4152. var s;
  4153. var l;
  4154. if (max === min) {
  4155. h = 0;
  4156. } else if (r === max) {
  4157. h = (g - b) / delta;
  4158. } else if (g === max) {
  4159. h = 2 + (b - r) / delta;
  4160. } else if (b === max) {
  4161. h = 4 + (r - g) / delta;
  4162. }
  4163. h = Math.min(h * 60, 360);
  4164. if (h < 0) {
  4165. h += 360;
  4166. }
  4167. l = (min + max) / 2;
  4168. if (max === min) {
  4169. s = 0;
  4170. } else if (l <= 0.5) {
  4171. s = delta / (max + min);
  4172. } else {
  4173. s = delta / (2 - max - min);
  4174. }
  4175. return [h, s * 100, l * 100];
  4176. };
  4177. convert.rgb.hsv = function(rgb) {
  4178. var rdif;
  4179. var gdif;
  4180. var bdif;
  4181. var h;
  4182. var s;
  4183. var r = rgb[0] / 255;
  4184. var g = rgb[1] / 255;
  4185. var b = rgb[2] / 255;
  4186. var v = Math.max(r, g, b);
  4187. var diff = v - Math.min(r, g, b);
  4188. var diffc = function(c) {
  4189. return (v - c) / 6 / diff + 1 / 2;
  4190. };
  4191. if (diff === 0) {
  4192. h = s = 0;
  4193. } else {
  4194. s = diff / v;
  4195. rdif = diffc(r);
  4196. gdif = diffc(g);
  4197. bdif = diffc(b);
  4198. if (r === v) {
  4199. h = bdif - gdif;
  4200. } else if (g === v) {
  4201. h = 1 / 3 + rdif - bdif;
  4202. } else if (b === v) {
  4203. h = 2 / 3 + gdif - rdif;
  4204. }
  4205. if (h < 0) {
  4206. h += 1;
  4207. } else if (h > 1) {
  4208. h -= 1;
  4209. }
  4210. }
  4211. return [h * 360, s * 100, v * 100];
  4212. };
  4213. convert.rgb.hwb = function(rgb) {
  4214. var r = rgb[0];
  4215. var g = rgb[1];
  4216. var b = rgb[2];
  4217. var h = convert.rgb.hsl(rgb)[0];
  4218. var w = 1 / 255 * Math.min(r, Math.min(g, b));
  4219. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  4220. return [h, w * 100, b * 100];
  4221. };
  4222. convert.rgb.cmyk = function(rgb) {
  4223. var r = rgb[0] / 255;
  4224. var g = rgb[1] / 255;
  4225. var b = rgb[2] / 255;
  4226. var c;
  4227. var m;
  4228. var y;
  4229. var k;
  4230. k = Math.min(1 - r, 1 - g, 1 - b);
  4231. c = (1 - r - k) / (1 - k) || 0;
  4232. m = (1 - g - k) / (1 - k) || 0;
  4233. y = (1 - b - k) / (1 - k) || 0;
  4234. return [c * 100, m * 100, y * 100, k * 100];
  4235. };
  4236. function comparativeDistance(x, y) {
  4237. return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
  4238. }
  4239. convert.rgb.keyword = function(rgb) {
  4240. var reversed = reverseKeywords[rgb];
  4241. if (reversed) {
  4242. return reversed;
  4243. }
  4244. var currentClosestDistance = Infinity;
  4245. var currentClosestKeyword;
  4246. for (var keyword in cssKeywords) {
  4247. if (cssKeywords.hasOwnProperty(keyword)) {
  4248. var value = cssKeywords[keyword];
  4249. var distance = comparativeDistance(rgb, value);
  4250. if (distance < currentClosestDistance) {
  4251. currentClosestDistance = distance;
  4252. currentClosestKeyword = keyword;
  4253. }
  4254. }
  4255. }
  4256. return currentClosestKeyword;
  4257. };
  4258. convert.keyword.rgb = function(keyword) {
  4259. return cssKeywords[keyword];
  4260. };
  4261. convert.rgb.xyz = function(rgb) {
  4262. var r = rgb[0] / 255;
  4263. var g = rgb[1] / 255;
  4264. var b = rgb[2] / 255;
  4265. r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
  4266. g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
  4267. b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
  4268. var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
  4269. var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
  4270. var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
  4271. return [x * 100, y * 100, z * 100];
  4272. };
  4273. convert.rgb.lab = function(rgb) {
  4274. var xyz = convert.rgb.xyz(rgb);
  4275. var x = xyz[0];
  4276. var y = xyz[1];
  4277. var z = xyz[2];
  4278. var l;
  4279. var a;
  4280. var b;
  4281. x /= 95.047;
  4282. y /= 100;
  4283. z /= 108.883;
  4284. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4285. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4286. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4287. l = 116 * y - 16;
  4288. a = 500 * (x - y);
  4289. b = 200 * (y - z);
  4290. return [l, a, b];
  4291. };
  4292. convert.hsl.rgb = function(hsl) {
  4293. var h = hsl[0] / 360;
  4294. var s = hsl[1] / 100;
  4295. var l = hsl[2] / 100;
  4296. var t1;
  4297. var t2;
  4298. var t3;
  4299. var rgb;
  4300. var val;
  4301. if (s === 0) {
  4302. val = l * 255;
  4303. return [val, val, val];
  4304. }
  4305. if (l < 0.5) {
  4306. t2 = l * (1 + s);
  4307. } else {
  4308. t2 = l + s - l * s;
  4309. }
  4310. t1 = 2 * l - t2;
  4311. rgb = [0, 0, 0];
  4312. for (var i = 0; i < 3; i++) {
  4313. t3 = h + 1 / 3 * -(i - 1);
  4314. if (t3 < 0) {
  4315. t3++;
  4316. }
  4317. if (t3 > 1) {
  4318. t3--;
  4319. }
  4320. if (6 * t3 < 1) {
  4321. val = t1 + (t2 - t1) * 6 * t3;
  4322. } else if (2 * t3 < 1) {
  4323. val = t2;
  4324. } else if (3 * t3 < 2) {
  4325. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  4326. } else {
  4327. val = t1;
  4328. }
  4329. rgb[i] = val * 255;
  4330. }
  4331. return rgb;
  4332. };
  4333. convert.hsl.hsv = function(hsl) {
  4334. var h = hsl[0];
  4335. var s = hsl[1] / 100;
  4336. var l = hsl[2] / 100;
  4337. var smin = s;
  4338. var lmin = Math.max(l, 0.01);
  4339. var sv;
  4340. var v;
  4341. l *= 2;
  4342. s *= l <= 1 ? l : 2 - l;
  4343. smin *= lmin <= 1 ? lmin : 2 - lmin;
  4344. v = (l + s) / 2;
  4345. sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
  4346. return [h, sv * 100, v * 100];
  4347. };
  4348. convert.hsv.rgb = function(hsv) {
  4349. var h = hsv[0] / 60;
  4350. var s = hsv[1] / 100;
  4351. var v = hsv[2] / 100;
  4352. var hi = Math.floor(h) % 6;
  4353. var f = h - Math.floor(h);
  4354. var p = 255 * v * (1 - s);
  4355. var q = 255 * v * (1 - s * f);
  4356. var t = 255 * v * (1 - s * (1 - f));
  4357. v *= 255;
  4358. switch (hi) {
  4359. case 0:
  4360. return [v, t, p];
  4361. case 1:
  4362. return [q, v, p];
  4363. case 2:
  4364. return [p, v, t];
  4365. case 3:
  4366. return [p, q, v];
  4367. case 4:
  4368. return [t, p, v];
  4369. case 5:
  4370. return [v, p, q];
  4371. }
  4372. };
  4373. convert.hsv.hsl = function(hsv) {
  4374. var h = hsv[0];
  4375. var s = hsv[1] / 100;
  4376. var v = hsv[2] / 100;
  4377. var vmin = Math.max(v, 0.01);
  4378. var lmin;
  4379. var sl;
  4380. var l;
  4381. l = (2 - s) * v;
  4382. lmin = (2 - s) * vmin;
  4383. sl = s * vmin;
  4384. sl /= lmin <= 1 ? lmin : 2 - lmin;
  4385. sl = sl || 0;
  4386. l /= 2;
  4387. return [h, sl * 100, l * 100];
  4388. };
  4389. convert.hwb.rgb = function(hwb) {
  4390. var h = hwb[0] / 360;
  4391. var wh = hwb[1] / 100;
  4392. var bl = hwb[2] / 100;
  4393. var ratio = wh + bl;
  4394. var i;
  4395. var v;
  4396. var f;
  4397. var n;
  4398. if (ratio > 1) {
  4399. wh /= ratio;
  4400. bl /= ratio;
  4401. }
  4402. i = Math.floor(6 * h);
  4403. v = 1 - bl;
  4404. f = 6 * h - i;
  4405. if ((i & 1) !== 0) {
  4406. f = 1 - f;
  4407. }
  4408. n = wh + f * (v - wh);
  4409. var r;
  4410. var g;
  4411. var b;
  4412. switch (i) {
  4413. default:
  4414. case 6:
  4415. case 0:
  4416. r = v;
  4417. g = n;
  4418. b = wh;
  4419. break;
  4420. case 1:
  4421. r = n;
  4422. g = v;
  4423. b = wh;
  4424. break;
  4425. case 2:
  4426. r = wh;
  4427. g = v;
  4428. b = n;
  4429. break;
  4430. case 3:
  4431. r = wh;
  4432. g = n;
  4433. b = v;
  4434. break;
  4435. case 4:
  4436. r = n;
  4437. g = wh;
  4438. b = v;
  4439. break;
  4440. case 5:
  4441. r = v;
  4442. g = wh;
  4443. b = n;
  4444. break;
  4445. }
  4446. return [r * 255, g * 255, b * 255];
  4447. };
  4448. convert.cmyk.rgb = function(cmyk) {
  4449. var c = cmyk[0] / 100;
  4450. var m = cmyk[1] / 100;
  4451. var y = cmyk[2] / 100;
  4452. var k = cmyk[3] / 100;
  4453. var r;
  4454. var g;
  4455. var b;
  4456. r = 1 - Math.min(1, c * (1 - k) + k);
  4457. g = 1 - Math.min(1, m * (1 - k) + k);
  4458. b = 1 - Math.min(1, y * (1 - k) + k);
  4459. return [r * 255, g * 255, b * 255];
  4460. };
  4461. convert.xyz.rgb = function(xyz) {
  4462. var x = xyz[0] / 100;
  4463. var y = xyz[1] / 100;
  4464. var z = xyz[2] / 100;
  4465. var r;
  4466. var g;
  4467. var b;
  4468. r = x * 3.2406 + y * -1.5372 + z * -0.4986;
  4469. g = x * -0.9689 + y * 1.8758 + z * 0.0415;
  4470. b = x * 0.0557 + y * -0.204 + z * 1.057;
  4471. r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
  4472. g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
  4473. b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
  4474. r = Math.min(Math.max(0, r), 1);
  4475. g = Math.min(Math.max(0, g), 1);
  4476. b = Math.min(Math.max(0, b), 1);
  4477. return [r * 255, g * 255, b * 255];
  4478. };
  4479. convert.xyz.lab = function(xyz) {
  4480. var x = xyz[0];
  4481. var y = xyz[1];
  4482. var z = xyz[2];
  4483. var l;
  4484. var a;
  4485. var b;
  4486. x /= 95.047;
  4487. y /= 100;
  4488. z /= 108.883;
  4489. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4490. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4491. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4492. l = 116 * y - 16;
  4493. a = 500 * (x - y);
  4494. b = 200 * (y - z);
  4495. return [l, a, b];
  4496. };
  4497. convert.lab.xyz = function(lab) {
  4498. var l = lab[0];
  4499. var a = lab[1];
  4500. var b = lab[2];
  4501. var x;
  4502. var y;
  4503. var z;
  4504. y = (l + 16) / 116;
  4505. x = a / 500 + y;
  4506. z = y - b / 200;
  4507. var y2 = Math.pow(y, 3);
  4508. var x2 = Math.pow(x, 3);
  4509. var z2 = Math.pow(z, 3);
  4510. y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
  4511. x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
  4512. z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
  4513. x *= 95.047;
  4514. y *= 100;
  4515. z *= 108.883;
  4516. return [x, y, z];
  4517. };
  4518. convert.lab.lch = function(lab) {
  4519. var l = lab[0];
  4520. var a = lab[1];
  4521. var b = lab[2];
  4522. var hr;
  4523. var h;
  4524. var c;
  4525. hr = Math.atan2(b, a);
  4526. h = hr * 360 / 2 / Math.PI;
  4527. if (h < 0) {
  4528. h += 360;
  4529. }
  4530. c = Math.sqrt(a * a + b * b);
  4531. return [l, c, h];
  4532. };
  4533. convert.lch.lab = function(lch) {
  4534. var l = lch[0];
  4535. var c = lch[1];
  4536. var h = lch[2];
  4537. var a;
  4538. var b;
  4539. var hr;
  4540. hr = h / 360 * 2 * Math.PI;
  4541. a = c * Math.cos(hr);
  4542. b = c * Math.sin(hr);
  4543. return [l, a, b];
  4544. };
  4545. convert.rgb.ansi16 = function(args) {
  4546. var r = args[0];
  4547. var g = args[1];
  4548. var b = args[2];
  4549. var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
  4550. value = Math.round(value / 50);
  4551. if (value === 0) {
  4552. return 30;
  4553. }
  4554. var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  4555. if (value === 2) {
  4556. ansi += 60;
  4557. }
  4558. return ansi;
  4559. };
  4560. convert.hsv.ansi16 = function(args) {
  4561. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  4562. };
  4563. convert.rgb.ansi256 = function(args) {
  4564. var r = args[0];
  4565. var g = args[1];
  4566. var b = args[2];
  4567. if (r === g && g === b) {
  4568. if (r < 8) {
  4569. return 16;
  4570. }
  4571. if (r > 248) {
  4572. return 231;
  4573. }
  4574. return Math.round((r - 8) / 247 * 24) + 232;
  4575. }
  4576. var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
  4577. return ansi;
  4578. };
  4579. convert.ansi16.rgb = function(args) {
  4580. var color = args % 10;
  4581. if (color === 0 || color === 7) {
  4582. if (args > 50) {
  4583. color += 3.5;
  4584. }
  4585. color = color / 10.5 * 255;
  4586. return [color, color, color];
  4587. }
  4588. var mult = (~~(args > 50) + 1) * 0.5;
  4589. var r = (color & 1) * mult * 255;
  4590. var g = (color >> 1 & 1) * mult * 255;
  4591. var b = (color >> 2 & 1) * mult * 255;
  4592. return [r, g, b];
  4593. };
  4594. convert.ansi256.rgb = function(args) {
  4595. if (args >= 232) {
  4596. var c = (args - 232) * 10 + 8;
  4597. return [c, c, c];
  4598. }
  4599. args -= 16;
  4600. var rem;
  4601. var r = Math.floor(args / 36) / 5 * 255;
  4602. var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  4603. var b = rem % 6 / 5 * 255;
  4604. return [r, g, b];
  4605. };
  4606. convert.rgb.hex = function(args) {
  4607. var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
  4608. var string = integer.toString(16).toUpperCase();
  4609. return "000000".substring(string.length) + string;
  4610. };
  4611. convert.hex.rgb = function(args) {
  4612. var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  4613. if (!match) {
  4614. return [0, 0, 0];
  4615. }
  4616. var colorString = match[0];
  4617. if (match[0].length === 3) {
  4618. colorString = colorString.split("").map(function(char) {
  4619. return char + char;
  4620. }).join("");
  4621. }
  4622. var integer = parseInt(colorString, 16);
  4623. var r = integer >> 16 & 255;
  4624. var g = integer >> 8 & 255;
  4625. var b = integer & 255;
  4626. return [r, g, b];
  4627. };
  4628. convert.rgb.hcg = function(rgb) {
  4629. var r = rgb[0] / 255;
  4630. var g = rgb[1] / 255;
  4631. var b = rgb[2] / 255;
  4632. var max = Math.max(Math.max(r, g), b);
  4633. var min = Math.min(Math.min(r, g), b);
  4634. var chroma = max - min;
  4635. var grayscale;
  4636. var hue;
  4637. if (chroma < 1) {
  4638. grayscale = min / (1 - chroma);
  4639. } else {
  4640. grayscale = 0;
  4641. }
  4642. if (chroma <= 0) {
  4643. hue = 0;
  4644. } else if (max === r) {
  4645. hue = (g - b) / chroma % 6;
  4646. } else if (max === g) {
  4647. hue = 2 + (b - r) / chroma;
  4648. } else {
  4649. hue = 4 + (r - g) / chroma + 4;
  4650. }
  4651. hue /= 6;
  4652. hue %= 1;
  4653. return [hue * 360, chroma * 100, grayscale * 100];
  4654. };
  4655. convert.hsl.hcg = function(hsl) {
  4656. var s = hsl[1] / 100;
  4657. var l = hsl[2] / 100;
  4658. var c = 1;
  4659. var f = 0;
  4660. if (l < 0.5) {
  4661. c = 2 * s * l;
  4662. } else {
  4663. c = 2 * s * (1 - l);
  4664. }
  4665. if (c < 1) {
  4666. f = (l - 0.5 * c) / (1 - c);
  4667. }
  4668. return [hsl[0], c * 100, f * 100];
  4669. };
  4670. convert.hsv.hcg = function(hsv) {
  4671. var s = hsv[1] / 100;
  4672. var v = hsv[2] / 100;
  4673. var c = s * v;
  4674. var f = 0;
  4675. if (c < 1) {
  4676. f = (v - c) / (1 - c);
  4677. }
  4678. return [hsv[0], c * 100, f * 100];
  4679. };
  4680. convert.hcg.rgb = function(hcg) {
  4681. var h = hcg[0] / 360;
  4682. var c = hcg[1] / 100;
  4683. var g = hcg[2] / 100;
  4684. if (c === 0) {
  4685. return [g * 255, g * 255, g * 255];
  4686. }
  4687. var pure = [0, 0, 0];
  4688. var hi = h % 1 * 6;
  4689. var v = hi % 1;
  4690. var w = 1 - v;
  4691. var mg = 0;
  4692. switch (Math.floor(hi)) {
  4693. case 0:
  4694. pure[0] = 1;
  4695. pure[1] = v;
  4696. pure[2] = 0;
  4697. break;
  4698. case 1:
  4699. pure[0] = w;
  4700. pure[1] = 1;
  4701. pure[2] = 0;
  4702. break;
  4703. case 2:
  4704. pure[0] = 0;
  4705. pure[1] = 1;
  4706. pure[2] = v;
  4707. break;
  4708. case 3:
  4709. pure[0] = 0;
  4710. pure[1] = w;
  4711. pure[2] = 1;
  4712. break;
  4713. case 4:
  4714. pure[0] = v;
  4715. pure[1] = 0;
  4716. pure[2] = 1;
  4717. break;
  4718. default:
  4719. pure[0] = 1;
  4720. pure[1] = 0;
  4721. pure[2] = w;
  4722. }
  4723. mg = (1 - c) * g;
  4724. return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  4725. };
  4726. convert.hcg.hsv = function(hcg) {
  4727. var c = hcg[1] / 100;
  4728. var g = hcg[2] / 100;
  4729. var v = c + g * (1 - c);
  4730. var f = 0;
  4731. if (v > 0) {
  4732. f = c / v;
  4733. }
  4734. return [hcg[0], f * 100, v * 100];
  4735. };
  4736. convert.hcg.hsl = function(hcg) {
  4737. var c = hcg[1] / 100;
  4738. var g = hcg[2] / 100;
  4739. var l = g * (1 - c) + 0.5 * c;
  4740. var s = 0;
  4741. if (l > 0 && l < 0.5) {
  4742. s = c / (2 * l);
  4743. } else if (l >= 0.5 && l < 1) {
  4744. s = c / (2 * (1 - l));
  4745. }
  4746. return [hcg[0], s * 100, l * 100];
  4747. };
  4748. convert.hcg.hwb = function(hcg) {
  4749. var c = hcg[1] / 100;
  4750. var g = hcg[2] / 100;
  4751. var v = c + g * (1 - c);
  4752. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  4753. };
  4754. convert.hwb.hcg = function(hwb) {
  4755. var w = hwb[1] / 100;
  4756. var b = hwb[2] / 100;
  4757. var v = 1 - b;
  4758. var c = v - w;
  4759. var g = 0;
  4760. if (c < 1) {
  4761. g = (v - c) / (1 - c);
  4762. }
  4763. return [hwb[0], c * 100, g * 100];
  4764. };
  4765. convert.apple.rgb = function(apple) {
  4766. return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  4767. };
  4768. convert.rgb.apple = function(rgb) {
  4769. return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  4770. };
  4771. convert.gray.rgb = function(args) {
  4772. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  4773. };
  4774. convert.gray.hsl = convert.gray.hsv = function(args) {
  4775. return [0, 0, args[0]];
  4776. };
  4777. convert.gray.hwb = function(gray) {
  4778. return [0, 100, gray[0]];
  4779. };
  4780. convert.gray.cmyk = function(gray) {
  4781. return [0, 0, 0, gray[0]];
  4782. };
  4783. convert.gray.lab = function(gray) {
  4784. return [gray[0], 0, 0];
  4785. };
  4786. convert.gray.hex = function(gray) {
  4787. var val = Math.round(gray[0] / 100 * 255) & 255;
  4788. var integer = (val << 16) + (val << 8) + val;
  4789. var string = integer.toString(16).toUpperCase();
  4790. return "000000".substring(string.length) + string;
  4791. };
  4792. convert.rgb.gray = function(rgb) {
  4793. var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  4794. return [val / 255 * 100];
  4795. };
  4796. }
  4797. });
  4798. var require_route = __commonJS2({
  4799. "node_modules/color-convert/route.js"(exports2, module2) {
  4800. var conversions = require_conversions();
  4801. function buildGraph() {
  4802. var graph = {};
  4803. var models = Object.keys(conversions);
  4804. for (var len = models.length, i = 0; i < len; i++) {
  4805. graph[models[i]] = {
  4806. distance: -1,
  4807. parent: null
  4808. };
  4809. }
  4810. return graph;
  4811. }
  4812. function deriveBFS(fromModel) {
  4813. var graph = buildGraph();
  4814. var queue = [fromModel];
  4815. graph[fromModel].distance = 0;
  4816. while (queue.length) {
  4817. var current = queue.pop();
  4818. var adjacents = Object.keys(conversions[current]);
  4819. for (var len = adjacents.length, i = 0; i < len; i++) {
  4820. var adjacent = adjacents[i];
  4821. var node = graph[adjacent];
  4822. if (node.distance === -1) {
  4823. node.distance = graph[current].distance + 1;
  4824. node.parent = current;
  4825. queue.unshift(adjacent);
  4826. }
  4827. }
  4828. }
  4829. return graph;
  4830. }
  4831. function link(from, to) {
  4832. return function(args) {
  4833. return to(from(args));
  4834. };
  4835. }
  4836. function wrapConversion(toModel, graph) {
  4837. var path = [graph[toModel].parent, toModel];
  4838. var fn = conversions[graph[toModel].parent][toModel];
  4839. var cur = graph[toModel].parent;
  4840. while (graph[cur].parent) {
  4841. path.unshift(graph[cur].parent);
  4842. fn = link(conversions[graph[cur].parent][cur], fn);
  4843. cur = graph[cur].parent;
  4844. }
  4845. fn.conversion = path;
  4846. return fn;
  4847. }
  4848. module2.exports = function(fromModel) {
  4849. var graph = deriveBFS(fromModel);
  4850. var conversion = {};
  4851. var models = Object.keys(graph);
  4852. for (var len = models.length, i = 0; i < len; i++) {
  4853. var toModel = models[i];
  4854. var node = graph[toModel];
  4855. if (node.parent === null) {
  4856. continue;
  4857. }
  4858. conversion[toModel] = wrapConversion(toModel, graph);
  4859. }
  4860. return conversion;
  4861. };
  4862. }
  4863. });
  4864. var require_color_convert = __commonJS2({
  4865. "node_modules/color-convert/index.js"(exports2, module2) {
  4866. var conversions = require_conversions();
  4867. var route = require_route();
  4868. var convert = {};
  4869. var models = Object.keys(conversions);
  4870. function wrapRaw(fn) {
  4871. var wrappedFn = function(args) {
  4872. if (args === void 0 || args === null) {
  4873. return args;
  4874. }
  4875. if (arguments.length > 1) {
  4876. args = Array.prototype.slice.call(arguments);
  4877. }
  4878. return fn(args);
  4879. };
  4880. if ("conversion" in fn) {
  4881. wrappedFn.conversion = fn.conversion;
  4882. }
  4883. return wrappedFn;
  4884. }
  4885. function wrapRounded(fn) {
  4886. var wrappedFn = function(args) {
  4887. if (args === void 0 || args === null) {
  4888. return args;
  4889. }
  4890. if (arguments.length > 1) {
  4891. args = Array.prototype.slice.call(arguments);
  4892. }
  4893. var result = fn(args);
  4894. if (typeof result === "object") {
  4895. for (var len = result.length, i = 0; i < len; i++) {
  4896. result[i] = Math.round(result[i]);
  4897. }
  4898. }
  4899. return result;
  4900. };
  4901. if ("conversion" in fn) {
  4902. wrappedFn.conversion = fn.conversion;
  4903. }
  4904. return wrappedFn;
  4905. }
  4906. models.forEach(function(fromModel) {
  4907. convert[fromModel] = {};
  4908. Object.defineProperty(convert[fromModel], "channels", {
  4909. value: conversions[fromModel].channels
  4910. });
  4911. Object.defineProperty(convert[fromModel], "labels", {
  4912. value: conversions[fromModel].labels
  4913. });
  4914. var routes = route(fromModel);
  4915. var routeModels = Object.keys(routes);
  4916. routeModels.forEach(function(toModel) {
  4917. var fn = routes[toModel];
  4918. convert[fromModel][toModel] = wrapRounded(fn);
  4919. convert[fromModel][toModel].raw = wrapRaw(fn);
  4920. });
  4921. });
  4922. module2.exports = convert;
  4923. }
  4924. });
  4925. var require_ansi_styles = __commonJS2({
  4926. "node_modules/ansi-styles/index.js"(exports2, module2) {
  4927. "use strict";
  4928. var colorConvert = require_color_convert();
  4929. var wrapAnsi16 = (fn, offset) => function() {
  4930. const code = fn.apply(colorConvert, arguments);
  4931. return `\x1B[${code + offset}m`;
  4932. };
  4933. var wrapAnsi256 = (fn, offset) => function() {
  4934. const code = fn.apply(colorConvert, arguments);
  4935. return `\x1B[${38 + offset};5;${code}m`;
  4936. };
  4937. var wrapAnsi16m = (fn, offset) => function() {
  4938. const rgb = fn.apply(colorConvert, arguments);
  4939. return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  4940. };
  4941. function assembleStyles() {
  4942. const codes = /* @__PURE__ */ new Map();
  4943. const styles = {
  4944. modifier: {
  4945. reset: [0, 0],
  4946. bold: [1, 22],
  4947. dim: [2, 22],
  4948. italic: [3, 23],
  4949. underline: [4, 24],
  4950. inverse: [7, 27],
  4951. hidden: [8, 28],
  4952. strikethrough: [9, 29]
  4953. },
  4954. color: {
  4955. black: [30, 39],
  4956. red: [31, 39],
  4957. green: [32, 39],
  4958. yellow: [33, 39],
  4959. blue: [34, 39],
  4960. magenta: [35, 39],
  4961. cyan: [36, 39],
  4962. white: [37, 39],
  4963. gray: [90, 39],
  4964. redBright: [91, 39],
  4965. greenBright: [92, 39],
  4966. yellowBright: [93, 39],
  4967. blueBright: [94, 39],
  4968. magentaBright: [95, 39],
  4969. cyanBright: [96, 39],
  4970. whiteBright: [97, 39]
  4971. },
  4972. bgColor: {
  4973. bgBlack: [40, 49],
  4974. bgRed: [41, 49],
  4975. bgGreen: [42, 49],
  4976. bgYellow: [43, 49],
  4977. bgBlue: [44, 49],
  4978. bgMagenta: [45, 49],
  4979. bgCyan: [46, 49],
  4980. bgWhite: [47, 49],
  4981. bgBlackBright: [100, 49],
  4982. bgRedBright: [101, 49],
  4983. bgGreenBright: [102, 49],
  4984. bgYellowBright: [103, 49],
  4985. bgBlueBright: [104, 49],
  4986. bgMagentaBright: [105, 49],
  4987. bgCyanBright: [106, 49],
  4988. bgWhiteBright: [107, 49]
  4989. }
  4990. };
  4991. styles.color.grey = styles.color.gray;
  4992. for (const groupName of Object.keys(styles)) {
  4993. const group = styles[groupName];
  4994. for (const styleName of Object.keys(group)) {
  4995. const style = group[styleName];
  4996. styles[styleName] = {
  4997. open: `\x1B[${style[0]}m`,
  4998. close: `\x1B[${style[1]}m`
  4999. };
  5000. group[styleName] = styles[styleName];
  5001. codes.set(style[0], style[1]);
  5002. }
  5003. Object.defineProperty(styles, groupName, {
  5004. value: group,
  5005. enumerable: false
  5006. });
  5007. Object.defineProperty(styles, "codes", {
  5008. value: codes,
  5009. enumerable: false
  5010. });
  5011. }
  5012. const ansi2ansi = (n) => n;
  5013. const rgb2rgb = (r, g, b) => [r, g, b];
  5014. styles.color.close = "\x1B[39m";
  5015. styles.bgColor.close = "\x1B[49m";
  5016. styles.color.ansi = {
  5017. ansi: wrapAnsi16(ansi2ansi, 0)
  5018. };
  5019. styles.color.ansi256 = {
  5020. ansi256: wrapAnsi256(ansi2ansi, 0)
  5021. };
  5022. styles.color.ansi16m = {
  5023. rgb: wrapAnsi16m(rgb2rgb, 0)
  5024. };
  5025. styles.bgColor.ansi = {
  5026. ansi: wrapAnsi16(ansi2ansi, 10)
  5027. };
  5028. styles.bgColor.ansi256 = {
  5029. ansi256: wrapAnsi256(ansi2ansi, 10)
  5030. };
  5031. styles.bgColor.ansi16m = {
  5032. rgb: wrapAnsi16m(rgb2rgb, 10)
  5033. };
  5034. for (let key of Object.keys(colorConvert)) {
  5035. if (typeof colorConvert[key] !== "object") {
  5036. continue;
  5037. }
  5038. const suite = colorConvert[key];
  5039. if (key === "ansi16") {
  5040. key = "ansi";
  5041. }
  5042. if ("ansi16" in suite) {
  5043. styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
  5044. styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
  5045. }
  5046. if ("ansi256" in suite) {
  5047. styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
  5048. styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
  5049. }
  5050. if ("rgb" in suite) {
  5051. styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
  5052. styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
  5053. }
  5054. }
  5055. return styles;
  5056. }
  5057. Object.defineProperty(module2, "exports", {
  5058. enumerable: true,
  5059. get: assembleStyles
  5060. });
  5061. }
  5062. });
  5063. var require_has_flag = __commonJS2({
  5064. "node_modules/vnopts/node_modules/has-flag/index.js"(exports2, module2) {
  5065. "use strict";
  5066. module2.exports = (flag, argv) => {
  5067. argv = argv || process.argv;
  5068. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  5069. const pos = argv.indexOf(prefix + flag);
  5070. const terminatorPos = argv.indexOf("--");
  5071. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  5072. };
  5073. }
  5074. });
  5075. var require_supports_color = __commonJS2({
  5076. "node_modules/vnopts/node_modules/supports-color/index.js"(exports2, module2) {
  5077. "use strict";
  5078. var os = require("os");
  5079. var hasFlag = require_has_flag();
  5080. var env = process.env;
  5081. var forceColor;
  5082. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  5083. forceColor = false;
  5084. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  5085. forceColor = true;
  5086. }
  5087. if ("FORCE_COLOR" in env) {
  5088. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  5089. }
  5090. function translateLevel(level) {
  5091. if (level === 0) {
  5092. return false;
  5093. }
  5094. return {
  5095. level,
  5096. hasBasic: true,
  5097. has256: level >= 2,
  5098. has16m: level >= 3
  5099. };
  5100. }
  5101. function supportsColor(stream) {
  5102. if (forceColor === false) {
  5103. return 0;
  5104. }
  5105. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  5106. return 3;
  5107. }
  5108. if (hasFlag("color=256")) {
  5109. return 2;
  5110. }
  5111. if (stream && !stream.isTTY && forceColor !== true) {
  5112. return 0;
  5113. }
  5114. const min = forceColor ? 1 : 0;
  5115. if (process.platform === "win32") {
  5116. const osRelease = os.release().split(".");
  5117. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  5118. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  5119. }
  5120. return 1;
  5121. }
  5122. if ("CI" in env) {
  5123. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  5124. return 1;
  5125. }
  5126. return min;
  5127. }
  5128. if ("TEAMCITY_VERSION" in env) {
  5129. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  5130. }
  5131. if (env.COLORTERM === "truecolor") {
  5132. return 3;
  5133. }
  5134. if ("TERM_PROGRAM" in env) {
  5135. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  5136. switch (env.TERM_PROGRAM) {
  5137. case "iTerm.app":
  5138. return version2 >= 3 ? 3 : 2;
  5139. case "Apple_Terminal":
  5140. return 2;
  5141. }
  5142. }
  5143. if (/-256(color)?$/i.test(env.TERM)) {
  5144. return 2;
  5145. }
  5146. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  5147. return 1;
  5148. }
  5149. if ("COLORTERM" in env) {
  5150. return 1;
  5151. }
  5152. if (env.TERM === "dumb") {
  5153. return min;
  5154. }
  5155. return min;
  5156. }
  5157. function getSupportLevel(stream) {
  5158. const level = supportsColor(stream);
  5159. return translateLevel(level);
  5160. }
  5161. module2.exports = {
  5162. supportsColor: getSupportLevel,
  5163. stdout: getSupportLevel(process.stdout),
  5164. stderr: getSupportLevel(process.stderr)
  5165. };
  5166. }
  5167. });
  5168. var require_templates = __commonJS2({
  5169. "node_modules/vnopts/node_modules/chalk/templates.js"(exports2, module2) {
  5170. "use strict";
  5171. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  5172. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  5173. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  5174. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  5175. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  5176. function unescape(c) {
  5177. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  5178. return String.fromCharCode(parseInt(c.slice(1), 16));
  5179. }
  5180. return ESCAPES.get(c) || c;
  5181. }
  5182. function parseArguments(name, args) {
  5183. const results = [];
  5184. const chunks = args.trim().split(/\s*,\s*/g);
  5185. let matches;
  5186. for (const chunk of chunks) {
  5187. if (!isNaN(chunk)) {
  5188. results.push(Number(chunk));
  5189. } else if (matches = chunk.match(STRING_REGEX)) {
  5190. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  5191. } else {
  5192. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  5193. }
  5194. }
  5195. return results;
  5196. }
  5197. function parseStyle(style) {
  5198. STYLE_REGEX.lastIndex = 0;
  5199. const results = [];
  5200. let matches;
  5201. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  5202. const name = matches[1];
  5203. if (matches[2]) {
  5204. const args = parseArguments(name, matches[2]);
  5205. results.push([name].concat(args));
  5206. } else {
  5207. results.push([name]);
  5208. }
  5209. }
  5210. return results;
  5211. }
  5212. function buildStyle(chalk, styles) {
  5213. const enabled = {};
  5214. for (const layer of styles) {
  5215. for (const style of layer.styles) {
  5216. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  5217. }
  5218. }
  5219. let current = chalk;
  5220. for (const styleName of Object.keys(enabled)) {
  5221. if (Array.isArray(enabled[styleName])) {
  5222. if (!(styleName in current)) {
  5223. throw new Error(`Unknown Chalk style: ${styleName}`);
  5224. }
  5225. if (enabled[styleName].length > 0) {
  5226. current = current[styleName].apply(current, enabled[styleName]);
  5227. } else {
  5228. current = current[styleName];
  5229. }
  5230. }
  5231. }
  5232. return current;
  5233. }
  5234. module2.exports = (chalk, tmp) => {
  5235. const styles = [];
  5236. const chunks = [];
  5237. let chunk = [];
  5238. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  5239. if (escapeChar) {
  5240. chunk.push(unescape(escapeChar));
  5241. } else if (style) {
  5242. const str = chunk.join("");
  5243. chunk = [];
  5244. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  5245. styles.push({
  5246. inverse,
  5247. styles: parseStyle(style)
  5248. });
  5249. } else if (close) {
  5250. if (styles.length === 0) {
  5251. throw new Error("Found extraneous } in Chalk template literal");
  5252. }
  5253. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  5254. chunk = [];
  5255. styles.pop();
  5256. } else {
  5257. chunk.push(chr);
  5258. }
  5259. });
  5260. chunks.push(chunk.join(""));
  5261. if (styles.length > 0) {
  5262. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  5263. throw new Error(errMsg);
  5264. }
  5265. return chunks.join("");
  5266. };
  5267. }
  5268. });
  5269. var require_chalk = __commonJS2({
  5270. "node_modules/vnopts/node_modules/chalk/index.js"(exports2, module2) {
  5271. "use strict";
  5272. var escapeStringRegexp2 = require_escape_string_regexp();
  5273. var ansiStyles = require_ansi_styles();
  5274. var stdoutColor = require_supports_color().stdout;
  5275. var template = require_templates();
  5276. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  5277. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  5278. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  5279. var styles = /* @__PURE__ */ Object.create(null);
  5280. function applyOptions(obj, options) {
  5281. options = options || {};
  5282. const scLevel = stdoutColor ? stdoutColor.level : 0;
  5283. obj.level = options.level === void 0 ? scLevel : options.level;
  5284. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  5285. }
  5286. function Chalk(options) {
  5287. if (!this || !(this instanceof Chalk) || this.template) {
  5288. const chalk = {};
  5289. applyOptions(chalk, options);
  5290. chalk.template = function() {
  5291. const args = [].slice.call(arguments);
  5292. return chalkTag.apply(null, [chalk.template].concat(args));
  5293. };
  5294. Object.setPrototypeOf(chalk, Chalk.prototype);
  5295. Object.setPrototypeOf(chalk.template, chalk);
  5296. chalk.template.constructor = Chalk;
  5297. return chalk.template;
  5298. }
  5299. applyOptions(this, options);
  5300. }
  5301. if (isSimpleWindowsTerm) {
  5302. ansiStyles.blue.open = "\x1B[94m";
  5303. }
  5304. for (const key of Object.keys(ansiStyles)) {
  5305. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  5306. styles[key] = {
  5307. get() {
  5308. const codes = ansiStyles[key];
  5309. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  5310. }
  5311. };
  5312. }
  5313. styles.visible = {
  5314. get() {
  5315. return build.call(this, this._styles || [], true, "visible");
  5316. }
  5317. };
  5318. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  5319. for (const model of Object.keys(ansiStyles.color.ansi)) {
  5320. if (skipModels.has(model)) {
  5321. continue;
  5322. }
  5323. styles[model] = {
  5324. get() {
  5325. const level = this.level;
  5326. return function() {
  5327. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  5328. const codes = {
  5329. open,
  5330. close: ansiStyles.color.close,
  5331. closeRe: ansiStyles.color.closeRe
  5332. };
  5333. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5334. };
  5335. }
  5336. };
  5337. }
  5338. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  5339. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  5340. if (skipModels.has(model)) {
  5341. continue;
  5342. }
  5343. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  5344. styles[bgModel] = {
  5345. get() {
  5346. const level = this.level;
  5347. return function() {
  5348. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  5349. const codes = {
  5350. open,
  5351. close: ansiStyles.bgColor.close,
  5352. closeRe: ansiStyles.bgColor.closeRe
  5353. };
  5354. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5355. };
  5356. }
  5357. };
  5358. }
  5359. var proto = Object.defineProperties(() => {
  5360. }, styles);
  5361. function build(_styles, _empty, key) {
  5362. const builder = function() {
  5363. return applyStyle.apply(builder, arguments);
  5364. };
  5365. builder._styles = _styles;
  5366. builder._empty = _empty;
  5367. const self2 = this;
  5368. Object.defineProperty(builder, "level", {
  5369. enumerable: true,
  5370. get() {
  5371. return self2.level;
  5372. },
  5373. set(level) {
  5374. self2.level = level;
  5375. }
  5376. });
  5377. Object.defineProperty(builder, "enabled", {
  5378. enumerable: true,
  5379. get() {
  5380. return self2.enabled;
  5381. },
  5382. set(enabled) {
  5383. self2.enabled = enabled;
  5384. }
  5385. });
  5386. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  5387. builder.__proto__ = proto;
  5388. return builder;
  5389. }
  5390. function applyStyle() {
  5391. const args = arguments;
  5392. const argsLen = args.length;
  5393. let str = String(arguments[0]);
  5394. if (argsLen === 0) {
  5395. return "";
  5396. }
  5397. if (argsLen > 1) {
  5398. for (let a = 1; a < argsLen; a++) {
  5399. str += " " + args[a];
  5400. }
  5401. }
  5402. if (!this.enabled || this.level <= 0 || !str) {
  5403. return this._empty ? "" : str;
  5404. }
  5405. const originalDim = ansiStyles.dim.open;
  5406. if (isSimpleWindowsTerm && this.hasGrey) {
  5407. ansiStyles.dim.open = "";
  5408. }
  5409. for (const code of this._styles.slice().reverse()) {
  5410. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  5411. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  5412. }
  5413. ansiStyles.dim.open = originalDim;
  5414. return str;
  5415. }
  5416. function chalkTag(chalk, strings) {
  5417. if (!Array.isArray(strings)) {
  5418. return [].slice.call(arguments, 1).join(" ");
  5419. }
  5420. const args = [].slice.call(arguments, 2);
  5421. const parts = [strings.raw[0]];
  5422. for (let i = 1; i < strings.length; i++) {
  5423. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  5424. parts.push(String(strings.raw[i]));
  5425. }
  5426. return template(chalk, parts.join(""));
  5427. }
  5428. Object.defineProperties(Chalk.prototype, styles);
  5429. module2.exports = Chalk();
  5430. module2.exports.supportsColor = stdoutColor;
  5431. module2.exports.default = module2.exports;
  5432. }
  5433. });
  5434. var require_common = __commonJS2({
  5435. "node_modules/vnopts/lib/handlers/deprecated/common.js"(exports2) {
  5436. "use strict";
  5437. Object.defineProperty(exports2, "__esModule", {
  5438. value: true
  5439. });
  5440. var chalk_1 = require_chalk();
  5441. exports2.commonDeprecatedHandler = (keyOrPair, redirectTo, {
  5442. descriptor
  5443. }) => {
  5444. const messages = [`${chalk_1.default.yellow(typeof keyOrPair === "string" ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`];
  5445. if (redirectTo) {
  5446. messages.push(`we now treat it as ${chalk_1.default.blue(typeof redirectTo === "string" ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
  5447. }
  5448. return messages.join("; ") + ".";
  5449. };
  5450. }
  5451. });
  5452. var require_deprecated = __commonJS2({
  5453. "node_modules/vnopts/lib/handlers/deprecated/index.js"(exports2) {
  5454. "use strict";
  5455. Object.defineProperty(exports2, "__esModule", {
  5456. value: true
  5457. });
  5458. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5459. tslib_1.__exportStar(require_common(), exports2);
  5460. }
  5461. });
  5462. var require_common2 = __commonJS2({
  5463. "node_modules/vnopts/lib/handlers/invalid/common.js"(exports2) {
  5464. "use strict";
  5465. Object.defineProperty(exports2, "__esModule", {
  5466. value: true
  5467. });
  5468. var chalk_1 = require_chalk();
  5469. 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(" ");
  5470. }
  5471. });
  5472. var require_invalid = __commonJS2({
  5473. "node_modules/vnopts/lib/handlers/invalid/index.js"(exports2) {
  5474. "use strict";
  5475. Object.defineProperty(exports2, "__esModule", {
  5476. value: true
  5477. });
  5478. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5479. tslib_1.__exportStar(require_common2(), exports2);
  5480. }
  5481. });
  5482. var require_leven = __commonJS2({
  5483. "node_modules/vnopts/node_modules/leven/index.js"(exports2, module2) {
  5484. "use strict";
  5485. var arr = [];
  5486. var charCodeCache = [];
  5487. module2.exports = function(a, b) {
  5488. if (a === b) {
  5489. return 0;
  5490. }
  5491. var swap = a;
  5492. if (a.length > b.length) {
  5493. a = b;
  5494. b = swap;
  5495. }
  5496. var aLen = a.length;
  5497. var bLen = b.length;
  5498. if (aLen === 0) {
  5499. return bLen;
  5500. }
  5501. if (bLen === 0) {
  5502. return aLen;
  5503. }
  5504. while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
  5505. aLen--;
  5506. bLen--;
  5507. }
  5508. if (aLen === 0) {
  5509. return bLen;
  5510. }
  5511. var start = 0;
  5512. while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
  5513. start++;
  5514. }
  5515. aLen -= start;
  5516. bLen -= start;
  5517. if (aLen === 0) {
  5518. return bLen;
  5519. }
  5520. var bCharCode;
  5521. var ret;
  5522. var tmp;
  5523. var tmp2;
  5524. var i = 0;
  5525. var j = 0;
  5526. while (i < aLen) {
  5527. charCodeCache[start + i] = a.charCodeAt(start + i);
  5528. arr[i] = ++i;
  5529. }
  5530. while (j < bLen) {
  5531. bCharCode = b.charCodeAt(start + j);
  5532. tmp = j++;
  5533. ret = j;
  5534. for (i = 0; i < aLen; i++) {
  5535. tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
  5536. tmp = arr[i];
  5537. ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
  5538. }
  5539. }
  5540. return ret;
  5541. };
  5542. }
  5543. });
  5544. var require_leven2 = __commonJS2({
  5545. "node_modules/vnopts/lib/handlers/unknown/leven.js"(exports2) {
  5546. "use strict";
  5547. Object.defineProperty(exports2, "__esModule", {
  5548. value: true
  5549. });
  5550. var chalk_1 = require_chalk();
  5551. var leven = require_leven();
  5552. exports2.levenUnknownHandler = (key, value, {
  5553. descriptor,
  5554. logger,
  5555. schemas
  5556. }) => {
  5557. const messages = [`Ignored unknown option ${chalk_1.default.yellow(descriptor.pair({
  5558. key,
  5559. value
  5560. }))}.`];
  5561. const suggestion = Object.keys(schemas).sort().find((knownKey) => leven(key, knownKey) < 3);
  5562. if (suggestion) {
  5563. messages.push(`Did you mean ${chalk_1.default.blue(descriptor.key(suggestion))}?`);
  5564. }
  5565. logger.warn(messages.join(" "));
  5566. };
  5567. }
  5568. });
  5569. var require_unknown = __commonJS2({
  5570. "node_modules/vnopts/lib/handlers/unknown/index.js"(exports2) {
  5571. "use strict";
  5572. Object.defineProperty(exports2, "__esModule", {
  5573. value: true
  5574. });
  5575. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5576. tslib_1.__exportStar(require_leven2(), exports2);
  5577. }
  5578. });
  5579. var require_handlers = __commonJS2({
  5580. "node_modules/vnopts/lib/handlers/index.js"(exports2) {
  5581. "use strict";
  5582. Object.defineProperty(exports2, "__esModule", {
  5583. value: true
  5584. });
  5585. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5586. tslib_1.__exportStar(require_deprecated(), exports2);
  5587. tslib_1.__exportStar(require_invalid(), exports2);
  5588. tslib_1.__exportStar(require_unknown(), exports2);
  5589. }
  5590. });
  5591. var require_schema = __commonJS2({
  5592. "node_modules/vnopts/lib/schema.js"(exports2) {
  5593. "use strict";
  5594. Object.defineProperty(exports2, "__esModule", {
  5595. value: true
  5596. });
  5597. var HANDLER_KEYS = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
  5598. function createSchema(SchemaConstructor, parameters) {
  5599. const schema = new SchemaConstructor(parameters);
  5600. const subSchema = Object.create(schema);
  5601. for (const handlerKey of HANDLER_KEYS) {
  5602. if (handlerKey in parameters) {
  5603. subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
  5604. }
  5605. }
  5606. return subSchema;
  5607. }
  5608. exports2.createSchema = createSchema;
  5609. var Schema = class {
  5610. constructor(parameters) {
  5611. this.name = parameters.name;
  5612. }
  5613. static create(parameters) {
  5614. return createSchema(this, parameters);
  5615. }
  5616. default(_utils) {
  5617. return void 0;
  5618. }
  5619. expected(_utils) {
  5620. return "nothing";
  5621. }
  5622. validate(_value, _utils) {
  5623. return false;
  5624. }
  5625. deprecated(_value, _utils) {
  5626. return false;
  5627. }
  5628. forward(_value, _utils) {
  5629. return void 0;
  5630. }
  5631. redirect(_value, _utils) {
  5632. return void 0;
  5633. }
  5634. overlap(currentValue, _newValue, _utils) {
  5635. return currentValue;
  5636. }
  5637. preprocess(value, _utils) {
  5638. return value;
  5639. }
  5640. postprocess(value, _utils) {
  5641. return value;
  5642. }
  5643. };
  5644. exports2.Schema = Schema;
  5645. function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
  5646. return typeof handler === "function" ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
  5647. }
  5648. }
  5649. });
  5650. var require_alias = __commonJS2({
  5651. "node_modules/vnopts/lib/schemas/alias.js"(exports2) {
  5652. "use strict";
  5653. Object.defineProperty(exports2, "__esModule", {
  5654. value: true
  5655. });
  5656. var schema_1 = require_schema();
  5657. var AliasSchema = class extends schema_1.Schema {
  5658. constructor(parameters) {
  5659. super(parameters);
  5660. this._sourceName = parameters.sourceName;
  5661. }
  5662. expected(utils) {
  5663. return utils.schemas[this._sourceName].expected(utils);
  5664. }
  5665. validate(value, utils) {
  5666. return utils.schemas[this._sourceName].validate(value, utils);
  5667. }
  5668. redirect(_value, _utils) {
  5669. return this._sourceName;
  5670. }
  5671. };
  5672. exports2.AliasSchema = AliasSchema;
  5673. }
  5674. });
  5675. var require_any = __commonJS2({
  5676. "node_modules/vnopts/lib/schemas/any.js"(exports2) {
  5677. "use strict";
  5678. Object.defineProperty(exports2, "__esModule", {
  5679. value: true
  5680. });
  5681. var schema_1 = require_schema();
  5682. var AnySchema = class extends schema_1.Schema {
  5683. expected() {
  5684. return "anything";
  5685. }
  5686. validate() {
  5687. return true;
  5688. }
  5689. };
  5690. exports2.AnySchema = AnySchema;
  5691. }
  5692. });
  5693. var require_array2 = __commonJS2({
  5694. "node_modules/vnopts/lib/schemas/array.js"(exports2) {
  5695. "use strict";
  5696. Object.defineProperty(exports2, "__esModule", {
  5697. value: true
  5698. });
  5699. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5700. var schema_1 = require_schema();
  5701. var ArraySchema = class extends schema_1.Schema {
  5702. constructor(_a) {
  5703. var {
  5704. valueSchema,
  5705. name = valueSchema.name
  5706. } = _a, handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
  5707. super(Object.assign({}, handlers, {
  5708. name
  5709. }));
  5710. this._valueSchema = valueSchema;
  5711. }
  5712. expected(utils) {
  5713. return `an array of ${this._valueSchema.expected(utils)}`;
  5714. }
  5715. validate(value, utils) {
  5716. if (!Array.isArray(value)) {
  5717. return false;
  5718. }
  5719. const invalidValues = [];
  5720. for (const subValue of value) {
  5721. const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
  5722. if (subValidateResult !== true) {
  5723. invalidValues.push(subValidateResult.value);
  5724. }
  5725. }
  5726. return invalidValues.length === 0 ? true : {
  5727. value: invalidValues
  5728. };
  5729. }
  5730. deprecated(value, utils) {
  5731. const deprecatedResult = [];
  5732. for (const subValue of value) {
  5733. const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
  5734. if (subDeprecatedResult !== false) {
  5735. deprecatedResult.push(...subDeprecatedResult.map(({
  5736. value: deprecatedValue
  5737. }) => ({
  5738. value: [deprecatedValue]
  5739. })));
  5740. }
  5741. }
  5742. return deprecatedResult;
  5743. }
  5744. forward(value, utils) {
  5745. const forwardResult = [];
  5746. for (const subValue of value) {
  5747. const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
  5748. forwardResult.push(...subForwardResult.map(wrapTransferResult));
  5749. }
  5750. return forwardResult;
  5751. }
  5752. redirect(value, utils) {
  5753. const remain = [];
  5754. const redirect = [];
  5755. for (const subValue of value) {
  5756. const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
  5757. if ("remain" in subRedirectResult) {
  5758. remain.push(subRedirectResult.remain);
  5759. }
  5760. redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
  5761. }
  5762. return remain.length === 0 ? {
  5763. redirect
  5764. } : {
  5765. redirect,
  5766. remain
  5767. };
  5768. }
  5769. overlap(currentValue, newValue) {
  5770. return currentValue.concat(newValue);
  5771. }
  5772. };
  5773. exports2.ArraySchema = ArraySchema;
  5774. function wrapTransferResult({
  5775. from,
  5776. to
  5777. }) {
  5778. return {
  5779. from: [from],
  5780. to
  5781. };
  5782. }
  5783. }
  5784. });
  5785. var require_boolean = __commonJS2({
  5786. "node_modules/vnopts/lib/schemas/boolean.js"(exports2) {
  5787. "use strict";
  5788. Object.defineProperty(exports2, "__esModule", {
  5789. value: true
  5790. });
  5791. var schema_1 = require_schema();
  5792. var BooleanSchema = class extends schema_1.Schema {
  5793. expected() {
  5794. return "true or false";
  5795. }
  5796. validate(value) {
  5797. return typeof value === "boolean";
  5798. }
  5799. };
  5800. exports2.BooleanSchema = BooleanSchema;
  5801. }
  5802. });
  5803. var require_utils = __commonJS2({
  5804. "node_modules/vnopts/lib/utils.js"(exports2) {
  5805. "use strict";
  5806. Object.defineProperty(exports2, "__esModule", {
  5807. value: true
  5808. });
  5809. function recordFromArray(array, mainKey) {
  5810. const record = /* @__PURE__ */ Object.create(null);
  5811. for (const value of array) {
  5812. const key = value[mainKey];
  5813. if (record[key]) {
  5814. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5815. }
  5816. record[key] = value;
  5817. }
  5818. return record;
  5819. }
  5820. exports2.recordFromArray = recordFromArray;
  5821. function mapFromArray(array, mainKey) {
  5822. const map = /* @__PURE__ */ new Map();
  5823. for (const value of array) {
  5824. const key = value[mainKey];
  5825. if (map.has(key)) {
  5826. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5827. }
  5828. map.set(key, value);
  5829. }
  5830. return map;
  5831. }
  5832. exports2.mapFromArray = mapFromArray;
  5833. function createAutoChecklist() {
  5834. const map = /* @__PURE__ */ Object.create(null);
  5835. return (id) => {
  5836. const idString = JSON.stringify(id);
  5837. if (map[idString]) {
  5838. return true;
  5839. }
  5840. map[idString] = true;
  5841. return false;
  5842. };
  5843. }
  5844. exports2.createAutoChecklist = createAutoChecklist;
  5845. function partition(array, predicate) {
  5846. const trueArray = [];
  5847. const falseArray = [];
  5848. for (const value of array) {
  5849. if (predicate(value)) {
  5850. trueArray.push(value);
  5851. } else {
  5852. falseArray.push(value);
  5853. }
  5854. }
  5855. return [trueArray, falseArray];
  5856. }
  5857. exports2.partition = partition;
  5858. function isInt(value) {
  5859. return value === Math.floor(value);
  5860. }
  5861. exports2.isInt = isInt;
  5862. function comparePrimitive(a, b) {
  5863. if (a === b) {
  5864. return 0;
  5865. }
  5866. const typeofA = typeof a;
  5867. const typeofB = typeof b;
  5868. const orders = ["undefined", "object", "boolean", "number", "string"];
  5869. if (typeofA !== typeofB) {
  5870. return orders.indexOf(typeofA) - orders.indexOf(typeofB);
  5871. }
  5872. if (typeofA !== "string") {
  5873. return Number(a) - Number(b);
  5874. }
  5875. return a.localeCompare(b);
  5876. }
  5877. exports2.comparePrimitive = comparePrimitive;
  5878. function normalizeDefaultResult(result) {
  5879. return result === void 0 ? {} : result;
  5880. }
  5881. exports2.normalizeDefaultResult = normalizeDefaultResult;
  5882. function normalizeValidateResult(result, value) {
  5883. return result === true ? true : result === false ? {
  5884. value
  5885. } : result;
  5886. }
  5887. exports2.normalizeValidateResult = normalizeValidateResult;
  5888. function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
  5889. return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
  5890. value
  5891. }] : "value" in result ? [result] : result.length === 0 ? false : result;
  5892. }
  5893. exports2.normalizeDeprecatedResult = normalizeDeprecatedResult;
  5894. function normalizeTransferResult(result, value) {
  5895. return typeof result === "string" || "key" in result ? {
  5896. from: value,
  5897. to: result
  5898. } : "from" in result ? {
  5899. from: result.from,
  5900. to: result.to
  5901. } : {
  5902. from: value,
  5903. to: result.to
  5904. };
  5905. }
  5906. exports2.normalizeTransferResult = normalizeTransferResult;
  5907. function normalizeForwardResult(result, value) {
  5908. return result === void 0 ? [] : Array.isArray(result) ? result.map((transferResult) => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
  5909. }
  5910. exports2.normalizeForwardResult = normalizeForwardResult;
  5911. function normalizeRedirectResult(result, value) {
  5912. const redirect = normalizeForwardResult(typeof result === "object" && "redirect" in result ? result.redirect : result, value);
  5913. return redirect.length === 0 ? {
  5914. remain: value,
  5915. redirect
  5916. } : typeof result === "object" && "remain" in result ? {
  5917. remain: result.remain,
  5918. redirect
  5919. } : {
  5920. redirect
  5921. };
  5922. }
  5923. exports2.normalizeRedirectResult = normalizeRedirectResult;
  5924. }
  5925. });
  5926. var require_choice = __commonJS2({
  5927. "node_modules/vnopts/lib/schemas/choice.js"(exports2) {
  5928. "use strict";
  5929. Object.defineProperty(exports2, "__esModule", {
  5930. value: true
  5931. });
  5932. var schema_1 = require_schema();
  5933. var utils_1 = require_utils();
  5934. var ChoiceSchema = class extends schema_1.Schema {
  5935. constructor(parameters) {
  5936. super(parameters);
  5937. this._choices = utils_1.mapFromArray(parameters.choices.map((choice) => choice && typeof choice === "object" ? choice : {
  5938. value: choice
  5939. }), "value");
  5940. }
  5941. expected({
  5942. descriptor
  5943. }) {
  5944. 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);
  5945. const head = choiceValues.slice(0, -2);
  5946. const tail = choiceValues.slice(-2);
  5947. return head.concat(tail.join(" or ")).join(", ");
  5948. }
  5949. validate(value) {
  5950. return this._choices.has(value);
  5951. }
  5952. deprecated(value) {
  5953. const choiceInfo = this._choices.get(value);
  5954. return choiceInfo && choiceInfo.deprecated ? {
  5955. value
  5956. } : false;
  5957. }
  5958. forward(value) {
  5959. const choiceInfo = this._choices.get(value);
  5960. return choiceInfo ? choiceInfo.forward : void 0;
  5961. }
  5962. redirect(value) {
  5963. const choiceInfo = this._choices.get(value);
  5964. return choiceInfo ? choiceInfo.redirect : void 0;
  5965. }
  5966. };
  5967. exports2.ChoiceSchema = ChoiceSchema;
  5968. }
  5969. });
  5970. var require_number = __commonJS2({
  5971. "node_modules/vnopts/lib/schemas/number.js"(exports2) {
  5972. "use strict";
  5973. Object.defineProperty(exports2, "__esModule", {
  5974. value: true
  5975. });
  5976. var schema_1 = require_schema();
  5977. var NumberSchema = class extends schema_1.Schema {
  5978. expected() {
  5979. return "a number";
  5980. }
  5981. validate(value, _utils) {
  5982. return typeof value === "number";
  5983. }
  5984. };
  5985. exports2.NumberSchema = NumberSchema;
  5986. }
  5987. });
  5988. var require_integer = __commonJS2({
  5989. "node_modules/vnopts/lib/schemas/integer.js"(exports2) {
  5990. "use strict";
  5991. Object.defineProperty(exports2, "__esModule", {
  5992. value: true
  5993. });
  5994. var utils_1 = require_utils();
  5995. var number_1 = require_number();
  5996. var IntegerSchema = class extends number_1.NumberSchema {
  5997. expected() {
  5998. return "an integer";
  5999. }
  6000. validate(value, utils) {
  6001. return utils.normalizeValidateResult(super.validate(value, utils), value) === true && utils_1.isInt(value);
  6002. }
  6003. };
  6004. exports2.IntegerSchema = IntegerSchema;
  6005. }
  6006. });
  6007. var require_string = __commonJS2({
  6008. "node_modules/vnopts/lib/schemas/string.js"(exports2) {
  6009. "use strict";
  6010. Object.defineProperty(exports2, "__esModule", {
  6011. value: true
  6012. });
  6013. var schema_1 = require_schema();
  6014. var StringSchema = class extends schema_1.Schema {
  6015. expected() {
  6016. return "a string";
  6017. }
  6018. validate(value) {
  6019. return typeof value === "string";
  6020. }
  6021. };
  6022. exports2.StringSchema = StringSchema;
  6023. }
  6024. });
  6025. var require_schemas = __commonJS2({
  6026. "node_modules/vnopts/lib/schemas/index.js"(exports2) {
  6027. "use strict";
  6028. Object.defineProperty(exports2, "__esModule", {
  6029. value: true
  6030. });
  6031. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  6032. tslib_1.__exportStar(require_alias(), exports2);
  6033. tslib_1.__exportStar(require_any(), exports2);
  6034. tslib_1.__exportStar(require_array2(), exports2);
  6035. tslib_1.__exportStar(require_boolean(), exports2);
  6036. tslib_1.__exportStar(require_choice(), exports2);
  6037. tslib_1.__exportStar(require_integer(), exports2);
  6038. tslib_1.__exportStar(require_number(), exports2);
  6039. tslib_1.__exportStar(require_string(), exports2);
  6040. }
  6041. });
  6042. var require_defaults = __commonJS2({
  6043. "node_modules/vnopts/lib/defaults.js"(exports2) {
  6044. "use strict";
  6045. Object.defineProperty(exports2, "__esModule", {
  6046. value: true
  6047. });
  6048. var api_1 = require_api();
  6049. var common_1 = require_common();
  6050. var invalid_1 = require_invalid();
  6051. var leven_1 = require_leven2();
  6052. exports2.defaultDescriptor = api_1.apiDescriptor;
  6053. exports2.defaultUnknownHandler = leven_1.levenUnknownHandler;
  6054. exports2.defaultInvalidHandler = invalid_1.commonInvalidHandler;
  6055. exports2.defaultDeprecatedHandler = common_1.commonDeprecatedHandler;
  6056. }
  6057. });
  6058. var require_normalize = __commonJS2({
  6059. "node_modules/vnopts/lib/normalize.js"(exports2) {
  6060. "use strict";
  6061. Object.defineProperty(exports2, "__esModule", {
  6062. value: true
  6063. });
  6064. var defaults_1 = require_defaults();
  6065. var utils_1 = require_utils();
  6066. exports2.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
  6067. var Normalizer = class {
  6068. constructor(schemas, opts) {
  6069. const {
  6070. logger = console,
  6071. descriptor = defaults_1.defaultDescriptor,
  6072. unknown = defaults_1.defaultUnknownHandler,
  6073. invalid = defaults_1.defaultInvalidHandler,
  6074. deprecated = defaults_1.defaultDeprecatedHandler
  6075. } = opts || {};
  6076. this._utils = {
  6077. descriptor,
  6078. logger: logger || {
  6079. warn: () => {
  6080. }
  6081. },
  6082. schemas: utils_1.recordFromArray(schemas, "name"),
  6083. normalizeDefaultResult: utils_1.normalizeDefaultResult,
  6084. normalizeDeprecatedResult: utils_1.normalizeDeprecatedResult,
  6085. normalizeForwardResult: utils_1.normalizeForwardResult,
  6086. normalizeRedirectResult: utils_1.normalizeRedirectResult,
  6087. normalizeValidateResult: utils_1.normalizeValidateResult
  6088. };
  6089. this._unknownHandler = unknown;
  6090. this._invalidHandler = invalid;
  6091. this._deprecatedHandler = deprecated;
  6092. this.cleanHistory();
  6093. }
  6094. cleanHistory() {
  6095. this._hasDeprecationWarned = utils_1.createAutoChecklist();
  6096. }
  6097. normalize(options) {
  6098. const normalized = {};
  6099. const restOptionsArray = [options];
  6100. const applyNormalization = () => {
  6101. while (restOptionsArray.length !== 0) {
  6102. const currentOptions = restOptionsArray.shift();
  6103. const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
  6104. restOptionsArray.push(...transferredOptionsArray);
  6105. }
  6106. };
  6107. applyNormalization();
  6108. for (const key of Object.keys(this._utils.schemas)) {
  6109. const schema = this._utils.schemas[key];
  6110. if (!(key in normalized)) {
  6111. const defaultResult = utils_1.normalizeDefaultResult(schema.default(this._utils));
  6112. if ("value" in defaultResult) {
  6113. restOptionsArray.push({
  6114. [key]: defaultResult.value
  6115. });
  6116. }
  6117. }
  6118. }
  6119. applyNormalization();
  6120. for (const key of Object.keys(this._utils.schemas)) {
  6121. const schema = this._utils.schemas[key];
  6122. if (key in normalized) {
  6123. normalized[key] = schema.postprocess(normalized[key], this._utils);
  6124. }
  6125. }
  6126. return normalized;
  6127. }
  6128. _applyNormalization(options, normalized) {
  6129. const transferredOptionsArray = [];
  6130. const [knownOptionNames, unknownOptionNames] = utils_1.partition(Object.keys(options), (key) => key in this._utils.schemas);
  6131. for (const key of knownOptionNames) {
  6132. const schema = this._utils.schemas[key];
  6133. const value = schema.preprocess(options[key], this._utils);
  6134. const validateResult = utils_1.normalizeValidateResult(schema.validate(value, this._utils), value);
  6135. if (validateResult !== true) {
  6136. const {
  6137. value: invalidValue
  6138. } = validateResult;
  6139. const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
  6140. throw typeof errorMessageOrError === "string" ? new Error(errorMessageOrError) : errorMessageOrError;
  6141. }
  6142. const appendTransferredOptions = ({
  6143. from,
  6144. to
  6145. }) => {
  6146. transferredOptionsArray.push(typeof to === "string" ? {
  6147. [to]: from
  6148. } : {
  6149. [to.key]: to.value
  6150. });
  6151. };
  6152. const warnDeprecated = ({
  6153. value: currentValue,
  6154. redirectTo
  6155. }) => {
  6156. const deprecatedResult = utils_1.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value, true);
  6157. if (deprecatedResult === false) {
  6158. return;
  6159. }
  6160. if (deprecatedResult === true) {
  6161. if (!this._hasDeprecationWarned(key)) {
  6162. this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
  6163. }
  6164. } else {
  6165. for (const {
  6166. value: deprecatedValue
  6167. } of deprecatedResult) {
  6168. const pair = {
  6169. key,
  6170. value: deprecatedValue
  6171. };
  6172. if (!this._hasDeprecationWarned(pair)) {
  6173. const redirectToPair = typeof redirectTo === "string" ? {
  6174. key: redirectTo,
  6175. value: deprecatedValue
  6176. } : redirectTo;
  6177. this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
  6178. }
  6179. }
  6180. }
  6181. };
  6182. const forwardResult = utils_1.normalizeForwardResult(schema.forward(value, this._utils), value);
  6183. forwardResult.forEach(appendTransferredOptions);
  6184. const redirectResult = utils_1.normalizeRedirectResult(schema.redirect(value, this._utils), value);
  6185. redirectResult.redirect.forEach(appendTransferredOptions);
  6186. if ("remain" in redirectResult) {
  6187. const remainingValue = redirectResult.remain;
  6188. normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
  6189. warnDeprecated({
  6190. value: remainingValue
  6191. });
  6192. }
  6193. for (const {
  6194. from,
  6195. to
  6196. } of redirectResult.redirect) {
  6197. warnDeprecated({
  6198. value: from,
  6199. redirectTo: to
  6200. });
  6201. }
  6202. }
  6203. for (const key of unknownOptionNames) {
  6204. const value = options[key];
  6205. const unknownResult = this._unknownHandler(key, value, this._utils);
  6206. if (unknownResult) {
  6207. for (const unknownKey of Object.keys(unknownResult)) {
  6208. const unknownOption = {
  6209. [unknownKey]: unknownResult[unknownKey]
  6210. };
  6211. if (unknownKey in this._utils.schemas) {
  6212. transferredOptionsArray.push(unknownOption);
  6213. } else {
  6214. Object.assign(normalized, unknownOption);
  6215. }
  6216. }
  6217. }
  6218. }
  6219. return transferredOptionsArray;
  6220. }
  6221. };
  6222. exports2.Normalizer = Normalizer;
  6223. }
  6224. });
  6225. var require_lib2 = __commonJS2({
  6226. "node_modules/vnopts/lib/index.js"(exports2) {
  6227. "use strict";
  6228. Object.defineProperty(exports2, "__esModule", {
  6229. value: true
  6230. });
  6231. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  6232. tslib_1.__exportStar(require_descriptors2(), exports2);
  6233. tslib_1.__exportStar(require_handlers(), exports2);
  6234. tslib_1.__exportStar(require_schemas(), exports2);
  6235. tslib_1.__exportStar(require_normalize(), exports2);
  6236. tslib_1.__exportStar(require_schema(), exports2);
  6237. }
  6238. });
  6239. var require_options_normalizer = __commonJS2({
  6240. "src/main/options-normalizer.js"(exports2, module2) {
  6241. "use strict";
  6242. var vnopts = require_lib2();
  6243. var getLast = require_get_last();
  6244. var cliDescriptor = {
  6245. key: (key) => key.length === 1 ? `-${key}` : `--${key}`,
  6246. value: (value) => vnopts.apiDescriptor.value(value),
  6247. pair: ({
  6248. key,
  6249. value
  6250. }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}`
  6251. };
  6252. var getFlagSchema = ({
  6253. colorsModule,
  6254. levenshteinDistance
  6255. }) => class FlagSchema extends vnopts.ChoiceSchema {
  6256. constructor({
  6257. name,
  6258. flags
  6259. }) {
  6260. super({
  6261. name,
  6262. choices: flags
  6263. });
  6264. this._flags = [...flags].sort();
  6265. }
  6266. preprocess(value, utils) {
  6267. if (typeof value === "string" && value.length > 0 && !this._flags.includes(value)) {
  6268. const suggestion = this._flags.find((flag) => levenshteinDistance(flag, value) < 3);
  6269. if (suggestion) {
  6270. utils.logger.warn([`Unknown flag ${colorsModule.yellow(utils.descriptor.value(value))},`, `did you mean ${colorsModule.blue(utils.descriptor.value(suggestion))}?`].join(" "));
  6271. return suggestion;
  6272. }
  6273. }
  6274. return value;
  6275. }
  6276. expected() {
  6277. return "a flag";
  6278. }
  6279. };
  6280. var hasDeprecationWarned;
  6281. function normalizeOptions(options, optionInfos, {
  6282. logger = false,
  6283. isCLI = false,
  6284. passThrough = false,
  6285. colorsModule = null,
  6286. levenshteinDistance = null
  6287. } = {}) {
  6288. const unknown = !passThrough ? (key, value, options2) => {
  6289. const _options2$schemas = options2.schemas, {
  6290. _
  6291. } = _options2$schemas, schemas2 = _objectWithoutProperties(_options2$schemas, _excluded2);
  6292. return vnopts.levenUnknownHandler(key, value, Object.assign(Object.assign({}, options2), {}, {
  6293. schemas: schemas2
  6294. }));
  6295. } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? void 0 : {
  6296. [key]: value
  6297. } : (key, value) => ({
  6298. [key]: value
  6299. });
  6300. const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
  6301. const schemas = optionInfosToSchemas(optionInfos, {
  6302. isCLI,
  6303. colorsModule,
  6304. levenshteinDistance
  6305. });
  6306. const normalizer = new vnopts.Normalizer(schemas, {
  6307. logger,
  6308. unknown,
  6309. descriptor
  6310. });
  6311. const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
  6312. if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
  6313. normalizer._hasDeprecationWarned = hasDeprecationWarned;
  6314. }
  6315. const normalized = normalizer.normalize(options);
  6316. if (shouldSuppressDuplicateDeprecationWarnings) {
  6317. hasDeprecationWarned = normalizer._hasDeprecationWarned;
  6318. }
  6319. if (isCLI && normalized["plugin-search"] === false) {
  6320. normalized["plugin-search-dir"] = false;
  6321. }
  6322. return normalized;
  6323. }
  6324. function optionInfosToSchemas(optionInfos, {
  6325. isCLI,
  6326. colorsModule,
  6327. levenshteinDistance
  6328. }) {
  6329. const schemas = [];
  6330. if (isCLI) {
  6331. schemas.push(vnopts.AnySchema.create({
  6332. name: "_"
  6333. }));
  6334. }
  6335. for (const optionInfo of optionInfos) {
  6336. schemas.push(optionInfoToSchema(optionInfo, {
  6337. isCLI,
  6338. optionInfos,
  6339. colorsModule,
  6340. levenshteinDistance
  6341. }));
  6342. if (optionInfo.alias && isCLI) {
  6343. schemas.push(vnopts.AliasSchema.create({
  6344. name: optionInfo.alias,
  6345. sourceName: optionInfo.name
  6346. }));
  6347. }
  6348. }
  6349. return schemas;
  6350. }
  6351. function optionInfoToSchema(optionInfo, {
  6352. isCLI,
  6353. optionInfos,
  6354. colorsModule,
  6355. levenshteinDistance
  6356. }) {
  6357. const {
  6358. name
  6359. } = optionInfo;
  6360. if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
  6361. return vnopts.AnySchema.create({
  6362. name,
  6363. preprocess(value) {
  6364. if (value === false) {
  6365. return value;
  6366. }
  6367. value = Array.isArray(value) ? value : [value];
  6368. return value;
  6369. },
  6370. validate(value) {
  6371. if (value === false) {
  6372. return true;
  6373. }
  6374. return value.every((dir) => typeof dir === "string");
  6375. },
  6376. expected() {
  6377. return "false or paths to plugin search dir";
  6378. }
  6379. });
  6380. }
  6381. const parameters = {
  6382. name
  6383. };
  6384. let SchemaConstructor;
  6385. const handlers = {};
  6386. switch (optionInfo.type) {
  6387. case "int":
  6388. SchemaConstructor = vnopts.IntegerSchema;
  6389. if (isCLI) {
  6390. parameters.preprocess = Number;
  6391. }
  6392. break;
  6393. case "string":
  6394. SchemaConstructor = vnopts.StringSchema;
  6395. break;
  6396. case "choice":
  6397. SchemaConstructor = vnopts.ChoiceSchema;
  6398. parameters.choices = optionInfo.choices.map((choiceInfo) => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign(Object.assign({}, choiceInfo), {}, {
  6399. redirect: {
  6400. to: {
  6401. key: optionInfo.name,
  6402. value: choiceInfo.redirect
  6403. }
  6404. }
  6405. }) : choiceInfo);
  6406. break;
  6407. case "boolean":
  6408. SchemaConstructor = vnopts.BooleanSchema;
  6409. break;
  6410. case "flag":
  6411. SchemaConstructor = getFlagSchema({
  6412. colorsModule,
  6413. levenshteinDistance
  6414. });
  6415. parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean));
  6416. break;
  6417. case "path":
  6418. SchemaConstructor = vnopts.StringSchema;
  6419. break;
  6420. default:
  6421. throw new Error(`Unexpected type ${optionInfo.type}`);
  6422. }
  6423. if (optionInfo.exception) {
  6424. parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils);
  6425. } else {
  6426. parameters.validate = (value, schema, utils) => value === void 0 || schema.validate(value, utils);
  6427. }
  6428. if (optionInfo.redirect) {
  6429. handlers.redirect = (value) => !value ? void 0 : {
  6430. to: {
  6431. key: optionInfo.redirect.option,
  6432. value: optionInfo.redirect.value
  6433. }
  6434. };
  6435. }
  6436. if (optionInfo.deprecated) {
  6437. handlers.deprecated = true;
  6438. }
  6439. if (isCLI && !optionInfo.array) {
  6440. const originalPreprocess = parameters.preprocess || ((x) => x);
  6441. parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? getLast(value) : value), utils);
  6442. }
  6443. return optionInfo.array ? vnopts.ArraySchema.create(Object.assign(Object.assign(Object.assign({}, isCLI ? {
  6444. preprocess: (v) => Array.isArray(v) ? v : [v]
  6445. } : {}), handlers), {}, {
  6446. valueSchema: SchemaConstructor.create(parameters)
  6447. })) : SchemaConstructor.create(Object.assign(Object.assign({}, parameters), handlers));
  6448. }
  6449. function normalizeApiOptions(options, optionInfos, opts) {
  6450. return normalizeOptions(options, optionInfos, opts);
  6451. }
  6452. function normalizeCliOptions(options, optionInfos, opts) {
  6453. if (false) {
  6454. if (!opts.colorsModule) {
  6455. throw new Error("'colorsModule' option is required.");
  6456. }
  6457. if (!opts.levenshteinDistance) {
  6458. throw new Error("'levenshteinDistance' option is required.");
  6459. }
  6460. }
  6461. return normalizeOptions(options, optionInfos, Object.assign({
  6462. isCLI: true
  6463. }, opts));
  6464. }
  6465. module2.exports = {
  6466. normalizeApiOptions,
  6467. normalizeCliOptions
  6468. };
  6469. }
  6470. });
  6471. var require_loc = __commonJS2({
  6472. "src/language-js/loc.js"(exports2, module2) {
  6473. "use strict";
  6474. var isNonEmptyArray = require_is_non_empty_array();
  6475. function locStart(node) {
  6476. var _node$declaration$dec, _node$declaration;
  6477. const start = node.range ? node.range[0] : node.start;
  6478. 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;
  6479. if (isNonEmptyArray(decorators)) {
  6480. return Math.min(locStart(decorators[0]), start);
  6481. }
  6482. return start;
  6483. }
  6484. function locEnd(node) {
  6485. return node.range ? node.range[1] : node.end;
  6486. }
  6487. function hasSameLocStart(nodeA, nodeB) {
  6488. const nodeAStart = locStart(nodeA);
  6489. return Number.isInteger(nodeAStart) && nodeAStart === locStart(nodeB);
  6490. }
  6491. function hasSameLocEnd(nodeA, nodeB) {
  6492. const nodeAEnd = locEnd(nodeA);
  6493. return Number.isInteger(nodeAEnd) && nodeAEnd === locEnd(nodeB);
  6494. }
  6495. function hasSameLoc(nodeA, nodeB) {
  6496. return hasSameLocStart(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB);
  6497. }
  6498. module2.exports = {
  6499. locStart,
  6500. locEnd,
  6501. hasSameLocStart,
  6502. hasSameLoc
  6503. };
  6504. }
  6505. });
  6506. var require_load_parser = __commonJS2({
  6507. "src/main/load-parser.js"(exports2, module2) {
  6508. "use strict";
  6509. var path = require("path");
  6510. var {
  6511. ConfigError
  6512. } = require_errors();
  6513. var {
  6514. locStart,
  6515. locEnd
  6516. } = require_loc();
  6517. function requireParser(parser) {
  6518. try {
  6519. return {
  6520. parse: require(path.resolve(process.cwd(), parser)),
  6521. astFormat: "estree",
  6522. locStart,
  6523. locEnd
  6524. };
  6525. } catch {
  6526. throw new ConfigError(`Couldn't resolve parser "${parser}"`);
  6527. }
  6528. }
  6529. module2.exports = requireParser;
  6530. }
  6531. });
  6532. var require_js_tokens = __commonJS2({
  6533. "node_modules/js-tokens/index.js"(exports2) {
  6534. Object.defineProperty(exports2, "__esModule", {
  6535. value: true
  6536. });
  6537. 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;
  6538. exports2.matchToToken = function(match) {
  6539. var token = {
  6540. type: "invalid",
  6541. value: match[0],
  6542. closed: void 0
  6543. };
  6544. if (match[1])
  6545. token.type = "string", token.closed = !!(match[3] || match[4]);
  6546. else if (match[5])
  6547. token.type = "comment";
  6548. else if (match[6])
  6549. token.type = "comment", token.closed = !!match[7];
  6550. else if (match[8])
  6551. token.type = "regex";
  6552. else if (match[9])
  6553. token.type = "number";
  6554. else if (match[10])
  6555. token.type = "name";
  6556. else if (match[11])
  6557. token.type = "punctuator";
  6558. else if (match[12])
  6559. token.type = "whitespace";
  6560. return token;
  6561. };
  6562. }
  6563. });
  6564. var require_identifier = __commonJS2({
  6565. "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
  6566. "use strict";
  6567. Object.defineProperty(exports2, "__esModule", {
  6568. value: true
  6569. });
  6570. exports2.isIdentifierChar = isIdentifierChar;
  6571. exports2.isIdentifierName = isIdentifierName;
  6572. exports2.isIdentifierStart = isIdentifierStart;
  6573. 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";
  6574. 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\u0CF3\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-\u0ECE\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";
  6575. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  6576. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  6577. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  6578. 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, 20, 1, 64, 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, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 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, 16, 0, 30, 2, 3, 0, 15, 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, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 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, 4153, 7, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938, 6, 4191];
  6579. 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, 81, 2, 71, 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, 3, 0, 158, 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, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 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, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
  6580. function isInAstralSet(code, set) {
  6581. let pos = 65536;
  6582. for (let i = 0, length = set.length; i < length; i += 2) {
  6583. pos += set[i];
  6584. if (pos > code)
  6585. return false;
  6586. pos += set[i + 1];
  6587. if (pos >= code)
  6588. return true;
  6589. }
  6590. return false;
  6591. }
  6592. function isIdentifierStart(code) {
  6593. if (code < 65)
  6594. return code === 36;
  6595. if (code <= 90)
  6596. return true;
  6597. if (code < 97)
  6598. return code === 95;
  6599. if (code <= 122)
  6600. return true;
  6601. if (code <= 65535) {
  6602. return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
  6603. }
  6604. return isInAstralSet(code, astralIdentifierStartCodes);
  6605. }
  6606. function isIdentifierChar(code) {
  6607. if (code < 48)
  6608. return code === 36;
  6609. if (code < 58)
  6610. return true;
  6611. if (code < 65)
  6612. return false;
  6613. if (code <= 90)
  6614. return true;
  6615. if (code < 97)
  6616. return code === 95;
  6617. if (code <= 122)
  6618. return true;
  6619. if (code <= 65535) {
  6620. return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
  6621. }
  6622. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  6623. }
  6624. function isIdentifierName(name) {
  6625. let isFirst = true;
  6626. for (let i = 0; i < name.length; i++) {
  6627. let cp = name.charCodeAt(i);
  6628. if ((cp & 64512) === 55296 && i + 1 < name.length) {
  6629. const trail = name.charCodeAt(++i);
  6630. if ((trail & 64512) === 56320) {
  6631. cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
  6632. }
  6633. }
  6634. if (isFirst) {
  6635. isFirst = false;
  6636. if (!isIdentifierStart(cp)) {
  6637. return false;
  6638. }
  6639. } else if (!isIdentifierChar(cp)) {
  6640. return false;
  6641. }
  6642. }
  6643. return !isFirst;
  6644. }
  6645. }
  6646. });
  6647. var require_keyword = __commonJS2({
  6648. "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
  6649. "use strict";
  6650. Object.defineProperty(exports2, "__esModule", {
  6651. value: true
  6652. });
  6653. exports2.isKeyword = isKeyword;
  6654. exports2.isReservedWord = isReservedWord;
  6655. exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
  6656. exports2.isStrictBindReservedWord = isStrictBindReservedWord;
  6657. exports2.isStrictReservedWord = isStrictReservedWord;
  6658. var reservedWords = {
  6659. 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"],
  6660. strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  6661. strictBind: ["eval", "arguments"]
  6662. };
  6663. var keywords = new Set(reservedWords.keyword);
  6664. var reservedWordsStrictSet = new Set(reservedWords.strict);
  6665. var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  6666. function isReservedWord(word, inModule) {
  6667. return inModule && word === "await" || word === "enum";
  6668. }
  6669. function isStrictReservedWord(word, inModule) {
  6670. return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  6671. }
  6672. function isStrictBindOnlyReservedWord(word) {
  6673. return reservedWordsStrictBindSet.has(word);
  6674. }
  6675. function isStrictBindReservedWord(word, inModule) {
  6676. return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  6677. }
  6678. function isKeyword(word) {
  6679. return keywords.has(word);
  6680. }
  6681. }
  6682. });
  6683. var require_lib3 = __commonJS2({
  6684. "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
  6685. "use strict";
  6686. Object.defineProperty(exports2, "__esModule", {
  6687. value: true
  6688. });
  6689. Object.defineProperty(exports2, "isIdentifierChar", {
  6690. enumerable: true,
  6691. get: function() {
  6692. return _identifier.isIdentifierChar;
  6693. }
  6694. });
  6695. Object.defineProperty(exports2, "isIdentifierName", {
  6696. enumerable: true,
  6697. get: function() {
  6698. return _identifier.isIdentifierName;
  6699. }
  6700. });
  6701. Object.defineProperty(exports2, "isIdentifierStart", {
  6702. enumerable: true,
  6703. get: function() {
  6704. return _identifier.isIdentifierStart;
  6705. }
  6706. });
  6707. Object.defineProperty(exports2, "isKeyword", {
  6708. enumerable: true,
  6709. get: function() {
  6710. return _keyword.isKeyword;
  6711. }
  6712. });
  6713. Object.defineProperty(exports2, "isReservedWord", {
  6714. enumerable: true,
  6715. get: function() {
  6716. return _keyword.isReservedWord;
  6717. }
  6718. });
  6719. Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
  6720. enumerable: true,
  6721. get: function() {
  6722. return _keyword.isStrictBindOnlyReservedWord;
  6723. }
  6724. });
  6725. Object.defineProperty(exports2, "isStrictBindReservedWord", {
  6726. enumerable: true,
  6727. get: function() {
  6728. return _keyword.isStrictBindReservedWord;
  6729. }
  6730. });
  6731. Object.defineProperty(exports2, "isStrictReservedWord", {
  6732. enumerable: true,
  6733. get: function() {
  6734. return _keyword.isStrictReservedWord;
  6735. }
  6736. });
  6737. var _identifier = require_identifier();
  6738. var _keyword = require_keyword();
  6739. }
  6740. });
  6741. var require_escape_string_regexp2 = __commonJS2({
  6742. "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  6743. "use strict";
  6744. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  6745. module2.exports = function(str) {
  6746. if (typeof str !== "string") {
  6747. throw new TypeError("Expected a string");
  6748. }
  6749. return str.replace(matchOperatorsRe, "\\$&");
  6750. };
  6751. }
  6752. });
  6753. var require_has_flag2 = __commonJS2({
  6754. "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
  6755. "use strict";
  6756. module2.exports = (flag, argv) => {
  6757. argv = argv || process.argv;
  6758. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  6759. const pos = argv.indexOf(prefix + flag);
  6760. const terminatorPos = argv.indexOf("--");
  6761. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  6762. };
  6763. }
  6764. });
  6765. var require_supports_color2 = __commonJS2({
  6766. "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
  6767. "use strict";
  6768. var os = require("os");
  6769. var hasFlag = require_has_flag2();
  6770. var env = process.env;
  6771. var forceColor;
  6772. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  6773. forceColor = false;
  6774. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  6775. forceColor = true;
  6776. }
  6777. if ("FORCE_COLOR" in env) {
  6778. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  6779. }
  6780. function translateLevel(level) {
  6781. if (level === 0) {
  6782. return false;
  6783. }
  6784. return {
  6785. level,
  6786. hasBasic: true,
  6787. has256: level >= 2,
  6788. has16m: level >= 3
  6789. };
  6790. }
  6791. function supportsColor(stream) {
  6792. if (forceColor === false) {
  6793. return 0;
  6794. }
  6795. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  6796. return 3;
  6797. }
  6798. if (hasFlag("color=256")) {
  6799. return 2;
  6800. }
  6801. if (stream && !stream.isTTY && forceColor !== true) {
  6802. return 0;
  6803. }
  6804. const min = forceColor ? 1 : 0;
  6805. if (process.platform === "win32") {
  6806. const osRelease = os.release().split(".");
  6807. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  6808. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  6809. }
  6810. return 1;
  6811. }
  6812. if ("CI" in env) {
  6813. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  6814. return 1;
  6815. }
  6816. return min;
  6817. }
  6818. if ("TEAMCITY_VERSION" in env) {
  6819. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  6820. }
  6821. if (env.COLORTERM === "truecolor") {
  6822. return 3;
  6823. }
  6824. if ("TERM_PROGRAM" in env) {
  6825. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  6826. switch (env.TERM_PROGRAM) {
  6827. case "iTerm.app":
  6828. return version2 >= 3 ? 3 : 2;
  6829. case "Apple_Terminal":
  6830. return 2;
  6831. }
  6832. }
  6833. if (/-256(color)?$/i.test(env.TERM)) {
  6834. return 2;
  6835. }
  6836. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  6837. return 1;
  6838. }
  6839. if ("COLORTERM" in env) {
  6840. return 1;
  6841. }
  6842. if (env.TERM === "dumb") {
  6843. return min;
  6844. }
  6845. return min;
  6846. }
  6847. function getSupportLevel(stream) {
  6848. const level = supportsColor(stream);
  6849. return translateLevel(level);
  6850. }
  6851. module2.exports = {
  6852. supportsColor: getSupportLevel,
  6853. stdout: getSupportLevel(process.stdout),
  6854. stderr: getSupportLevel(process.stderr)
  6855. };
  6856. }
  6857. });
  6858. var require_templates2 = __commonJS2({
  6859. "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
  6860. "use strict";
  6861. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  6862. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  6863. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  6864. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  6865. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  6866. function unescape(c) {
  6867. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  6868. return String.fromCharCode(parseInt(c.slice(1), 16));
  6869. }
  6870. return ESCAPES.get(c) || c;
  6871. }
  6872. function parseArguments(name, args) {
  6873. const results = [];
  6874. const chunks = args.trim().split(/\s*,\s*/g);
  6875. let matches;
  6876. for (const chunk of chunks) {
  6877. if (!isNaN(chunk)) {
  6878. results.push(Number(chunk));
  6879. } else if (matches = chunk.match(STRING_REGEX)) {
  6880. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  6881. } else {
  6882. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  6883. }
  6884. }
  6885. return results;
  6886. }
  6887. function parseStyle(style) {
  6888. STYLE_REGEX.lastIndex = 0;
  6889. const results = [];
  6890. let matches;
  6891. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  6892. const name = matches[1];
  6893. if (matches[2]) {
  6894. const args = parseArguments(name, matches[2]);
  6895. results.push([name].concat(args));
  6896. } else {
  6897. results.push([name]);
  6898. }
  6899. }
  6900. return results;
  6901. }
  6902. function buildStyle(chalk, styles) {
  6903. const enabled = {};
  6904. for (const layer of styles) {
  6905. for (const style of layer.styles) {
  6906. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  6907. }
  6908. }
  6909. let current = chalk;
  6910. for (const styleName of Object.keys(enabled)) {
  6911. if (Array.isArray(enabled[styleName])) {
  6912. if (!(styleName in current)) {
  6913. throw new Error(`Unknown Chalk style: ${styleName}`);
  6914. }
  6915. if (enabled[styleName].length > 0) {
  6916. current = current[styleName].apply(current, enabled[styleName]);
  6917. } else {
  6918. current = current[styleName];
  6919. }
  6920. }
  6921. }
  6922. return current;
  6923. }
  6924. module2.exports = (chalk, tmp) => {
  6925. const styles = [];
  6926. const chunks = [];
  6927. let chunk = [];
  6928. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  6929. if (escapeChar) {
  6930. chunk.push(unescape(escapeChar));
  6931. } else if (style) {
  6932. const str = chunk.join("");
  6933. chunk = [];
  6934. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  6935. styles.push({
  6936. inverse,
  6937. styles: parseStyle(style)
  6938. });
  6939. } else if (close) {
  6940. if (styles.length === 0) {
  6941. throw new Error("Found extraneous } in Chalk template literal");
  6942. }
  6943. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  6944. chunk = [];
  6945. styles.pop();
  6946. } else {
  6947. chunk.push(chr);
  6948. }
  6949. });
  6950. chunks.push(chunk.join(""));
  6951. if (styles.length > 0) {
  6952. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  6953. throw new Error(errMsg);
  6954. }
  6955. return chunks.join("");
  6956. };
  6957. }
  6958. });
  6959. var require_chalk2 = __commonJS2({
  6960. "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
  6961. "use strict";
  6962. var escapeStringRegexp2 = require_escape_string_regexp2();
  6963. var ansiStyles = require_ansi_styles();
  6964. var stdoutColor = require_supports_color2().stdout;
  6965. var template = require_templates2();
  6966. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  6967. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  6968. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  6969. var styles = /* @__PURE__ */ Object.create(null);
  6970. function applyOptions(obj, options) {
  6971. options = options || {};
  6972. const scLevel = stdoutColor ? stdoutColor.level : 0;
  6973. obj.level = options.level === void 0 ? scLevel : options.level;
  6974. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  6975. }
  6976. function Chalk(options) {
  6977. if (!this || !(this instanceof Chalk) || this.template) {
  6978. const chalk = {};
  6979. applyOptions(chalk, options);
  6980. chalk.template = function() {
  6981. const args = [].slice.call(arguments);
  6982. return chalkTag.apply(null, [chalk.template].concat(args));
  6983. };
  6984. Object.setPrototypeOf(chalk, Chalk.prototype);
  6985. Object.setPrototypeOf(chalk.template, chalk);
  6986. chalk.template.constructor = Chalk;
  6987. return chalk.template;
  6988. }
  6989. applyOptions(this, options);
  6990. }
  6991. if (isSimpleWindowsTerm) {
  6992. ansiStyles.blue.open = "\x1B[94m";
  6993. }
  6994. for (const key of Object.keys(ansiStyles)) {
  6995. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  6996. styles[key] = {
  6997. get() {
  6998. const codes = ansiStyles[key];
  6999. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  7000. }
  7001. };
  7002. }
  7003. styles.visible = {
  7004. get() {
  7005. return build.call(this, this._styles || [], true, "visible");
  7006. }
  7007. };
  7008. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  7009. for (const model of Object.keys(ansiStyles.color.ansi)) {
  7010. if (skipModels.has(model)) {
  7011. continue;
  7012. }
  7013. styles[model] = {
  7014. get() {
  7015. const level = this.level;
  7016. return function() {
  7017. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  7018. const codes = {
  7019. open,
  7020. close: ansiStyles.color.close,
  7021. closeRe: ansiStyles.color.closeRe
  7022. };
  7023. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  7024. };
  7025. }
  7026. };
  7027. }
  7028. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  7029. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  7030. if (skipModels.has(model)) {
  7031. continue;
  7032. }
  7033. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  7034. styles[bgModel] = {
  7035. get() {
  7036. const level = this.level;
  7037. return function() {
  7038. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  7039. const codes = {
  7040. open,
  7041. close: ansiStyles.bgColor.close,
  7042. closeRe: ansiStyles.bgColor.closeRe
  7043. };
  7044. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  7045. };
  7046. }
  7047. };
  7048. }
  7049. var proto = Object.defineProperties(() => {
  7050. }, styles);
  7051. function build(_styles, _empty, key) {
  7052. const builder = function() {
  7053. return applyStyle.apply(builder, arguments);
  7054. };
  7055. builder._styles = _styles;
  7056. builder._empty = _empty;
  7057. const self2 = this;
  7058. Object.defineProperty(builder, "level", {
  7059. enumerable: true,
  7060. get() {
  7061. return self2.level;
  7062. },
  7063. set(level) {
  7064. self2.level = level;
  7065. }
  7066. });
  7067. Object.defineProperty(builder, "enabled", {
  7068. enumerable: true,
  7069. get() {
  7070. return self2.enabled;
  7071. },
  7072. set(enabled) {
  7073. self2.enabled = enabled;
  7074. }
  7075. });
  7076. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  7077. builder.__proto__ = proto;
  7078. return builder;
  7079. }
  7080. function applyStyle() {
  7081. const args = arguments;
  7082. const argsLen = args.length;
  7083. let str = String(arguments[0]);
  7084. if (argsLen === 0) {
  7085. return "";
  7086. }
  7087. if (argsLen > 1) {
  7088. for (let a = 1; a < argsLen; a++) {
  7089. str += " " + args[a];
  7090. }
  7091. }
  7092. if (!this.enabled || this.level <= 0 || !str) {
  7093. return this._empty ? "" : str;
  7094. }
  7095. const originalDim = ansiStyles.dim.open;
  7096. if (isSimpleWindowsTerm && this.hasGrey) {
  7097. ansiStyles.dim.open = "";
  7098. }
  7099. for (const code of this._styles.slice().reverse()) {
  7100. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  7101. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  7102. }
  7103. ansiStyles.dim.open = originalDim;
  7104. return str;
  7105. }
  7106. function chalkTag(chalk, strings) {
  7107. if (!Array.isArray(strings)) {
  7108. return [].slice.call(arguments, 1).join(" ");
  7109. }
  7110. const args = [].slice.call(arguments, 2);
  7111. const parts = [strings.raw[0]];
  7112. for (let i = 1; i < strings.length; i++) {
  7113. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  7114. parts.push(String(strings.raw[i]));
  7115. }
  7116. return template(chalk, parts.join(""));
  7117. }
  7118. Object.defineProperties(Chalk.prototype, styles);
  7119. module2.exports = Chalk();
  7120. module2.exports.supportsColor = stdoutColor;
  7121. module2.exports.default = module2.exports;
  7122. }
  7123. });
  7124. var require_lib4 = __commonJS2({
  7125. "node_modules/@babel/highlight/lib/index.js"(exports2) {
  7126. "use strict";
  7127. Object.defineProperty(exports2, "__esModule", {
  7128. value: true
  7129. });
  7130. exports2.default = highlight;
  7131. exports2.getChalk = getChalk;
  7132. exports2.shouldHighlight = shouldHighlight;
  7133. var _jsTokens = require_js_tokens();
  7134. var _helperValidatorIdentifier = require_lib3();
  7135. var _chalk = require_chalk2();
  7136. var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
  7137. function getDefs(chalk) {
  7138. return {
  7139. keyword: chalk.cyan,
  7140. capitalized: chalk.yellow,
  7141. jsxIdentifier: chalk.yellow,
  7142. punctuator: chalk.yellow,
  7143. number: chalk.magenta,
  7144. string: chalk.green,
  7145. regex: chalk.magenta,
  7146. comment: chalk.grey,
  7147. invalid: chalk.white.bgRed.bold
  7148. };
  7149. }
  7150. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  7151. var BRACKET = /^[()[\]{}]$/;
  7152. var tokenize;
  7153. {
  7154. const JSX_TAG = /^[a-z][\w-]*$/i;
  7155. const getTokenType = function(token, offset, text) {
  7156. if (token.type === "name") {
  7157. if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
  7158. return "keyword";
  7159. }
  7160. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
  7161. return "jsxIdentifier";
  7162. }
  7163. if (token.value[0] !== token.value[0].toLowerCase()) {
  7164. return "capitalized";
  7165. }
  7166. }
  7167. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  7168. return "bracket";
  7169. }
  7170. if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
  7171. return "punctuator";
  7172. }
  7173. return token.type;
  7174. };
  7175. tokenize = function* (text) {
  7176. let match;
  7177. while (match = _jsTokens.default.exec(text)) {
  7178. const token = _jsTokens.matchToToken(match);
  7179. yield {
  7180. type: getTokenType(token, match.index, text),
  7181. value: token.value
  7182. };
  7183. }
  7184. };
  7185. }
  7186. function highlightTokens(defs, text) {
  7187. let highlighted = "";
  7188. for (const {
  7189. type,
  7190. value
  7191. } of tokenize(text)) {
  7192. const colorize = defs[type];
  7193. if (colorize) {
  7194. highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
  7195. } else {
  7196. highlighted += value;
  7197. }
  7198. }
  7199. return highlighted;
  7200. }
  7201. function shouldHighlight(options) {
  7202. return !!_chalk.supportsColor || options.forceColor;
  7203. }
  7204. function getChalk(options) {
  7205. return options.forceColor ? new _chalk.constructor({
  7206. enabled: true,
  7207. level: 1
  7208. }) : _chalk;
  7209. }
  7210. function highlight(code, options = {}) {
  7211. if (code !== "" && shouldHighlight(options)) {
  7212. const chalk = getChalk(options);
  7213. const defs = getDefs(chalk);
  7214. return highlightTokens(defs, code);
  7215. } else {
  7216. return code;
  7217. }
  7218. }
  7219. }
  7220. });
  7221. var require_lib5 = __commonJS2({
  7222. "node_modules/@babel/code-frame/lib/index.js"(exports2) {
  7223. "use strict";
  7224. Object.defineProperty(exports2, "__esModule", {
  7225. value: true
  7226. });
  7227. exports2.codeFrameColumns = codeFrameColumns;
  7228. exports2.default = _default;
  7229. var _highlight = require_lib4();
  7230. var deprecationWarningShown = false;
  7231. function getDefs(chalk) {
  7232. return {
  7233. gutter: chalk.grey,
  7234. marker: chalk.red.bold,
  7235. message: chalk.red.bold
  7236. };
  7237. }
  7238. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  7239. function getMarkerLines(loc, source, opts) {
  7240. const startLoc = Object.assign({
  7241. column: 0,
  7242. line: -1
  7243. }, loc.start);
  7244. const endLoc = Object.assign({}, startLoc, loc.end);
  7245. const {
  7246. linesAbove = 2,
  7247. linesBelow = 3
  7248. } = opts || {};
  7249. const startLine = startLoc.line;
  7250. const startColumn = startLoc.column;
  7251. const endLine = endLoc.line;
  7252. const endColumn = endLoc.column;
  7253. let start = Math.max(startLine - (linesAbove + 1), 0);
  7254. let end = Math.min(source.length, endLine + linesBelow);
  7255. if (startLine === -1) {
  7256. start = 0;
  7257. }
  7258. if (endLine === -1) {
  7259. end = source.length;
  7260. }
  7261. const lineDiff = endLine - startLine;
  7262. const markerLines = {};
  7263. if (lineDiff) {
  7264. for (let i = 0; i <= lineDiff; i++) {
  7265. const lineNumber = i + startLine;
  7266. if (!startColumn) {
  7267. markerLines[lineNumber] = true;
  7268. } else if (i === 0) {
  7269. const sourceLength = source[lineNumber - 1].length;
  7270. markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
  7271. } else if (i === lineDiff) {
  7272. markerLines[lineNumber] = [0, endColumn];
  7273. } else {
  7274. const sourceLength = source[lineNumber - i].length;
  7275. markerLines[lineNumber] = [0, sourceLength];
  7276. }
  7277. }
  7278. } else {
  7279. if (startColumn === endColumn) {
  7280. if (startColumn) {
  7281. markerLines[startLine] = [startColumn, 0];
  7282. } else {
  7283. markerLines[startLine] = true;
  7284. }
  7285. } else {
  7286. markerLines[startLine] = [startColumn, endColumn - startColumn];
  7287. }
  7288. }
  7289. return {
  7290. start,
  7291. end,
  7292. markerLines
  7293. };
  7294. }
  7295. function codeFrameColumns(rawLines, loc, opts = {}) {
  7296. const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
  7297. const chalk = (0, _highlight.getChalk)(opts);
  7298. const defs = getDefs(chalk);
  7299. const maybeHighlight = (chalkFn, string) => {
  7300. return highlighted ? chalkFn(string) : string;
  7301. };
  7302. const lines = rawLines.split(NEWLINE);
  7303. const {
  7304. start,
  7305. end,
  7306. markerLines
  7307. } = getMarkerLines(loc, lines, opts);
  7308. const hasColumns = loc.start && typeof loc.start.column === "number";
  7309. const numberMaxWidth = String(end).length;
  7310. const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
  7311. let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
  7312. const number = start + 1 + index;
  7313. const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
  7314. const gutter = ` ${paddedNumber} |`;
  7315. const hasMarker = markerLines[number];
  7316. const lastMarkerLine = !markerLines[number + 1];
  7317. if (hasMarker) {
  7318. let markerLine = "";
  7319. if (Array.isArray(hasMarker)) {
  7320. const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
  7321. const numberOfMarkers = hasMarker[1] || 1;
  7322. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
  7323. if (lastMarkerLine && opts.message) {
  7324. markerLine += " " + maybeHighlight(defs.message, opts.message);
  7325. }
  7326. }
  7327. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
  7328. } else {
  7329. return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
  7330. }
  7331. }).join("\n");
  7332. if (opts.message && !hasColumns) {
  7333. frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
  7334. ${frame}`;
  7335. }
  7336. if (highlighted) {
  7337. return chalk.reset(frame);
  7338. } else {
  7339. return frame;
  7340. }
  7341. }
  7342. function _default(rawLines, lineNumber, colNumber, opts = {}) {
  7343. if (!deprecationWarningShown) {
  7344. deprecationWarningShown = true;
  7345. const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
  7346. if (process.emitWarning) {
  7347. process.emitWarning(message, "DeprecationWarning");
  7348. } else {
  7349. const deprecationError = new Error(message);
  7350. deprecationError.name = "DeprecationWarning";
  7351. console.warn(new Error(message));
  7352. }
  7353. }
  7354. colNumber = Math.max(colNumber, 0);
  7355. const location = {
  7356. start: {
  7357. column: colNumber,
  7358. line: lineNumber
  7359. }
  7360. };
  7361. return codeFrameColumns(rawLines, location, opts);
  7362. }
  7363. }
  7364. });
  7365. var require_parser = __commonJS2({
  7366. "src/main/parser.js"(exports2, module2) {
  7367. "use strict";
  7368. var {
  7369. ConfigError
  7370. } = require_errors();
  7371. var jsLoc = require_loc();
  7372. var loadParser = require_load_parser();
  7373. var {
  7374. locStart,
  7375. locEnd
  7376. } = jsLoc;
  7377. var ownNames = Object.getOwnPropertyNames;
  7378. var ownDescriptor = Object.getOwnPropertyDescriptor;
  7379. function getParsers(options) {
  7380. const parsers = {};
  7381. for (const plugin of options.plugins) {
  7382. if (!plugin.parsers) {
  7383. continue;
  7384. }
  7385. for (const name of ownNames(plugin.parsers)) {
  7386. Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
  7387. }
  7388. }
  7389. return parsers;
  7390. }
  7391. function resolveParser(opts, parsers = getParsers(opts)) {
  7392. if (typeof opts.parser === "function") {
  7393. return {
  7394. parse: opts.parser,
  7395. astFormat: "estree",
  7396. locStart,
  7397. locEnd
  7398. };
  7399. }
  7400. if (typeof opts.parser === "string") {
  7401. if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
  7402. return parsers[opts.parser];
  7403. }
  7404. if (false) {
  7405. throw new ConfigError(`Couldn't resolve parser "${opts.parser}". Parsers must be explicitly added to the standalone bundle.`);
  7406. }
  7407. return loadParser(opts.parser);
  7408. }
  7409. }
  7410. function parse(text, opts) {
  7411. const parsers = getParsers(opts);
  7412. const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map((parserName) => [parserName, {
  7413. enumerable: true,
  7414. get() {
  7415. return parsers[parserName].parse;
  7416. }
  7417. }])));
  7418. const parser = resolveParser(opts, parsers);
  7419. try {
  7420. if (parser.preprocess) {
  7421. text = parser.preprocess(text, opts);
  7422. }
  7423. return {
  7424. text,
  7425. ast: parser.parse(text, parsersForCustomParserApi, opts)
  7426. };
  7427. } catch (error) {
  7428. const {
  7429. loc
  7430. } = error;
  7431. if (loc) {
  7432. const {
  7433. codeFrameColumns
  7434. } = require_lib5();
  7435. error.codeFrame = codeFrameColumns(text, loc, {
  7436. highlightCode: true
  7437. });
  7438. error.message += "\n" + error.codeFrame;
  7439. throw error;
  7440. }
  7441. throw error;
  7442. }
  7443. }
  7444. module2.exports = {
  7445. parse,
  7446. resolveParser
  7447. };
  7448. }
  7449. });
  7450. var require_readlines = __commonJS2({
  7451. "node_modules/n-readlines/readlines.js"(exports2, module2) {
  7452. "use strict";
  7453. var fs = require("fs");
  7454. var LineByLine = class {
  7455. constructor(file, options) {
  7456. options = options || {};
  7457. if (!options.readChunk)
  7458. options.readChunk = 1024;
  7459. if (!options.newLineCharacter) {
  7460. options.newLineCharacter = 10;
  7461. } else {
  7462. options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
  7463. }
  7464. if (typeof file === "number") {
  7465. this.fd = file;
  7466. } else {
  7467. this.fd = fs.openSync(file, "r");
  7468. }
  7469. this.options = options;
  7470. this.newLineCharacter = options.newLineCharacter;
  7471. this.reset();
  7472. }
  7473. _searchInBuffer(buffer, hexNeedle) {
  7474. let found = -1;
  7475. for (let i = 0; i <= buffer.length; i++) {
  7476. let b_byte = buffer[i];
  7477. if (b_byte === hexNeedle) {
  7478. found = i;
  7479. break;
  7480. }
  7481. }
  7482. return found;
  7483. }
  7484. reset() {
  7485. this.eofReached = false;
  7486. this.linesCache = [];
  7487. this.fdPosition = 0;
  7488. }
  7489. close() {
  7490. fs.closeSync(this.fd);
  7491. this.fd = null;
  7492. }
  7493. _extractLines(buffer) {
  7494. let line;
  7495. const lines = [];
  7496. let bufferPosition = 0;
  7497. let lastNewLineBufferPosition = 0;
  7498. while (true) {
  7499. let bufferPositionValue = buffer[bufferPosition++];
  7500. if (bufferPositionValue === this.newLineCharacter) {
  7501. line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7502. lines.push(line);
  7503. lastNewLineBufferPosition = bufferPosition;
  7504. } else if (bufferPositionValue === void 0) {
  7505. break;
  7506. }
  7507. }
  7508. let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7509. if (leftovers.length) {
  7510. lines.push(leftovers);
  7511. }
  7512. return lines;
  7513. }
  7514. _readChunk(lineLeftovers) {
  7515. let totalBytesRead = 0;
  7516. let bytesRead;
  7517. const buffers = [];
  7518. do {
  7519. const readBuffer = new Buffer(this.options.readChunk);
  7520. bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
  7521. totalBytesRead = totalBytesRead + bytesRead;
  7522. this.fdPosition = this.fdPosition + bytesRead;
  7523. buffers.push(readBuffer);
  7524. } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
  7525. let bufferData = Buffer.concat(buffers);
  7526. if (bytesRead < this.options.readChunk) {
  7527. this.eofReached = true;
  7528. bufferData = bufferData.slice(0, totalBytesRead);
  7529. }
  7530. if (totalBytesRead) {
  7531. this.linesCache = this._extractLines(bufferData);
  7532. if (lineLeftovers) {
  7533. this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
  7534. }
  7535. }
  7536. return totalBytesRead;
  7537. }
  7538. next() {
  7539. if (!this.fd)
  7540. return false;
  7541. let line = false;
  7542. if (this.eofReached && this.linesCache.length === 0) {
  7543. return line;
  7544. }
  7545. let bytesRead;
  7546. if (!this.linesCache.length) {
  7547. bytesRead = this._readChunk();
  7548. }
  7549. if (this.linesCache.length) {
  7550. line = this.linesCache.shift();
  7551. const lastLineCharacter = line[line.length - 1];
  7552. if (lastLineCharacter !== this.newLineCharacter) {
  7553. bytesRead = this._readChunk(line);
  7554. if (bytesRead) {
  7555. line = this.linesCache.shift();
  7556. }
  7557. }
  7558. }
  7559. if (this.eofReached && this.linesCache.length === 0) {
  7560. this.close();
  7561. }
  7562. if (line && line[line.length - 1] === this.newLineCharacter) {
  7563. line = line.slice(0, line.length - 1);
  7564. }
  7565. return line;
  7566. }
  7567. };
  7568. module2.exports = LineByLine;
  7569. }
  7570. });
  7571. var require_get_interpreter = __commonJS2({
  7572. "src/utils/get-interpreter.js"(exports2, module2) {
  7573. "use strict";
  7574. var fs = require("fs");
  7575. var readlines = require_readlines();
  7576. function getInterpreter(filepath) {
  7577. if (typeof filepath !== "string") {
  7578. return "";
  7579. }
  7580. let fd;
  7581. try {
  7582. fd = fs.openSync(filepath, "r");
  7583. } catch {
  7584. return "";
  7585. }
  7586. try {
  7587. const liner = new readlines(fd);
  7588. const firstLine = liner.next().toString("utf8");
  7589. const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
  7590. if (m1) {
  7591. return m1[1];
  7592. }
  7593. const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
  7594. if (m2) {
  7595. return m2[1];
  7596. }
  7597. return "";
  7598. } catch {
  7599. return "";
  7600. } finally {
  7601. try {
  7602. fs.closeSync(fd);
  7603. } catch {
  7604. }
  7605. }
  7606. }
  7607. module2.exports = getInterpreter;
  7608. }
  7609. });
  7610. var require_options = __commonJS2({
  7611. "src/main/options.js"(exports2, module2) {
  7612. "use strict";
  7613. var path = require("path");
  7614. var {
  7615. UndefinedParserError
  7616. } = require_errors();
  7617. var {
  7618. getSupportInfo: getSupportInfo2
  7619. } = require_support();
  7620. var normalizer = require_options_normalizer();
  7621. var {
  7622. resolveParser
  7623. } = require_parser();
  7624. var hiddenDefaults = {
  7625. astFormat: "estree",
  7626. printer: {},
  7627. originalText: void 0,
  7628. locStart: null,
  7629. locEnd: null
  7630. };
  7631. function normalize(options, opts = {}) {
  7632. const rawOptions = Object.assign({}, options);
  7633. const supportOptions = getSupportInfo2({
  7634. plugins: options.plugins,
  7635. showUnreleased: true,
  7636. showDeprecated: true
  7637. }).options;
  7638. const defaults = Object.assign(Object.assign({}, hiddenDefaults), Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default])));
  7639. if (!rawOptions.parser) {
  7640. if (!rawOptions.filepath) {
  7641. const logger = opts.logger || console;
  7642. 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.");
  7643. rawOptions.parser = "babel";
  7644. } else {
  7645. rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
  7646. if (!rawOptions.parser) {
  7647. throw new UndefinedParserError(`No parser could be inferred for file: ${rawOptions.filepath}`);
  7648. }
  7649. }
  7650. }
  7651. const parser = resolveParser(normalizer.normalizeApiOptions(rawOptions, [supportOptions.find((x) => x.name === "parser")], {
  7652. passThrough: true,
  7653. logger: false
  7654. }));
  7655. rawOptions.astFormat = parser.astFormat;
  7656. rawOptions.locEnd = parser.locEnd;
  7657. rawOptions.locStart = parser.locStart;
  7658. const plugin = getPlugin(rawOptions);
  7659. rawOptions.printer = plugin.printers[rawOptions.astFormat];
  7660. const pluginDefaults = Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== void 0).map((optionInfo) => [optionInfo.name, optionInfo.pluginDefaults[plugin.name]]));
  7661. const mixedDefaults = Object.assign(Object.assign({}, defaults), pluginDefaults);
  7662. for (const [k, value] of Object.entries(mixedDefaults)) {
  7663. if (rawOptions[k] === null || rawOptions[k] === void 0) {
  7664. rawOptions[k] = value;
  7665. }
  7666. }
  7667. if (rawOptions.parser === "json") {
  7668. rawOptions.trailingComma = "none";
  7669. }
  7670. return normalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
  7671. passThrough: Object.keys(hiddenDefaults)
  7672. }, opts));
  7673. }
  7674. function getPlugin(options) {
  7675. const {
  7676. astFormat
  7677. } = options;
  7678. if (!astFormat) {
  7679. throw new Error("getPlugin() requires astFormat to be set");
  7680. }
  7681. const printerPlugin = options.plugins.find((plugin) => plugin.printers && plugin.printers[astFormat]);
  7682. if (!printerPlugin) {
  7683. throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
  7684. }
  7685. return printerPlugin;
  7686. }
  7687. function inferParser(filepath, plugins2) {
  7688. const filename = path.basename(filepath).toLowerCase();
  7689. const languages = getSupportInfo2({
  7690. plugins: plugins2
  7691. }).languages.filter((language2) => language2.since !== null);
  7692. let language = languages.find((language2) => language2.extensions && language2.extensions.some((extension) => filename.endsWith(extension)) || language2.filenames && language2.filenames.some((name) => name.toLowerCase() === filename));
  7693. if (!language && !filename.includes(".")) {
  7694. const getInterpreter = require_get_interpreter();
  7695. const interpreter = getInterpreter(filepath);
  7696. language = languages.find((language2) => language2.interpreters && language2.interpreters.includes(interpreter));
  7697. }
  7698. return language && language.parsers[0];
  7699. }
  7700. module2.exports = {
  7701. normalize,
  7702. hiddenDefaults,
  7703. inferParser
  7704. };
  7705. }
  7706. });
  7707. var require_massage_ast = __commonJS2({
  7708. "src/main/massage-ast.js"(exports2, module2) {
  7709. "use strict";
  7710. function massageAST(ast, options, parent) {
  7711. if (Array.isArray(ast)) {
  7712. return ast.map((e) => massageAST(e, options, parent)).filter(Boolean);
  7713. }
  7714. if (!ast || typeof ast !== "object") {
  7715. return ast;
  7716. }
  7717. const cleanFunction = options.printer.massageAstNode;
  7718. let ignoredProperties;
  7719. if (cleanFunction && cleanFunction.ignoredProperties) {
  7720. ignoredProperties = cleanFunction.ignoredProperties;
  7721. } else {
  7722. ignoredProperties = /* @__PURE__ */ new Set();
  7723. }
  7724. const newObj = {};
  7725. for (const [key, value] of Object.entries(ast)) {
  7726. if (!ignoredProperties.has(key) && typeof value !== "function") {
  7727. newObj[key] = massageAST(value, options, ast);
  7728. }
  7729. }
  7730. if (cleanFunction) {
  7731. const result = cleanFunction(ast, newObj, parent);
  7732. if (result === null) {
  7733. return;
  7734. }
  7735. if (result) {
  7736. return result;
  7737. }
  7738. }
  7739. return newObj;
  7740. }
  7741. module2.exports = massageAST;
  7742. }
  7743. });
  7744. var require_comments = __commonJS2({
  7745. "src/main/comments.js"(exports2, module2) {
  7746. "use strict";
  7747. var assert = require("assert");
  7748. var {
  7749. builders: {
  7750. line,
  7751. hardline,
  7752. breakParent,
  7753. indent,
  7754. lineSuffix,
  7755. join,
  7756. cursor
  7757. }
  7758. } = require("./doc.js");
  7759. var {
  7760. hasNewline,
  7761. skipNewline,
  7762. skipSpaces,
  7763. isPreviousLineEmpty,
  7764. addLeadingComment,
  7765. addDanglingComment,
  7766. addTrailingComment
  7767. } = require_util();
  7768. var childNodesCache = /* @__PURE__ */ new WeakMap();
  7769. function getSortedChildNodes(node, options, resultArray) {
  7770. if (!node) {
  7771. return;
  7772. }
  7773. const {
  7774. printer,
  7775. locStart,
  7776. locEnd
  7777. } = options;
  7778. if (resultArray) {
  7779. if (printer.canAttachComment && printer.canAttachComment(node)) {
  7780. let i;
  7781. for (i = resultArray.length - 1; i >= 0; --i) {
  7782. if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
  7783. break;
  7784. }
  7785. }
  7786. resultArray.splice(i + 1, 0, node);
  7787. return;
  7788. }
  7789. } else if (childNodesCache.has(node)) {
  7790. return childNodesCache.get(node);
  7791. }
  7792. 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);
  7793. if (!childNodes) {
  7794. return;
  7795. }
  7796. if (!resultArray) {
  7797. resultArray = [];
  7798. childNodesCache.set(node, resultArray);
  7799. }
  7800. for (const childNode of childNodes) {
  7801. getSortedChildNodes(childNode, options, resultArray);
  7802. }
  7803. return resultArray;
  7804. }
  7805. function decorateComment(node, comment, options, enclosingNode) {
  7806. const {
  7807. locStart,
  7808. locEnd
  7809. } = options;
  7810. const commentStart = locStart(comment);
  7811. const commentEnd = locEnd(comment);
  7812. const childNodes = getSortedChildNodes(node, options);
  7813. let precedingNode;
  7814. let followingNode;
  7815. let left = 0;
  7816. let right = childNodes.length;
  7817. while (left < right) {
  7818. const middle = left + right >> 1;
  7819. const child = childNodes[middle];
  7820. const start = locStart(child);
  7821. const end = locEnd(child);
  7822. if (start <= commentStart && commentEnd <= end) {
  7823. return decorateComment(child, comment, options, child);
  7824. }
  7825. if (end <= commentStart) {
  7826. precedingNode = child;
  7827. left = middle + 1;
  7828. continue;
  7829. }
  7830. if (commentEnd <= start) {
  7831. followingNode = child;
  7832. right = middle;
  7833. continue;
  7834. }
  7835. throw new Error("Comment location overlaps with node location");
  7836. }
  7837. if (enclosingNode && enclosingNode.type === "TemplateLiteral") {
  7838. const {
  7839. quasis
  7840. } = enclosingNode;
  7841. const commentIndex = findExpressionIndexForComment(quasis, comment, options);
  7842. if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
  7843. precedingNode = null;
  7844. }
  7845. if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
  7846. followingNode = null;
  7847. }
  7848. }
  7849. return {
  7850. enclosingNode,
  7851. precedingNode,
  7852. followingNode
  7853. };
  7854. }
  7855. var returnFalse = () => false;
  7856. function attach(comments, ast, text, options) {
  7857. if (!Array.isArray(comments)) {
  7858. return;
  7859. }
  7860. const tiesToBreak = [];
  7861. const {
  7862. locStart,
  7863. locEnd,
  7864. printer: {
  7865. handleComments = {}
  7866. }
  7867. } = options;
  7868. const {
  7869. avoidAstMutation,
  7870. ownLine: handleOwnLineComment = returnFalse,
  7871. endOfLine: handleEndOfLineComment = returnFalse,
  7872. remaining: handleRemainingComment = returnFalse
  7873. } = handleComments;
  7874. const decoratedComments = comments.map((comment, index) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
  7875. comment,
  7876. text,
  7877. options,
  7878. ast,
  7879. isLastComment: comments.length - 1 === index
  7880. }));
  7881. for (const [index, context] of decoratedComments.entries()) {
  7882. const {
  7883. comment,
  7884. precedingNode,
  7885. enclosingNode,
  7886. followingNode,
  7887. text: text2,
  7888. options: options2,
  7889. ast: ast2,
  7890. isLastComment
  7891. } = context;
  7892. if (options2.parser === "json" || options2.parser === "json5" || options2.parser === "__js_expression" || options2.parser === "__vue_expression" || options2.parser === "__vue_ts_expression") {
  7893. if (locStart(comment) - locStart(ast2) <= 0) {
  7894. addLeadingComment(ast2, comment);
  7895. continue;
  7896. }
  7897. if (locEnd(comment) - locEnd(ast2) >= 0) {
  7898. addTrailingComment(ast2, comment);
  7899. continue;
  7900. }
  7901. }
  7902. let args;
  7903. if (avoidAstMutation) {
  7904. args = [context];
  7905. } else {
  7906. comment.enclosingNode = enclosingNode;
  7907. comment.precedingNode = precedingNode;
  7908. comment.followingNode = followingNode;
  7909. args = [comment, text2, options2, ast2, isLastComment];
  7910. }
  7911. if (isOwnLineComment(text2, options2, decoratedComments, index)) {
  7912. comment.placement = "ownLine";
  7913. if (handleOwnLineComment(...args)) {
  7914. } else if (followingNode) {
  7915. addLeadingComment(followingNode, comment);
  7916. } else if (precedingNode) {
  7917. addTrailingComment(precedingNode, comment);
  7918. } else if (enclosingNode) {
  7919. addDanglingComment(enclosingNode, comment);
  7920. } else {
  7921. addDanglingComment(ast2, comment);
  7922. }
  7923. } else if (isEndOfLineComment(text2, options2, decoratedComments, index)) {
  7924. comment.placement = "endOfLine";
  7925. if (handleEndOfLineComment(...args)) {
  7926. } else if (precedingNode) {
  7927. addTrailingComment(precedingNode, comment);
  7928. } else if (followingNode) {
  7929. addLeadingComment(followingNode, comment);
  7930. } else if (enclosingNode) {
  7931. addDanglingComment(enclosingNode, comment);
  7932. } else {
  7933. addDanglingComment(ast2, comment);
  7934. }
  7935. } else {
  7936. comment.placement = "remaining";
  7937. if (handleRemainingComment(...args)) {
  7938. } else if (precedingNode && followingNode) {
  7939. const tieCount = tiesToBreak.length;
  7940. if (tieCount > 0) {
  7941. const lastTie = tiesToBreak[tieCount - 1];
  7942. if (lastTie.followingNode !== followingNode) {
  7943. breakTies(tiesToBreak, text2, options2);
  7944. }
  7945. }
  7946. tiesToBreak.push(context);
  7947. } else if (precedingNode) {
  7948. addTrailingComment(precedingNode, comment);
  7949. } else if (followingNode) {
  7950. addLeadingComment(followingNode, comment);
  7951. } else if (enclosingNode) {
  7952. addDanglingComment(enclosingNode, comment);
  7953. } else {
  7954. addDanglingComment(ast2, comment);
  7955. }
  7956. }
  7957. }
  7958. breakTies(tiesToBreak, text, options);
  7959. if (!avoidAstMutation) {
  7960. for (const comment of comments) {
  7961. delete comment.precedingNode;
  7962. delete comment.enclosingNode;
  7963. delete comment.followingNode;
  7964. }
  7965. }
  7966. }
  7967. var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text);
  7968. function isOwnLineComment(text, options, decoratedComments, commentIndex) {
  7969. const {
  7970. comment,
  7971. precedingNode
  7972. } = decoratedComments[commentIndex];
  7973. const {
  7974. locStart,
  7975. locEnd
  7976. } = options;
  7977. let start = locStart(comment);
  7978. if (precedingNode) {
  7979. for (let index = commentIndex - 1; index >= 0; index--) {
  7980. const {
  7981. comment: comment2,
  7982. precedingNode: currentCommentPrecedingNode
  7983. } = decoratedComments[index];
  7984. if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) {
  7985. break;
  7986. }
  7987. start = locStart(comment2);
  7988. }
  7989. }
  7990. return hasNewline(text, start, {
  7991. backwards: true
  7992. });
  7993. }
  7994. function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
  7995. const {
  7996. comment,
  7997. followingNode
  7998. } = decoratedComments[commentIndex];
  7999. const {
  8000. locStart,
  8001. locEnd
  8002. } = options;
  8003. let end = locEnd(comment);
  8004. if (followingNode) {
  8005. for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
  8006. const {
  8007. comment: comment2,
  8008. followingNode: currentCommentFollowingNode
  8009. } = decoratedComments[index];
  8010. if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) {
  8011. break;
  8012. }
  8013. end = locEnd(comment2);
  8014. }
  8015. }
  8016. return hasNewline(text, end);
  8017. }
  8018. function breakTies(tiesToBreak, text, options) {
  8019. const tieCount = tiesToBreak.length;
  8020. if (tieCount === 0) {
  8021. return;
  8022. }
  8023. const {
  8024. precedingNode,
  8025. followingNode,
  8026. enclosingNode
  8027. } = tiesToBreak[0];
  8028. const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
  8029. let gapEndPos = options.locStart(followingNode);
  8030. let indexOfFirstLeadingComment;
  8031. for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
  8032. const {
  8033. comment,
  8034. precedingNode: currentCommentPrecedingNode,
  8035. followingNode: currentCommentFollowingNode
  8036. } = tiesToBreak[indexOfFirstLeadingComment - 1];
  8037. assert.strictEqual(currentCommentPrecedingNode, precedingNode);
  8038. assert.strictEqual(currentCommentFollowingNode, followingNode);
  8039. const gap = text.slice(options.locEnd(comment), gapEndPos);
  8040. if (gapRegExp.test(gap)) {
  8041. gapEndPos = options.locStart(comment);
  8042. } else {
  8043. break;
  8044. }
  8045. }
  8046. for (const [i, {
  8047. comment
  8048. }] of tiesToBreak.entries()) {
  8049. if (i < indexOfFirstLeadingComment) {
  8050. addTrailingComment(precedingNode, comment);
  8051. } else {
  8052. addLeadingComment(followingNode, comment);
  8053. }
  8054. }
  8055. for (const node of [precedingNode, followingNode]) {
  8056. if (node.comments && node.comments.length > 1) {
  8057. node.comments.sort((a, b) => options.locStart(a) - options.locStart(b));
  8058. }
  8059. }
  8060. tiesToBreak.length = 0;
  8061. }
  8062. function printComment(path, options) {
  8063. const comment = path.getValue();
  8064. comment.printed = true;
  8065. return options.printer.printComment(path, options);
  8066. }
  8067. function findExpressionIndexForComment(quasis, comment, options) {
  8068. const startPos = options.locStart(comment) - 1;
  8069. for (let i = 1; i < quasis.length; ++i) {
  8070. if (startPos < options.locStart(quasis[i])) {
  8071. return i - 1;
  8072. }
  8073. }
  8074. return 0;
  8075. }
  8076. function printLeadingComment(path, options) {
  8077. const comment = path.getValue();
  8078. const parts = [printComment(path, options)];
  8079. const {
  8080. printer,
  8081. originalText,
  8082. locStart,
  8083. locEnd
  8084. } = options;
  8085. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  8086. if (isBlock) {
  8087. const lineBreak = hasNewline(originalText, locEnd(comment)) ? hasNewline(originalText, locStart(comment), {
  8088. backwards: true
  8089. }) ? hardline : line : " ";
  8090. parts.push(lineBreak);
  8091. } else {
  8092. parts.push(hardline);
  8093. }
  8094. const index = skipNewline(originalText, skipSpaces(originalText, locEnd(comment)));
  8095. if (index !== false && hasNewline(originalText, index)) {
  8096. parts.push(hardline);
  8097. }
  8098. return parts;
  8099. }
  8100. function printTrailingComment(path, options) {
  8101. const comment = path.getValue();
  8102. const printed = printComment(path, options);
  8103. const {
  8104. printer,
  8105. originalText,
  8106. locStart
  8107. } = options;
  8108. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  8109. if (hasNewline(originalText, locStart(comment), {
  8110. backwards: true
  8111. })) {
  8112. const isLineBeforeEmpty = isPreviousLineEmpty(originalText, comment, locStart);
  8113. return lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]);
  8114. }
  8115. let parts = [" ", printed];
  8116. if (!isBlock) {
  8117. parts = [lineSuffix(parts), breakParent];
  8118. }
  8119. return parts;
  8120. }
  8121. function printDanglingComments(path, options, sameIndent, filter) {
  8122. const parts = [];
  8123. const node = path.getValue();
  8124. if (!node || !node.comments) {
  8125. return "";
  8126. }
  8127. path.each(() => {
  8128. const comment = path.getValue();
  8129. if (!comment.leading && !comment.trailing && (!filter || filter(comment))) {
  8130. parts.push(printComment(path, options));
  8131. }
  8132. }, "comments");
  8133. if (parts.length === 0) {
  8134. return "";
  8135. }
  8136. if (sameIndent) {
  8137. return join(hardline, parts);
  8138. }
  8139. return indent([hardline, join(hardline, parts)]);
  8140. }
  8141. function printCommentsSeparately(path, options, ignored) {
  8142. const value = path.getValue();
  8143. if (!value) {
  8144. return {};
  8145. }
  8146. let comments = value.comments || [];
  8147. if (ignored) {
  8148. comments = comments.filter((comment) => !ignored.has(comment));
  8149. }
  8150. const isCursorNode = value === options.cursorNode;
  8151. if (comments.length === 0) {
  8152. const maybeCursor = isCursorNode ? cursor : "";
  8153. return {
  8154. leading: maybeCursor,
  8155. trailing: maybeCursor
  8156. };
  8157. }
  8158. const leadingParts = [];
  8159. const trailingParts = [];
  8160. path.each(() => {
  8161. const comment = path.getValue();
  8162. if (ignored && ignored.has(comment)) {
  8163. return;
  8164. }
  8165. const {
  8166. leading,
  8167. trailing
  8168. } = comment;
  8169. if (leading) {
  8170. leadingParts.push(printLeadingComment(path, options));
  8171. } else if (trailing) {
  8172. trailingParts.push(printTrailingComment(path, options));
  8173. }
  8174. }, "comments");
  8175. if (isCursorNode) {
  8176. leadingParts.unshift(cursor);
  8177. trailingParts.push(cursor);
  8178. }
  8179. return {
  8180. leading: leadingParts,
  8181. trailing: trailingParts
  8182. };
  8183. }
  8184. function printComments(path, doc2, options, ignored) {
  8185. const {
  8186. leading,
  8187. trailing
  8188. } = printCommentsSeparately(path, options, ignored);
  8189. if (!leading && !trailing) {
  8190. return doc2;
  8191. }
  8192. return [leading, doc2, trailing];
  8193. }
  8194. function ensureAllCommentsPrinted(astComments) {
  8195. if (!astComments) {
  8196. return;
  8197. }
  8198. for (const comment of astComments) {
  8199. if (!comment.printed) {
  8200. throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
  8201. }
  8202. delete comment.printed;
  8203. }
  8204. }
  8205. module2.exports = {
  8206. attach,
  8207. printComments,
  8208. printCommentsSeparately,
  8209. printDanglingComments,
  8210. getSortedChildNodes,
  8211. ensureAllCommentsPrinted
  8212. };
  8213. }
  8214. });
  8215. var require_ast_path = __commonJS2({
  8216. "src/common/ast-path.js"(exports2, module2) {
  8217. "use strict";
  8218. var getLast = require_get_last();
  8219. function getNodeHelper(path, count) {
  8220. const stackIndex = getNodeStackIndexHelper(path.stack, count);
  8221. return stackIndex === -1 ? null : path.stack[stackIndex];
  8222. }
  8223. function getNodeStackIndexHelper(stack, count) {
  8224. for (let i = stack.length - 1; i >= 0; i -= 2) {
  8225. const value = stack[i];
  8226. if (value && !Array.isArray(value) && --count < 0) {
  8227. return i;
  8228. }
  8229. }
  8230. return -1;
  8231. }
  8232. var AstPath = class {
  8233. constructor(value) {
  8234. this.stack = [value];
  8235. }
  8236. getName() {
  8237. const {
  8238. stack
  8239. } = this;
  8240. const {
  8241. length
  8242. } = stack;
  8243. if (length > 1) {
  8244. return stack[length - 2];
  8245. }
  8246. return null;
  8247. }
  8248. getValue() {
  8249. return getLast(this.stack);
  8250. }
  8251. getNode(count = 0) {
  8252. return getNodeHelper(this, count);
  8253. }
  8254. getParentNode(count = 0) {
  8255. return getNodeHelper(this, count + 1);
  8256. }
  8257. call(callback, ...names) {
  8258. const {
  8259. stack
  8260. } = this;
  8261. const {
  8262. length
  8263. } = stack;
  8264. let value = getLast(stack);
  8265. for (const name of names) {
  8266. value = value[name];
  8267. stack.push(name, value);
  8268. }
  8269. const result = callback(this);
  8270. stack.length = length;
  8271. return result;
  8272. }
  8273. callParent(callback, count = 0) {
  8274. const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
  8275. const parentValues = this.stack.splice(stackIndex + 1);
  8276. const result = callback(this);
  8277. this.stack.push(...parentValues);
  8278. return result;
  8279. }
  8280. each(callback, ...names) {
  8281. const {
  8282. stack
  8283. } = this;
  8284. const {
  8285. length
  8286. } = stack;
  8287. let value = getLast(stack);
  8288. for (const name of names) {
  8289. value = value[name];
  8290. stack.push(name, value);
  8291. }
  8292. for (let i = 0; i < value.length; ++i) {
  8293. stack.push(i, value[i]);
  8294. callback(this, i, value);
  8295. stack.length -= 2;
  8296. }
  8297. stack.length = length;
  8298. }
  8299. map(callback, ...names) {
  8300. const result = [];
  8301. this.each((path, index, value) => {
  8302. result[index] = callback(path, index, value);
  8303. }, ...names);
  8304. return result;
  8305. }
  8306. try(callback) {
  8307. const {
  8308. stack
  8309. } = this;
  8310. const stackBackup = [...stack];
  8311. try {
  8312. return callback();
  8313. } finally {
  8314. stack.length = 0;
  8315. stack.push(...stackBackup);
  8316. }
  8317. }
  8318. match(...predicates) {
  8319. let stackPointer = this.stack.length - 1;
  8320. let name = null;
  8321. let node = this.stack[stackPointer--];
  8322. for (const predicate of predicates) {
  8323. if (node === void 0) {
  8324. return false;
  8325. }
  8326. let number = null;
  8327. if (typeof name === "number") {
  8328. number = name;
  8329. name = this.stack[stackPointer--];
  8330. node = this.stack[stackPointer--];
  8331. }
  8332. if (predicate && !predicate(node, name, number)) {
  8333. return false;
  8334. }
  8335. name = this.stack[stackPointer--];
  8336. node = this.stack[stackPointer--];
  8337. }
  8338. return true;
  8339. }
  8340. findAncestor(predicate) {
  8341. let stackPointer = this.stack.length - 1;
  8342. let name = null;
  8343. let node = this.stack[stackPointer--];
  8344. while (node) {
  8345. let number = null;
  8346. if (typeof name === "number") {
  8347. number = name;
  8348. name = this.stack[stackPointer--];
  8349. node = this.stack[stackPointer--];
  8350. }
  8351. if (name !== null && predicate(node, name, number)) {
  8352. return node;
  8353. }
  8354. name = this.stack[stackPointer--];
  8355. node = this.stack[stackPointer--];
  8356. }
  8357. }
  8358. };
  8359. module2.exports = AstPath;
  8360. }
  8361. });
  8362. var require_multiparser = __commonJS2({
  8363. "src/main/multiparser.js"(exports2, module2) {
  8364. "use strict";
  8365. var {
  8366. utils: {
  8367. stripTrailingHardline
  8368. }
  8369. } = require("./doc.js");
  8370. var {
  8371. normalize
  8372. } = require_options();
  8373. var comments = require_comments();
  8374. function printSubtree(path, print, options, printAstToDoc) {
  8375. if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
  8376. return options.printer.embed(path, print, (text, partialNextOptions, textToDocOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
  8377. }
  8378. }
  8379. function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc, {
  8380. stripTrailingHardline: shouldStripTrailingHardline = false
  8381. } = {}) {
  8382. const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
  8383. parentParser: parentOptions.parser,
  8384. originalText: text
  8385. }), {
  8386. passThrough: true
  8387. });
  8388. const result = require_parser().parse(text, nextOptions);
  8389. const {
  8390. ast
  8391. } = result;
  8392. text = result.text;
  8393. const astComments = ast.comments;
  8394. delete ast.comments;
  8395. comments.attach(astComments, ast, text, nextOptions);
  8396. nextOptions[Symbol.for("comments")] = astComments || [];
  8397. nextOptions[Symbol.for("tokens")] = ast.tokens || [];
  8398. const doc2 = printAstToDoc(ast, nextOptions);
  8399. comments.ensureAllCommentsPrinted(astComments);
  8400. if (shouldStripTrailingHardline) {
  8401. if (typeof doc2 === "string") {
  8402. return doc2.replace(/(?:\r?\n)*$/, "");
  8403. }
  8404. return stripTrailingHardline(doc2);
  8405. }
  8406. return doc2;
  8407. }
  8408. module2.exports = {
  8409. printSubtree
  8410. };
  8411. }
  8412. });
  8413. var require_ast_to_doc = __commonJS2({
  8414. "src/main/ast-to-doc.js"(exports2, module2) {
  8415. "use strict";
  8416. var AstPath = require_ast_path();
  8417. var {
  8418. builders: {
  8419. hardline,
  8420. addAlignmentToDoc
  8421. },
  8422. utils: {
  8423. propagateBreaks
  8424. }
  8425. } = require("./doc.js");
  8426. var {
  8427. printComments
  8428. } = require_comments();
  8429. var multiparser = require_multiparser();
  8430. function printAstToDoc(ast, options, alignmentSize = 0) {
  8431. const {
  8432. printer
  8433. } = options;
  8434. if (printer.preprocess) {
  8435. ast = printer.preprocess(ast, options);
  8436. }
  8437. const cache = /* @__PURE__ */ new Map();
  8438. const path = new AstPath(ast);
  8439. let doc2 = mainPrint();
  8440. if (alignmentSize > 0) {
  8441. doc2 = addAlignmentToDoc([hardline, doc2], alignmentSize, options.tabWidth);
  8442. }
  8443. propagateBreaks(doc2);
  8444. return doc2;
  8445. function mainPrint(selector, args) {
  8446. if (selector === void 0 || selector === path) {
  8447. return mainPrintInternal(args);
  8448. }
  8449. if (Array.isArray(selector)) {
  8450. return path.call(() => mainPrintInternal(args), ...selector);
  8451. }
  8452. return path.call(() => mainPrintInternal(args), selector);
  8453. }
  8454. function mainPrintInternal(args) {
  8455. const value = path.getValue();
  8456. const shouldCache = value && typeof value === "object" && args === void 0;
  8457. if (shouldCache && cache.has(value)) {
  8458. return cache.get(value);
  8459. }
  8460. const doc3 = callPluginPrintFunction(path, options, mainPrint, args);
  8461. if (shouldCache) {
  8462. cache.set(value, doc3);
  8463. }
  8464. return doc3;
  8465. }
  8466. }
  8467. function printPrettierIgnoredNode(node, options) {
  8468. const {
  8469. originalText,
  8470. [Symbol.for("comments")]: comments,
  8471. locStart,
  8472. locEnd
  8473. } = options;
  8474. const start = locStart(node);
  8475. const end = locEnd(node);
  8476. const printedComments = /* @__PURE__ */ new Set();
  8477. for (const comment of comments) {
  8478. if (locStart(comment) >= start && locEnd(comment) <= end) {
  8479. comment.printed = true;
  8480. printedComments.add(comment);
  8481. }
  8482. }
  8483. return {
  8484. doc: originalText.slice(start, end),
  8485. printedComments
  8486. };
  8487. }
  8488. function callPluginPrintFunction(path, options, printPath, args) {
  8489. const node = path.getValue();
  8490. const {
  8491. printer
  8492. } = options;
  8493. let doc2;
  8494. let printedComments;
  8495. if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
  8496. ({
  8497. doc: doc2,
  8498. printedComments
  8499. } = printPrettierIgnoredNode(node, options));
  8500. } else {
  8501. if (node) {
  8502. try {
  8503. doc2 = multiparser.printSubtree(path, printPath, options, printAstToDoc);
  8504. } catch (error) {
  8505. if (process.env.PRETTIER_DEBUG) {
  8506. throw error;
  8507. }
  8508. }
  8509. }
  8510. if (!doc2) {
  8511. doc2 = printer.print(path, options, printPath, args);
  8512. }
  8513. }
  8514. if (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path, options)) {
  8515. doc2 = printComments(path, doc2, options, printedComments);
  8516. }
  8517. return doc2;
  8518. }
  8519. module2.exports = printAstToDoc;
  8520. }
  8521. });
  8522. var require_range_util = __commonJS2({
  8523. "src/main/range-util.js"(exports2, module2) {
  8524. "use strict";
  8525. var assert = require("assert");
  8526. var comments = require_comments();
  8527. var isJsonParser = ({
  8528. parser
  8529. }) => parser === "json" || parser === "json5" || parser === "json-stringify";
  8530. function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
  8531. const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
  8532. const endNodeAndAncestors = /* @__PURE__ */ new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
  8533. return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
  8534. }
  8535. function dropRootParents(parents) {
  8536. let lastParentIndex = parents.length - 1;
  8537. for (; ; ) {
  8538. const parent = parents[lastParentIndex];
  8539. if (parent && (parent.type === "Program" || parent.type === "File")) {
  8540. lastParentIndex--;
  8541. } else {
  8542. break;
  8543. }
  8544. }
  8545. return parents.slice(0, lastParentIndex + 1);
  8546. }
  8547. function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
  8548. locStart,
  8549. locEnd
  8550. }) {
  8551. let resultStartNode = startNodeAndParents.node;
  8552. let resultEndNode = endNodeAndParents.node;
  8553. if (resultStartNode === resultEndNode) {
  8554. return {
  8555. startNode: resultStartNode,
  8556. endNode: resultEndNode
  8557. };
  8558. }
  8559. const startNodeStart = locStart(startNodeAndParents.node);
  8560. for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
  8561. if (locStart(endParent) >= startNodeStart) {
  8562. resultEndNode = endParent;
  8563. } else {
  8564. break;
  8565. }
  8566. }
  8567. const endNodeEnd = locEnd(endNodeAndParents.node);
  8568. for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
  8569. if (locEnd(startParent) <= endNodeEnd) {
  8570. resultStartNode = startParent;
  8571. } else {
  8572. break;
  8573. }
  8574. if (resultStartNode === resultEndNode) {
  8575. break;
  8576. }
  8577. }
  8578. return {
  8579. startNode: resultStartNode,
  8580. endNode: resultEndNode
  8581. };
  8582. }
  8583. function findNodeAtOffset(node, offset, options, predicate, parentNodes = [], type) {
  8584. const {
  8585. locStart,
  8586. locEnd
  8587. } = options;
  8588. const start = locStart(node);
  8589. const end = locEnd(node);
  8590. if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) {
  8591. return;
  8592. }
  8593. for (const childNode of comments.getSortedChildNodes(node, options)) {
  8594. const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node, ...parentNodes], type);
  8595. if (childResult) {
  8596. return childResult;
  8597. }
  8598. }
  8599. if (!predicate || predicate(node, parentNodes[0])) {
  8600. return {
  8601. node,
  8602. parentNodes
  8603. };
  8604. }
  8605. }
  8606. function isJsSourceElement(type, parentType) {
  8607. return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration"));
  8608. }
  8609. var jsonSourceElements = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
  8610. var graphqlSourceElements = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
  8611. function isSourceElement(opts, node, parentNode) {
  8612. if (!node) {
  8613. return false;
  8614. }
  8615. switch (opts.parser) {
  8616. case "flow":
  8617. case "babel":
  8618. case "babel-flow":
  8619. case "babel-ts":
  8620. case "typescript":
  8621. case "acorn":
  8622. case "espree":
  8623. case "meriyah":
  8624. case "__babel_estree":
  8625. return isJsSourceElement(node.type, parentNode && parentNode.type);
  8626. case "json":
  8627. case "json5":
  8628. case "json-stringify":
  8629. return jsonSourceElements.has(node.type);
  8630. case "graphql":
  8631. return graphqlSourceElements.has(node.kind);
  8632. case "vue":
  8633. return node.tag !== "root";
  8634. }
  8635. return false;
  8636. }
  8637. function calculateRange(text, opts, ast) {
  8638. let {
  8639. rangeStart: start,
  8640. rangeEnd: end,
  8641. locStart,
  8642. locEnd
  8643. } = opts;
  8644. assert.ok(end > start);
  8645. const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
  8646. const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
  8647. if (!isAllWhitespace) {
  8648. start += firstNonWhitespaceCharacterIndex;
  8649. for (; end > start; --end) {
  8650. if (/\S/.test(text[end - 1])) {
  8651. break;
  8652. }
  8653. }
  8654. }
  8655. const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
  8656. const endNodeAndParents = isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd");
  8657. if (!startNodeAndParents || !endNodeAndParents) {
  8658. return {
  8659. rangeStart: 0,
  8660. rangeEnd: 0
  8661. };
  8662. }
  8663. let startNode;
  8664. let endNode;
  8665. if (isJsonParser(opts)) {
  8666. const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
  8667. startNode = commonAncestor;
  8668. endNode = commonAncestor;
  8669. } else {
  8670. ({
  8671. startNode,
  8672. endNode
  8673. } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
  8674. }
  8675. return {
  8676. rangeStart: Math.min(locStart(startNode), locStart(endNode)),
  8677. rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
  8678. };
  8679. }
  8680. module2.exports = {
  8681. calculateRange,
  8682. findNodeAtOffset
  8683. };
  8684. }
  8685. });
  8686. var require_core = __commonJS2({
  8687. "src/main/core.js"(exports2, module2) {
  8688. "use strict";
  8689. var {
  8690. diffArrays
  8691. } = require_array();
  8692. var {
  8693. printer: {
  8694. printDocToString
  8695. },
  8696. debug: {
  8697. printDocToDebug
  8698. }
  8699. } = require("./doc.js");
  8700. var {
  8701. getAlignmentSize
  8702. } = require_util();
  8703. var {
  8704. guessEndOfLine,
  8705. convertEndOfLineToChars,
  8706. countEndOfLineChars,
  8707. normalizeEndOfLine
  8708. } = require_end_of_line();
  8709. var normalizeOptions = require_options().normalize;
  8710. var massageAST = require_massage_ast();
  8711. var comments = require_comments();
  8712. var parser = require_parser();
  8713. var printAstToDoc = require_ast_to_doc();
  8714. var rangeUtil = require_range_util();
  8715. var BOM = "\uFEFF";
  8716. var CURSOR = Symbol("cursor");
  8717. function attachComments(text, ast, opts) {
  8718. const astComments = ast.comments;
  8719. if (astComments) {
  8720. delete ast.comments;
  8721. comments.attach(astComments, ast, text, opts);
  8722. }
  8723. opts[Symbol.for("comments")] = astComments || [];
  8724. opts[Symbol.for("tokens")] = ast.tokens || [];
  8725. opts.originalText = text;
  8726. return astComments;
  8727. }
  8728. function coreFormat(originalText, opts, addAlignmentSize = 0) {
  8729. if (!originalText || originalText.trim().length === 0) {
  8730. return {
  8731. formatted: "",
  8732. cursorOffset: -1,
  8733. comments: []
  8734. };
  8735. }
  8736. const {
  8737. ast,
  8738. text
  8739. } = parser.parse(originalText, opts);
  8740. if (opts.cursorOffset >= 0) {
  8741. const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
  8742. if (nodeResult && nodeResult.node) {
  8743. opts.cursorNode = nodeResult.node;
  8744. }
  8745. }
  8746. const astComments = attachComments(text, ast, opts);
  8747. const doc2 = printAstToDoc(ast, opts, addAlignmentSize);
  8748. const result = printDocToString(doc2, opts);
  8749. comments.ensureAllCommentsPrinted(astComments);
  8750. if (addAlignmentSize > 0) {
  8751. const trimmed = result.formatted.trim();
  8752. if (result.cursorNodeStart !== void 0) {
  8753. result.cursorNodeStart -= result.formatted.indexOf(trimmed);
  8754. }
  8755. result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
  8756. }
  8757. if (opts.cursorOffset >= 0) {
  8758. let oldCursorNodeStart;
  8759. let oldCursorNodeText;
  8760. let cursorOffsetRelativeToOldCursorNode;
  8761. let newCursorNodeStart;
  8762. let newCursorNodeText;
  8763. if (opts.cursorNode && result.cursorNodeText) {
  8764. oldCursorNodeStart = opts.locStart(opts.cursorNode);
  8765. oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
  8766. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
  8767. newCursorNodeStart = result.cursorNodeStart;
  8768. newCursorNodeText = result.cursorNodeText;
  8769. } else {
  8770. oldCursorNodeStart = 0;
  8771. oldCursorNodeText = text;
  8772. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
  8773. newCursorNodeStart = 0;
  8774. newCursorNodeText = result.formatted;
  8775. }
  8776. if (oldCursorNodeText === newCursorNodeText) {
  8777. return {
  8778. formatted: result.formatted,
  8779. cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
  8780. comments: astComments
  8781. };
  8782. }
  8783. const oldCursorNodeCharArray = [...oldCursorNodeText];
  8784. oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
  8785. const newCursorNodeCharArray = [...newCursorNodeText];
  8786. const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
  8787. let cursorOffset = newCursorNodeStart;
  8788. for (const entry of cursorNodeDiff) {
  8789. if (entry.removed) {
  8790. if (entry.value.includes(CURSOR)) {
  8791. break;
  8792. }
  8793. } else {
  8794. cursorOffset += entry.count;
  8795. }
  8796. }
  8797. return {
  8798. formatted: result.formatted,
  8799. cursorOffset,
  8800. comments: astComments
  8801. };
  8802. }
  8803. return {
  8804. formatted: result.formatted,
  8805. cursorOffset: -1,
  8806. comments: astComments
  8807. };
  8808. }
  8809. function formatRange(originalText, opts) {
  8810. const {
  8811. ast,
  8812. text
  8813. } = parser.parse(originalText, opts);
  8814. const {
  8815. rangeStart,
  8816. rangeEnd
  8817. } = rangeUtil.calculateRange(text, opts, ast);
  8818. const rangeString = text.slice(rangeStart, rangeEnd);
  8819. const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
  8820. const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
  8821. const alignmentSize = getAlignmentSize(indentString, opts.tabWidth);
  8822. const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
  8823. rangeStart: 0,
  8824. rangeEnd: Number.POSITIVE_INFINITY,
  8825. cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
  8826. endOfLine: "lf"
  8827. }), alignmentSize);
  8828. const rangeTrimmed = rangeResult.formatted.trimEnd();
  8829. let {
  8830. cursorOffset
  8831. } = opts;
  8832. if (cursorOffset > rangeEnd) {
  8833. cursorOffset += rangeTrimmed.length - rangeString.length;
  8834. } else if (rangeResult.cursorOffset >= 0) {
  8835. cursorOffset = rangeResult.cursorOffset + rangeStart;
  8836. }
  8837. let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
  8838. if (opts.endOfLine !== "lf") {
  8839. const eol = convertEndOfLineToChars(opts.endOfLine);
  8840. if (cursorOffset >= 0 && eol === "\r\n") {
  8841. cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
  8842. }
  8843. formatted = formatted.replace(/\n/g, eol);
  8844. }
  8845. return {
  8846. formatted,
  8847. cursorOffset,
  8848. comments: rangeResult.comments
  8849. };
  8850. }
  8851. function ensureIndexInText(text, index, defaultValue) {
  8852. if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
  8853. return defaultValue;
  8854. }
  8855. return index;
  8856. }
  8857. function normalizeIndexes(text, options) {
  8858. let {
  8859. cursorOffset,
  8860. rangeStart,
  8861. rangeEnd
  8862. } = options;
  8863. cursorOffset = ensureIndexInText(text, cursorOffset, -1);
  8864. rangeStart = ensureIndexInText(text, rangeStart, 0);
  8865. rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
  8866. return Object.assign(Object.assign({}, options), {}, {
  8867. cursorOffset,
  8868. rangeStart,
  8869. rangeEnd
  8870. });
  8871. }
  8872. function normalizeInputAndOptions(text, options) {
  8873. let {
  8874. cursorOffset,
  8875. rangeStart,
  8876. rangeEnd,
  8877. endOfLine
  8878. } = normalizeIndexes(text, options);
  8879. const hasBOM = text.charAt(0) === BOM;
  8880. if (hasBOM) {
  8881. text = text.slice(1);
  8882. cursorOffset--;
  8883. rangeStart--;
  8884. rangeEnd--;
  8885. }
  8886. if (endOfLine === "auto") {
  8887. endOfLine = guessEndOfLine(text);
  8888. }
  8889. if (text.includes("\r")) {
  8890. const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
  8891. cursorOffset -= countCrlfBefore(cursorOffset);
  8892. rangeStart -= countCrlfBefore(rangeStart);
  8893. rangeEnd -= countCrlfBefore(rangeEnd);
  8894. text = normalizeEndOfLine(text);
  8895. }
  8896. return {
  8897. hasBOM,
  8898. text,
  8899. options: normalizeIndexes(text, Object.assign(Object.assign({}, options), {}, {
  8900. cursorOffset,
  8901. rangeStart,
  8902. rangeEnd,
  8903. endOfLine
  8904. }))
  8905. };
  8906. }
  8907. function hasPragma(text, options) {
  8908. const selectedParser = parser.resolveParser(options);
  8909. return !selectedParser.hasPragma || selectedParser.hasPragma(text);
  8910. }
  8911. function formatWithCursor2(originalText, originalOptions) {
  8912. let {
  8913. hasBOM,
  8914. text,
  8915. options
  8916. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8917. if (options.rangeStart >= options.rangeEnd && text !== "" || options.requirePragma && !hasPragma(text, options)) {
  8918. return {
  8919. formatted: originalText,
  8920. cursorOffset: originalOptions.cursorOffset,
  8921. comments: []
  8922. };
  8923. }
  8924. let result;
  8925. if (options.rangeStart > 0 || options.rangeEnd < text.length) {
  8926. result = formatRange(text, options);
  8927. } else {
  8928. if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(text, options)) {
  8929. text = options.printer.insertPragma(text);
  8930. }
  8931. result = coreFormat(text, options);
  8932. }
  8933. if (hasBOM) {
  8934. result.formatted = BOM + result.formatted;
  8935. if (result.cursorOffset >= 0) {
  8936. result.cursorOffset++;
  8937. }
  8938. }
  8939. return result;
  8940. }
  8941. module2.exports = {
  8942. formatWithCursor: formatWithCursor2,
  8943. parse(originalText, originalOptions, massage) {
  8944. const {
  8945. text,
  8946. options
  8947. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8948. const parsed = parser.parse(text, options);
  8949. if (massage) {
  8950. parsed.ast = massageAST(parsed.ast, options);
  8951. }
  8952. return parsed;
  8953. },
  8954. formatAST(ast, options) {
  8955. options = normalizeOptions(options);
  8956. const doc2 = printAstToDoc(ast, options);
  8957. return printDocToString(doc2, options);
  8958. },
  8959. formatDoc(doc2, options) {
  8960. return formatWithCursor2(printDocToDebug(doc2), Object.assign(Object.assign({}, options), {}, {
  8961. parser: "__js_expression"
  8962. })).formatted;
  8963. },
  8964. printToDoc(originalText, options) {
  8965. options = normalizeOptions(options);
  8966. const {
  8967. ast,
  8968. text
  8969. } = parser.parse(originalText, options);
  8970. attachComments(text, ast, options);
  8971. return printAstToDoc(ast, options);
  8972. },
  8973. printDocToString(doc2, options) {
  8974. return printDocToString(doc2, normalizeOptions(options));
  8975. }
  8976. };
  8977. }
  8978. });
  8979. var require_utils2 = __commonJS2({
  8980. "node_modules/braces/lib/utils.js"(exports2) {
  8981. "use strict";
  8982. exports2.isInteger = (num) => {
  8983. if (typeof num === "number") {
  8984. return Number.isInteger(num);
  8985. }
  8986. if (typeof num === "string" && num.trim() !== "") {
  8987. return Number.isInteger(Number(num));
  8988. }
  8989. return false;
  8990. };
  8991. exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
  8992. exports2.exceedsLimit = (min, max, step = 1, limit) => {
  8993. if (limit === false)
  8994. return false;
  8995. if (!exports2.isInteger(min) || !exports2.isInteger(max))
  8996. return false;
  8997. return (Number(max) - Number(min)) / Number(step) >= limit;
  8998. };
  8999. exports2.escapeNode = (block, n = 0, type) => {
  9000. let node = block.nodes[n];
  9001. if (!node)
  9002. return;
  9003. if (type && node.type === type || node.type === "open" || node.type === "close") {
  9004. if (node.escaped !== true) {
  9005. node.value = "\\" + node.value;
  9006. node.escaped = true;
  9007. }
  9008. }
  9009. };
  9010. exports2.encloseBrace = (node) => {
  9011. if (node.type !== "brace")
  9012. return false;
  9013. if (node.commas >> 0 + node.ranges >> 0 === 0) {
  9014. node.invalid = true;
  9015. return true;
  9016. }
  9017. return false;
  9018. };
  9019. exports2.isInvalidBrace = (block) => {
  9020. if (block.type !== "brace")
  9021. return false;
  9022. if (block.invalid === true || block.dollar)
  9023. return true;
  9024. if (block.commas >> 0 + block.ranges >> 0 === 0) {
  9025. block.invalid = true;
  9026. return true;
  9027. }
  9028. if (block.open !== true || block.close !== true) {
  9029. block.invalid = true;
  9030. return true;
  9031. }
  9032. return false;
  9033. };
  9034. exports2.isOpenOrClose = (node) => {
  9035. if (node.type === "open" || node.type === "close") {
  9036. return true;
  9037. }
  9038. return node.open === true || node.close === true;
  9039. };
  9040. exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
  9041. if (node.type === "text")
  9042. acc.push(node.value);
  9043. if (node.type === "range")
  9044. node.type = "text";
  9045. return acc;
  9046. }, []);
  9047. exports2.flatten = (...args) => {
  9048. const result = [];
  9049. const flat = (arr) => {
  9050. for (let i = 0; i < arr.length; i++) {
  9051. let ele = arr[i];
  9052. Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
  9053. }
  9054. return result;
  9055. };
  9056. flat(args);
  9057. return result;
  9058. };
  9059. }
  9060. });
  9061. var require_stringify = __commonJS2({
  9062. "node_modules/braces/lib/stringify.js"(exports2, module2) {
  9063. "use strict";
  9064. var utils = require_utils2();
  9065. module2.exports = (ast, options = {}) => {
  9066. let stringify = (node, parent = {}) => {
  9067. let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
  9068. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  9069. let output = "";
  9070. if (node.value) {
  9071. if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
  9072. return "\\" + node.value;
  9073. }
  9074. return node.value;
  9075. }
  9076. if (node.value) {
  9077. return node.value;
  9078. }
  9079. if (node.nodes) {
  9080. for (let child of node.nodes) {
  9081. output += stringify(child);
  9082. }
  9083. }
  9084. return output;
  9085. };
  9086. return stringify(ast);
  9087. };
  9088. }
  9089. });
  9090. var require_is_number = __commonJS2({
  9091. "node_modules/is-number/index.js"(exports2, module2) {
  9092. "use strict";
  9093. module2.exports = function(num) {
  9094. if (typeof num === "number") {
  9095. return num - num === 0;
  9096. }
  9097. if (typeof num === "string" && num.trim() !== "") {
  9098. return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  9099. }
  9100. return false;
  9101. };
  9102. }
  9103. });
  9104. var require_to_regex_range = __commonJS2({
  9105. "node_modules/to-regex-range/index.js"(exports2, module2) {
  9106. "use strict";
  9107. var isNumber = require_is_number();
  9108. var toRegexRange = (min, max, options) => {
  9109. if (isNumber(min) === false) {
  9110. throw new TypeError("toRegexRange: expected the first argument to be a number");
  9111. }
  9112. if (max === void 0 || min === max) {
  9113. return String(min);
  9114. }
  9115. if (isNumber(max) === false) {
  9116. throw new TypeError("toRegexRange: expected the second argument to be a number.");
  9117. }
  9118. let opts = Object.assign({
  9119. relaxZeros: true
  9120. }, options);
  9121. if (typeof opts.strictZeros === "boolean") {
  9122. opts.relaxZeros = opts.strictZeros === false;
  9123. }
  9124. let relax = String(opts.relaxZeros);
  9125. let shorthand = String(opts.shorthand);
  9126. let capture = String(opts.capture);
  9127. let wrap = String(opts.wrap);
  9128. let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
  9129. if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
  9130. return toRegexRange.cache[cacheKey].result;
  9131. }
  9132. let a = Math.min(min, max);
  9133. let b = Math.max(min, max);
  9134. if (Math.abs(a - b) === 1) {
  9135. let result = min + "|" + max;
  9136. if (opts.capture) {
  9137. return `(${result})`;
  9138. }
  9139. if (opts.wrap === false) {
  9140. return result;
  9141. }
  9142. return `(?:${result})`;
  9143. }
  9144. let isPadded = hasPadding(min) || hasPadding(max);
  9145. let state = {
  9146. min,
  9147. max,
  9148. a,
  9149. b
  9150. };
  9151. let positives = [];
  9152. let negatives = [];
  9153. if (isPadded) {
  9154. state.isPadded = isPadded;
  9155. state.maxLen = String(state.max).length;
  9156. }
  9157. if (a < 0) {
  9158. let newMin = b < 0 ? Math.abs(b) : 1;
  9159. negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
  9160. a = state.a = 0;
  9161. }
  9162. if (b >= 0) {
  9163. positives = splitToPatterns(a, b, state, opts);
  9164. }
  9165. state.negatives = negatives;
  9166. state.positives = positives;
  9167. state.result = collatePatterns(negatives, positives, opts);
  9168. if (opts.capture === true) {
  9169. state.result = `(${state.result})`;
  9170. } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
  9171. state.result = `(?:${state.result})`;
  9172. }
  9173. toRegexRange.cache[cacheKey] = state;
  9174. return state.result;
  9175. };
  9176. function collatePatterns(neg, pos, options) {
  9177. let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
  9178. let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
  9179. let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
  9180. let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
  9181. return subpatterns.join("|");
  9182. }
  9183. function splitToRanges(min, max) {
  9184. let nines = 1;
  9185. let zeros = 1;
  9186. let stop = countNines(min, nines);
  9187. let stops = /* @__PURE__ */ new Set([max]);
  9188. while (min <= stop && stop <= max) {
  9189. stops.add(stop);
  9190. nines += 1;
  9191. stop = countNines(min, nines);
  9192. }
  9193. stop = countZeros(max + 1, zeros) - 1;
  9194. while (min < stop && stop <= max) {
  9195. stops.add(stop);
  9196. zeros += 1;
  9197. stop = countZeros(max + 1, zeros) - 1;
  9198. }
  9199. stops = [...stops];
  9200. stops.sort(compare);
  9201. return stops;
  9202. }
  9203. function rangeToPattern(start, stop, options) {
  9204. if (start === stop) {
  9205. return {
  9206. pattern: start,
  9207. count: [],
  9208. digits: 0
  9209. };
  9210. }
  9211. let zipped = zip(start, stop);
  9212. let digits = zipped.length;
  9213. let pattern = "";
  9214. let count = 0;
  9215. for (let i = 0; i < digits; i++) {
  9216. let [startDigit, stopDigit] = zipped[i];
  9217. if (startDigit === stopDigit) {
  9218. pattern += startDigit;
  9219. } else if (startDigit !== "0" || stopDigit !== "9") {
  9220. pattern += toCharacterClass(startDigit, stopDigit, options);
  9221. } else {
  9222. count++;
  9223. }
  9224. }
  9225. if (count) {
  9226. pattern += options.shorthand === true ? "\\d" : "[0-9]";
  9227. }
  9228. return {
  9229. pattern,
  9230. count: [count],
  9231. digits
  9232. };
  9233. }
  9234. function splitToPatterns(min, max, tok, options) {
  9235. let ranges = splitToRanges(min, max);
  9236. let tokens = [];
  9237. let start = min;
  9238. let prev;
  9239. for (let i = 0; i < ranges.length; i++) {
  9240. let max2 = ranges[i];
  9241. let obj = rangeToPattern(String(start), String(max2), options);
  9242. let zeros = "";
  9243. if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
  9244. if (prev.count.length > 1) {
  9245. prev.count.pop();
  9246. }
  9247. prev.count.push(obj.count[0]);
  9248. prev.string = prev.pattern + toQuantifier(prev.count);
  9249. start = max2 + 1;
  9250. continue;
  9251. }
  9252. if (tok.isPadded) {
  9253. zeros = padZeros(max2, tok, options);
  9254. }
  9255. obj.string = zeros + obj.pattern + toQuantifier(obj.count);
  9256. tokens.push(obj);
  9257. start = max2 + 1;
  9258. prev = obj;
  9259. }
  9260. return tokens;
  9261. }
  9262. function filterPatterns(arr, comparison, prefix, intersection, options) {
  9263. let result = [];
  9264. for (let ele of arr) {
  9265. let {
  9266. string
  9267. } = ele;
  9268. if (!intersection && !contains(comparison, "string", string)) {
  9269. result.push(prefix + string);
  9270. }
  9271. if (intersection && contains(comparison, "string", string)) {
  9272. result.push(prefix + string);
  9273. }
  9274. }
  9275. return result;
  9276. }
  9277. function zip(a, b) {
  9278. let arr = [];
  9279. for (let i = 0; i < a.length; i++)
  9280. arr.push([a[i], b[i]]);
  9281. return arr;
  9282. }
  9283. function compare(a, b) {
  9284. return a > b ? 1 : b > a ? -1 : 0;
  9285. }
  9286. function contains(arr, key, val) {
  9287. return arr.some((ele) => ele[key] === val);
  9288. }
  9289. function countNines(min, len) {
  9290. return Number(String(min).slice(0, -len) + "9".repeat(len));
  9291. }
  9292. function countZeros(integer, zeros) {
  9293. return integer - integer % Math.pow(10, zeros);
  9294. }
  9295. function toQuantifier(digits) {
  9296. let [start = 0, stop = ""] = digits;
  9297. if (stop || start > 1) {
  9298. return `{${start + (stop ? "," + stop : "")}}`;
  9299. }
  9300. return "";
  9301. }
  9302. function toCharacterClass(a, b, options) {
  9303. return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
  9304. }
  9305. function hasPadding(str) {
  9306. return /^-?(0+)\d/.test(str);
  9307. }
  9308. function padZeros(value, tok, options) {
  9309. if (!tok.isPadded) {
  9310. return value;
  9311. }
  9312. let diff = Math.abs(tok.maxLen - String(value).length);
  9313. let relax = options.relaxZeros !== false;
  9314. switch (diff) {
  9315. case 0:
  9316. return "";
  9317. case 1:
  9318. return relax ? "0?" : "0";
  9319. case 2:
  9320. return relax ? "0{0,2}" : "00";
  9321. default: {
  9322. return relax ? `0{0,${diff}}` : `0{${diff}}`;
  9323. }
  9324. }
  9325. }
  9326. toRegexRange.cache = {};
  9327. toRegexRange.clearCache = () => toRegexRange.cache = {};
  9328. module2.exports = toRegexRange;
  9329. }
  9330. });
  9331. var require_fill_range = __commonJS2({
  9332. "node_modules/fill-range/index.js"(exports2, module2) {
  9333. "use strict";
  9334. var util = require("util");
  9335. var toRegexRange = require_to_regex_range();
  9336. var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  9337. var transform = (toNumber) => {
  9338. return (value) => toNumber === true ? Number(value) : String(value);
  9339. };
  9340. var isValidValue = (value) => {
  9341. return typeof value === "number" || typeof value === "string" && value !== "";
  9342. };
  9343. var isNumber = (num) => Number.isInteger(+num);
  9344. var zeros = (input) => {
  9345. let value = `${input}`;
  9346. let index = -1;
  9347. if (value[0] === "-")
  9348. value = value.slice(1);
  9349. if (value === "0")
  9350. return false;
  9351. while (value[++index] === "0")
  9352. ;
  9353. return index > 0;
  9354. };
  9355. var stringify = (start, end, options) => {
  9356. if (typeof start === "string" || typeof end === "string") {
  9357. return true;
  9358. }
  9359. return options.stringify === true;
  9360. };
  9361. var pad = (input, maxLength, toNumber) => {
  9362. if (maxLength > 0) {
  9363. let dash = input[0] === "-" ? "-" : "";
  9364. if (dash)
  9365. input = input.slice(1);
  9366. input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
  9367. }
  9368. if (toNumber === false) {
  9369. return String(input);
  9370. }
  9371. return input;
  9372. };
  9373. var toMaxLen = (input, maxLength) => {
  9374. let negative = input[0] === "-" ? "-" : "";
  9375. if (negative) {
  9376. input = input.slice(1);
  9377. maxLength--;
  9378. }
  9379. while (input.length < maxLength)
  9380. input = "0" + input;
  9381. return negative ? "-" + input : input;
  9382. };
  9383. var toSequence = (parts, options) => {
  9384. parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9385. parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9386. let prefix = options.capture ? "" : "?:";
  9387. let positives = "";
  9388. let negatives = "";
  9389. let result;
  9390. if (parts.positives.length) {
  9391. positives = parts.positives.join("|");
  9392. }
  9393. if (parts.negatives.length) {
  9394. negatives = `-(${prefix}${parts.negatives.join("|")})`;
  9395. }
  9396. if (positives && negatives) {
  9397. result = `${positives}|${negatives}`;
  9398. } else {
  9399. result = positives || negatives;
  9400. }
  9401. if (options.wrap) {
  9402. return `(${prefix}${result})`;
  9403. }
  9404. return result;
  9405. };
  9406. var toRange = (a, b, isNumbers, options) => {
  9407. if (isNumbers) {
  9408. return toRegexRange(a, b, Object.assign({
  9409. wrap: false
  9410. }, options));
  9411. }
  9412. let start = String.fromCharCode(a);
  9413. if (a === b)
  9414. return start;
  9415. let stop = String.fromCharCode(b);
  9416. return `[${start}-${stop}]`;
  9417. };
  9418. var toRegex = (start, end, options) => {
  9419. if (Array.isArray(start)) {
  9420. let wrap = options.wrap === true;
  9421. let prefix = options.capture ? "" : "?:";
  9422. return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
  9423. }
  9424. return toRegexRange(start, end, options);
  9425. };
  9426. var rangeError = (...args) => {
  9427. return new RangeError("Invalid range arguments: " + util.inspect(...args));
  9428. };
  9429. var invalidRange = (start, end, options) => {
  9430. if (options.strictRanges === true)
  9431. throw rangeError([start, end]);
  9432. return [];
  9433. };
  9434. var invalidStep = (step, options) => {
  9435. if (options.strictRanges === true) {
  9436. throw new TypeError(`Expected step "${step}" to be a number`);
  9437. }
  9438. return [];
  9439. };
  9440. var fillNumbers = (start, end, step = 1, options = {}) => {
  9441. let a = Number(start);
  9442. let b = Number(end);
  9443. if (!Number.isInteger(a) || !Number.isInteger(b)) {
  9444. if (options.strictRanges === true)
  9445. throw rangeError([start, end]);
  9446. return [];
  9447. }
  9448. if (a === 0)
  9449. a = 0;
  9450. if (b === 0)
  9451. b = 0;
  9452. let descending = a > b;
  9453. let startString = String(start);
  9454. let endString = String(end);
  9455. let stepString = String(step);
  9456. step = Math.max(Math.abs(step), 1);
  9457. let padded = zeros(startString) || zeros(endString) || zeros(stepString);
  9458. let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
  9459. let toNumber = padded === false && stringify(start, end, options) === false;
  9460. let format = options.transform || transform(toNumber);
  9461. if (options.toRegex && step === 1) {
  9462. return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
  9463. }
  9464. let parts = {
  9465. negatives: [],
  9466. positives: []
  9467. };
  9468. let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
  9469. let range = [];
  9470. let index = 0;
  9471. while (descending ? a >= b : a <= b) {
  9472. if (options.toRegex === true && step > 1) {
  9473. push(a);
  9474. } else {
  9475. range.push(pad(format(a, index), maxLen, toNumber));
  9476. }
  9477. a = descending ? a - step : a + step;
  9478. index++;
  9479. }
  9480. if (options.toRegex === true) {
  9481. return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
  9482. wrap: false
  9483. }, options));
  9484. }
  9485. return range;
  9486. };
  9487. var fillLetters = (start, end, step = 1, options = {}) => {
  9488. if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
  9489. return invalidRange(start, end, options);
  9490. }
  9491. let format = options.transform || ((val) => String.fromCharCode(val));
  9492. let a = `${start}`.charCodeAt(0);
  9493. let b = `${end}`.charCodeAt(0);
  9494. let descending = a > b;
  9495. let min = Math.min(a, b);
  9496. let max = Math.max(a, b);
  9497. if (options.toRegex && step === 1) {
  9498. return toRange(min, max, false, options);
  9499. }
  9500. let range = [];
  9501. let index = 0;
  9502. while (descending ? a >= b : a <= b) {
  9503. range.push(format(a, index));
  9504. a = descending ? a - step : a + step;
  9505. index++;
  9506. }
  9507. if (options.toRegex === true) {
  9508. return toRegex(range, null, {
  9509. wrap: false,
  9510. options
  9511. });
  9512. }
  9513. return range;
  9514. };
  9515. var fill = (start, end, step, options = {}) => {
  9516. if (end == null && isValidValue(start)) {
  9517. return [start];
  9518. }
  9519. if (!isValidValue(start) || !isValidValue(end)) {
  9520. return invalidRange(start, end, options);
  9521. }
  9522. if (typeof step === "function") {
  9523. return fill(start, end, 1, {
  9524. transform: step
  9525. });
  9526. }
  9527. if (isObject(step)) {
  9528. return fill(start, end, 0, step);
  9529. }
  9530. let opts = Object.assign({}, options);
  9531. if (opts.capture === true)
  9532. opts.wrap = true;
  9533. step = step || opts.step || 1;
  9534. if (!isNumber(step)) {
  9535. if (step != null && !isObject(step))
  9536. return invalidStep(step, opts);
  9537. return fill(start, end, 1, step);
  9538. }
  9539. if (isNumber(start) && isNumber(end)) {
  9540. return fillNumbers(start, end, step, opts);
  9541. }
  9542. return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
  9543. };
  9544. module2.exports = fill;
  9545. }
  9546. });
  9547. var require_compile = __commonJS2({
  9548. "node_modules/braces/lib/compile.js"(exports2, module2) {
  9549. "use strict";
  9550. var fill = require_fill_range();
  9551. var utils = require_utils2();
  9552. var compile = (ast, options = {}) => {
  9553. let walk = (node, parent = {}) => {
  9554. let invalidBlock = utils.isInvalidBrace(parent);
  9555. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  9556. let invalid = invalidBlock === true || invalidNode === true;
  9557. let prefix = options.escapeInvalid === true ? "\\" : "";
  9558. let output = "";
  9559. if (node.isOpen === true) {
  9560. return prefix + node.value;
  9561. }
  9562. if (node.isClose === true) {
  9563. return prefix + node.value;
  9564. }
  9565. if (node.type === "open") {
  9566. return invalid ? prefix + node.value : "(";
  9567. }
  9568. if (node.type === "close") {
  9569. return invalid ? prefix + node.value : ")";
  9570. }
  9571. if (node.type === "comma") {
  9572. return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
  9573. }
  9574. if (node.value) {
  9575. return node.value;
  9576. }
  9577. if (node.nodes && node.ranges > 0) {
  9578. let args = utils.reduce(node.nodes);
  9579. let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
  9580. wrap: false,
  9581. toRegex: true
  9582. }));
  9583. if (range.length !== 0) {
  9584. return args.length > 1 && range.length > 1 ? `(${range})` : range;
  9585. }
  9586. }
  9587. if (node.nodes) {
  9588. for (let child of node.nodes) {
  9589. output += walk(child, node);
  9590. }
  9591. }
  9592. return output;
  9593. };
  9594. return walk(ast);
  9595. };
  9596. module2.exports = compile;
  9597. }
  9598. });
  9599. var require_expand = __commonJS2({
  9600. "node_modules/braces/lib/expand.js"(exports2, module2) {
  9601. "use strict";
  9602. var fill = require_fill_range();
  9603. var stringify = require_stringify();
  9604. var utils = require_utils2();
  9605. var append = (queue = "", stash = "", enclose = false) => {
  9606. let result = [];
  9607. queue = [].concat(queue);
  9608. stash = [].concat(stash);
  9609. if (!stash.length)
  9610. return queue;
  9611. if (!queue.length) {
  9612. return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
  9613. }
  9614. for (let item of queue) {
  9615. if (Array.isArray(item)) {
  9616. for (let value of item) {
  9617. result.push(append(value, stash, enclose));
  9618. }
  9619. } else {
  9620. for (let ele of stash) {
  9621. if (enclose === true && typeof ele === "string")
  9622. ele = `{${ele}}`;
  9623. result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
  9624. }
  9625. }
  9626. }
  9627. return utils.flatten(result);
  9628. };
  9629. var expand = (ast, options = {}) => {
  9630. let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
  9631. let walk = (node, parent = {}) => {
  9632. node.queue = [];
  9633. let p = parent;
  9634. let q = parent.queue;
  9635. while (p.type !== "brace" && p.type !== "root" && p.parent) {
  9636. p = p.parent;
  9637. q = p.queue;
  9638. }
  9639. if (node.invalid || node.dollar) {
  9640. q.push(append(q.pop(), stringify(node, options)));
  9641. return;
  9642. }
  9643. if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
  9644. q.push(append(q.pop(), ["{}"]));
  9645. return;
  9646. }
  9647. if (node.nodes && node.ranges > 0) {
  9648. let args = utils.reduce(node.nodes);
  9649. if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
  9650. throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
  9651. }
  9652. let range = fill(...args, options);
  9653. if (range.length === 0) {
  9654. range = stringify(node, options);
  9655. }
  9656. q.push(append(q.pop(), range));
  9657. node.nodes = [];
  9658. return;
  9659. }
  9660. let enclose = utils.encloseBrace(node);
  9661. let queue = node.queue;
  9662. let block = node;
  9663. while (block.type !== "brace" && block.type !== "root" && block.parent) {
  9664. block = block.parent;
  9665. queue = block.queue;
  9666. }
  9667. for (let i = 0; i < node.nodes.length; i++) {
  9668. let child = node.nodes[i];
  9669. if (child.type === "comma" && node.type === "brace") {
  9670. if (i === 1)
  9671. queue.push("");
  9672. queue.push("");
  9673. continue;
  9674. }
  9675. if (child.type === "close") {
  9676. q.push(append(q.pop(), queue, enclose));
  9677. continue;
  9678. }
  9679. if (child.value && child.type !== "open") {
  9680. queue.push(append(queue.pop(), child.value));
  9681. continue;
  9682. }
  9683. if (child.nodes) {
  9684. walk(child, node);
  9685. }
  9686. }
  9687. return queue;
  9688. };
  9689. return utils.flatten(walk(ast));
  9690. };
  9691. module2.exports = expand;
  9692. }
  9693. });
  9694. var require_constants2 = __commonJS2({
  9695. "node_modules/braces/lib/constants.js"(exports2, module2) {
  9696. "use strict";
  9697. module2.exports = {
  9698. MAX_LENGTH: 1024 * 64,
  9699. CHAR_0: "0",
  9700. CHAR_9: "9",
  9701. CHAR_UPPERCASE_A: "A",
  9702. CHAR_LOWERCASE_A: "a",
  9703. CHAR_UPPERCASE_Z: "Z",
  9704. CHAR_LOWERCASE_Z: "z",
  9705. CHAR_LEFT_PARENTHESES: "(",
  9706. CHAR_RIGHT_PARENTHESES: ")",
  9707. CHAR_ASTERISK: "*",
  9708. CHAR_AMPERSAND: "&",
  9709. CHAR_AT: "@",
  9710. CHAR_BACKSLASH: "\\",
  9711. CHAR_BACKTICK: "`",
  9712. CHAR_CARRIAGE_RETURN: "\r",
  9713. CHAR_CIRCUMFLEX_ACCENT: "^",
  9714. CHAR_COLON: ":",
  9715. CHAR_COMMA: ",",
  9716. CHAR_DOLLAR: "$",
  9717. CHAR_DOT: ".",
  9718. CHAR_DOUBLE_QUOTE: '"',
  9719. CHAR_EQUAL: "=",
  9720. CHAR_EXCLAMATION_MARK: "!",
  9721. CHAR_FORM_FEED: "\f",
  9722. CHAR_FORWARD_SLASH: "/",
  9723. CHAR_HASH: "#",
  9724. CHAR_HYPHEN_MINUS: "-",
  9725. CHAR_LEFT_ANGLE_BRACKET: "<",
  9726. CHAR_LEFT_CURLY_BRACE: "{",
  9727. CHAR_LEFT_SQUARE_BRACKET: "[",
  9728. CHAR_LINE_FEED: "\n",
  9729. CHAR_NO_BREAK_SPACE: "\xA0",
  9730. CHAR_PERCENT: "%",
  9731. CHAR_PLUS: "+",
  9732. CHAR_QUESTION_MARK: "?",
  9733. CHAR_RIGHT_ANGLE_BRACKET: ">",
  9734. CHAR_RIGHT_CURLY_BRACE: "}",
  9735. CHAR_RIGHT_SQUARE_BRACKET: "]",
  9736. CHAR_SEMICOLON: ";",
  9737. CHAR_SINGLE_QUOTE: "'",
  9738. CHAR_SPACE: " ",
  9739. CHAR_TAB: " ",
  9740. CHAR_UNDERSCORE: "_",
  9741. CHAR_VERTICAL_LINE: "|",
  9742. CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
  9743. };
  9744. }
  9745. });
  9746. var require_parse = __commonJS2({
  9747. "node_modules/braces/lib/parse.js"(exports2, module2) {
  9748. "use strict";
  9749. var stringify = require_stringify();
  9750. var {
  9751. MAX_LENGTH,
  9752. CHAR_BACKSLASH,
  9753. CHAR_BACKTICK,
  9754. CHAR_COMMA,
  9755. CHAR_DOT,
  9756. CHAR_LEFT_PARENTHESES,
  9757. CHAR_RIGHT_PARENTHESES,
  9758. CHAR_LEFT_CURLY_BRACE,
  9759. CHAR_RIGHT_CURLY_BRACE,
  9760. CHAR_LEFT_SQUARE_BRACKET,
  9761. CHAR_RIGHT_SQUARE_BRACKET,
  9762. CHAR_DOUBLE_QUOTE,
  9763. CHAR_SINGLE_QUOTE,
  9764. CHAR_NO_BREAK_SPACE,
  9765. CHAR_ZERO_WIDTH_NOBREAK_SPACE
  9766. } = require_constants2();
  9767. var parse = (input, options = {}) => {
  9768. if (typeof input !== "string") {
  9769. throw new TypeError("Expected a string");
  9770. }
  9771. let opts = options || {};
  9772. let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  9773. if (input.length > max) {
  9774. throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
  9775. }
  9776. let ast = {
  9777. type: "root",
  9778. input,
  9779. nodes: []
  9780. };
  9781. let stack = [ast];
  9782. let block = ast;
  9783. let prev = ast;
  9784. let brackets = 0;
  9785. let length = input.length;
  9786. let index = 0;
  9787. let depth = 0;
  9788. let value;
  9789. let memo = {};
  9790. const advance = () => input[index++];
  9791. const push = (node) => {
  9792. if (node.type === "text" && prev.type === "dot") {
  9793. prev.type = "text";
  9794. }
  9795. if (prev && prev.type === "text" && node.type === "text") {
  9796. prev.value += node.value;
  9797. return;
  9798. }
  9799. block.nodes.push(node);
  9800. node.parent = block;
  9801. node.prev = prev;
  9802. prev = node;
  9803. return node;
  9804. };
  9805. push({
  9806. type: "bos"
  9807. });
  9808. while (index < length) {
  9809. block = stack[stack.length - 1];
  9810. value = advance();
  9811. if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
  9812. continue;
  9813. }
  9814. if (value === CHAR_BACKSLASH) {
  9815. push({
  9816. type: "text",
  9817. value: (options.keepEscaping ? value : "") + advance()
  9818. });
  9819. continue;
  9820. }
  9821. if (value === CHAR_RIGHT_SQUARE_BRACKET) {
  9822. push({
  9823. type: "text",
  9824. value: "\\" + value
  9825. });
  9826. continue;
  9827. }
  9828. if (value === CHAR_LEFT_SQUARE_BRACKET) {
  9829. brackets++;
  9830. let closed = true;
  9831. let next;
  9832. while (index < length && (next = advance())) {
  9833. value += next;
  9834. if (next === CHAR_LEFT_SQUARE_BRACKET) {
  9835. brackets++;
  9836. continue;
  9837. }
  9838. if (next === CHAR_BACKSLASH) {
  9839. value += advance();
  9840. continue;
  9841. }
  9842. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  9843. brackets--;
  9844. if (brackets === 0) {
  9845. break;
  9846. }
  9847. }
  9848. }
  9849. push({
  9850. type: "text",
  9851. value
  9852. });
  9853. continue;
  9854. }
  9855. if (value === CHAR_LEFT_PARENTHESES) {
  9856. block = push({
  9857. type: "paren",
  9858. nodes: []
  9859. });
  9860. stack.push(block);
  9861. push({
  9862. type: "text",
  9863. value
  9864. });
  9865. continue;
  9866. }
  9867. if (value === CHAR_RIGHT_PARENTHESES) {
  9868. if (block.type !== "paren") {
  9869. push({
  9870. type: "text",
  9871. value
  9872. });
  9873. continue;
  9874. }
  9875. block = stack.pop();
  9876. push({
  9877. type: "text",
  9878. value
  9879. });
  9880. block = stack[stack.length - 1];
  9881. continue;
  9882. }
  9883. if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
  9884. let open = value;
  9885. let next;
  9886. if (options.keepQuotes !== true) {
  9887. value = "";
  9888. }
  9889. while (index < length && (next = advance())) {
  9890. if (next === CHAR_BACKSLASH) {
  9891. value += next + advance();
  9892. continue;
  9893. }
  9894. if (next === open) {
  9895. if (options.keepQuotes === true)
  9896. value += next;
  9897. break;
  9898. }
  9899. value += next;
  9900. }
  9901. push({
  9902. type: "text",
  9903. value
  9904. });
  9905. continue;
  9906. }
  9907. if (value === CHAR_LEFT_CURLY_BRACE) {
  9908. depth++;
  9909. let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
  9910. let brace = {
  9911. type: "brace",
  9912. open: true,
  9913. close: false,
  9914. dollar,
  9915. depth,
  9916. commas: 0,
  9917. ranges: 0,
  9918. nodes: []
  9919. };
  9920. block = push(brace);
  9921. stack.push(block);
  9922. push({
  9923. type: "open",
  9924. value
  9925. });
  9926. continue;
  9927. }
  9928. if (value === CHAR_RIGHT_CURLY_BRACE) {
  9929. if (block.type !== "brace") {
  9930. push({
  9931. type: "text",
  9932. value
  9933. });
  9934. continue;
  9935. }
  9936. let type = "close";
  9937. block = stack.pop();
  9938. block.close = true;
  9939. push({
  9940. type,
  9941. value
  9942. });
  9943. depth--;
  9944. block = stack[stack.length - 1];
  9945. continue;
  9946. }
  9947. if (value === CHAR_COMMA && depth > 0) {
  9948. if (block.ranges > 0) {
  9949. block.ranges = 0;
  9950. let open = block.nodes.shift();
  9951. block.nodes = [open, {
  9952. type: "text",
  9953. value: stringify(block)
  9954. }];
  9955. }
  9956. push({
  9957. type: "comma",
  9958. value
  9959. });
  9960. block.commas++;
  9961. continue;
  9962. }
  9963. if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
  9964. let siblings = block.nodes;
  9965. if (depth === 0 || siblings.length === 0) {
  9966. push({
  9967. type: "text",
  9968. value
  9969. });
  9970. continue;
  9971. }
  9972. if (prev.type === "dot") {
  9973. block.range = [];
  9974. prev.value += value;
  9975. prev.type = "range";
  9976. if (block.nodes.length !== 3 && block.nodes.length !== 5) {
  9977. block.invalid = true;
  9978. block.ranges = 0;
  9979. prev.type = "text";
  9980. continue;
  9981. }
  9982. block.ranges++;
  9983. block.args = [];
  9984. continue;
  9985. }
  9986. if (prev.type === "range") {
  9987. siblings.pop();
  9988. let before = siblings[siblings.length - 1];
  9989. before.value += prev.value + value;
  9990. prev = before;
  9991. block.ranges--;
  9992. continue;
  9993. }
  9994. push({
  9995. type: "dot",
  9996. value
  9997. });
  9998. continue;
  9999. }
  10000. push({
  10001. type: "text",
  10002. value
  10003. });
  10004. }
  10005. do {
  10006. block = stack.pop();
  10007. if (block.type !== "root") {
  10008. block.nodes.forEach((node) => {
  10009. if (!node.nodes) {
  10010. if (node.type === "open")
  10011. node.isOpen = true;
  10012. if (node.type === "close")
  10013. node.isClose = true;
  10014. if (!node.nodes)
  10015. node.type = "text";
  10016. node.invalid = true;
  10017. }
  10018. });
  10019. let parent = stack[stack.length - 1];
  10020. let index2 = parent.nodes.indexOf(block);
  10021. parent.nodes.splice(index2, 1, ...block.nodes);
  10022. }
  10023. } while (stack.length > 0);
  10024. push({
  10025. type: "eos"
  10026. });
  10027. return ast;
  10028. };
  10029. module2.exports = parse;
  10030. }
  10031. });
  10032. var require_braces = __commonJS2({
  10033. "node_modules/braces/index.js"(exports2, module2) {
  10034. "use strict";
  10035. var stringify = require_stringify();
  10036. var compile = require_compile();
  10037. var expand = require_expand();
  10038. var parse = require_parse();
  10039. var braces = (input, options = {}) => {
  10040. let output = [];
  10041. if (Array.isArray(input)) {
  10042. for (let pattern of input) {
  10043. let result = braces.create(pattern, options);
  10044. if (Array.isArray(result)) {
  10045. output.push(...result);
  10046. } else {
  10047. output.push(result);
  10048. }
  10049. }
  10050. } else {
  10051. output = [].concat(braces.create(input, options));
  10052. }
  10053. if (options && options.expand === true && options.nodupes === true) {
  10054. output = [...new Set(output)];
  10055. }
  10056. return output;
  10057. };
  10058. braces.parse = (input, options = {}) => parse(input, options);
  10059. braces.stringify = (input, options = {}) => {
  10060. if (typeof input === "string") {
  10061. return stringify(braces.parse(input, options), options);
  10062. }
  10063. return stringify(input, options);
  10064. };
  10065. braces.compile = (input, options = {}) => {
  10066. if (typeof input === "string") {
  10067. input = braces.parse(input, options);
  10068. }
  10069. return compile(input, options);
  10070. };
  10071. braces.expand = (input, options = {}) => {
  10072. if (typeof input === "string") {
  10073. input = braces.parse(input, options);
  10074. }
  10075. let result = expand(input, options);
  10076. if (options.noempty === true) {
  10077. result = result.filter(Boolean);
  10078. }
  10079. if (options.nodupes === true) {
  10080. result = [...new Set(result)];
  10081. }
  10082. return result;
  10083. };
  10084. braces.create = (input, options = {}) => {
  10085. if (input === "" || input.length < 3) {
  10086. return [input];
  10087. }
  10088. return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
  10089. };
  10090. module2.exports = braces;
  10091. }
  10092. });
  10093. var require_constants3 = __commonJS2({
  10094. "node_modules/picomatch/lib/constants.js"(exports2, module2) {
  10095. "use strict";
  10096. var path = require("path");
  10097. var WIN_SLASH = "\\\\/";
  10098. var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  10099. var DOT_LITERAL = "\\.";
  10100. var PLUS_LITERAL = "\\+";
  10101. var QMARK_LITERAL = "\\?";
  10102. var SLASH_LITERAL = "\\/";
  10103. var ONE_CHAR = "(?=.)";
  10104. var QMARK = "[^/]";
  10105. var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  10106. var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  10107. var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  10108. var NO_DOT = `(?!${DOT_LITERAL})`;
  10109. var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
  10110. var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
  10111. var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
  10112. var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
  10113. var STAR = `${QMARK}*?`;
  10114. var POSIX_CHARS = {
  10115. DOT_LITERAL,
  10116. PLUS_LITERAL,
  10117. QMARK_LITERAL,
  10118. SLASH_LITERAL,
  10119. ONE_CHAR,
  10120. QMARK,
  10121. END_ANCHOR,
  10122. DOTS_SLASH,
  10123. NO_DOT,
  10124. NO_DOTS,
  10125. NO_DOT_SLASH,
  10126. NO_DOTS_SLASH,
  10127. QMARK_NO_DOT,
  10128. STAR,
  10129. START_ANCHOR
  10130. };
  10131. var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
  10132. SLASH_LITERAL: `[${WIN_SLASH}]`,
  10133. QMARK: WIN_NO_SLASH,
  10134. STAR: `${WIN_NO_SLASH}*?`,
  10135. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  10136. NO_DOT: `(?!${DOT_LITERAL})`,
  10137. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  10138. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  10139. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  10140. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  10141. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  10142. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
  10143. });
  10144. var POSIX_REGEX_SOURCE = {
  10145. alnum: "a-zA-Z0-9",
  10146. alpha: "a-zA-Z",
  10147. ascii: "\\x00-\\x7F",
  10148. blank: " \\t",
  10149. cntrl: "\\x00-\\x1F\\x7F",
  10150. digit: "0-9",
  10151. graph: "\\x21-\\x7E",
  10152. lower: "a-z",
  10153. print: "\\x20-\\x7E ",
  10154. punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
  10155. space: " \\t\\r\\n\\v\\f",
  10156. upper: "A-Z",
  10157. word: "A-Za-z0-9_",
  10158. xdigit: "A-Fa-f0-9"
  10159. };
  10160. module2.exports = {
  10161. MAX_LENGTH: 1024 * 64,
  10162. POSIX_REGEX_SOURCE,
  10163. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  10164. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  10165. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  10166. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  10167. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  10168. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  10169. REPLACEMENTS: {
  10170. "***": "*",
  10171. "**/**": "**",
  10172. "**/**/**": "**"
  10173. },
  10174. CHAR_0: 48,
  10175. CHAR_9: 57,
  10176. CHAR_UPPERCASE_A: 65,
  10177. CHAR_LOWERCASE_A: 97,
  10178. CHAR_UPPERCASE_Z: 90,
  10179. CHAR_LOWERCASE_Z: 122,
  10180. CHAR_LEFT_PARENTHESES: 40,
  10181. CHAR_RIGHT_PARENTHESES: 41,
  10182. CHAR_ASTERISK: 42,
  10183. CHAR_AMPERSAND: 38,
  10184. CHAR_AT: 64,
  10185. CHAR_BACKWARD_SLASH: 92,
  10186. CHAR_CARRIAGE_RETURN: 13,
  10187. CHAR_CIRCUMFLEX_ACCENT: 94,
  10188. CHAR_COLON: 58,
  10189. CHAR_COMMA: 44,
  10190. CHAR_DOT: 46,
  10191. CHAR_DOUBLE_QUOTE: 34,
  10192. CHAR_EQUAL: 61,
  10193. CHAR_EXCLAMATION_MARK: 33,
  10194. CHAR_FORM_FEED: 12,
  10195. CHAR_FORWARD_SLASH: 47,
  10196. CHAR_GRAVE_ACCENT: 96,
  10197. CHAR_HASH: 35,
  10198. CHAR_HYPHEN_MINUS: 45,
  10199. CHAR_LEFT_ANGLE_BRACKET: 60,
  10200. CHAR_LEFT_CURLY_BRACE: 123,
  10201. CHAR_LEFT_SQUARE_BRACKET: 91,
  10202. CHAR_LINE_FEED: 10,
  10203. CHAR_NO_BREAK_SPACE: 160,
  10204. CHAR_PERCENT: 37,
  10205. CHAR_PLUS: 43,
  10206. CHAR_QUESTION_MARK: 63,
  10207. CHAR_RIGHT_ANGLE_BRACKET: 62,
  10208. CHAR_RIGHT_CURLY_BRACE: 125,
  10209. CHAR_RIGHT_SQUARE_BRACKET: 93,
  10210. CHAR_SEMICOLON: 59,
  10211. CHAR_SINGLE_QUOTE: 39,
  10212. CHAR_SPACE: 32,
  10213. CHAR_TAB: 9,
  10214. CHAR_UNDERSCORE: 95,
  10215. CHAR_VERTICAL_LINE: 124,
  10216. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
  10217. SEP: path.sep,
  10218. extglobChars(chars) {
  10219. return {
  10220. "!": {
  10221. type: "negate",
  10222. open: "(?:(?!(?:",
  10223. close: `))${chars.STAR})`
  10224. },
  10225. "?": {
  10226. type: "qmark",
  10227. open: "(?:",
  10228. close: ")?"
  10229. },
  10230. "+": {
  10231. type: "plus",
  10232. open: "(?:",
  10233. close: ")+"
  10234. },
  10235. "*": {
  10236. type: "star",
  10237. open: "(?:",
  10238. close: ")*"
  10239. },
  10240. "@": {
  10241. type: "at",
  10242. open: "(?:",
  10243. close: ")"
  10244. }
  10245. };
  10246. },
  10247. globChars(win32) {
  10248. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  10249. }
  10250. };
  10251. }
  10252. });
  10253. var require_utils3 = __commonJS2({
  10254. "node_modules/picomatch/lib/utils.js"(exports2) {
  10255. "use strict";
  10256. var path = require("path");
  10257. var win32 = process.platform === "win32";
  10258. var {
  10259. REGEX_BACKSLASH,
  10260. REGEX_REMOVE_BACKSLASH,
  10261. REGEX_SPECIAL_CHARS,
  10262. REGEX_SPECIAL_CHARS_GLOBAL
  10263. } = require_constants3();
  10264. exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  10265. exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
  10266. exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
  10267. exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
  10268. exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
  10269. exports2.removeBackslashes = (str) => {
  10270. return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
  10271. return match === "\\" ? "" : match;
  10272. });
  10273. };
  10274. exports2.supportsLookbehinds = () => {
  10275. const segs = process.version.slice(1).split(".").map(Number);
  10276. if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
  10277. return true;
  10278. }
  10279. return false;
  10280. };
  10281. exports2.isWindows = (options) => {
  10282. if (options && typeof options.windows === "boolean") {
  10283. return options.windows;
  10284. }
  10285. return win32 === true || path.sep === "\\";
  10286. };
  10287. exports2.escapeLast = (input, char, lastIdx) => {
  10288. const idx = input.lastIndexOf(char, lastIdx);
  10289. if (idx === -1)
  10290. return input;
  10291. if (input[idx - 1] === "\\")
  10292. return exports2.escapeLast(input, char, idx - 1);
  10293. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  10294. };
  10295. exports2.removePrefix = (input, state = {}) => {
  10296. let output = input;
  10297. if (output.startsWith("./")) {
  10298. output = output.slice(2);
  10299. state.prefix = "./";
  10300. }
  10301. return output;
  10302. };
  10303. exports2.wrapOutput = (input, state = {}, options = {}) => {
  10304. const prepend = options.contains ? "" : "^";
  10305. const append = options.contains ? "" : "$";
  10306. let output = `${prepend}(?:${input})${append}`;
  10307. if (state.negated === true) {
  10308. output = `(?:^(?!${output}).*$)`;
  10309. }
  10310. return output;
  10311. };
  10312. }
  10313. });
  10314. var require_scan = __commonJS2({
  10315. "node_modules/picomatch/lib/scan.js"(exports2, module2) {
  10316. "use strict";
  10317. var utils = require_utils3();
  10318. var {
  10319. CHAR_ASTERISK,
  10320. CHAR_AT,
  10321. CHAR_BACKWARD_SLASH,
  10322. CHAR_COMMA,
  10323. CHAR_DOT,
  10324. CHAR_EXCLAMATION_MARK,
  10325. CHAR_FORWARD_SLASH,
  10326. CHAR_LEFT_CURLY_BRACE,
  10327. CHAR_LEFT_PARENTHESES,
  10328. CHAR_LEFT_SQUARE_BRACKET,
  10329. CHAR_PLUS,
  10330. CHAR_QUESTION_MARK,
  10331. CHAR_RIGHT_CURLY_BRACE,
  10332. CHAR_RIGHT_PARENTHESES,
  10333. CHAR_RIGHT_SQUARE_BRACKET
  10334. } = require_constants3();
  10335. var isPathSeparator = (code) => {
  10336. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  10337. };
  10338. var depth = (token) => {
  10339. if (token.isPrefix !== true) {
  10340. token.depth = token.isGlobstar ? Infinity : 1;
  10341. }
  10342. };
  10343. var scan = (input, options) => {
  10344. const opts = options || {};
  10345. const length = input.length - 1;
  10346. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  10347. const slashes = [];
  10348. const tokens = [];
  10349. const parts = [];
  10350. let str = input;
  10351. let index = -1;
  10352. let start = 0;
  10353. let lastIndex = 0;
  10354. let isBrace = false;
  10355. let isBracket = false;
  10356. let isGlob = false;
  10357. let isExtglob = false;
  10358. let isGlobstar = false;
  10359. let braceEscaped = false;
  10360. let backslashes = false;
  10361. let negated = false;
  10362. let negatedExtglob = false;
  10363. let finished = false;
  10364. let braces = 0;
  10365. let prev;
  10366. let code;
  10367. let token = {
  10368. value: "",
  10369. depth: 0,
  10370. isGlob: false
  10371. };
  10372. const eos = () => index >= length;
  10373. const peek = () => str.charCodeAt(index + 1);
  10374. const advance = () => {
  10375. prev = code;
  10376. return str.charCodeAt(++index);
  10377. };
  10378. while (index < length) {
  10379. code = advance();
  10380. let next;
  10381. if (code === CHAR_BACKWARD_SLASH) {
  10382. backslashes = token.backslashes = true;
  10383. code = advance();
  10384. if (code === CHAR_LEFT_CURLY_BRACE) {
  10385. braceEscaped = true;
  10386. }
  10387. continue;
  10388. }
  10389. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  10390. braces++;
  10391. while (eos() !== true && (code = advance())) {
  10392. if (code === CHAR_BACKWARD_SLASH) {
  10393. backslashes = token.backslashes = true;
  10394. advance();
  10395. continue;
  10396. }
  10397. if (code === CHAR_LEFT_CURLY_BRACE) {
  10398. braces++;
  10399. continue;
  10400. }
  10401. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  10402. isBrace = token.isBrace = true;
  10403. isGlob = token.isGlob = true;
  10404. finished = true;
  10405. if (scanToEnd === true) {
  10406. continue;
  10407. }
  10408. break;
  10409. }
  10410. if (braceEscaped !== true && code === CHAR_COMMA) {
  10411. isBrace = token.isBrace = true;
  10412. isGlob = token.isGlob = true;
  10413. finished = true;
  10414. if (scanToEnd === true) {
  10415. continue;
  10416. }
  10417. break;
  10418. }
  10419. if (code === CHAR_RIGHT_CURLY_BRACE) {
  10420. braces--;
  10421. if (braces === 0) {
  10422. braceEscaped = false;
  10423. isBrace = token.isBrace = true;
  10424. finished = true;
  10425. break;
  10426. }
  10427. }
  10428. }
  10429. if (scanToEnd === true) {
  10430. continue;
  10431. }
  10432. break;
  10433. }
  10434. if (code === CHAR_FORWARD_SLASH) {
  10435. slashes.push(index);
  10436. tokens.push(token);
  10437. token = {
  10438. value: "",
  10439. depth: 0,
  10440. isGlob: false
  10441. };
  10442. if (finished === true)
  10443. continue;
  10444. if (prev === CHAR_DOT && index === start + 1) {
  10445. start += 2;
  10446. continue;
  10447. }
  10448. lastIndex = index + 1;
  10449. continue;
  10450. }
  10451. if (opts.noext !== true) {
  10452. const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
  10453. if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
  10454. isGlob = token.isGlob = true;
  10455. isExtglob = token.isExtglob = true;
  10456. finished = true;
  10457. if (code === CHAR_EXCLAMATION_MARK && index === start) {
  10458. negatedExtglob = true;
  10459. }
  10460. if (scanToEnd === true) {
  10461. while (eos() !== true && (code = advance())) {
  10462. if (code === CHAR_BACKWARD_SLASH) {
  10463. backslashes = token.backslashes = true;
  10464. code = advance();
  10465. continue;
  10466. }
  10467. if (code === CHAR_RIGHT_PARENTHESES) {
  10468. isGlob = token.isGlob = true;
  10469. finished = true;
  10470. break;
  10471. }
  10472. }
  10473. continue;
  10474. }
  10475. break;
  10476. }
  10477. }
  10478. if (code === CHAR_ASTERISK) {
  10479. if (prev === CHAR_ASTERISK)
  10480. isGlobstar = token.isGlobstar = true;
  10481. isGlob = token.isGlob = true;
  10482. finished = true;
  10483. if (scanToEnd === true) {
  10484. continue;
  10485. }
  10486. break;
  10487. }
  10488. if (code === CHAR_QUESTION_MARK) {
  10489. isGlob = token.isGlob = true;
  10490. finished = true;
  10491. if (scanToEnd === true) {
  10492. continue;
  10493. }
  10494. break;
  10495. }
  10496. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  10497. while (eos() !== true && (next = advance())) {
  10498. if (next === CHAR_BACKWARD_SLASH) {
  10499. backslashes = token.backslashes = true;
  10500. advance();
  10501. continue;
  10502. }
  10503. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  10504. isBracket = token.isBracket = true;
  10505. isGlob = token.isGlob = true;
  10506. finished = true;
  10507. break;
  10508. }
  10509. }
  10510. if (scanToEnd === true) {
  10511. continue;
  10512. }
  10513. break;
  10514. }
  10515. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  10516. negated = token.negated = true;
  10517. start++;
  10518. continue;
  10519. }
  10520. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  10521. isGlob = token.isGlob = true;
  10522. if (scanToEnd === true) {
  10523. while (eos() !== true && (code = advance())) {
  10524. if (code === CHAR_LEFT_PARENTHESES) {
  10525. backslashes = token.backslashes = true;
  10526. code = advance();
  10527. continue;
  10528. }
  10529. if (code === CHAR_RIGHT_PARENTHESES) {
  10530. finished = true;
  10531. break;
  10532. }
  10533. }
  10534. continue;
  10535. }
  10536. break;
  10537. }
  10538. if (isGlob === true) {
  10539. finished = true;
  10540. if (scanToEnd === true) {
  10541. continue;
  10542. }
  10543. break;
  10544. }
  10545. }
  10546. if (opts.noext === true) {
  10547. isExtglob = false;
  10548. isGlob = false;
  10549. }
  10550. let base = str;
  10551. let prefix = "";
  10552. let glob = "";
  10553. if (start > 0) {
  10554. prefix = str.slice(0, start);
  10555. str = str.slice(start);
  10556. lastIndex -= start;
  10557. }
  10558. if (base && isGlob === true && lastIndex > 0) {
  10559. base = str.slice(0, lastIndex);
  10560. glob = str.slice(lastIndex);
  10561. } else if (isGlob === true) {
  10562. base = "";
  10563. glob = str;
  10564. } else {
  10565. base = str;
  10566. }
  10567. if (base && base !== "" && base !== "/" && base !== str) {
  10568. if (isPathSeparator(base.charCodeAt(base.length - 1))) {
  10569. base = base.slice(0, -1);
  10570. }
  10571. }
  10572. if (opts.unescape === true) {
  10573. if (glob)
  10574. glob = utils.removeBackslashes(glob);
  10575. if (base && backslashes === true) {
  10576. base = utils.removeBackslashes(base);
  10577. }
  10578. }
  10579. const state = {
  10580. prefix,
  10581. input,
  10582. start,
  10583. base,
  10584. glob,
  10585. isBrace,
  10586. isBracket,
  10587. isGlob,
  10588. isExtglob,
  10589. isGlobstar,
  10590. negated,
  10591. negatedExtglob
  10592. };
  10593. if (opts.tokens === true) {
  10594. state.maxDepth = 0;
  10595. if (!isPathSeparator(code)) {
  10596. tokens.push(token);
  10597. }
  10598. state.tokens = tokens;
  10599. }
  10600. if (opts.parts === true || opts.tokens === true) {
  10601. let prevIndex;
  10602. for (let idx = 0; idx < slashes.length; idx++) {
  10603. const n = prevIndex ? prevIndex + 1 : start;
  10604. const i = slashes[idx];
  10605. const value = input.slice(n, i);
  10606. if (opts.tokens) {
  10607. if (idx === 0 && start !== 0) {
  10608. tokens[idx].isPrefix = true;
  10609. tokens[idx].value = prefix;
  10610. } else {
  10611. tokens[idx].value = value;
  10612. }
  10613. depth(tokens[idx]);
  10614. state.maxDepth += tokens[idx].depth;
  10615. }
  10616. if (idx !== 0 || value !== "") {
  10617. parts.push(value);
  10618. }
  10619. prevIndex = i;
  10620. }
  10621. if (prevIndex && prevIndex + 1 < input.length) {
  10622. const value = input.slice(prevIndex + 1);
  10623. parts.push(value);
  10624. if (opts.tokens) {
  10625. tokens[tokens.length - 1].value = value;
  10626. depth(tokens[tokens.length - 1]);
  10627. state.maxDepth += tokens[tokens.length - 1].depth;
  10628. }
  10629. }
  10630. state.slashes = slashes;
  10631. state.parts = parts;
  10632. }
  10633. return state;
  10634. };
  10635. module2.exports = scan;
  10636. }
  10637. });
  10638. var require_parse2 = __commonJS2({
  10639. "node_modules/picomatch/lib/parse.js"(exports2, module2) {
  10640. "use strict";
  10641. var constants = require_constants3();
  10642. var utils = require_utils3();
  10643. var {
  10644. MAX_LENGTH,
  10645. POSIX_REGEX_SOURCE,
  10646. REGEX_NON_SPECIAL_CHARS,
  10647. REGEX_SPECIAL_CHARS_BACKREF,
  10648. REPLACEMENTS
  10649. } = constants;
  10650. var expandRange = (args, options) => {
  10651. if (typeof options.expandRange === "function") {
  10652. return options.expandRange(...args, options);
  10653. }
  10654. args.sort();
  10655. const value = `[${args.join("-")}]`;
  10656. try {
  10657. new RegExp(value);
  10658. } catch (ex) {
  10659. return args.map((v) => utils.escapeRegex(v)).join("..");
  10660. }
  10661. return value;
  10662. };
  10663. var syntaxError = (type, char) => {
  10664. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  10665. };
  10666. var parse = (input, options) => {
  10667. if (typeof input !== "string") {
  10668. throw new TypeError("Expected a string");
  10669. }
  10670. input = REPLACEMENTS[input] || input;
  10671. const opts = Object.assign({}, options);
  10672. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  10673. let len = input.length;
  10674. if (len > max) {
  10675. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  10676. }
  10677. const bos = {
  10678. type: "bos",
  10679. value: "",
  10680. output: opts.prepend || ""
  10681. };
  10682. const tokens = [bos];
  10683. const capture = opts.capture ? "" : "?:";
  10684. const win32 = utils.isWindows(options);
  10685. const PLATFORM_CHARS = constants.globChars(win32);
  10686. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  10687. const {
  10688. DOT_LITERAL,
  10689. PLUS_LITERAL,
  10690. SLASH_LITERAL,
  10691. ONE_CHAR,
  10692. DOTS_SLASH,
  10693. NO_DOT,
  10694. NO_DOT_SLASH,
  10695. NO_DOTS_SLASH,
  10696. QMARK,
  10697. QMARK_NO_DOT,
  10698. STAR,
  10699. START_ANCHOR
  10700. } = PLATFORM_CHARS;
  10701. const globstar = (opts2) => {
  10702. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  10703. };
  10704. const nodot = opts.dot ? "" : NO_DOT;
  10705. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  10706. let star = opts.bash === true ? globstar(opts) : STAR;
  10707. if (opts.capture) {
  10708. star = `(${star})`;
  10709. }
  10710. if (typeof opts.noext === "boolean") {
  10711. opts.noextglob = opts.noext;
  10712. }
  10713. const state = {
  10714. input,
  10715. index: -1,
  10716. start: 0,
  10717. dot: opts.dot === true,
  10718. consumed: "",
  10719. output: "",
  10720. prefix: "",
  10721. backtrack: false,
  10722. negated: false,
  10723. brackets: 0,
  10724. braces: 0,
  10725. parens: 0,
  10726. quotes: 0,
  10727. globstar: false,
  10728. tokens
  10729. };
  10730. input = utils.removePrefix(input, state);
  10731. len = input.length;
  10732. const extglobs = [];
  10733. const braces = [];
  10734. const stack = [];
  10735. let prev = bos;
  10736. let value;
  10737. const eos = () => state.index === len - 1;
  10738. const peek = state.peek = (n = 1) => input[state.index + n];
  10739. const advance = state.advance = () => input[++state.index] || "";
  10740. const remaining = () => input.slice(state.index + 1);
  10741. const consume = (value2 = "", num = 0) => {
  10742. state.consumed += value2;
  10743. state.index += num;
  10744. };
  10745. const append = (token) => {
  10746. state.output += token.output != null ? token.output : token.value;
  10747. consume(token.value);
  10748. };
  10749. const negate = () => {
  10750. let count = 1;
  10751. while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
  10752. advance();
  10753. state.start++;
  10754. count++;
  10755. }
  10756. if (count % 2 === 0) {
  10757. return false;
  10758. }
  10759. state.negated = true;
  10760. state.start++;
  10761. return true;
  10762. };
  10763. const increment = (type) => {
  10764. state[type]++;
  10765. stack.push(type);
  10766. };
  10767. const decrement = (type) => {
  10768. state[type]--;
  10769. stack.pop();
  10770. };
  10771. const push = (tok) => {
  10772. if (prev.type === "globstar") {
  10773. const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
  10774. const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
  10775. if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
  10776. state.output = state.output.slice(0, -prev.output.length);
  10777. prev.type = "star";
  10778. prev.value = "*";
  10779. prev.output = star;
  10780. state.output += prev.output;
  10781. }
  10782. }
  10783. if (extglobs.length && tok.type !== "paren") {
  10784. extglobs[extglobs.length - 1].inner += tok.value;
  10785. }
  10786. if (tok.value || tok.output)
  10787. append(tok);
  10788. if (prev && prev.type === "text" && tok.type === "text") {
  10789. prev.value += tok.value;
  10790. prev.output = (prev.output || "") + tok.value;
  10791. return;
  10792. }
  10793. tok.prev = prev;
  10794. tokens.push(tok);
  10795. prev = tok;
  10796. };
  10797. const extglobOpen = (type, value2) => {
  10798. const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
  10799. conditions: 1,
  10800. inner: ""
  10801. });
  10802. token.prev = prev;
  10803. token.parens = state.parens;
  10804. token.output = state.output;
  10805. const output = (opts.capture ? "(" : "") + token.open;
  10806. increment("parens");
  10807. push({
  10808. type,
  10809. value: value2,
  10810. output: state.output ? "" : ONE_CHAR
  10811. });
  10812. push({
  10813. type: "paren",
  10814. extglob: true,
  10815. value: advance(),
  10816. output
  10817. });
  10818. extglobs.push(token);
  10819. };
  10820. const extglobClose = (token) => {
  10821. let output = token.close + (opts.capture ? ")" : "");
  10822. let rest;
  10823. if (token.type === "negate") {
  10824. let extglobStar = star;
  10825. if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
  10826. extglobStar = globstar(opts);
  10827. }
  10828. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
  10829. output = token.close = `)$))${extglobStar}`;
  10830. }
  10831. if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
  10832. const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
  10833. fastpaths: false
  10834. })).output;
  10835. output = token.close = `)${expression})${extglobStar})`;
  10836. }
  10837. if (token.prev.type === "bos") {
  10838. state.negatedExtglob = true;
  10839. }
  10840. }
  10841. push({
  10842. type: "paren",
  10843. extglob: true,
  10844. value,
  10845. output
  10846. });
  10847. decrement("parens");
  10848. };
  10849. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  10850. let backslashes = false;
  10851. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  10852. if (first === "\\") {
  10853. backslashes = true;
  10854. return m;
  10855. }
  10856. if (first === "?") {
  10857. if (esc) {
  10858. return esc + first + (rest ? QMARK.repeat(rest.length) : "");
  10859. }
  10860. if (index === 0) {
  10861. return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
  10862. }
  10863. return QMARK.repeat(chars.length);
  10864. }
  10865. if (first === ".") {
  10866. return DOT_LITERAL.repeat(chars.length);
  10867. }
  10868. if (first === "*") {
  10869. if (esc) {
  10870. return esc + first + (rest ? star : "");
  10871. }
  10872. return star;
  10873. }
  10874. return esc ? m : `\\${m}`;
  10875. });
  10876. if (backslashes === true) {
  10877. if (opts.unescape === true) {
  10878. output = output.replace(/\\/g, "");
  10879. } else {
  10880. output = output.replace(/\\+/g, (m) => {
  10881. return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
  10882. });
  10883. }
  10884. }
  10885. if (output === input && opts.contains === true) {
  10886. state.output = input;
  10887. return state;
  10888. }
  10889. state.output = utils.wrapOutput(output, state, options);
  10890. return state;
  10891. }
  10892. while (!eos()) {
  10893. value = advance();
  10894. if (value === "\0") {
  10895. continue;
  10896. }
  10897. if (value === "\\") {
  10898. const next = peek();
  10899. if (next === "/" && opts.bash !== true) {
  10900. continue;
  10901. }
  10902. if (next === "." || next === ";") {
  10903. continue;
  10904. }
  10905. if (!next) {
  10906. value += "\\";
  10907. push({
  10908. type: "text",
  10909. value
  10910. });
  10911. continue;
  10912. }
  10913. const match = /^\\+/.exec(remaining());
  10914. let slashes = 0;
  10915. if (match && match[0].length > 2) {
  10916. slashes = match[0].length;
  10917. state.index += slashes;
  10918. if (slashes % 2 !== 0) {
  10919. value += "\\";
  10920. }
  10921. }
  10922. if (opts.unescape === true) {
  10923. value = advance();
  10924. } else {
  10925. value += advance();
  10926. }
  10927. if (state.brackets === 0) {
  10928. push({
  10929. type: "text",
  10930. value
  10931. });
  10932. continue;
  10933. }
  10934. }
  10935. if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
  10936. if (opts.posix !== false && value === ":") {
  10937. const inner = prev.value.slice(1);
  10938. if (inner.includes("[")) {
  10939. prev.posix = true;
  10940. if (inner.includes(":")) {
  10941. const idx = prev.value.lastIndexOf("[");
  10942. const pre = prev.value.slice(0, idx);
  10943. const rest2 = prev.value.slice(idx + 2);
  10944. const posix = POSIX_REGEX_SOURCE[rest2];
  10945. if (posix) {
  10946. prev.value = pre + posix;
  10947. state.backtrack = true;
  10948. advance();
  10949. if (!bos.output && tokens.indexOf(prev) === 1) {
  10950. bos.output = ONE_CHAR;
  10951. }
  10952. continue;
  10953. }
  10954. }
  10955. }
  10956. }
  10957. if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
  10958. value = `\\${value}`;
  10959. }
  10960. if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
  10961. value = `\\${value}`;
  10962. }
  10963. if (opts.posix === true && value === "!" && prev.value === "[") {
  10964. value = "^";
  10965. }
  10966. prev.value += value;
  10967. append({
  10968. value
  10969. });
  10970. continue;
  10971. }
  10972. if (state.quotes === 1 && value !== '"') {
  10973. value = utils.escapeRegex(value);
  10974. prev.value += value;
  10975. append({
  10976. value
  10977. });
  10978. continue;
  10979. }
  10980. if (value === '"') {
  10981. state.quotes = state.quotes === 1 ? 0 : 1;
  10982. if (opts.keepQuotes === true) {
  10983. push({
  10984. type: "text",
  10985. value
  10986. });
  10987. }
  10988. continue;
  10989. }
  10990. if (value === "(") {
  10991. increment("parens");
  10992. push({
  10993. type: "paren",
  10994. value
  10995. });
  10996. continue;
  10997. }
  10998. if (value === ")") {
  10999. if (state.parens === 0 && opts.strictBrackets === true) {
  11000. throw new SyntaxError(syntaxError("opening", "("));
  11001. }
  11002. const extglob = extglobs[extglobs.length - 1];
  11003. if (extglob && state.parens === extglob.parens + 1) {
  11004. extglobClose(extglobs.pop());
  11005. continue;
  11006. }
  11007. push({
  11008. type: "paren",
  11009. value,
  11010. output: state.parens ? ")" : "\\)"
  11011. });
  11012. decrement("parens");
  11013. continue;
  11014. }
  11015. if (value === "[") {
  11016. if (opts.nobracket === true || !remaining().includes("]")) {
  11017. if (opts.nobracket !== true && opts.strictBrackets === true) {
  11018. throw new SyntaxError(syntaxError("closing", "]"));
  11019. }
  11020. value = `\\${value}`;
  11021. } else {
  11022. increment("brackets");
  11023. }
  11024. push({
  11025. type: "bracket",
  11026. value
  11027. });
  11028. continue;
  11029. }
  11030. if (value === "]") {
  11031. if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
  11032. push({
  11033. type: "text",
  11034. value,
  11035. output: `\\${value}`
  11036. });
  11037. continue;
  11038. }
  11039. if (state.brackets === 0) {
  11040. if (opts.strictBrackets === true) {
  11041. throw new SyntaxError(syntaxError("opening", "["));
  11042. }
  11043. push({
  11044. type: "text",
  11045. value,
  11046. output: `\\${value}`
  11047. });
  11048. continue;
  11049. }
  11050. decrement("brackets");
  11051. const prevValue = prev.value.slice(1);
  11052. if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
  11053. value = `/${value}`;
  11054. }
  11055. prev.value += value;
  11056. append({
  11057. value
  11058. });
  11059. if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
  11060. continue;
  11061. }
  11062. const escaped = utils.escapeRegex(prev.value);
  11063. state.output = state.output.slice(0, -prev.value.length);
  11064. if (opts.literalBrackets === true) {
  11065. state.output += escaped;
  11066. prev.value = escaped;
  11067. continue;
  11068. }
  11069. prev.value = `(${capture}${escaped}|${prev.value})`;
  11070. state.output += prev.value;
  11071. continue;
  11072. }
  11073. if (value === "{" && opts.nobrace !== true) {
  11074. increment("braces");
  11075. const open = {
  11076. type: "brace",
  11077. value,
  11078. output: "(",
  11079. outputIndex: state.output.length,
  11080. tokensIndex: state.tokens.length
  11081. };
  11082. braces.push(open);
  11083. push(open);
  11084. continue;
  11085. }
  11086. if (value === "}") {
  11087. const brace = braces[braces.length - 1];
  11088. if (opts.nobrace === true || !brace) {
  11089. push({
  11090. type: "text",
  11091. value,
  11092. output: value
  11093. });
  11094. continue;
  11095. }
  11096. let output = ")";
  11097. if (brace.dots === true) {
  11098. const arr = tokens.slice();
  11099. const range = [];
  11100. for (let i = arr.length - 1; i >= 0; i--) {
  11101. tokens.pop();
  11102. if (arr[i].type === "brace") {
  11103. break;
  11104. }
  11105. if (arr[i].type !== "dots") {
  11106. range.unshift(arr[i].value);
  11107. }
  11108. }
  11109. output = expandRange(range, opts);
  11110. state.backtrack = true;
  11111. }
  11112. if (brace.comma !== true && brace.dots !== true) {
  11113. const out = state.output.slice(0, brace.outputIndex);
  11114. const toks = state.tokens.slice(brace.tokensIndex);
  11115. brace.value = brace.output = "\\{";
  11116. value = output = "\\}";
  11117. state.output = out;
  11118. for (const t of toks) {
  11119. state.output += t.output || t.value;
  11120. }
  11121. }
  11122. push({
  11123. type: "brace",
  11124. value,
  11125. output
  11126. });
  11127. decrement("braces");
  11128. braces.pop();
  11129. continue;
  11130. }
  11131. if (value === "|") {
  11132. if (extglobs.length > 0) {
  11133. extglobs[extglobs.length - 1].conditions++;
  11134. }
  11135. push({
  11136. type: "text",
  11137. value
  11138. });
  11139. continue;
  11140. }
  11141. if (value === ",") {
  11142. let output = value;
  11143. const brace = braces[braces.length - 1];
  11144. if (brace && stack[stack.length - 1] === "braces") {
  11145. brace.comma = true;
  11146. output = "|";
  11147. }
  11148. push({
  11149. type: "comma",
  11150. value,
  11151. output
  11152. });
  11153. continue;
  11154. }
  11155. if (value === "/") {
  11156. if (prev.type === "dot" && state.index === state.start + 1) {
  11157. state.start = state.index + 1;
  11158. state.consumed = "";
  11159. state.output = "";
  11160. tokens.pop();
  11161. prev = bos;
  11162. continue;
  11163. }
  11164. push({
  11165. type: "slash",
  11166. value,
  11167. output: SLASH_LITERAL
  11168. });
  11169. continue;
  11170. }
  11171. if (value === ".") {
  11172. if (state.braces > 0 && prev.type === "dot") {
  11173. if (prev.value === ".")
  11174. prev.output = DOT_LITERAL;
  11175. const brace = braces[braces.length - 1];
  11176. prev.type = "dots";
  11177. prev.output += value;
  11178. prev.value += value;
  11179. brace.dots = true;
  11180. continue;
  11181. }
  11182. if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
  11183. push({
  11184. type: "text",
  11185. value,
  11186. output: DOT_LITERAL
  11187. });
  11188. continue;
  11189. }
  11190. push({
  11191. type: "dot",
  11192. value,
  11193. output: DOT_LITERAL
  11194. });
  11195. continue;
  11196. }
  11197. if (value === "?") {
  11198. const isGroup = prev && prev.value === "(";
  11199. if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11200. extglobOpen("qmark", value);
  11201. continue;
  11202. }
  11203. if (prev && prev.type === "paren") {
  11204. const next = peek();
  11205. let output = value;
  11206. if (next === "<" && !utils.supportsLookbehinds()) {
  11207. throw new Error("Node.js v10 or higher is required for regex lookbehinds");
  11208. }
  11209. if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
  11210. output = `\\${value}`;
  11211. }
  11212. push({
  11213. type: "text",
  11214. value,
  11215. output
  11216. });
  11217. continue;
  11218. }
  11219. if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
  11220. push({
  11221. type: "qmark",
  11222. value,
  11223. output: QMARK_NO_DOT
  11224. });
  11225. continue;
  11226. }
  11227. push({
  11228. type: "qmark",
  11229. value,
  11230. output: QMARK
  11231. });
  11232. continue;
  11233. }
  11234. if (value === "!") {
  11235. if (opts.noextglob !== true && peek() === "(") {
  11236. if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
  11237. extglobOpen("negate", value);
  11238. continue;
  11239. }
  11240. }
  11241. if (opts.nonegate !== true && state.index === 0) {
  11242. negate();
  11243. continue;
  11244. }
  11245. }
  11246. if (value === "+") {
  11247. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11248. extglobOpen("plus", value);
  11249. continue;
  11250. }
  11251. if (prev && prev.value === "(" || opts.regex === false) {
  11252. push({
  11253. type: "plus",
  11254. value,
  11255. output: PLUS_LITERAL
  11256. });
  11257. continue;
  11258. }
  11259. if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
  11260. push({
  11261. type: "plus",
  11262. value
  11263. });
  11264. continue;
  11265. }
  11266. push({
  11267. type: "plus",
  11268. value: PLUS_LITERAL
  11269. });
  11270. continue;
  11271. }
  11272. if (value === "@") {
  11273. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11274. push({
  11275. type: "at",
  11276. extglob: true,
  11277. value,
  11278. output: ""
  11279. });
  11280. continue;
  11281. }
  11282. push({
  11283. type: "text",
  11284. value
  11285. });
  11286. continue;
  11287. }
  11288. if (value !== "*") {
  11289. if (value === "$" || value === "^") {
  11290. value = `\\${value}`;
  11291. }
  11292. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  11293. if (match) {
  11294. value += match[0];
  11295. state.index += match[0].length;
  11296. }
  11297. push({
  11298. type: "text",
  11299. value
  11300. });
  11301. continue;
  11302. }
  11303. if (prev && (prev.type === "globstar" || prev.star === true)) {
  11304. prev.type = "star";
  11305. prev.star = true;
  11306. prev.value += value;
  11307. prev.output = star;
  11308. state.backtrack = true;
  11309. state.globstar = true;
  11310. consume(value);
  11311. continue;
  11312. }
  11313. let rest = remaining();
  11314. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  11315. extglobOpen("star", value);
  11316. continue;
  11317. }
  11318. if (prev.type === "star") {
  11319. if (opts.noglobstar === true) {
  11320. consume(value);
  11321. continue;
  11322. }
  11323. const prior = prev.prev;
  11324. const before = prior.prev;
  11325. const isStart = prior.type === "slash" || prior.type === "bos";
  11326. const afterStar = before && (before.type === "star" || before.type === "globstar");
  11327. if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
  11328. push({
  11329. type: "star",
  11330. value,
  11331. output: ""
  11332. });
  11333. continue;
  11334. }
  11335. const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
  11336. const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
  11337. if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
  11338. push({
  11339. type: "star",
  11340. value,
  11341. output: ""
  11342. });
  11343. continue;
  11344. }
  11345. while (rest.slice(0, 3) === "/**") {
  11346. const after = input[state.index + 4];
  11347. if (after && after !== "/") {
  11348. break;
  11349. }
  11350. rest = rest.slice(3);
  11351. consume("/**", 3);
  11352. }
  11353. if (prior.type === "bos" && eos()) {
  11354. prev.type = "globstar";
  11355. prev.value += value;
  11356. prev.output = globstar(opts);
  11357. state.output = prev.output;
  11358. state.globstar = true;
  11359. consume(value);
  11360. continue;
  11361. }
  11362. if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
  11363. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11364. prior.output = `(?:${prior.output}`;
  11365. prev.type = "globstar";
  11366. prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
  11367. prev.value += value;
  11368. state.globstar = true;
  11369. state.output += prior.output + prev.output;
  11370. consume(value);
  11371. continue;
  11372. }
  11373. if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
  11374. const end = rest[1] !== void 0 ? "|$" : "";
  11375. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11376. prior.output = `(?:${prior.output}`;
  11377. prev.type = "globstar";
  11378. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  11379. prev.value += value;
  11380. state.output += prior.output + prev.output;
  11381. state.globstar = true;
  11382. consume(value + advance());
  11383. push({
  11384. type: "slash",
  11385. value: "/",
  11386. output: ""
  11387. });
  11388. continue;
  11389. }
  11390. if (prior.type === "bos" && rest[0] === "/") {
  11391. prev.type = "globstar";
  11392. prev.value += value;
  11393. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  11394. state.output = prev.output;
  11395. state.globstar = true;
  11396. consume(value + advance());
  11397. push({
  11398. type: "slash",
  11399. value: "/",
  11400. output: ""
  11401. });
  11402. continue;
  11403. }
  11404. state.output = state.output.slice(0, -prev.output.length);
  11405. prev.type = "globstar";
  11406. prev.output = globstar(opts);
  11407. prev.value += value;
  11408. state.output += prev.output;
  11409. state.globstar = true;
  11410. consume(value);
  11411. continue;
  11412. }
  11413. const token = {
  11414. type: "star",
  11415. value,
  11416. output: star
  11417. };
  11418. if (opts.bash === true) {
  11419. token.output = ".*?";
  11420. if (prev.type === "bos" || prev.type === "slash") {
  11421. token.output = nodot + token.output;
  11422. }
  11423. push(token);
  11424. continue;
  11425. }
  11426. if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
  11427. token.output = value;
  11428. push(token);
  11429. continue;
  11430. }
  11431. if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
  11432. if (prev.type === "dot") {
  11433. state.output += NO_DOT_SLASH;
  11434. prev.output += NO_DOT_SLASH;
  11435. } else if (opts.dot === true) {
  11436. state.output += NO_DOTS_SLASH;
  11437. prev.output += NO_DOTS_SLASH;
  11438. } else {
  11439. state.output += nodot;
  11440. prev.output += nodot;
  11441. }
  11442. if (peek() !== "*") {
  11443. state.output += ONE_CHAR;
  11444. prev.output += ONE_CHAR;
  11445. }
  11446. }
  11447. push(token);
  11448. }
  11449. while (state.brackets > 0) {
  11450. if (opts.strictBrackets === true)
  11451. throw new SyntaxError(syntaxError("closing", "]"));
  11452. state.output = utils.escapeLast(state.output, "[");
  11453. decrement("brackets");
  11454. }
  11455. while (state.parens > 0) {
  11456. if (opts.strictBrackets === true)
  11457. throw new SyntaxError(syntaxError("closing", ")"));
  11458. state.output = utils.escapeLast(state.output, "(");
  11459. decrement("parens");
  11460. }
  11461. while (state.braces > 0) {
  11462. if (opts.strictBrackets === true)
  11463. throw new SyntaxError(syntaxError("closing", "}"));
  11464. state.output = utils.escapeLast(state.output, "{");
  11465. decrement("braces");
  11466. }
  11467. if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
  11468. push({
  11469. type: "maybe_slash",
  11470. value: "",
  11471. output: `${SLASH_LITERAL}?`
  11472. });
  11473. }
  11474. if (state.backtrack === true) {
  11475. state.output = "";
  11476. for (const token of state.tokens) {
  11477. state.output += token.output != null ? token.output : token.value;
  11478. if (token.suffix) {
  11479. state.output += token.suffix;
  11480. }
  11481. }
  11482. }
  11483. return state;
  11484. };
  11485. parse.fastpaths = (input, options) => {
  11486. const opts = Object.assign({}, options);
  11487. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  11488. const len = input.length;
  11489. if (len > max) {
  11490. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  11491. }
  11492. input = REPLACEMENTS[input] || input;
  11493. const win32 = utils.isWindows(options);
  11494. const {
  11495. DOT_LITERAL,
  11496. SLASH_LITERAL,
  11497. ONE_CHAR,
  11498. DOTS_SLASH,
  11499. NO_DOT,
  11500. NO_DOTS,
  11501. NO_DOTS_SLASH,
  11502. STAR,
  11503. START_ANCHOR
  11504. } = constants.globChars(win32);
  11505. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  11506. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  11507. const capture = opts.capture ? "" : "?:";
  11508. const state = {
  11509. negated: false,
  11510. prefix: ""
  11511. };
  11512. let star = opts.bash === true ? ".*?" : STAR;
  11513. if (opts.capture) {
  11514. star = `(${star})`;
  11515. }
  11516. const globstar = (opts2) => {
  11517. if (opts2.noglobstar === true)
  11518. return star;
  11519. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  11520. };
  11521. const create = (str) => {
  11522. switch (str) {
  11523. case "*":
  11524. return `${nodot}${ONE_CHAR}${star}`;
  11525. case ".*":
  11526. return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  11527. case "*.*":
  11528. return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11529. case "*/*":
  11530. return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  11531. case "**":
  11532. return nodot + globstar(opts);
  11533. case "**/*":
  11534. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  11535. case "**/*.*":
  11536. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11537. case "**/.*":
  11538. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  11539. default: {
  11540. const match = /^(.*?)\.(\w+)$/.exec(str);
  11541. if (!match)
  11542. return;
  11543. const source2 = create(match[1]);
  11544. if (!source2)
  11545. return;
  11546. return source2 + DOT_LITERAL + match[2];
  11547. }
  11548. }
  11549. };
  11550. const output = utils.removePrefix(input, state);
  11551. let source = create(output);
  11552. if (source && opts.strictSlashes !== true) {
  11553. source += `${SLASH_LITERAL}?`;
  11554. }
  11555. return source;
  11556. };
  11557. module2.exports = parse;
  11558. }
  11559. });
  11560. var require_picomatch = __commonJS2({
  11561. "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
  11562. "use strict";
  11563. var path = require("path");
  11564. var scan = require_scan();
  11565. var parse = require_parse2();
  11566. var utils = require_utils3();
  11567. var constants = require_constants3();
  11568. var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
  11569. var picomatch = (glob, options, returnState = false) => {
  11570. if (Array.isArray(glob)) {
  11571. const fns = glob.map((input) => picomatch(input, options, returnState));
  11572. const arrayMatcher = (str) => {
  11573. for (const isMatch of fns) {
  11574. const state2 = isMatch(str);
  11575. if (state2)
  11576. return state2;
  11577. }
  11578. return false;
  11579. };
  11580. return arrayMatcher;
  11581. }
  11582. const isState = isObject(glob) && glob.tokens && glob.input;
  11583. if (glob === "" || typeof glob !== "string" && !isState) {
  11584. throw new TypeError("Expected pattern to be a non-empty string");
  11585. }
  11586. const opts = options || {};
  11587. const posix = utils.isWindows(options);
  11588. const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
  11589. const state = regex.state;
  11590. delete regex.state;
  11591. let isIgnored = () => false;
  11592. if (opts.ignore) {
  11593. const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
  11594. ignore: null,
  11595. onMatch: null,
  11596. onResult: null
  11597. });
  11598. isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  11599. }
  11600. const matcher = (input, returnObject = false) => {
  11601. const {
  11602. isMatch,
  11603. match,
  11604. output
  11605. } = picomatch.test(input, regex, options, {
  11606. glob,
  11607. posix
  11608. });
  11609. const result = {
  11610. glob,
  11611. state,
  11612. regex,
  11613. posix,
  11614. input,
  11615. output,
  11616. match,
  11617. isMatch
  11618. };
  11619. if (typeof opts.onResult === "function") {
  11620. opts.onResult(result);
  11621. }
  11622. if (isMatch === false) {
  11623. result.isMatch = false;
  11624. return returnObject ? result : false;
  11625. }
  11626. if (isIgnored(input)) {
  11627. if (typeof opts.onIgnore === "function") {
  11628. opts.onIgnore(result);
  11629. }
  11630. result.isMatch = false;
  11631. return returnObject ? result : false;
  11632. }
  11633. if (typeof opts.onMatch === "function") {
  11634. opts.onMatch(result);
  11635. }
  11636. return returnObject ? result : true;
  11637. };
  11638. if (returnState) {
  11639. matcher.state = state;
  11640. }
  11641. return matcher;
  11642. };
  11643. picomatch.test = (input, regex, options, {
  11644. glob,
  11645. posix
  11646. } = {}) => {
  11647. if (typeof input !== "string") {
  11648. throw new TypeError("Expected input to be a string");
  11649. }
  11650. if (input === "") {
  11651. return {
  11652. isMatch: false,
  11653. output: ""
  11654. };
  11655. }
  11656. const opts = options || {};
  11657. const format = opts.format || (posix ? utils.toPosixSlashes : null);
  11658. let match = input === glob;
  11659. let output = match && format ? format(input) : input;
  11660. if (match === false) {
  11661. output = format ? format(input) : input;
  11662. match = output === glob;
  11663. }
  11664. if (match === false || opts.capture === true) {
  11665. if (opts.matchBase === true || opts.basename === true) {
  11666. match = picomatch.matchBase(input, regex, options, posix);
  11667. } else {
  11668. match = regex.exec(output);
  11669. }
  11670. }
  11671. return {
  11672. isMatch: Boolean(match),
  11673. match,
  11674. output
  11675. };
  11676. };
  11677. picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  11678. const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  11679. return regex.test(path.basename(input));
  11680. };
  11681. picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11682. picomatch.parse = (pattern, options) => {
  11683. if (Array.isArray(pattern))
  11684. return pattern.map((p) => picomatch.parse(p, options));
  11685. return parse(pattern, Object.assign(Object.assign({}, options), {}, {
  11686. fastpaths: false
  11687. }));
  11688. };
  11689. picomatch.scan = (input, options) => scan(input, options);
  11690. picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  11691. if (returnOutput === true) {
  11692. return state.output;
  11693. }
  11694. const opts = options || {};
  11695. const prepend = opts.contains ? "" : "^";
  11696. const append = opts.contains ? "" : "$";
  11697. let source = `${prepend}(?:${state.output})${append}`;
  11698. if (state && state.negated === true) {
  11699. source = `^(?!${source}).*$`;
  11700. }
  11701. const regex = picomatch.toRegex(source, options);
  11702. if (returnState === true) {
  11703. regex.state = state;
  11704. }
  11705. return regex;
  11706. };
  11707. picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  11708. if (!input || typeof input !== "string") {
  11709. throw new TypeError("Expected a non-empty string");
  11710. }
  11711. let parsed = {
  11712. negated: false,
  11713. fastpaths: true
  11714. };
  11715. if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
  11716. parsed.output = parse.fastpaths(input, options);
  11717. }
  11718. if (!parsed.output) {
  11719. parsed = parse(input, options);
  11720. }
  11721. return picomatch.compileRe(parsed, options, returnOutput, returnState);
  11722. };
  11723. picomatch.toRegex = (source, options) => {
  11724. try {
  11725. const opts = options || {};
  11726. return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
  11727. } catch (err) {
  11728. if (options && options.debug === true)
  11729. throw err;
  11730. return /$^/;
  11731. }
  11732. };
  11733. picomatch.constants = constants;
  11734. module2.exports = picomatch;
  11735. }
  11736. });
  11737. var require_picomatch2 = __commonJS2({
  11738. "node_modules/picomatch/index.js"(exports2, module2) {
  11739. "use strict";
  11740. module2.exports = require_picomatch();
  11741. }
  11742. });
  11743. var require_micromatch = __commonJS2({
  11744. "node_modules/micromatch/index.js"(exports2, module2) {
  11745. "use strict";
  11746. var util = require("util");
  11747. var braces = require_braces();
  11748. var picomatch = require_picomatch2();
  11749. var utils = require_utils3();
  11750. var isEmptyString = (val) => val === "" || val === "./";
  11751. var micromatch = (list, patterns, options) => {
  11752. patterns = [].concat(patterns);
  11753. list = [].concat(list);
  11754. let omit = /* @__PURE__ */ new Set();
  11755. let keep = /* @__PURE__ */ new Set();
  11756. let items = /* @__PURE__ */ new Set();
  11757. let negatives = 0;
  11758. let onResult = (state) => {
  11759. items.add(state.output);
  11760. if (options && options.onResult) {
  11761. options.onResult(state);
  11762. }
  11763. };
  11764. for (let i = 0; i < patterns.length; i++) {
  11765. let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
  11766. onResult
  11767. }), true);
  11768. let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
  11769. if (negated)
  11770. negatives++;
  11771. for (let item of list) {
  11772. let matched = isMatch(item, true);
  11773. let match = negated ? !matched.isMatch : matched.isMatch;
  11774. if (!match)
  11775. continue;
  11776. if (negated) {
  11777. omit.add(matched.output);
  11778. } else {
  11779. omit.delete(matched.output);
  11780. keep.add(matched.output);
  11781. }
  11782. }
  11783. }
  11784. let result = negatives === patterns.length ? [...items] : [...keep];
  11785. let matches = result.filter((item) => !omit.has(item));
  11786. if (options && matches.length === 0) {
  11787. if (options.failglob === true) {
  11788. throw new Error(`No matches found for "${patterns.join(", ")}"`);
  11789. }
  11790. if (options.nonull === true || options.nullglob === true) {
  11791. return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
  11792. }
  11793. }
  11794. return matches;
  11795. };
  11796. micromatch.match = micromatch;
  11797. micromatch.matcher = (pattern, options) => picomatch(pattern, options);
  11798. micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11799. micromatch.any = micromatch.isMatch;
  11800. micromatch.not = (list, patterns, options = {}) => {
  11801. patterns = [].concat(patterns).map(String);
  11802. let result = /* @__PURE__ */ new Set();
  11803. let items = [];
  11804. let onResult = (state) => {
  11805. if (options.onResult)
  11806. options.onResult(state);
  11807. items.push(state.output);
  11808. };
  11809. let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
  11810. onResult
  11811. })));
  11812. for (let item of items) {
  11813. if (!matches.has(item)) {
  11814. result.add(item);
  11815. }
  11816. }
  11817. return [...result];
  11818. };
  11819. micromatch.contains = (str, pattern, options) => {
  11820. if (typeof str !== "string") {
  11821. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11822. }
  11823. if (Array.isArray(pattern)) {
  11824. return pattern.some((p) => micromatch.contains(str, p, options));
  11825. }
  11826. if (typeof pattern === "string") {
  11827. if (isEmptyString(str) || isEmptyString(pattern)) {
  11828. return false;
  11829. }
  11830. if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
  11831. return true;
  11832. }
  11833. }
  11834. return micromatch.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
  11835. contains: true
  11836. }));
  11837. };
  11838. micromatch.matchKeys = (obj, patterns, options) => {
  11839. if (!utils.isObject(obj)) {
  11840. throw new TypeError("Expected the first argument to be an object");
  11841. }
  11842. let keys = micromatch(Object.keys(obj), patterns, options);
  11843. let res = {};
  11844. for (let key of keys)
  11845. res[key] = obj[key];
  11846. return res;
  11847. };
  11848. micromatch.some = (list, patterns, options) => {
  11849. let items = [].concat(list);
  11850. for (let pattern of [].concat(patterns)) {
  11851. let isMatch = picomatch(String(pattern), options);
  11852. if (items.some((item) => isMatch(item))) {
  11853. return true;
  11854. }
  11855. }
  11856. return false;
  11857. };
  11858. micromatch.every = (list, patterns, options) => {
  11859. let items = [].concat(list);
  11860. for (let pattern of [].concat(patterns)) {
  11861. let isMatch = picomatch(String(pattern), options);
  11862. if (!items.every((item) => isMatch(item))) {
  11863. return false;
  11864. }
  11865. }
  11866. return true;
  11867. };
  11868. micromatch.all = (str, patterns, options) => {
  11869. if (typeof str !== "string") {
  11870. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11871. }
  11872. return [].concat(patterns).every((p) => picomatch(p, options)(str));
  11873. };
  11874. micromatch.capture = (glob, input, options) => {
  11875. let posix = utils.isWindows(options);
  11876. let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
  11877. capture: true
  11878. }));
  11879. let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
  11880. if (match) {
  11881. return match.slice(1).map((v) => v === void 0 ? "" : v);
  11882. }
  11883. };
  11884. micromatch.makeRe = (...args) => picomatch.makeRe(...args);
  11885. micromatch.scan = (...args) => picomatch.scan(...args);
  11886. micromatch.parse = (patterns, options) => {
  11887. let res = [];
  11888. for (let pattern of [].concat(patterns || [])) {
  11889. for (let str of braces(String(pattern), options)) {
  11890. res.push(picomatch.parse(str, options));
  11891. }
  11892. }
  11893. return res;
  11894. };
  11895. micromatch.braces = (pattern, options) => {
  11896. if (typeof pattern !== "string")
  11897. throw new TypeError("Expected a string");
  11898. if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
  11899. return [pattern];
  11900. }
  11901. return braces(pattern, options);
  11902. };
  11903. micromatch.braceExpand = (pattern, options) => {
  11904. if (typeof pattern !== "string")
  11905. throw new TypeError("Expected a string");
  11906. return micromatch.braces(pattern, Object.assign(Object.assign({}, options), {}, {
  11907. expand: true
  11908. }));
  11909. };
  11910. module2.exports = micromatch;
  11911. }
  11912. });
  11913. var require_parser2 = __commonJS2({
  11914. "node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
  11915. "use strict";
  11916. var ParserEND = 1114112;
  11917. var ParserError = class extends Error {
  11918. constructor(msg, filename, linenumber) {
  11919. super("[ParserError] " + msg, filename, linenumber);
  11920. this.name = "ParserError";
  11921. this.code = "ParserError";
  11922. if (Error.captureStackTrace)
  11923. Error.captureStackTrace(this, ParserError);
  11924. }
  11925. };
  11926. var State = class {
  11927. constructor(parser) {
  11928. this.parser = parser;
  11929. this.buf = "";
  11930. this.returned = null;
  11931. this.result = null;
  11932. this.resultTable = null;
  11933. this.resultArr = null;
  11934. }
  11935. };
  11936. var Parser = class {
  11937. constructor() {
  11938. this.pos = 0;
  11939. this.col = 0;
  11940. this.line = 0;
  11941. this.obj = {};
  11942. this.ctx = this.obj;
  11943. this.stack = [];
  11944. this._buf = "";
  11945. this.char = null;
  11946. this.ii = 0;
  11947. this.state = new State(this.parseStart);
  11948. }
  11949. parse(str) {
  11950. if (str.length === 0 || str.length == null)
  11951. return;
  11952. this._buf = String(str);
  11953. this.ii = -1;
  11954. this.char = -1;
  11955. let getNext;
  11956. while (getNext === false || this.nextChar()) {
  11957. getNext = this.runOne();
  11958. }
  11959. this._buf = null;
  11960. }
  11961. nextChar() {
  11962. if (this.char === 10) {
  11963. ++this.line;
  11964. this.col = -1;
  11965. }
  11966. ++this.ii;
  11967. this.char = this._buf.codePointAt(this.ii);
  11968. ++this.pos;
  11969. ++this.col;
  11970. return this.haveBuffer();
  11971. }
  11972. haveBuffer() {
  11973. return this.ii < this._buf.length;
  11974. }
  11975. runOne() {
  11976. return this.state.parser.call(this, this.state.returned);
  11977. }
  11978. finish() {
  11979. this.char = ParserEND;
  11980. let last;
  11981. do {
  11982. last = this.state.parser;
  11983. this.runOne();
  11984. } while (this.state.parser !== last);
  11985. this.ctx = null;
  11986. this.state = null;
  11987. this._buf = null;
  11988. return this.obj;
  11989. }
  11990. next(fn) {
  11991. if (typeof fn !== "function")
  11992. throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
  11993. this.state.parser = fn;
  11994. }
  11995. goto(fn) {
  11996. this.next(fn);
  11997. return this.runOne();
  11998. }
  11999. call(fn, returnWith) {
  12000. if (returnWith)
  12001. this.next(returnWith);
  12002. this.stack.push(this.state);
  12003. this.state = new State(fn);
  12004. }
  12005. callNow(fn, returnWith) {
  12006. this.call(fn, returnWith);
  12007. return this.runOne();
  12008. }
  12009. return(value) {
  12010. if (this.stack.length === 0)
  12011. throw this.error(new ParserError("Stack underflow"));
  12012. if (value === void 0)
  12013. value = this.state.buf;
  12014. this.state = this.stack.pop();
  12015. this.state.returned = value;
  12016. }
  12017. returnNow(value) {
  12018. this.return(value);
  12019. return this.runOne();
  12020. }
  12021. consume() {
  12022. if (this.char === ParserEND)
  12023. throw this.error(new ParserError("Unexpected end-of-buffer"));
  12024. this.state.buf += this._buf[this.ii];
  12025. }
  12026. error(err) {
  12027. err.line = this.line;
  12028. err.col = this.col;
  12029. err.pos = this.pos;
  12030. return err;
  12031. }
  12032. parseStart() {
  12033. throw new ParserError("Must declare a parseStart method");
  12034. }
  12035. };
  12036. Parser.END = ParserEND;
  12037. Parser.Error = ParserError;
  12038. module2.exports = Parser;
  12039. }
  12040. });
  12041. var require_create_datetime = __commonJS2({
  12042. "node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
  12043. "use strict";
  12044. module2.exports = (value) => {
  12045. const date = new Date(value);
  12046. if (isNaN(date)) {
  12047. throw new TypeError("Invalid Datetime");
  12048. } else {
  12049. return date;
  12050. }
  12051. };
  12052. }
  12053. });
  12054. var require_format_num = __commonJS2({
  12055. "node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
  12056. "use strict";
  12057. module2.exports = (d, num) => {
  12058. num = String(num);
  12059. while (num.length < d)
  12060. num = "0" + num;
  12061. return num;
  12062. };
  12063. }
  12064. });
  12065. var require_create_datetime_float = __commonJS2({
  12066. "node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
  12067. "use strict";
  12068. var f = require_format_num();
  12069. var FloatingDateTime = class extends Date {
  12070. constructor(value) {
  12071. super(value + "Z");
  12072. this.isFloating = true;
  12073. }
  12074. toISOString() {
  12075. const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  12076. const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  12077. return `${date}T${time}`;
  12078. }
  12079. };
  12080. module2.exports = (value) => {
  12081. const date = new FloatingDateTime(value);
  12082. if (isNaN(date)) {
  12083. throw new TypeError("Invalid Datetime");
  12084. } else {
  12085. return date;
  12086. }
  12087. };
  12088. }
  12089. });
  12090. var require_create_date = __commonJS2({
  12091. "node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
  12092. "use strict";
  12093. var f = require_format_num();
  12094. var DateTime = global.Date;
  12095. var Date2 = class extends DateTime {
  12096. constructor(value) {
  12097. super(value);
  12098. this.isDate = true;
  12099. }
  12100. toISOString() {
  12101. return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  12102. }
  12103. };
  12104. module2.exports = (value) => {
  12105. const date = new Date2(value);
  12106. if (isNaN(date)) {
  12107. throw new TypeError("Invalid Datetime");
  12108. } else {
  12109. return date;
  12110. }
  12111. };
  12112. }
  12113. });
  12114. var require_create_time = __commonJS2({
  12115. "node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
  12116. "use strict";
  12117. var f = require_format_num();
  12118. var Time = class extends Date {
  12119. constructor(value) {
  12120. super(`0000-01-01T${value}Z`);
  12121. this.isTime = true;
  12122. }
  12123. toISOString() {
  12124. return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  12125. }
  12126. };
  12127. module2.exports = (value) => {
  12128. const date = new Time(value);
  12129. if (isNaN(date)) {
  12130. throw new TypeError("Invalid Datetime");
  12131. } else {
  12132. return date;
  12133. }
  12134. };
  12135. }
  12136. });
  12137. var require_toml_parser = __commonJS2({
  12138. "node_modules/@iarna/toml/lib/toml-parser.js"(exports2, module2) {
  12139. "use strict";
  12140. module2.exports = makeParserClass(require_parser2());
  12141. module2.exports.makeParserClass = makeParserClass;
  12142. var TomlError = class extends Error {
  12143. constructor(msg) {
  12144. super(msg);
  12145. this.name = "TomlError";
  12146. if (Error.captureStackTrace)
  12147. Error.captureStackTrace(this, TomlError);
  12148. this.fromTOML = true;
  12149. this.wrapped = null;
  12150. }
  12151. };
  12152. TomlError.wrap = (err) => {
  12153. const terr = new TomlError(err.message);
  12154. terr.code = err.code;
  12155. terr.wrapped = err;
  12156. return terr;
  12157. };
  12158. module2.exports.TomlError = TomlError;
  12159. var createDateTime = require_create_datetime();
  12160. var createDateTimeFloat = require_create_datetime_float();
  12161. var createDate = require_create_date();
  12162. var createTime = require_create_time();
  12163. var CTRL_I = 9;
  12164. var CTRL_J = 10;
  12165. var CTRL_M = 13;
  12166. var CTRL_CHAR_BOUNDARY = 31;
  12167. var CHAR_SP = 32;
  12168. var CHAR_QUOT = 34;
  12169. var CHAR_NUM = 35;
  12170. var CHAR_APOS = 39;
  12171. var CHAR_PLUS = 43;
  12172. var CHAR_COMMA = 44;
  12173. var CHAR_HYPHEN = 45;
  12174. var CHAR_PERIOD = 46;
  12175. var CHAR_0 = 48;
  12176. var CHAR_1 = 49;
  12177. var CHAR_7 = 55;
  12178. var CHAR_9 = 57;
  12179. var CHAR_COLON = 58;
  12180. var CHAR_EQUALS = 61;
  12181. var CHAR_A = 65;
  12182. var CHAR_E = 69;
  12183. var CHAR_F = 70;
  12184. var CHAR_T = 84;
  12185. var CHAR_U = 85;
  12186. var CHAR_Z = 90;
  12187. var CHAR_LOWBAR = 95;
  12188. var CHAR_a = 97;
  12189. var CHAR_b = 98;
  12190. var CHAR_e = 101;
  12191. var CHAR_f = 102;
  12192. var CHAR_i = 105;
  12193. var CHAR_l = 108;
  12194. var CHAR_n = 110;
  12195. var CHAR_o = 111;
  12196. var CHAR_r = 114;
  12197. var CHAR_s = 115;
  12198. var CHAR_t = 116;
  12199. var CHAR_u = 117;
  12200. var CHAR_x = 120;
  12201. var CHAR_z = 122;
  12202. var CHAR_LCUB = 123;
  12203. var CHAR_RCUB = 125;
  12204. var CHAR_LSQB = 91;
  12205. var CHAR_BSOL = 92;
  12206. var CHAR_RSQB = 93;
  12207. var CHAR_DEL = 127;
  12208. var SURROGATE_FIRST = 55296;
  12209. var SURROGATE_LAST = 57343;
  12210. var escapes = {
  12211. [CHAR_b]: "\b",
  12212. [CHAR_t]: " ",
  12213. [CHAR_n]: "\n",
  12214. [CHAR_f]: "\f",
  12215. [CHAR_r]: "\r",
  12216. [CHAR_QUOT]: '"',
  12217. [CHAR_BSOL]: "\\"
  12218. };
  12219. function isDigit(cp) {
  12220. return cp >= CHAR_0 && cp <= CHAR_9;
  12221. }
  12222. function isHexit(cp) {
  12223. return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
  12224. }
  12225. function isBit(cp) {
  12226. return cp === CHAR_1 || cp === CHAR_0;
  12227. }
  12228. function isOctit(cp) {
  12229. return cp >= CHAR_0 && cp <= CHAR_7;
  12230. }
  12231. function isAlphaNumQuoteHyphen(cp) {
  12232. 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;
  12233. }
  12234. function isAlphaNumHyphen(cp) {
  12235. 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;
  12236. }
  12237. var _type = Symbol("type");
  12238. var _declared = Symbol("declared");
  12239. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12240. var defineProperty = Object.defineProperty;
  12241. var descriptor = {
  12242. configurable: true,
  12243. enumerable: true,
  12244. writable: true,
  12245. value: void 0
  12246. };
  12247. function hasKey(obj, key) {
  12248. if (hasOwnProperty.call(obj, key))
  12249. return true;
  12250. if (key === "__proto__")
  12251. defineProperty(obj, "__proto__", descriptor);
  12252. return false;
  12253. }
  12254. var INLINE_TABLE = Symbol("inline-table");
  12255. function InlineTable() {
  12256. return Object.defineProperties({}, {
  12257. [_type]: {
  12258. value: INLINE_TABLE
  12259. }
  12260. });
  12261. }
  12262. function isInlineTable(obj) {
  12263. if (obj === null || typeof obj !== "object")
  12264. return false;
  12265. return obj[_type] === INLINE_TABLE;
  12266. }
  12267. var TABLE = Symbol("table");
  12268. function Table() {
  12269. return Object.defineProperties({}, {
  12270. [_type]: {
  12271. value: TABLE
  12272. },
  12273. [_declared]: {
  12274. value: false,
  12275. writable: true
  12276. }
  12277. });
  12278. }
  12279. function isTable(obj) {
  12280. if (obj === null || typeof obj !== "object")
  12281. return false;
  12282. return obj[_type] === TABLE;
  12283. }
  12284. var _contentType = Symbol("content-type");
  12285. var INLINE_LIST = Symbol("inline-list");
  12286. function InlineList(type) {
  12287. return Object.defineProperties([], {
  12288. [_type]: {
  12289. value: INLINE_LIST
  12290. },
  12291. [_contentType]: {
  12292. value: type
  12293. }
  12294. });
  12295. }
  12296. function isInlineList(obj) {
  12297. if (obj === null || typeof obj !== "object")
  12298. return false;
  12299. return obj[_type] === INLINE_LIST;
  12300. }
  12301. var LIST = Symbol("list");
  12302. function List() {
  12303. return Object.defineProperties([], {
  12304. [_type]: {
  12305. value: LIST
  12306. }
  12307. });
  12308. }
  12309. function isList(obj) {
  12310. if (obj === null || typeof obj !== "object")
  12311. return false;
  12312. return obj[_type] === LIST;
  12313. }
  12314. var _custom;
  12315. try {
  12316. const utilInspect = require("util").inspect;
  12317. _custom = utilInspect.custom;
  12318. } catch (_) {
  12319. }
  12320. var _inspect = _custom || "inspect";
  12321. var BoxedBigInt = class {
  12322. constructor(value) {
  12323. try {
  12324. this.value = global.BigInt.asIntN(64, value);
  12325. } catch (_) {
  12326. this.value = null;
  12327. }
  12328. Object.defineProperty(this, _type, {
  12329. value: INTEGER
  12330. });
  12331. }
  12332. isNaN() {
  12333. return this.value === null;
  12334. }
  12335. toString() {
  12336. return String(this.value);
  12337. }
  12338. [_inspect]() {
  12339. return `[BigInt: ${this.toString()}]}`;
  12340. }
  12341. valueOf() {
  12342. return this.value;
  12343. }
  12344. };
  12345. var INTEGER = Symbol("integer");
  12346. function Integer(value) {
  12347. let num = Number(value);
  12348. if (Object.is(num, -0))
  12349. num = 0;
  12350. if (global.BigInt && !Number.isSafeInteger(num)) {
  12351. return new BoxedBigInt(value);
  12352. } else {
  12353. return Object.defineProperties(new Number(num), {
  12354. isNaN: {
  12355. value: function() {
  12356. return isNaN(this);
  12357. }
  12358. },
  12359. [_type]: {
  12360. value: INTEGER
  12361. },
  12362. [_inspect]: {
  12363. value: () => `[Integer: ${value}]`
  12364. }
  12365. });
  12366. }
  12367. }
  12368. function isInteger(obj) {
  12369. if (obj === null || typeof obj !== "object")
  12370. return false;
  12371. return obj[_type] === INTEGER;
  12372. }
  12373. var FLOAT = Symbol("float");
  12374. function Float(value) {
  12375. return Object.defineProperties(new Number(value), {
  12376. [_type]: {
  12377. value: FLOAT
  12378. },
  12379. [_inspect]: {
  12380. value: () => `[Float: ${value}]`
  12381. }
  12382. });
  12383. }
  12384. function isFloat(obj) {
  12385. if (obj === null || typeof obj !== "object")
  12386. return false;
  12387. return obj[_type] === FLOAT;
  12388. }
  12389. function tomlType(value) {
  12390. const type = typeof value;
  12391. if (type === "object") {
  12392. if (value === null)
  12393. return "null";
  12394. if (value instanceof Date)
  12395. return "datetime";
  12396. if (_type in value) {
  12397. switch (value[_type]) {
  12398. case INLINE_TABLE:
  12399. return "inline-table";
  12400. case INLINE_LIST:
  12401. return "inline-list";
  12402. case TABLE:
  12403. return "table";
  12404. case LIST:
  12405. return "list";
  12406. case FLOAT:
  12407. return "float";
  12408. case INTEGER:
  12409. return "integer";
  12410. }
  12411. }
  12412. }
  12413. return type;
  12414. }
  12415. function makeParserClass(Parser) {
  12416. class TOMLParser extends Parser {
  12417. constructor() {
  12418. super();
  12419. this.ctx = this.obj = Table();
  12420. }
  12421. atEndOfWord() {
  12422. return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
  12423. }
  12424. atEndOfLine() {
  12425. return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
  12426. }
  12427. parseStart() {
  12428. if (this.char === Parser.END) {
  12429. return null;
  12430. } else if (this.char === CHAR_LSQB) {
  12431. return this.call(this.parseTableOrList);
  12432. } else if (this.char === CHAR_NUM) {
  12433. return this.call(this.parseComment);
  12434. } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12435. return null;
  12436. } else if (isAlphaNumQuoteHyphen(this.char)) {
  12437. return this.callNow(this.parseAssignStatement);
  12438. } else {
  12439. throw this.error(new TomlError(`Unknown character "${this.char}"`));
  12440. }
  12441. }
  12442. parseWhitespaceToEOL() {
  12443. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12444. return null;
  12445. } else if (this.char === CHAR_NUM) {
  12446. return this.goto(this.parseComment);
  12447. } else if (this.char === Parser.END || this.char === CTRL_J) {
  12448. return this.return();
  12449. } else {
  12450. throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
  12451. }
  12452. }
  12453. parseAssignStatement() {
  12454. return this.callNow(this.parseAssign, this.recordAssignStatement);
  12455. }
  12456. recordAssignStatement(kv) {
  12457. let target = this.ctx;
  12458. let finalKey = kv.key.pop();
  12459. for (let kw of kv.key) {
  12460. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  12461. throw this.error(new TomlError("Can't redefine existing key"));
  12462. }
  12463. target = target[kw] = target[kw] || Table();
  12464. }
  12465. if (hasKey(target, finalKey)) {
  12466. throw this.error(new TomlError("Can't redefine existing key"));
  12467. }
  12468. if (isInteger(kv.value) || isFloat(kv.value)) {
  12469. target[finalKey] = kv.value.valueOf();
  12470. } else {
  12471. target[finalKey] = kv.value;
  12472. }
  12473. return this.goto(this.parseWhitespaceToEOL);
  12474. }
  12475. parseAssign() {
  12476. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12477. }
  12478. recordAssignKeyword(key) {
  12479. if (this.state.resultTable) {
  12480. this.state.resultTable.push(key);
  12481. } else {
  12482. this.state.resultTable = [key];
  12483. }
  12484. return this.goto(this.parseAssignKeywordPreDot);
  12485. }
  12486. parseAssignKeywordPreDot() {
  12487. if (this.char === CHAR_PERIOD) {
  12488. return this.next(this.parseAssignKeywordPostDot);
  12489. } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12490. return this.goto(this.parseAssignEqual);
  12491. }
  12492. }
  12493. parseAssignKeywordPostDot() {
  12494. if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12495. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12496. }
  12497. }
  12498. parseAssignEqual() {
  12499. if (this.char === CHAR_EQUALS) {
  12500. return this.next(this.parseAssignPreValue);
  12501. } else {
  12502. throw this.error(new TomlError('Invalid character, expected "="'));
  12503. }
  12504. }
  12505. parseAssignPreValue() {
  12506. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12507. return null;
  12508. } else {
  12509. return this.callNow(this.parseValue, this.recordAssignValue);
  12510. }
  12511. }
  12512. recordAssignValue(value) {
  12513. return this.returnNow({
  12514. key: this.state.resultTable,
  12515. value
  12516. });
  12517. }
  12518. parseComment() {
  12519. do {
  12520. if (this.char === Parser.END || this.char === CTRL_J) {
  12521. return this.return();
  12522. }
  12523. } while (this.nextChar());
  12524. }
  12525. parseTableOrList() {
  12526. if (this.char === CHAR_LSQB) {
  12527. this.next(this.parseList);
  12528. } else {
  12529. return this.goto(this.parseTable);
  12530. }
  12531. }
  12532. parseTable() {
  12533. this.ctx = this.obj;
  12534. return this.goto(this.parseTableNext);
  12535. }
  12536. parseTableNext() {
  12537. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12538. return null;
  12539. } else {
  12540. return this.callNow(this.parseKeyword, this.parseTableMore);
  12541. }
  12542. }
  12543. parseTableMore(keyword) {
  12544. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12545. return null;
  12546. } else if (this.char === CHAR_RSQB) {
  12547. if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
  12548. throw this.error(new TomlError("Can't redefine existing key"));
  12549. } else {
  12550. this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
  12551. this.ctx[_declared] = true;
  12552. }
  12553. return this.next(this.parseWhitespaceToEOL);
  12554. } else if (this.char === CHAR_PERIOD) {
  12555. if (!hasKey(this.ctx, keyword)) {
  12556. this.ctx = this.ctx[keyword] = Table();
  12557. } else if (isTable(this.ctx[keyword])) {
  12558. this.ctx = this.ctx[keyword];
  12559. } else if (isList(this.ctx[keyword])) {
  12560. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12561. } else {
  12562. throw this.error(new TomlError("Can't redefine existing key"));
  12563. }
  12564. return this.next(this.parseTableNext);
  12565. } else {
  12566. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12567. }
  12568. }
  12569. parseList() {
  12570. this.ctx = this.obj;
  12571. return this.goto(this.parseListNext);
  12572. }
  12573. parseListNext() {
  12574. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12575. return null;
  12576. } else {
  12577. return this.callNow(this.parseKeyword, this.parseListMore);
  12578. }
  12579. }
  12580. parseListMore(keyword) {
  12581. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12582. return null;
  12583. } else if (this.char === CHAR_RSQB) {
  12584. if (!hasKey(this.ctx, keyword)) {
  12585. this.ctx[keyword] = List();
  12586. }
  12587. if (isInlineList(this.ctx[keyword])) {
  12588. throw this.error(new TomlError("Can't extend an inline array"));
  12589. } else if (isList(this.ctx[keyword])) {
  12590. const next = Table();
  12591. this.ctx[keyword].push(next);
  12592. this.ctx = next;
  12593. } else {
  12594. throw this.error(new TomlError("Can't redefine an existing key"));
  12595. }
  12596. return this.next(this.parseListEnd);
  12597. } else if (this.char === CHAR_PERIOD) {
  12598. if (!hasKey(this.ctx, keyword)) {
  12599. this.ctx = this.ctx[keyword] = Table();
  12600. } else if (isInlineList(this.ctx[keyword])) {
  12601. throw this.error(new TomlError("Can't extend an inline array"));
  12602. } else if (isInlineTable(this.ctx[keyword])) {
  12603. throw this.error(new TomlError("Can't extend an inline table"));
  12604. } else if (isList(this.ctx[keyword])) {
  12605. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12606. } else if (isTable(this.ctx[keyword])) {
  12607. this.ctx = this.ctx[keyword];
  12608. } else {
  12609. throw this.error(new TomlError("Can't redefine an existing key"));
  12610. }
  12611. return this.next(this.parseListNext);
  12612. } else {
  12613. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12614. }
  12615. }
  12616. parseListEnd(keyword) {
  12617. if (this.char === CHAR_RSQB) {
  12618. return this.next(this.parseWhitespaceToEOL);
  12619. } else {
  12620. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12621. }
  12622. }
  12623. parseValue() {
  12624. if (this.char === Parser.END) {
  12625. throw this.error(new TomlError("Key without value"));
  12626. } else if (this.char === CHAR_QUOT) {
  12627. return this.next(this.parseDoubleString);
  12628. }
  12629. if (this.char === CHAR_APOS) {
  12630. return this.next(this.parseSingleString);
  12631. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  12632. return this.goto(this.parseNumberSign);
  12633. } else if (this.char === CHAR_i) {
  12634. return this.next(this.parseInf);
  12635. } else if (this.char === CHAR_n) {
  12636. return this.next(this.parseNan);
  12637. } else if (isDigit(this.char)) {
  12638. return this.goto(this.parseNumberOrDateTime);
  12639. } else if (this.char === CHAR_t || this.char === CHAR_f) {
  12640. return this.goto(this.parseBoolean);
  12641. } else if (this.char === CHAR_LSQB) {
  12642. return this.call(this.parseInlineList, this.recordValue);
  12643. } else if (this.char === CHAR_LCUB) {
  12644. return this.call(this.parseInlineTable, this.recordValue);
  12645. } else {
  12646. throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
  12647. }
  12648. }
  12649. recordValue(value) {
  12650. return this.returnNow(value);
  12651. }
  12652. parseInf() {
  12653. if (this.char === CHAR_n) {
  12654. return this.next(this.parseInf2);
  12655. } else {
  12656. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12657. }
  12658. }
  12659. parseInf2() {
  12660. if (this.char === CHAR_f) {
  12661. if (this.state.buf === "-") {
  12662. return this.return(-Infinity);
  12663. } else {
  12664. return this.return(Infinity);
  12665. }
  12666. } else {
  12667. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12668. }
  12669. }
  12670. parseNan() {
  12671. if (this.char === CHAR_a) {
  12672. return this.next(this.parseNan2);
  12673. } else {
  12674. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12675. }
  12676. }
  12677. parseNan2() {
  12678. if (this.char === CHAR_n) {
  12679. return this.return(NaN);
  12680. } else {
  12681. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12682. }
  12683. }
  12684. parseKeyword() {
  12685. if (this.char === CHAR_QUOT) {
  12686. return this.next(this.parseBasicString);
  12687. } else if (this.char === CHAR_APOS) {
  12688. return this.next(this.parseLiteralString);
  12689. } else {
  12690. return this.goto(this.parseBareKey);
  12691. }
  12692. }
  12693. parseBareKey() {
  12694. do {
  12695. if (this.char === Parser.END) {
  12696. throw this.error(new TomlError("Key ended without value"));
  12697. } else if (isAlphaNumHyphen(this.char)) {
  12698. this.consume();
  12699. } else if (this.state.buf.length === 0) {
  12700. throw this.error(new TomlError("Empty bare keys are not allowed"));
  12701. } else {
  12702. return this.returnNow();
  12703. }
  12704. } while (this.nextChar());
  12705. }
  12706. parseSingleString() {
  12707. if (this.char === CHAR_APOS) {
  12708. return this.next(this.parseLiteralMultiStringMaybe);
  12709. } else {
  12710. return this.goto(this.parseLiteralString);
  12711. }
  12712. }
  12713. parseLiteralString() {
  12714. do {
  12715. if (this.char === CHAR_APOS) {
  12716. return this.return();
  12717. } else if (this.atEndOfLine()) {
  12718. throw this.error(new TomlError("Unterminated string"));
  12719. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12720. throw this.errorControlCharInString();
  12721. } else {
  12722. this.consume();
  12723. }
  12724. } while (this.nextChar());
  12725. }
  12726. parseLiteralMultiStringMaybe() {
  12727. if (this.char === CHAR_APOS) {
  12728. return this.next(this.parseLiteralMultiString);
  12729. } else {
  12730. return this.returnNow();
  12731. }
  12732. }
  12733. parseLiteralMultiString() {
  12734. if (this.char === CTRL_M) {
  12735. return null;
  12736. } else if (this.char === CTRL_J) {
  12737. return this.next(this.parseLiteralMultiStringContent);
  12738. } else {
  12739. return this.goto(this.parseLiteralMultiStringContent);
  12740. }
  12741. }
  12742. parseLiteralMultiStringContent() {
  12743. do {
  12744. if (this.char === CHAR_APOS) {
  12745. return this.next(this.parseLiteralMultiEnd);
  12746. } else if (this.char === Parser.END) {
  12747. throw this.error(new TomlError("Unterminated multi-line string"));
  12748. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12749. throw this.errorControlCharInString();
  12750. } else {
  12751. this.consume();
  12752. }
  12753. } while (this.nextChar());
  12754. }
  12755. parseLiteralMultiEnd() {
  12756. if (this.char === CHAR_APOS) {
  12757. return this.next(this.parseLiteralMultiEnd2);
  12758. } else {
  12759. this.state.buf += "'";
  12760. return this.goto(this.parseLiteralMultiStringContent);
  12761. }
  12762. }
  12763. parseLiteralMultiEnd2() {
  12764. if (this.char === CHAR_APOS) {
  12765. return this.return();
  12766. } else {
  12767. this.state.buf += "''";
  12768. return this.goto(this.parseLiteralMultiStringContent);
  12769. }
  12770. }
  12771. parseDoubleString() {
  12772. if (this.char === CHAR_QUOT) {
  12773. return this.next(this.parseMultiStringMaybe);
  12774. } else {
  12775. return this.goto(this.parseBasicString);
  12776. }
  12777. }
  12778. parseBasicString() {
  12779. do {
  12780. if (this.char === CHAR_BSOL) {
  12781. return this.call(this.parseEscape, this.recordEscapeReplacement);
  12782. } else if (this.char === CHAR_QUOT) {
  12783. return this.return();
  12784. } else if (this.atEndOfLine()) {
  12785. throw this.error(new TomlError("Unterminated string"));
  12786. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12787. throw this.errorControlCharInString();
  12788. } else {
  12789. this.consume();
  12790. }
  12791. } while (this.nextChar());
  12792. }
  12793. recordEscapeReplacement(replacement) {
  12794. this.state.buf += replacement;
  12795. return this.goto(this.parseBasicString);
  12796. }
  12797. parseMultiStringMaybe() {
  12798. if (this.char === CHAR_QUOT) {
  12799. return this.next(this.parseMultiString);
  12800. } else {
  12801. return this.returnNow();
  12802. }
  12803. }
  12804. parseMultiString() {
  12805. if (this.char === CTRL_M) {
  12806. return null;
  12807. } else if (this.char === CTRL_J) {
  12808. return this.next(this.parseMultiStringContent);
  12809. } else {
  12810. return this.goto(this.parseMultiStringContent);
  12811. }
  12812. }
  12813. parseMultiStringContent() {
  12814. do {
  12815. if (this.char === CHAR_BSOL) {
  12816. return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
  12817. } else if (this.char === CHAR_QUOT) {
  12818. return this.next(this.parseMultiEnd);
  12819. } else if (this.char === Parser.END) {
  12820. throw this.error(new TomlError("Unterminated multi-line string"));
  12821. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12822. throw this.errorControlCharInString();
  12823. } else {
  12824. this.consume();
  12825. }
  12826. } while (this.nextChar());
  12827. }
  12828. errorControlCharInString() {
  12829. let displayCode = "\\u00";
  12830. if (this.char < 16) {
  12831. displayCode += "0";
  12832. }
  12833. displayCode += this.char.toString(16);
  12834. return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
  12835. }
  12836. recordMultiEscapeReplacement(replacement) {
  12837. this.state.buf += replacement;
  12838. return this.goto(this.parseMultiStringContent);
  12839. }
  12840. parseMultiEnd() {
  12841. if (this.char === CHAR_QUOT) {
  12842. return this.next(this.parseMultiEnd2);
  12843. } else {
  12844. this.state.buf += '"';
  12845. return this.goto(this.parseMultiStringContent);
  12846. }
  12847. }
  12848. parseMultiEnd2() {
  12849. if (this.char === CHAR_QUOT) {
  12850. return this.return();
  12851. } else {
  12852. this.state.buf += '""';
  12853. return this.goto(this.parseMultiStringContent);
  12854. }
  12855. }
  12856. parseMultiEscape() {
  12857. if (this.char === CTRL_M || this.char === CTRL_J) {
  12858. return this.next(this.parseMultiTrim);
  12859. } else if (this.char === CHAR_SP || this.char === CTRL_I) {
  12860. return this.next(this.parsePreMultiTrim);
  12861. } else {
  12862. return this.goto(this.parseEscape);
  12863. }
  12864. }
  12865. parsePreMultiTrim() {
  12866. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12867. return null;
  12868. } else if (this.char === CTRL_M || this.char === CTRL_J) {
  12869. return this.next(this.parseMultiTrim);
  12870. } else {
  12871. throw this.error(new TomlError("Can't escape whitespace"));
  12872. }
  12873. }
  12874. parseMultiTrim() {
  12875. if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12876. return null;
  12877. } else {
  12878. return this.returnNow();
  12879. }
  12880. }
  12881. parseEscape() {
  12882. if (this.char in escapes) {
  12883. return this.return(escapes[this.char]);
  12884. } else if (this.char === CHAR_u) {
  12885. return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
  12886. } else if (this.char === CHAR_U) {
  12887. return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
  12888. } else {
  12889. throw this.error(new TomlError("Unknown escape character: " + this.char));
  12890. }
  12891. }
  12892. parseUnicodeReturn(char) {
  12893. try {
  12894. const codePoint = parseInt(char, 16);
  12895. if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
  12896. throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
  12897. }
  12898. return this.returnNow(String.fromCodePoint(codePoint));
  12899. } catch (err) {
  12900. throw this.error(TomlError.wrap(err));
  12901. }
  12902. }
  12903. parseSmallUnicode() {
  12904. if (!isHexit(this.char)) {
  12905. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12906. } else {
  12907. this.consume();
  12908. if (this.state.buf.length >= 4)
  12909. return this.return();
  12910. }
  12911. }
  12912. parseLargeUnicode() {
  12913. if (!isHexit(this.char)) {
  12914. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12915. } else {
  12916. this.consume();
  12917. if (this.state.buf.length >= 8)
  12918. return this.return();
  12919. }
  12920. }
  12921. parseNumberSign() {
  12922. this.consume();
  12923. return this.next(this.parseMaybeSignedInfOrNan);
  12924. }
  12925. parseMaybeSignedInfOrNan() {
  12926. if (this.char === CHAR_i) {
  12927. return this.next(this.parseInf);
  12928. } else if (this.char === CHAR_n) {
  12929. return this.next(this.parseNan);
  12930. } else {
  12931. return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
  12932. }
  12933. }
  12934. parseNumberIntegerStart() {
  12935. if (this.char === CHAR_0) {
  12936. this.consume();
  12937. return this.next(this.parseNumberIntegerExponentOrDecimal);
  12938. } else {
  12939. return this.goto(this.parseNumberInteger);
  12940. }
  12941. }
  12942. parseNumberIntegerExponentOrDecimal() {
  12943. if (this.char === CHAR_PERIOD) {
  12944. this.consume();
  12945. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12946. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12947. this.consume();
  12948. return this.next(this.parseNumberExponentSign);
  12949. } else {
  12950. return this.returnNow(Integer(this.state.buf));
  12951. }
  12952. }
  12953. parseNumberInteger() {
  12954. if (isDigit(this.char)) {
  12955. this.consume();
  12956. } else if (this.char === CHAR_LOWBAR) {
  12957. return this.call(this.parseNoUnder);
  12958. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12959. this.consume();
  12960. return this.next(this.parseNumberExponentSign);
  12961. } else if (this.char === CHAR_PERIOD) {
  12962. this.consume();
  12963. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12964. } else {
  12965. const result = Integer(this.state.buf);
  12966. if (result.isNaN()) {
  12967. throw this.error(new TomlError("Invalid number"));
  12968. } else {
  12969. return this.returnNow(result);
  12970. }
  12971. }
  12972. }
  12973. parseNoUnder() {
  12974. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
  12975. throw this.error(new TomlError("Unexpected character, expected digit"));
  12976. } else if (this.atEndOfWord()) {
  12977. throw this.error(new TomlError("Incomplete number"));
  12978. }
  12979. return this.returnNow();
  12980. }
  12981. parseNoUnderHexOctBinLiteral() {
  12982. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
  12983. throw this.error(new TomlError("Unexpected character, expected digit"));
  12984. } else if (this.atEndOfWord()) {
  12985. throw this.error(new TomlError("Incomplete number"));
  12986. }
  12987. return this.returnNow();
  12988. }
  12989. parseNumberFloat() {
  12990. if (this.char === CHAR_LOWBAR) {
  12991. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12992. } else if (isDigit(this.char)) {
  12993. this.consume();
  12994. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12995. this.consume();
  12996. return this.next(this.parseNumberExponentSign);
  12997. } else {
  12998. return this.returnNow(Float(this.state.buf));
  12999. }
  13000. }
  13001. parseNumberExponentSign() {
  13002. if (isDigit(this.char)) {
  13003. return this.goto(this.parseNumberExponent);
  13004. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13005. this.consume();
  13006. this.call(this.parseNoUnder, this.parseNumberExponent);
  13007. } else {
  13008. throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
  13009. }
  13010. }
  13011. parseNumberExponent() {
  13012. if (isDigit(this.char)) {
  13013. this.consume();
  13014. } else if (this.char === CHAR_LOWBAR) {
  13015. return this.call(this.parseNoUnder);
  13016. } else {
  13017. return this.returnNow(Float(this.state.buf));
  13018. }
  13019. }
  13020. parseNumberOrDateTime() {
  13021. if (this.char === CHAR_0) {
  13022. this.consume();
  13023. return this.next(this.parseNumberBaseOrDateTime);
  13024. } else {
  13025. return this.goto(this.parseNumberOrDateTimeOnly);
  13026. }
  13027. }
  13028. parseNumberOrDateTimeOnly() {
  13029. if (this.char === CHAR_LOWBAR) {
  13030. return this.call(this.parseNoUnder, this.parseNumberInteger);
  13031. } else if (isDigit(this.char)) {
  13032. this.consume();
  13033. if (this.state.buf.length > 4)
  13034. this.next(this.parseNumberInteger);
  13035. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  13036. this.consume();
  13037. return this.next(this.parseNumberExponentSign);
  13038. } else if (this.char === CHAR_PERIOD) {
  13039. this.consume();
  13040. return this.call(this.parseNoUnder, this.parseNumberFloat);
  13041. } else if (this.char === CHAR_HYPHEN) {
  13042. return this.goto(this.parseDateTime);
  13043. } else if (this.char === CHAR_COLON) {
  13044. return this.goto(this.parseOnlyTimeHour);
  13045. } else {
  13046. return this.returnNow(Integer(this.state.buf));
  13047. }
  13048. }
  13049. parseDateTimeOnly() {
  13050. if (this.state.buf.length < 4) {
  13051. if (isDigit(this.char)) {
  13052. return this.consume();
  13053. } else if (this.char === CHAR_COLON) {
  13054. return this.goto(this.parseOnlyTimeHour);
  13055. } else {
  13056. throw this.error(new TomlError("Expected digit while parsing year part of a date"));
  13057. }
  13058. } else {
  13059. if (this.char === CHAR_HYPHEN) {
  13060. return this.goto(this.parseDateTime);
  13061. } else {
  13062. throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
  13063. }
  13064. }
  13065. }
  13066. parseNumberBaseOrDateTime() {
  13067. if (this.char === CHAR_b) {
  13068. this.consume();
  13069. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
  13070. } else if (this.char === CHAR_o) {
  13071. this.consume();
  13072. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
  13073. } else if (this.char === CHAR_x) {
  13074. this.consume();
  13075. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
  13076. } else if (this.char === CHAR_PERIOD) {
  13077. return this.goto(this.parseNumberInteger);
  13078. } else if (isDigit(this.char)) {
  13079. return this.goto(this.parseDateTimeOnly);
  13080. } else {
  13081. return this.returnNow(Integer(this.state.buf));
  13082. }
  13083. }
  13084. parseIntegerHex() {
  13085. if (isHexit(this.char)) {
  13086. this.consume();
  13087. } else if (this.char === CHAR_LOWBAR) {
  13088. return this.call(this.parseNoUnderHexOctBinLiteral);
  13089. } else {
  13090. const result = Integer(this.state.buf);
  13091. if (result.isNaN()) {
  13092. throw this.error(new TomlError("Invalid number"));
  13093. } else {
  13094. return this.returnNow(result);
  13095. }
  13096. }
  13097. }
  13098. parseIntegerOct() {
  13099. if (isOctit(this.char)) {
  13100. this.consume();
  13101. } else if (this.char === CHAR_LOWBAR) {
  13102. return this.call(this.parseNoUnderHexOctBinLiteral);
  13103. } else {
  13104. const result = Integer(this.state.buf);
  13105. if (result.isNaN()) {
  13106. throw this.error(new TomlError("Invalid number"));
  13107. } else {
  13108. return this.returnNow(result);
  13109. }
  13110. }
  13111. }
  13112. parseIntegerBin() {
  13113. if (isBit(this.char)) {
  13114. this.consume();
  13115. } else if (this.char === CHAR_LOWBAR) {
  13116. return this.call(this.parseNoUnderHexOctBinLiteral);
  13117. } else {
  13118. const result = Integer(this.state.buf);
  13119. if (result.isNaN()) {
  13120. throw this.error(new TomlError("Invalid number"));
  13121. } else {
  13122. return this.returnNow(result);
  13123. }
  13124. }
  13125. }
  13126. parseDateTime() {
  13127. if (this.state.buf.length < 4) {
  13128. throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
  13129. }
  13130. this.state.result = this.state.buf;
  13131. this.state.buf = "";
  13132. return this.next(this.parseDateMonth);
  13133. }
  13134. parseDateMonth() {
  13135. if (this.char === CHAR_HYPHEN) {
  13136. if (this.state.buf.length < 2) {
  13137. throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
  13138. }
  13139. this.state.result += "-" + this.state.buf;
  13140. this.state.buf = "";
  13141. return this.next(this.parseDateDay);
  13142. } else if (isDigit(this.char)) {
  13143. this.consume();
  13144. } else {
  13145. throw this.error(new TomlError("Incomplete datetime"));
  13146. }
  13147. }
  13148. parseDateDay() {
  13149. if (this.char === CHAR_T || this.char === CHAR_SP) {
  13150. if (this.state.buf.length < 2) {
  13151. throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
  13152. }
  13153. this.state.result += "-" + this.state.buf;
  13154. this.state.buf = "";
  13155. return this.next(this.parseStartTimeHour);
  13156. } else if (this.atEndOfWord()) {
  13157. return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
  13158. } else if (isDigit(this.char)) {
  13159. this.consume();
  13160. } else {
  13161. throw this.error(new TomlError("Incomplete datetime"));
  13162. }
  13163. }
  13164. parseStartTimeHour() {
  13165. if (this.atEndOfWord()) {
  13166. return this.returnNow(createDate(this.state.result));
  13167. } else {
  13168. return this.goto(this.parseTimeHour);
  13169. }
  13170. }
  13171. parseTimeHour() {
  13172. if (this.char === CHAR_COLON) {
  13173. if (this.state.buf.length < 2) {
  13174. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13175. }
  13176. this.state.result += "T" + this.state.buf;
  13177. this.state.buf = "";
  13178. return this.next(this.parseTimeMin);
  13179. } else if (isDigit(this.char)) {
  13180. this.consume();
  13181. } else {
  13182. throw this.error(new TomlError("Incomplete datetime"));
  13183. }
  13184. }
  13185. parseTimeMin() {
  13186. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13187. this.consume();
  13188. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13189. this.state.result += ":" + this.state.buf;
  13190. this.state.buf = "";
  13191. return this.next(this.parseTimeSec);
  13192. } else {
  13193. throw this.error(new TomlError("Incomplete datetime"));
  13194. }
  13195. }
  13196. parseTimeSec() {
  13197. if (isDigit(this.char)) {
  13198. this.consume();
  13199. if (this.state.buf.length === 2) {
  13200. this.state.result += ":" + this.state.buf;
  13201. this.state.buf = "";
  13202. return this.next(this.parseTimeZoneOrFraction);
  13203. }
  13204. } else {
  13205. throw this.error(new TomlError("Incomplete datetime"));
  13206. }
  13207. }
  13208. parseOnlyTimeHour() {
  13209. if (this.char === CHAR_COLON) {
  13210. if (this.state.buf.length < 2) {
  13211. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13212. }
  13213. this.state.result = this.state.buf;
  13214. this.state.buf = "";
  13215. return this.next(this.parseOnlyTimeMin);
  13216. } else {
  13217. throw this.error(new TomlError("Incomplete time"));
  13218. }
  13219. }
  13220. parseOnlyTimeMin() {
  13221. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13222. this.consume();
  13223. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13224. this.state.result += ":" + this.state.buf;
  13225. this.state.buf = "";
  13226. return this.next(this.parseOnlyTimeSec);
  13227. } else {
  13228. throw this.error(new TomlError("Incomplete time"));
  13229. }
  13230. }
  13231. parseOnlyTimeSec() {
  13232. if (isDigit(this.char)) {
  13233. this.consume();
  13234. if (this.state.buf.length === 2) {
  13235. return this.next(this.parseOnlyTimeFractionMaybe);
  13236. }
  13237. } else {
  13238. throw this.error(new TomlError("Incomplete time"));
  13239. }
  13240. }
  13241. parseOnlyTimeFractionMaybe() {
  13242. this.state.result += ":" + this.state.buf;
  13243. if (this.char === CHAR_PERIOD) {
  13244. this.state.buf = "";
  13245. this.next(this.parseOnlyTimeFraction);
  13246. } else {
  13247. return this.return(createTime(this.state.result));
  13248. }
  13249. }
  13250. parseOnlyTimeFraction() {
  13251. if (isDigit(this.char)) {
  13252. this.consume();
  13253. } else if (this.atEndOfWord()) {
  13254. if (this.state.buf.length === 0)
  13255. throw this.error(new TomlError("Expected digit in milliseconds"));
  13256. return this.returnNow(createTime(this.state.result + "." + this.state.buf));
  13257. } else {
  13258. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13259. }
  13260. }
  13261. parseTimeZoneOrFraction() {
  13262. if (this.char === CHAR_PERIOD) {
  13263. this.consume();
  13264. this.next(this.parseDateTimeFraction);
  13265. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13266. this.consume();
  13267. this.next(this.parseTimeZoneHour);
  13268. } else if (this.char === CHAR_Z) {
  13269. this.consume();
  13270. return this.return(createDateTime(this.state.result + this.state.buf));
  13271. } else if (this.atEndOfWord()) {
  13272. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13273. } else {
  13274. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13275. }
  13276. }
  13277. parseDateTimeFraction() {
  13278. if (isDigit(this.char)) {
  13279. this.consume();
  13280. } else if (this.state.buf.length === 1) {
  13281. throw this.error(new TomlError("Expected digit in milliseconds"));
  13282. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13283. this.consume();
  13284. this.next(this.parseTimeZoneHour);
  13285. } else if (this.char === CHAR_Z) {
  13286. this.consume();
  13287. return this.return(createDateTime(this.state.result + this.state.buf));
  13288. } else if (this.atEndOfWord()) {
  13289. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13290. } else {
  13291. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13292. }
  13293. }
  13294. parseTimeZoneHour() {
  13295. if (isDigit(this.char)) {
  13296. this.consume();
  13297. if (/\d\d$/.test(this.state.buf))
  13298. return this.next(this.parseTimeZoneSep);
  13299. } else {
  13300. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13301. }
  13302. }
  13303. parseTimeZoneSep() {
  13304. if (this.char === CHAR_COLON) {
  13305. this.consume();
  13306. this.next(this.parseTimeZoneMin);
  13307. } else {
  13308. throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
  13309. }
  13310. }
  13311. parseTimeZoneMin() {
  13312. if (isDigit(this.char)) {
  13313. this.consume();
  13314. if (/\d\d$/.test(this.state.buf))
  13315. return this.return(createDateTime(this.state.result + this.state.buf));
  13316. } else {
  13317. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13318. }
  13319. }
  13320. parseBoolean() {
  13321. if (this.char === CHAR_t) {
  13322. this.consume();
  13323. return this.next(this.parseTrue_r);
  13324. } else if (this.char === CHAR_f) {
  13325. this.consume();
  13326. return this.next(this.parseFalse_a);
  13327. }
  13328. }
  13329. parseTrue_r() {
  13330. if (this.char === CHAR_r) {
  13331. this.consume();
  13332. return this.next(this.parseTrue_u);
  13333. } else {
  13334. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13335. }
  13336. }
  13337. parseTrue_u() {
  13338. if (this.char === CHAR_u) {
  13339. this.consume();
  13340. return this.next(this.parseTrue_e);
  13341. } else {
  13342. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13343. }
  13344. }
  13345. parseTrue_e() {
  13346. if (this.char === CHAR_e) {
  13347. return this.return(true);
  13348. } else {
  13349. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13350. }
  13351. }
  13352. parseFalse_a() {
  13353. if (this.char === CHAR_a) {
  13354. this.consume();
  13355. return this.next(this.parseFalse_l);
  13356. } else {
  13357. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13358. }
  13359. }
  13360. parseFalse_l() {
  13361. if (this.char === CHAR_l) {
  13362. this.consume();
  13363. return this.next(this.parseFalse_s);
  13364. } else {
  13365. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13366. }
  13367. }
  13368. parseFalse_s() {
  13369. if (this.char === CHAR_s) {
  13370. this.consume();
  13371. return this.next(this.parseFalse_e);
  13372. } else {
  13373. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13374. }
  13375. }
  13376. parseFalse_e() {
  13377. if (this.char === CHAR_e) {
  13378. return this.return(false);
  13379. } else {
  13380. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13381. }
  13382. }
  13383. parseInlineList() {
  13384. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13385. return null;
  13386. } else if (this.char === Parser.END) {
  13387. throw this.error(new TomlError("Unterminated inline array"));
  13388. } else if (this.char === CHAR_NUM) {
  13389. return this.call(this.parseComment);
  13390. } else if (this.char === CHAR_RSQB) {
  13391. return this.return(this.state.resultArr || InlineList());
  13392. } else {
  13393. return this.callNow(this.parseValue, this.recordInlineListValue);
  13394. }
  13395. }
  13396. recordInlineListValue(value) {
  13397. if (this.state.resultArr) {
  13398. const listType = this.state.resultArr[_contentType];
  13399. const valueType = tomlType(value);
  13400. if (listType !== valueType) {
  13401. throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
  13402. }
  13403. } else {
  13404. this.state.resultArr = InlineList(tomlType(value));
  13405. }
  13406. if (isFloat(value) || isInteger(value)) {
  13407. this.state.resultArr.push(value.valueOf());
  13408. } else {
  13409. this.state.resultArr.push(value);
  13410. }
  13411. return this.goto(this.parseInlineListNext);
  13412. }
  13413. parseInlineListNext() {
  13414. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13415. return null;
  13416. } else if (this.char === CHAR_NUM) {
  13417. return this.call(this.parseComment);
  13418. } else if (this.char === CHAR_COMMA) {
  13419. return this.next(this.parseInlineList);
  13420. } else if (this.char === CHAR_RSQB) {
  13421. return this.goto(this.parseInlineList);
  13422. } else {
  13423. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13424. }
  13425. }
  13426. parseInlineTable() {
  13427. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13428. return null;
  13429. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13430. throw this.error(new TomlError("Unterminated inline array"));
  13431. } else if (this.char === CHAR_RCUB) {
  13432. return this.return(this.state.resultTable || InlineTable());
  13433. } else {
  13434. if (!this.state.resultTable)
  13435. this.state.resultTable = InlineTable();
  13436. return this.callNow(this.parseAssign, this.recordInlineTableValue);
  13437. }
  13438. }
  13439. recordInlineTableValue(kv) {
  13440. let target = this.state.resultTable;
  13441. let finalKey = kv.key.pop();
  13442. for (let kw of kv.key) {
  13443. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  13444. throw this.error(new TomlError("Can't redefine existing key"));
  13445. }
  13446. target = target[kw] = target[kw] || Table();
  13447. }
  13448. if (hasKey(target, finalKey)) {
  13449. throw this.error(new TomlError("Can't redefine existing key"));
  13450. }
  13451. if (isInteger(kv.value) || isFloat(kv.value)) {
  13452. target[finalKey] = kv.value.valueOf();
  13453. } else {
  13454. target[finalKey] = kv.value;
  13455. }
  13456. return this.goto(this.parseInlineTableNext);
  13457. }
  13458. parseInlineTableNext() {
  13459. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13460. return null;
  13461. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13462. throw this.error(new TomlError("Unterminated inline array"));
  13463. } else if (this.char === CHAR_COMMA) {
  13464. return this.next(this.parseInlineTable);
  13465. } else if (this.char === CHAR_RCUB) {
  13466. return this.goto(this.parseInlineTable);
  13467. } else {
  13468. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13469. }
  13470. }
  13471. }
  13472. return TOMLParser;
  13473. }
  13474. }
  13475. });
  13476. var require_parse_pretty_error = __commonJS2({
  13477. "node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
  13478. "use strict";
  13479. module2.exports = prettyError;
  13480. function prettyError(err, buf) {
  13481. if (err.pos == null || err.line == null)
  13482. return err;
  13483. let msg = err.message;
  13484. msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
  13485. `;
  13486. if (buf && buf.split) {
  13487. const lines = buf.split(/\n/);
  13488. const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
  13489. let linePadding = " ";
  13490. while (linePadding.length < lineNumWidth)
  13491. linePadding += " ";
  13492. for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
  13493. let lineNum = String(ii + 1);
  13494. if (lineNum.length < lineNumWidth)
  13495. lineNum = " " + lineNum;
  13496. if (err.line === ii) {
  13497. msg += lineNum + "> " + lines[ii] + "\n";
  13498. msg += linePadding + " ";
  13499. for (let hh = 0; hh < err.col; ++hh) {
  13500. msg += " ";
  13501. }
  13502. msg += "^\n";
  13503. } else {
  13504. msg += lineNum + ": " + lines[ii] + "\n";
  13505. }
  13506. }
  13507. }
  13508. err.message = msg + "\n";
  13509. return err;
  13510. }
  13511. }
  13512. });
  13513. var require_parse_string = __commonJS2({
  13514. "node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
  13515. "use strict";
  13516. module2.exports = parseString;
  13517. var TOMLParser = require_toml_parser();
  13518. var prettyError = require_parse_pretty_error();
  13519. function parseString(str) {
  13520. if (global.Buffer && global.Buffer.isBuffer(str)) {
  13521. str = str.toString("utf8");
  13522. }
  13523. const parser = new TOMLParser();
  13524. try {
  13525. parser.parse(str);
  13526. return parser.finish();
  13527. } catch (err) {
  13528. throw prettyError(err, str);
  13529. }
  13530. }
  13531. }
  13532. });
  13533. var require_load_toml = __commonJS2({
  13534. "src/utils/load-toml.js"(exports2, module2) {
  13535. "use strict";
  13536. var parse = require_parse_string();
  13537. module2.exports = function(filePath, content) {
  13538. try {
  13539. return parse(content);
  13540. } catch (error) {
  13541. error.message = `TOML Error in ${filePath}:
  13542. ${error.message}`;
  13543. throw error;
  13544. }
  13545. };
  13546. }
  13547. });
  13548. var require_unicode = __commonJS2({
  13549. "node_modules/json5/lib/unicode.js"(exports2, module2) {
  13550. module2.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  13551. 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]/;
  13552. 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]/;
  13553. }
  13554. });
  13555. var require_util2 = __commonJS2({
  13556. "node_modules/json5/lib/util.js"(exports2, module2) {
  13557. var unicode = require_unicode();
  13558. module2.exports = {
  13559. isSpaceSeparator(c) {
  13560. return typeof c === "string" && unicode.Space_Separator.test(c);
  13561. },
  13562. isIdStartChar(c) {
  13563. return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
  13564. },
  13565. isIdContinueChar(c) {
  13566. 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));
  13567. },
  13568. isDigit(c) {
  13569. return typeof c === "string" && /[0-9]/.test(c);
  13570. },
  13571. isHexDigit(c) {
  13572. return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
  13573. }
  13574. };
  13575. }
  13576. });
  13577. var require_parse3 = __commonJS2({
  13578. "node_modules/json5/lib/parse.js"(exports2, module2) {
  13579. var util = require_util2();
  13580. var source;
  13581. var parseState;
  13582. var stack;
  13583. var pos;
  13584. var line;
  13585. var column;
  13586. var token;
  13587. var key;
  13588. var root;
  13589. module2.exports = function parse(text, reviver) {
  13590. source = String(text);
  13591. parseState = "start";
  13592. stack = [];
  13593. pos = 0;
  13594. line = 1;
  13595. column = 0;
  13596. token = void 0;
  13597. key = void 0;
  13598. root = void 0;
  13599. do {
  13600. token = lex();
  13601. parseStates[parseState]();
  13602. } while (token.type !== "eof");
  13603. if (typeof reviver === "function") {
  13604. return internalize({
  13605. "": root
  13606. }, "", reviver);
  13607. }
  13608. return root;
  13609. };
  13610. function internalize(holder, name, reviver) {
  13611. const value = holder[name];
  13612. if (value != null && typeof value === "object") {
  13613. if (Array.isArray(value)) {
  13614. for (let i = 0; i < value.length; i++) {
  13615. const key2 = String(i);
  13616. const replacement = internalize(value, key2, reviver);
  13617. if (replacement === void 0) {
  13618. delete value[key2];
  13619. } else {
  13620. Object.defineProperty(value, key2, {
  13621. value: replacement,
  13622. writable: true,
  13623. enumerable: true,
  13624. configurable: true
  13625. });
  13626. }
  13627. }
  13628. } else {
  13629. for (const key2 in value) {
  13630. const replacement = internalize(value, key2, reviver);
  13631. if (replacement === void 0) {
  13632. delete value[key2];
  13633. } else {
  13634. Object.defineProperty(value, key2, {
  13635. value: replacement,
  13636. writable: true,
  13637. enumerable: true,
  13638. configurable: true
  13639. });
  13640. }
  13641. }
  13642. }
  13643. }
  13644. return reviver.call(holder, name, value);
  13645. }
  13646. var lexState;
  13647. var buffer;
  13648. var doubleQuote;
  13649. var sign;
  13650. var c;
  13651. function lex() {
  13652. lexState = "default";
  13653. buffer = "";
  13654. doubleQuote = false;
  13655. sign = 1;
  13656. for (; ; ) {
  13657. c = peek();
  13658. const token2 = lexStates[lexState]();
  13659. if (token2) {
  13660. return token2;
  13661. }
  13662. }
  13663. }
  13664. function peek() {
  13665. if (source[pos]) {
  13666. return String.fromCodePoint(source.codePointAt(pos));
  13667. }
  13668. }
  13669. function read() {
  13670. const c2 = peek();
  13671. if (c2 === "\n") {
  13672. line++;
  13673. column = 0;
  13674. } else if (c2) {
  13675. column += c2.length;
  13676. } else {
  13677. column++;
  13678. }
  13679. if (c2) {
  13680. pos += c2.length;
  13681. }
  13682. return c2;
  13683. }
  13684. var lexStates = {
  13685. default() {
  13686. switch (c) {
  13687. case " ":
  13688. case "\v":
  13689. case "\f":
  13690. case " ":
  13691. case "\xA0":
  13692. case "\uFEFF":
  13693. case "\n":
  13694. case "\r":
  13695. case "\u2028":
  13696. case "\u2029":
  13697. read();
  13698. return;
  13699. case "/":
  13700. read();
  13701. lexState = "comment";
  13702. return;
  13703. case void 0:
  13704. read();
  13705. return newToken("eof");
  13706. }
  13707. if (util.isSpaceSeparator(c)) {
  13708. read();
  13709. return;
  13710. }
  13711. return lexStates[parseState]();
  13712. },
  13713. comment() {
  13714. switch (c) {
  13715. case "*":
  13716. read();
  13717. lexState = "multiLineComment";
  13718. return;
  13719. case "/":
  13720. read();
  13721. lexState = "singleLineComment";
  13722. return;
  13723. }
  13724. throw invalidChar(read());
  13725. },
  13726. multiLineComment() {
  13727. switch (c) {
  13728. case "*":
  13729. read();
  13730. lexState = "multiLineCommentAsterisk";
  13731. return;
  13732. case void 0:
  13733. throw invalidChar(read());
  13734. }
  13735. read();
  13736. },
  13737. multiLineCommentAsterisk() {
  13738. switch (c) {
  13739. case "*":
  13740. read();
  13741. return;
  13742. case "/":
  13743. read();
  13744. lexState = "default";
  13745. return;
  13746. case void 0:
  13747. throw invalidChar(read());
  13748. }
  13749. read();
  13750. lexState = "multiLineComment";
  13751. },
  13752. singleLineComment() {
  13753. switch (c) {
  13754. case "\n":
  13755. case "\r":
  13756. case "\u2028":
  13757. case "\u2029":
  13758. read();
  13759. lexState = "default";
  13760. return;
  13761. case void 0:
  13762. read();
  13763. return newToken("eof");
  13764. }
  13765. read();
  13766. },
  13767. value() {
  13768. switch (c) {
  13769. case "{":
  13770. case "[":
  13771. return newToken("punctuator", read());
  13772. case "n":
  13773. read();
  13774. literal("ull");
  13775. return newToken("null", null);
  13776. case "t":
  13777. read();
  13778. literal("rue");
  13779. return newToken("boolean", true);
  13780. case "f":
  13781. read();
  13782. literal("alse");
  13783. return newToken("boolean", false);
  13784. case "-":
  13785. case "+":
  13786. if (read() === "-") {
  13787. sign = -1;
  13788. }
  13789. lexState = "sign";
  13790. return;
  13791. case ".":
  13792. buffer = read();
  13793. lexState = "decimalPointLeading";
  13794. return;
  13795. case "0":
  13796. buffer = read();
  13797. lexState = "zero";
  13798. return;
  13799. case "1":
  13800. case "2":
  13801. case "3":
  13802. case "4":
  13803. case "5":
  13804. case "6":
  13805. case "7":
  13806. case "8":
  13807. case "9":
  13808. buffer = read();
  13809. lexState = "decimalInteger";
  13810. return;
  13811. case "I":
  13812. read();
  13813. literal("nfinity");
  13814. return newToken("numeric", Infinity);
  13815. case "N":
  13816. read();
  13817. literal("aN");
  13818. return newToken("numeric", NaN);
  13819. case '"':
  13820. case "'":
  13821. doubleQuote = read() === '"';
  13822. buffer = "";
  13823. lexState = "string";
  13824. return;
  13825. }
  13826. throw invalidChar(read());
  13827. },
  13828. identifierNameStartEscape() {
  13829. if (c !== "u") {
  13830. throw invalidChar(read());
  13831. }
  13832. read();
  13833. const u = unicodeEscape();
  13834. switch (u) {
  13835. case "$":
  13836. case "_":
  13837. break;
  13838. default:
  13839. if (!util.isIdStartChar(u)) {
  13840. throw invalidIdentifier();
  13841. }
  13842. break;
  13843. }
  13844. buffer += u;
  13845. lexState = "identifierName";
  13846. },
  13847. identifierName() {
  13848. switch (c) {
  13849. case "$":
  13850. case "_":
  13851. case "\u200C":
  13852. case "\u200D":
  13853. buffer += read();
  13854. return;
  13855. case "\\":
  13856. read();
  13857. lexState = "identifierNameEscape";
  13858. return;
  13859. }
  13860. if (util.isIdContinueChar(c)) {
  13861. buffer += read();
  13862. return;
  13863. }
  13864. return newToken("identifier", buffer);
  13865. },
  13866. identifierNameEscape() {
  13867. if (c !== "u") {
  13868. throw invalidChar(read());
  13869. }
  13870. read();
  13871. const u = unicodeEscape();
  13872. switch (u) {
  13873. case "$":
  13874. case "_":
  13875. case "\u200C":
  13876. case "\u200D":
  13877. break;
  13878. default:
  13879. if (!util.isIdContinueChar(u)) {
  13880. throw invalidIdentifier();
  13881. }
  13882. break;
  13883. }
  13884. buffer += u;
  13885. lexState = "identifierName";
  13886. },
  13887. sign() {
  13888. switch (c) {
  13889. case ".":
  13890. buffer = read();
  13891. lexState = "decimalPointLeading";
  13892. return;
  13893. case "0":
  13894. buffer = read();
  13895. lexState = "zero";
  13896. return;
  13897. case "1":
  13898. case "2":
  13899. case "3":
  13900. case "4":
  13901. case "5":
  13902. case "6":
  13903. case "7":
  13904. case "8":
  13905. case "9":
  13906. buffer = read();
  13907. lexState = "decimalInteger";
  13908. return;
  13909. case "I":
  13910. read();
  13911. literal("nfinity");
  13912. return newToken("numeric", sign * Infinity);
  13913. case "N":
  13914. read();
  13915. literal("aN");
  13916. return newToken("numeric", NaN);
  13917. }
  13918. throw invalidChar(read());
  13919. },
  13920. zero() {
  13921. switch (c) {
  13922. case ".":
  13923. buffer += read();
  13924. lexState = "decimalPoint";
  13925. return;
  13926. case "e":
  13927. case "E":
  13928. buffer += read();
  13929. lexState = "decimalExponent";
  13930. return;
  13931. case "x":
  13932. case "X":
  13933. buffer += read();
  13934. lexState = "hexadecimal";
  13935. return;
  13936. }
  13937. return newToken("numeric", sign * 0);
  13938. },
  13939. decimalInteger() {
  13940. switch (c) {
  13941. case ".":
  13942. buffer += read();
  13943. lexState = "decimalPoint";
  13944. return;
  13945. case "e":
  13946. case "E":
  13947. buffer += read();
  13948. lexState = "decimalExponent";
  13949. return;
  13950. }
  13951. if (util.isDigit(c)) {
  13952. buffer += read();
  13953. return;
  13954. }
  13955. return newToken("numeric", sign * Number(buffer));
  13956. },
  13957. decimalPointLeading() {
  13958. if (util.isDigit(c)) {
  13959. buffer += read();
  13960. lexState = "decimalFraction";
  13961. return;
  13962. }
  13963. throw invalidChar(read());
  13964. },
  13965. decimalPoint() {
  13966. switch (c) {
  13967. case "e":
  13968. case "E":
  13969. buffer += read();
  13970. lexState = "decimalExponent";
  13971. return;
  13972. }
  13973. if (util.isDigit(c)) {
  13974. buffer += read();
  13975. lexState = "decimalFraction";
  13976. return;
  13977. }
  13978. return newToken("numeric", sign * Number(buffer));
  13979. },
  13980. decimalFraction() {
  13981. switch (c) {
  13982. case "e":
  13983. case "E":
  13984. buffer += read();
  13985. lexState = "decimalExponent";
  13986. return;
  13987. }
  13988. if (util.isDigit(c)) {
  13989. buffer += read();
  13990. return;
  13991. }
  13992. return newToken("numeric", sign * Number(buffer));
  13993. },
  13994. decimalExponent() {
  13995. switch (c) {
  13996. case "+":
  13997. case "-":
  13998. buffer += read();
  13999. lexState = "decimalExponentSign";
  14000. return;
  14001. }
  14002. if (util.isDigit(c)) {
  14003. buffer += read();
  14004. lexState = "decimalExponentInteger";
  14005. return;
  14006. }
  14007. throw invalidChar(read());
  14008. },
  14009. decimalExponentSign() {
  14010. if (util.isDigit(c)) {
  14011. buffer += read();
  14012. lexState = "decimalExponentInteger";
  14013. return;
  14014. }
  14015. throw invalidChar(read());
  14016. },
  14017. decimalExponentInteger() {
  14018. if (util.isDigit(c)) {
  14019. buffer += read();
  14020. return;
  14021. }
  14022. return newToken("numeric", sign * Number(buffer));
  14023. },
  14024. hexadecimal() {
  14025. if (util.isHexDigit(c)) {
  14026. buffer += read();
  14027. lexState = "hexadecimalInteger";
  14028. return;
  14029. }
  14030. throw invalidChar(read());
  14031. },
  14032. hexadecimalInteger() {
  14033. if (util.isHexDigit(c)) {
  14034. buffer += read();
  14035. return;
  14036. }
  14037. return newToken("numeric", sign * Number(buffer));
  14038. },
  14039. string() {
  14040. switch (c) {
  14041. case "\\":
  14042. read();
  14043. buffer += escape();
  14044. return;
  14045. case '"':
  14046. if (doubleQuote) {
  14047. read();
  14048. return newToken("string", buffer);
  14049. }
  14050. buffer += read();
  14051. return;
  14052. case "'":
  14053. if (!doubleQuote) {
  14054. read();
  14055. return newToken("string", buffer);
  14056. }
  14057. buffer += read();
  14058. return;
  14059. case "\n":
  14060. case "\r":
  14061. throw invalidChar(read());
  14062. case "\u2028":
  14063. case "\u2029":
  14064. separatorChar(c);
  14065. break;
  14066. case void 0:
  14067. throw invalidChar(read());
  14068. }
  14069. buffer += read();
  14070. },
  14071. start() {
  14072. switch (c) {
  14073. case "{":
  14074. case "[":
  14075. return newToken("punctuator", read());
  14076. }
  14077. lexState = "value";
  14078. },
  14079. beforePropertyName() {
  14080. switch (c) {
  14081. case "$":
  14082. case "_":
  14083. buffer = read();
  14084. lexState = "identifierName";
  14085. return;
  14086. case "\\":
  14087. read();
  14088. lexState = "identifierNameStartEscape";
  14089. return;
  14090. case "}":
  14091. return newToken("punctuator", read());
  14092. case '"':
  14093. case "'":
  14094. doubleQuote = read() === '"';
  14095. lexState = "string";
  14096. return;
  14097. }
  14098. if (util.isIdStartChar(c)) {
  14099. buffer += read();
  14100. lexState = "identifierName";
  14101. return;
  14102. }
  14103. throw invalidChar(read());
  14104. },
  14105. afterPropertyName() {
  14106. if (c === ":") {
  14107. return newToken("punctuator", read());
  14108. }
  14109. throw invalidChar(read());
  14110. },
  14111. beforePropertyValue() {
  14112. lexState = "value";
  14113. },
  14114. afterPropertyValue() {
  14115. switch (c) {
  14116. case ",":
  14117. case "}":
  14118. return newToken("punctuator", read());
  14119. }
  14120. throw invalidChar(read());
  14121. },
  14122. beforeArrayValue() {
  14123. if (c === "]") {
  14124. return newToken("punctuator", read());
  14125. }
  14126. lexState = "value";
  14127. },
  14128. afterArrayValue() {
  14129. switch (c) {
  14130. case ",":
  14131. case "]":
  14132. return newToken("punctuator", read());
  14133. }
  14134. throw invalidChar(read());
  14135. },
  14136. end() {
  14137. throw invalidChar(read());
  14138. }
  14139. };
  14140. function newToken(type, value) {
  14141. return {
  14142. type,
  14143. value,
  14144. line,
  14145. column
  14146. };
  14147. }
  14148. function literal(s) {
  14149. for (const c2 of s) {
  14150. const p = peek();
  14151. if (p !== c2) {
  14152. throw invalidChar(read());
  14153. }
  14154. read();
  14155. }
  14156. }
  14157. function escape() {
  14158. const c2 = peek();
  14159. switch (c2) {
  14160. case "b":
  14161. read();
  14162. return "\b";
  14163. case "f":
  14164. read();
  14165. return "\f";
  14166. case "n":
  14167. read();
  14168. return "\n";
  14169. case "r":
  14170. read();
  14171. return "\r";
  14172. case "t":
  14173. read();
  14174. return " ";
  14175. case "v":
  14176. read();
  14177. return "\v";
  14178. case "0":
  14179. read();
  14180. if (util.isDigit(peek())) {
  14181. throw invalidChar(read());
  14182. }
  14183. return "\0";
  14184. case "x":
  14185. read();
  14186. return hexEscape();
  14187. case "u":
  14188. read();
  14189. return unicodeEscape();
  14190. case "\n":
  14191. case "\u2028":
  14192. case "\u2029":
  14193. read();
  14194. return "";
  14195. case "\r":
  14196. read();
  14197. if (peek() === "\n") {
  14198. read();
  14199. }
  14200. return "";
  14201. case "1":
  14202. case "2":
  14203. case "3":
  14204. case "4":
  14205. case "5":
  14206. case "6":
  14207. case "7":
  14208. case "8":
  14209. case "9":
  14210. throw invalidChar(read());
  14211. case void 0:
  14212. throw invalidChar(read());
  14213. }
  14214. return read();
  14215. }
  14216. function hexEscape() {
  14217. let buffer2 = "";
  14218. let c2 = peek();
  14219. if (!util.isHexDigit(c2)) {
  14220. throw invalidChar(read());
  14221. }
  14222. buffer2 += read();
  14223. c2 = peek();
  14224. if (!util.isHexDigit(c2)) {
  14225. throw invalidChar(read());
  14226. }
  14227. buffer2 += read();
  14228. return String.fromCodePoint(parseInt(buffer2, 16));
  14229. }
  14230. function unicodeEscape() {
  14231. let buffer2 = "";
  14232. let count = 4;
  14233. while (count-- > 0) {
  14234. const c2 = peek();
  14235. if (!util.isHexDigit(c2)) {
  14236. throw invalidChar(read());
  14237. }
  14238. buffer2 += read();
  14239. }
  14240. return String.fromCodePoint(parseInt(buffer2, 16));
  14241. }
  14242. var parseStates = {
  14243. start() {
  14244. if (token.type === "eof") {
  14245. throw invalidEOF();
  14246. }
  14247. push();
  14248. },
  14249. beforePropertyName() {
  14250. switch (token.type) {
  14251. case "identifier":
  14252. case "string":
  14253. key = token.value;
  14254. parseState = "afterPropertyName";
  14255. return;
  14256. case "punctuator":
  14257. pop();
  14258. return;
  14259. case "eof":
  14260. throw invalidEOF();
  14261. }
  14262. },
  14263. afterPropertyName() {
  14264. if (token.type === "eof") {
  14265. throw invalidEOF();
  14266. }
  14267. parseState = "beforePropertyValue";
  14268. },
  14269. beforePropertyValue() {
  14270. if (token.type === "eof") {
  14271. throw invalidEOF();
  14272. }
  14273. push();
  14274. },
  14275. beforeArrayValue() {
  14276. if (token.type === "eof") {
  14277. throw invalidEOF();
  14278. }
  14279. if (token.type === "punctuator" && token.value === "]") {
  14280. pop();
  14281. return;
  14282. }
  14283. push();
  14284. },
  14285. afterPropertyValue() {
  14286. if (token.type === "eof") {
  14287. throw invalidEOF();
  14288. }
  14289. switch (token.value) {
  14290. case ",":
  14291. parseState = "beforePropertyName";
  14292. return;
  14293. case "}":
  14294. pop();
  14295. }
  14296. },
  14297. afterArrayValue() {
  14298. if (token.type === "eof") {
  14299. throw invalidEOF();
  14300. }
  14301. switch (token.value) {
  14302. case ",":
  14303. parseState = "beforeArrayValue";
  14304. return;
  14305. case "]":
  14306. pop();
  14307. }
  14308. },
  14309. end() {
  14310. }
  14311. };
  14312. function push() {
  14313. let value;
  14314. switch (token.type) {
  14315. case "punctuator":
  14316. switch (token.value) {
  14317. case "{":
  14318. value = {};
  14319. break;
  14320. case "[":
  14321. value = [];
  14322. break;
  14323. }
  14324. break;
  14325. case "null":
  14326. case "boolean":
  14327. case "numeric":
  14328. case "string":
  14329. value = token.value;
  14330. break;
  14331. }
  14332. if (root === void 0) {
  14333. root = value;
  14334. } else {
  14335. const parent = stack[stack.length - 1];
  14336. if (Array.isArray(parent)) {
  14337. parent.push(value);
  14338. } else {
  14339. Object.defineProperty(parent, key, {
  14340. value,
  14341. writable: true,
  14342. enumerable: true,
  14343. configurable: true
  14344. });
  14345. }
  14346. }
  14347. if (value !== null && typeof value === "object") {
  14348. stack.push(value);
  14349. if (Array.isArray(value)) {
  14350. parseState = "beforeArrayValue";
  14351. } else {
  14352. parseState = "beforePropertyName";
  14353. }
  14354. } else {
  14355. const current = stack[stack.length - 1];
  14356. if (current == null) {
  14357. parseState = "end";
  14358. } else if (Array.isArray(current)) {
  14359. parseState = "afterArrayValue";
  14360. } else {
  14361. parseState = "afterPropertyValue";
  14362. }
  14363. }
  14364. }
  14365. function pop() {
  14366. stack.pop();
  14367. const current = stack[stack.length - 1];
  14368. if (current == null) {
  14369. parseState = "end";
  14370. } else if (Array.isArray(current)) {
  14371. parseState = "afterArrayValue";
  14372. } else {
  14373. parseState = "afterPropertyValue";
  14374. }
  14375. }
  14376. function invalidChar(c2) {
  14377. if (c2 === void 0) {
  14378. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14379. }
  14380. return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
  14381. }
  14382. function invalidEOF() {
  14383. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14384. }
  14385. function invalidIdentifier() {
  14386. column -= 5;
  14387. return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
  14388. }
  14389. function separatorChar(c2) {
  14390. console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
  14391. }
  14392. function formatChar(c2) {
  14393. const replacements = {
  14394. "'": "\\'",
  14395. '"': '\\"',
  14396. "\\": "\\\\",
  14397. "\b": "\\b",
  14398. "\f": "\\f",
  14399. "\n": "\\n",
  14400. "\r": "\\r",
  14401. " ": "\\t",
  14402. "\v": "\\v",
  14403. "\0": "\\0",
  14404. "\u2028": "\\u2028",
  14405. "\u2029": "\\u2029"
  14406. };
  14407. if (replacements[c2]) {
  14408. return replacements[c2];
  14409. }
  14410. if (c2 < " ") {
  14411. const hexString = c2.charCodeAt(0).toString(16);
  14412. return "\\x" + ("00" + hexString).substring(hexString.length);
  14413. }
  14414. return c2;
  14415. }
  14416. function syntaxError(message) {
  14417. const err = new SyntaxError(message);
  14418. err.lineNumber = line;
  14419. err.columnNumber = column;
  14420. return err;
  14421. }
  14422. }
  14423. });
  14424. var require_stringify2 = __commonJS2({
  14425. "node_modules/json5/lib/stringify.js"(exports2, module2) {
  14426. var util = require_util2();
  14427. module2.exports = function stringify(value, replacer, space) {
  14428. const stack = [];
  14429. let indent = "";
  14430. let propertyList;
  14431. let replacerFunc;
  14432. let gap = "";
  14433. let quote;
  14434. if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
  14435. space = replacer.space;
  14436. quote = replacer.quote;
  14437. replacer = replacer.replacer;
  14438. }
  14439. if (typeof replacer === "function") {
  14440. replacerFunc = replacer;
  14441. } else if (Array.isArray(replacer)) {
  14442. propertyList = [];
  14443. for (const v of replacer) {
  14444. let item;
  14445. if (typeof v === "string") {
  14446. item = v;
  14447. } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
  14448. item = String(v);
  14449. }
  14450. if (item !== void 0 && propertyList.indexOf(item) < 0) {
  14451. propertyList.push(item);
  14452. }
  14453. }
  14454. }
  14455. if (space instanceof Number) {
  14456. space = Number(space);
  14457. } else if (space instanceof String) {
  14458. space = String(space);
  14459. }
  14460. if (typeof space === "number") {
  14461. if (space > 0) {
  14462. space = Math.min(10, Math.floor(space));
  14463. gap = " ".substr(0, space);
  14464. }
  14465. } else if (typeof space === "string") {
  14466. gap = space.substr(0, 10);
  14467. }
  14468. return serializeProperty("", {
  14469. "": value
  14470. });
  14471. function serializeProperty(key, holder) {
  14472. let value2 = holder[key];
  14473. if (value2 != null) {
  14474. if (typeof value2.toJSON5 === "function") {
  14475. value2 = value2.toJSON5(key);
  14476. } else if (typeof value2.toJSON === "function") {
  14477. value2 = value2.toJSON(key);
  14478. }
  14479. }
  14480. if (replacerFunc) {
  14481. value2 = replacerFunc.call(holder, key, value2);
  14482. }
  14483. if (value2 instanceof Number) {
  14484. value2 = Number(value2);
  14485. } else if (value2 instanceof String) {
  14486. value2 = String(value2);
  14487. } else if (value2 instanceof Boolean) {
  14488. value2 = value2.valueOf();
  14489. }
  14490. switch (value2) {
  14491. case null:
  14492. return "null";
  14493. case true:
  14494. return "true";
  14495. case false:
  14496. return "false";
  14497. }
  14498. if (typeof value2 === "string") {
  14499. return quoteString(value2, false);
  14500. }
  14501. if (typeof value2 === "number") {
  14502. return String(value2);
  14503. }
  14504. if (typeof value2 === "object") {
  14505. return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
  14506. }
  14507. return void 0;
  14508. }
  14509. function quoteString(value2) {
  14510. const quotes = {
  14511. "'": 0.1,
  14512. '"': 0.2
  14513. };
  14514. const replacements = {
  14515. "'": "\\'",
  14516. '"': '\\"',
  14517. "\\": "\\\\",
  14518. "\b": "\\b",
  14519. "\f": "\\f",
  14520. "\n": "\\n",
  14521. "\r": "\\r",
  14522. " ": "\\t",
  14523. "\v": "\\v",
  14524. "\0": "\\0",
  14525. "\u2028": "\\u2028",
  14526. "\u2029": "\\u2029"
  14527. };
  14528. let product = "";
  14529. for (let i = 0; i < value2.length; i++) {
  14530. const c = value2[i];
  14531. switch (c) {
  14532. case "'":
  14533. case '"':
  14534. quotes[c]++;
  14535. product += c;
  14536. continue;
  14537. case "\0":
  14538. if (util.isDigit(value2[i + 1])) {
  14539. product += "\\x00";
  14540. continue;
  14541. }
  14542. }
  14543. if (replacements[c]) {
  14544. product += replacements[c];
  14545. continue;
  14546. }
  14547. if (c < " ") {
  14548. let hexString = c.charCodeAt(0).toString(16);
  14549. product += "\\x" + ("00" + hexString).substring(hexString.length);
  14550. continue;
  14551. }
  14552. product += c;
  14553. }
  14554. const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
  14555. product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
  14556. return quoteChar + product + quoteChar;
  14557. }
  14558. function serializeObject(value2) {
  14559. if (stack.indexOf(value2) >= 0) {
  14560. throw TypeError("Converting circular structure to JSON5");
  14561. }
  14562. stack.push(value2);
  14563. let stepback = indent;
  14564. indent = indent + gap;
  14565. let keys = propertyList || Object.keys(value2);
  14566. let partial = [];
  14567. for (const key of keys) {
  14568. const propertyString = serializeProperty(key, value2);
  14569. if (propertyString !== void 0) {
  14570. let member = serializeKey(key) + ":";
  14571. if (gap !== "") {
  14572. member += " ";
  14573. }
  14574. member += propertyString;
  14575. partial.push(member);
  14576. }
  14577. }
  14578. let final;
  14579. if (partial.length === 0) {
  14580. final = "{}";
  14581. } else {
  14582. let properties;
  14583. if (gap === "") {
  14584. properties = partial.join(",");
  14585. final = "{" + properties + "}";
  14586. } else {
  14587. let separator = ",\n" + indent;
  14588. properties = partial.join(separator);
  14589. final = "{\n" + indent + properties + ",\n" + stepback + "}";
  14590. }
  14591. }
  14592. stack.pop();
  14593. indent = stepback;
  14594. return final;
  14595. }
  14596. function serializeKey(key) {
  14597. if (key.length === 0) {
  14598. return quoteString(key, true);
  14599. }
  14600. const firstChar = String.fromCodePoint(key.codePointAt(0));
  14601. if (!util.isIdStartChar(firstChar)) {
  14602. return quoteString(key, true);
  14603. }
  14604. for (let i = firstChar.length; i < key.length; i++) {
  14605. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  14606. return quoteString(key, true);
  14607. }
  14608. }
  14609. return key;
  14610. }
  14611. function serializeArray(value2) {
  14612. if (stack.indexOf(value2) >= 0) {
  14613. throw TypeError("Converting circular structure to JSON5");
  14614. }
  14615. stack.push(value2);
  14616. let stepback = indent;
  14617. indent = indent + gap;
  14618. let partial = [];
  14619. for (let i = 0; i < value2.length; i++) {
  14620. const propertyString = serializeProperty(String(i), value2);
  14621. partial.push(propertyString !== void 0 ? propertyString : "null");
  14622. }
  14623. let final;
  14624. if (partial.length === 0) {
  14625. final = "[]";
  14626. } else {
  14627. if (gap === "") {
  14628. let properties = partial.join(",");
  14629. final = "[" + properties + "]";
  14630. } else {
  14631. let separator = ",\n" + indent;
  14632. let properties = partial.join(separator);
  14633. final = "[\n" + indent + properties + ",\n" + stepback + "]";
  14634. }
  14635. }
  14636. stack.pop();
  14637. indent = stepback;
  14638. return final;
  14639. }
  14640. };
  14641. }
  14642. });
  14643. var require_lib6 = __commonJS2({
  14644. "node_modules/json5/lib/index.js"(exports2, module2) {
  14645. var parse = require_parse3();
  14646. var stringify = require_stringify2();
  14647. var JSON5 = {
  14648. parse,
  14649. stringify
  14650. };
  14651. module2.exports = JSON5;
  14652. }
  14653. });
  14654. var require_load_json5 = __commonJS2({
  14655. "src/utils/load-json5.js"(exports2, module2) {
  14656. "use strict";
  14657. var {
  14658. parse
  14659. } = require_lib6();
  14660. module2.exports = function(filePath, content) {
  14661. try {
  14662. return parse(content);
  14663. } catch (error) {
  14664. error.message = `JSON5 Error in ${filePath}:
  14665. ${error.message}`;
  14666. throw error;
  14667. }
  14668. };
  14669. }
  14670. });
  14671. var require_partition = __commonJS2({
  14672. "src/utils/partition.js"(exports2, module2) {
  14673. "use strict";
  14674. function partition(array, predicate) {
  14675. const result = [[], []];
  14676. for (const value of array) {
  14677. result[predicate(value) ? 0 : 1].push(value);
  14678. }
  14679. return result;
  14680. }
  14681. module2.exports = partition;
  14682. }
  14683. });
  14684. var require_homedir = __commonJS2({
  14685. "node_modules/resolve/lib/homedir.js"(exports2, module2) {
  14686. "use strict";
  14687. var os = require("os");
  14688. module2.exports = os.homedir || function homedir() {
  14689. var home = process.env.HOME;
  14690. var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
  14691. if (process.platform === "win32") {
  14692. return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
  14693. }
  14694. if (process.platform === "darwin") {
  14695. return home || (user ? "/Users/" + user : null);
  14696. }
  14697. if (process.platform === "linux") {
  14698. return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
  14699. }
  14700. return home || null;
  14701. };
  14702. }
  14703. });
  14704. var require_caller = __commonJS2({
  14705. "node_modules/resolve/lib/caller.js"(exports2, module2) {
  14706. module2.exports = function() {
  14707. var origPrepareStackTrace = Error.prepareStackTrace;
  14708. Error.prepareStackTrace = function(_, stack2) {
  14709. return stack2;
  14710. };
  14711. var stack = new Error().stack;
  14712. Error.prepareStackTrace = origPrepareStackTrace;
  14713. return stack[2].getFileName();
  14714. };
  14715. }
  14716. });
  14717. var require_path_parse = __commonJS2({
  14718. "node_modules/path-parse/index.js"(exports2, module2) {
  14719. "use strict";
  14720. var isWindows = process.platform === "win32";
  14721. var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
  14722. var win32 = {};
  14723. function win32SplitPath(filename) {
  14724. return splitWindowsRe.exec(filename).slice(1);
  14725. }
  14726. win32.parse = function(pathString) {
  14727. if (typeof pathString !== "string") {
  14728. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14729. }
  14730. var allParts = win32SplitPath(pathString);
  14731. if (!allParts || allParts.length !== 5) {
  14732. throw new TypeError("Invalid path '" + pathString + "'");
  14733. }
  14734. return {
  14735. root: allParts[1],
  14736. dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
  14737. base: allParts[2],
  14738. ext: allParts[4],
  14739. name: allParts[3]
  14740. };
  14741. };
  14742. var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
  14743. var posix = {};
  14744. function posixSplitPath(filename) {
  14745. return splitPathRe.exec(filename).slice(1);
  14746. }
  14747. posix.parse = function(pathString) {
  14748. if (typeof pathString !== "string") {
  14749. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14750. }
  14751. var allParts = posixSplitPath(pathString);
  14752. if (!allParts || allParts.length !== 5) {
  14753. throw new TypeError("Invalid path '" + pathString + "'");
  14754. }
  14755. return {
  14756. root: allParts[1],
  14757. dir: allParts[0].slice(0, -1),
  14758. base: allParts[2],
  14759. ext: allParts[4],
  14760. name: allParts[3]
  14761. };
  14762. };
  14763. if (isWindows)
  14764. module2.exports = win32.parse;
  14765. else
  14766. module2.exports = posix.parse;
  14767. module2.exports.posix = posix.parse;
  14768. module2.exports.win32 = win32.parse;
  14769. }
  14770. });
  14771. var require_node_modules_paths = __commonJS2({
  14772. "node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
  14773. var path = require("path");
  14774. var parse = path.parse || require_path_parse();
  14775. var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
  14776. var prefix = "/";
  14777. if (/^([A-Za-z]:)/.test(absoluteStart)) {
  14778. prefix = "";
  14779. } else if (/^\\\\/.test(absoluteStart)) {
  14780. prefix = "\\\\";
  14781. }
  14782. var paths = [absoluteStart];
  14783. var parsed = parse(absoluteStart);
  14784. while (parsed.dir !== paths[paths.length - 1]) {
  14785. paths.push(parsed.dir);
  14786. parsed = parse(parsed.dir);
  14787. }
  14788. return paths.reduce(function(dirs, aPath) {
  14789. return dirs.concat(modules.map(function(moduleDir) {
  14790. return path.resolve(prefix, aPath, moduleDir);
  14791. }));
  14792. }, []);
  14793. };
  14794. module2.exports = function nodeModulesPaths(start, opts, request) {
  14795. var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
  14796. if (opts && typeof opts.paths === "function") {
  14797. return opts.paths(request, start, function() {
  14798. return getNodeModulesDirs(start, modules);
  14799. }, opts);
  14800. }
  14801. var dirs = getNodeModulesDirs(start, modules);
  14802. return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
  14803. };
  14804. }
  14805. });
  14806. var require_normalize_options = __commonJS2({
  14807. "node_modules/resolve/lib/normalize-options.js"(exports2, module2) {
  14808. module2.exports = function(x, opts) {
  14809. return opts || {};
  14810. };
  14811. }
  14812. });
  14813. var require_implementation = __commonJS2({
  14814. "node_modules/function-bind/implementation.js"(exports2, module2) {
  14815. "use strict";
  14816. var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
  14817. var slice = Array.prototype.slice;
  14818. var toStr = Object.prototype.toString;
  14819. var funcType = "[object Function]";
  14820. module2.exports = function bind(that) {
  14821. var target = this;
  14822. if (typeof target !== "function" || toStr.call(target) !== funcType) {
  14823. throw new TypeError(ERROR_MESSAGE + target);
  14824. }
  14825. var args = slice.call(arguments, 1);
  14826. var bound;
  14827. var binder = function() {
  14828. if (this instanceof bound) {
  14829. var result = target.apply(this, args.concat(slice.call(arguments)));
  14830. if (Object(result) === result) {
  14831. return result;
  14832. }
  14833. return this;
  14834. } else {
  14835. return target.apply(that, args.concat(slice.call(arguments)));
  14836. }
  14837. };
  14838. var boundLength = Math.max(0, target.length - args.length);
  14839. var boundArgs = [];
  14840. for (var i = 0; i < boundLength; i++) {
  14841. boundArgs.push("$" + i);
  14842. }
  14843. bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
  14844. if (target.prototype) {
  14845. var Empty = function Empty2() {
  14846. };
  14847. Empty.prototype = target.prototype;
  14848. bound.prototype = new Empty();
  14849. Empty.prototype = null;
  14850. }
  14851. return bound;
  14852. };
  14853. }
  14854. });
  14855. var require_function_bind = __commonJS2({
  14856. "node_modules/function-bind/index.js"(exports2, module2) {
  14857. "use strict";
  14858. var implementation = require_implementation();
  14859. module2.exports = Function.prototype.bind || implementation;
  14860. }
  14861. });
  14862. var require_src = __commonJS2({
  14863. "node_modules/has/src/index.js"(exports2, module2) {
  14864. "use strict";
  14865. var bind = require_function_bind();
  14866. module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  14867. }
  14868. });
  14869. var require_core2 = __commonJS2({
  14870. "node_modules/is-core-module/core.json"(exports2, module2) {
  14871. module2.exports = {
  14872. assert: true,
  14873. "node:assert": [">= 14.18 && < 15", ">= 16"],
  14874. "assert/strict": ">= 15",
  14875. "node:assert/strict": ">= 16",
  14876. async_hooks: ">= 8",
  14877. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  14878. buffer_ieee754: ">= 0.5 && < 0.9.7",
  14879. buffer: true,
  14880. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  14881. child_process: true,
  14882. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  14883. cluster: ">= 0.5",
  14884. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  14885. console: true,
  14886. "node:console": [">= 14.18 && < 15", ">= 16"],
  14887. constants: true,
  14888. "node:constants": [">= 14.18 && < 15", ">= 16"],
  14889. crypto: true,
  14890. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  14891. _debug_agent: ">= 1 && < 8",
  14892. _debugger: "< 8",
  14893. dgram: true,
  14894. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  14895. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  14896. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  14897. dns: true,
  14898. "node:dns": [">= 14.18 && < 15", ">= 16"],
  14899. "dns/promises": ">= 15",
  14900. "node:dns/promises": ">= 16",
  14901. domain: ">= 0.7.12",
  14902. "node:domain": [">= 14.18 && < 15", ">= 16"],
  14903. events: true,
  14904. "node:events": [">= 14.18 && < 15", ">= 16"],
  14905. freelist: "< 6",
  14906. fs: true,
  14907. "node:fs": [">= 14.18 && < 15", ">= 16"],
  14908. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  14909. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  14910. _http_agent: ">= 0.11.1",
  14911. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  14912. _http_client: ">= 0.11.1",
  14913. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  14914. _http_common: ">= 0.11.1",
  14915. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  14916. _http_incoming: ">= 0.11.1",
  14917. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  14918. _http_outgoing: ">= 0.11.1",
  14919. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  14920. _http_server: ">= 0.11.1",
  14921. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  14922. http: true,
  14923. "node:http": [">= 14.18 && < 15", ">= 16"],
  14924. http2: ">= 8.8",
  14925. "node:http2": [">= 14.18 && < 15", ">= 16"],
  14926. https: true,
  14927. "node:https": [">= 14.18 && < 15", ">= 16"],
  14928. inspector: ">= 8",
  14929. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  14930. "inspector/promises": [">= 19"],
  14931. "node:inspector/promises": [">= 19"],
  14932. _linklist: "< 8",
  14933. module: true,
  14934. "node:module": [">= 14.18 && < 15", ">= 16"],
  14935. net: true,
  14936. "node:net": [">= 14.18 && < 15", ">= 16"],
  14937. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  14938. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  14939. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  14940. os: true,
  14941. "node:os": [">= 14.18 && < 15", ">= 16"],
  14942. path: true,
  14943. "node:path": [">= 14.18 && < 15", ">= 16"],
  14944. "path/posix": ">= 15.3",
  14945. "node:path/posix": ">= 16",
  14946. "path/win32": ">= 15.3",
  14947. "node:path/win32": ">= 16",
  14948. perf_hooks: ">= 8.5",
  14949. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  14950. process: ">= 1",
  14951. "node:process": [">= 14.18 && < 15", ">= 16"],
  14952. punycode: ">= 0.5",
  14953. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  14954. querystring: true,
  14955. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  14956. readline: true,
  14957. "node:readline": [">= 14.18 && < 15", ">= 16"],
  14958. "readline/promises": ">= 17",
  14959. "node:readline/promises": ">= 17",
  14960. repl: true,
  14961. "node:repl": [">= 14.18 && < 15", ">= 16"],
  14962. smalloc: ">= 0.11.5 && < 3",
  14963. _stream_duplex: ">= 0.9.4",
  14964. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  14965. _stream_transform: ">= 0.9.4",
  14966. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  14967. _stream_wrap: ">= 1.4.1",
  14968. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  14969. _stream_passthrough: ">= 0.9.4",
  14970. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  14971. _stream_readable: ">= 0.9.4",
  14972. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  14973. _stream_writable: ">= 0.9.4",
  14974. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  14975. stream: true,
  14976. "node:stream": [">= 14.18 && < 15", ">= 16"],
  14977. "stream/consumers": ">= 16.7",
  14978. "node:stream/consumers": ">= 16.7",
  14979. "stream/promises": ">= 15",
  14980. "node:stream/promises": ">= 16",
  14981. "stream/web": ">= 16.5",
  14982. "node:stream/web": ">= 16.5",
  14983. string_decoder: true,
  14984. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  14985. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  14986. "node:sys": [">= 14.18 && < 15", ">= 16"],
  14987. "node:test": [">= 16.17 && < 17", ">= 18"],
  14988. timers: true,
  14989. "node:timers": [">= 14.18 && < 15", ">= 16"],
  14990. "timers/promises": ">= 15",
  14991. "node:timers/promises": ">= 16",
  14992. _tls_common: ">= 0.11.13",
  14993. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  14994. _tls_legacy: ">= 0.11.3 && < 10",
  14995. _tls_wrap: ">= 0.11.3",
  14996. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  14997. tls: true,
  14998. "node:tls": [">= 14.18 && < 15", ">= 16"],
  14999. trace_events: ">= 10",
  15000. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  15001. tty: true,
  15002. "node:tty": [">= 14.18 && < 15", ">= 16"],
  15003. url: true,
  15004. "node:url": [">= 14.18 && < 15", ">= 16"],
  15005. util: true,
  15006. "node:util": [">= 14.18 && < 15", ">= 16"],
  15007. "util/types": ">= 15.3",
  15008. "node:util/types": ">= 16",
  15009. "v8/tools/arguments": ">= 10 && < 12",
  15010. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15011. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15012. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15013. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15014. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15015. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15016. v8: ">= 1",
  15017. "node:v8": [">= 14.18 && < 15", ">= 16"],
  15018. vm: true,
  15019. "node:vm": [">= 14.18 && < 15", ">= 16"],
  15020. wasi: ">= 13.4 && < 13.5",
  15021. worker_threads: ">= 11.7",
  15022. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  15023. zlib: ">= 0.5",
  15024. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  15025. };
  15026. }
  15027. });
  15028. var require_is_core_module = __commonJS2({
  15029. "node_modules/is-core-module/index.js"(exports2, module2) {
  15030. "use strict";
  15031. var has = require_src();
  15032. function specifierIncluded(current, specifier) {
  15033. var nodeParts = current.split(".");
  15034. var parts = specifier.split(" ");
  15035. var op = parts.length > 1 ? parts[0] : "=";
  15036. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  15037. for (var i = 0; i < 3; ++i) {
  15038. var cur = parseInt(nodeParts[i] || 0, 10);
  15039. var ver = parseInt(versionParts[i] || 0, 10);
  15040. if (cur === ver) {
  15041. continue;
  15042. }
  15043. if (op === "<") {
  15044. return cur < ver;
  15045. }
  15046. if (op === ">=") {
  15047. return cur >= ver;
  15048. }
  15049. return false;
  15050. }
  15051. return op === ">=";
  15052. }
  15053. function matchesRange(current, range) {
  15054. var specifiers = range.split(/ ?&& ?/);
  15055. if (specifiers.length === 0) {
  15056. return false;
  15057. }
  15058. for (var i = 0; i < specifiers.length; ++i) {
  15059. if (!specifierIncluded(current, specifiers[i])) {
  15060. return false;
  15061. }
  15062. }
  15063. return true;
  15064. }
  15065. function versionIncluded(nodeVersion, specifierValue) {
  15066. if (typeof specifierValue === "boolean") {
  15067. return specifierValue;
  15068. }
  15069. var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
  15070. if (typeof current !== "string") {
  15071. throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
  15072. }
  15073. if (specifierValue && typeof specifierValue === "object") {
  15074. for (var i = 0; i < specifierValue.length; ++i) {
  15075. if (matchesRange(current, specifierValue[i])) {
  15076. return true;
  15077. }
  15078. }
  15079. return false;
  15080. }
  15081. return matchesRange(current, specifierValue);
  15082. }
  15083. var data = require_core2();
  15084. module2.exports = function isCore(x, nodeVersion) {
  15085. return has(data, x) && versionIncluded(nodeVersion, data[x]);
  15086. };
  15087. }
  15088. });
  15089. var require_async = __commonJS2({
  15090. "node_modules/resolve/lib/async.js"(exports2, module2) {
  15091. var fs = require("fs");
  15092. var getHomedir = require_homedir();
  15093. var path = require("path");
  15094. var caller = require_caller();
  15095. var nodeModulesPaths = require_node_modules_paths();
  15096. var normalizeOptions = require_normalize_options();
  15097. var isCore = require_is_core_module();
  15098. var realpathFS = process.platform !== "win32" && fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
  15099. var homedir = getHomedir();
  15100. var defaultPaths = function() {
  15101. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  15102. };
  15103. var defaultIsFile = function isFile(file, cb) {
  15104. fs.stat(file, function(err, stat) {
  15105. if (!err) {
  15106. return cb(null, stat.isFile() || stat.isFIFO());
  15107. }
  15108. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  15109. return cb(null, false);
  15110. return cb(err);
  15111. });
  15112. };
  15113. var defaultIsDir = function isDirectory(dir, cb) {
  15114. fs.stat(dir, function(err, stat) {
  15115. if (!err) {
  15116. return cb(null, stat.isDirectory());
  15117. }
  15118. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  15119. return cb(null, false);
  15120. return cb(err);
  15121. });
  15122. };
  15123. var defaultRealpath = function realpath(x, cb) {
  15124. realpathFS(x, function(realpathErr, realPath) {
  15125. if (realpathErr && realpathErr.code !== "ENOENT")
  15126. cb(realpathErr);
  15127. else
  15128. cb(null, realpathErr ? x : realPath);
  15129. });
  15130. };
  15131. var maybeRealpath = function maybeRealpath2(realpath, x, opts, cb) {
  15132. if (opts && opts.preserveSymlinks === false) {
  15133. realpath(x, cb);
  15134. } else {
  15135. cb(null, x);
  15136. }
  15137. };
  15138. var defaultReadPackage = function defaultReadPackage2(readFile, pkgfile, cb) {
  15139. readFile(pkgfile, function(readFileErr, body) {
  15140. if (readFileErr)
  15141. cb(readFileErr);
  15142. else {
  15143. try {
  15144. var pkg = JSON.parse(body);
  15145. cb(null, pkg);
  15146. } catch (jsonErr) {
  15147. cb(null);
  15148. }
  15149. }
  15150. });
  15151. };
  15152. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  15153. var dirs = nodeModulesPaths(start, opts, x);
  15154. for (var i = 0; i < dirs.length; i++) {
  15155. dirs[i] = path.join(dirs[i], x);
  15156. }
  15157. return dirs;
  15158. };
  15159. module2.exports = function resolve(x, options, callback) {
  15160. var cb = callback;
  15161. var opts = options;
  15162. if (typeof options === "function") {
  15163. cb = opts;
  15164. opts = {};
  15165. }
  15166. if (typeof x !== "string") {
  15167. var err = new TypeError("Path must be a string.");
  15168. return process.nextTick(function() {
  15169. cb(err);
  15170. });
  15171. }
  15172. opts = normalizeOptions(x, opts);
  15173. var isFile = opts.isFile || defaultIsFile;
  15174. var isDirectory = opts.isDirectory || defaultIsDir;
  15175. var readFile = opts.readFile || fs.readFile;
  15176. var realpath = opts.realpath || defaultRealpath;
  15177. var readPackage = opts.readPackage || defaultReadPackage;
  15178. if (opts.readFile && opts.readPackage) {
  15179. var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
  15180. return process.nextTick(function() {
  15181. cb(conflictErr);
  15182. });
  15183. }
  15184. var packageIterator = opts.packageIterator;
  15185. var extensions = opts.extensions || [".js"];
  15186. var includeCoreModules = opts.includeCoreModules !== false;
  15187. var basedir = opts.basedir || path.dirname(caller());
  15188. var parent = opts.filename || basedir;
  15189. opts.paths = opts.paths || defaultPaths();
  15190. var absoluteStart = path.resolve(basedir);
  15191. maybeRealpath(realpath, absoluteStart, opts, function(err2, realStart) {
  15192. if (err2)
  15193. cb(err2);
  15194. else
  15195. init(realStart);
  15196. });
  15197. var res;
  15198. function init(basedir2) {
  15199. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  15200. res = path.resolve(basedir2, x);
  15201. if (x === "." || x === ".." || x.slice(-1) === "/")
  15202. res += "/";
  15203. if (/\/$/.test(x) && res === basedir2) {
  15204. loadAsDirectory(res, opts.package, onfile);
  15205. } else
  15206. loadAsFile(res, opts.package, onfile);
  15207. } else if (includeCoreModules && isCore(x)) {
  15208. return cb(null, x);
  15209. } else
  15210. loadNodeModules(x, basedir2, function(err2, n, pkg) {
  15211. if (err2)
  15212. cb(err2);
  15213. else if (n) {
  15214. return maybeRealpath(realpath, n, opts, function(err3, realN) {
  15215. if (err3) {
  15216. cb(err3);
  15217. } else {
  15218. cb(null, realN, pkg);
  15219. }
  15220. });
  15221. } else {
  15222. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15223. moduleError.code = "MODULE_NOT_FOUND";
  15224. cb(moduleError);
  15225. }
  15226. });
  15227. }
  15228. function onfile(err2, m, pkg) {
  15229. if (err2)
  15230. cb(err2);
  15231. else if (m)
  15232. cb(null, m, pkg);
  15233. else
  15234. loadAsDirectory(res, function(err3, d, pkg2) {
  15235. if (err3)
  15236. cb(err3);
  15237. else if (d) {
  15238. maybeRealpath(realpath, d, opts, function(err4, realD) {
  15239. if (err4) {
  15240. cb(err4);
  15241. } else {
  15242. cb(null, realD, pkg2);
  15243. }
  15244. });
  15245. } else {
  15246. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15247. moduleError.code = "MODULE_NOT_FOUND";
  15248. cb(moduleError);
  15249. }
  15250. });
  15251. }
  15252. function loadAsFile(x2, thePackage, callback2) {
  15253. var loadAsFilePackage = thePackage;
  15254. var cb2 = callback2;
  15255. if (typeof loadAsFilePackage === "function") {
  15256. cb2 = loadAsFilePackage;
  15257. loadAsFilePackage = void 0;
  15258. }
  15259. var exts = [""].concat(extensions);
  15260. load(exts, x2, loadAsFilePackage);
  15261. function load(exts2, x3, loadPackage) {
  15262. if (exts2.length === 0)
  15263. return cb2(null, void 0, loadPackage);
  15264. var file = x3 + exts2[0];
  15265. var pkg = loadPackage;
  15266. if (pkg)
  15267. onpkg(null, pkg);
  15268. else
  15269. loadpkg(path.dirname(file), onpkg);
  15270. function onpkg(err2, pkg_, dir) {
  15271. pkg = pkg_;
  15272. if (err2)
  15273. return cb2(err2);
  15274. if (dir && pkg && opts.pathFilter) {
  15275. var rfile = path.relative(dir, file);
  15276. var rel = rfile.slice(0, rfile.length - exts2[0].length);
  15277. var r = opts.pathFilter(pkg, x3, rel);
  15278. if (r)
  15279. return load([""].concat(extensions.slice()), path.resolve(dir, r), pkg);
  15280. }
  15281. isFile(file, onex);
  15282. }
  15283. function onex(err2, ex) {
  15284. if (err2)
  15285. return cb2(err2);
  15286. if (ex)
  15287. return cb2(null, file, pkg);
  15288. load(exts2.slice(1), x3, pkg);
  15289. }
  15290. }
  15291. }
  15292. function loadpkg(dir, cb2) {
  15293. if (dir === "" || dir === "/")
  15294. return cb2(null);
  15295. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15296. return cb2(null);
  15297. }
  15298. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15299. return cb2(null);
  15300. maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
  15301. if (unwrapErr)
  15302. return loadpkg(path.dirname(dir), cb2);
  15303. var pkgfile = path.join(pkgdir, "package.json");
  15304. isFile(pkgfile, function(err2, ex) {
  15305. if (!ex)
  15306. return loadpkg(path.dirname(dir), cb2);
  15307. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15308. if (err3)
  15309. cb2(err3);
  15310. var pkg = pkgParam;
  15311. if (pkg && opts.packageFilter) {
  15312. pkg = opts.packageFilter(pkg, pkgfile);
  15313. }
  15314. cb2(null, pkg, dir);
  15315. });
  15316. });
  15317. });
  15318. }
  15319. function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
  15320. var cb2 = callback2;
  15321. var fpkg = loadAsDirectoryPackage;
  15322. if (typeof fpkg === "function") {
  15323. cb2 = fpkg;
  15324. fpkg = opts.package;
  15325. }
  15326. maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
  15327. if (unwrapErr)
  15328. return cb2(unwrapErr);
  15329. var pkgfile = path.join(pkgdir, "package.json");
  15330. isFile(pkgfile, function(err2, ex) {
  15331. if (err2)
  15332. return cb2(err2);
  15333. if (!ex)
  15334. return loadAsFile(path.join(x2, "index"), fpkg, cb2);
  15335. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15336. if (err3)
  15337. return cb2(err3);
  15338. var pkg = pkgParam;
  15339. if (pkg && opts.packageFilter) {
  15340. pkg = opts.packageFilter(pkg, pkgfile);
  15341. }
  15342. if (pkg && pkg.main) {
  15343. if (typeof pkg.main !== "string") {
  15344. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15345. mainError.code = "INVALID_PACKAGE_MAIN";
  15346. return cb2(mainError);
  15347. }
  15348. if (pkg.main === "." || pkg.main === "./") {
  15349. pkg.main = "index";
  15350. }
  15351. loadAsFile(path.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
  15352. if (err4)
  15353. return cb2(err4);
  15354. if (m)
  15355. return cb2(null, m, pkg2);
  15356. if (!pkg2)
  15357. return loadAsFile(path.join(x2, "index"), pkg2, cb2);
  15358. var dir = path.resolve(x2, pkg2.main);
  15359. loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
  15360. if (err5)
  15361. return cb2(err5);
  15362. if (n)
  15363. return cb2(null, n, pkg3);
  15364. loadAsFile(path.join(x2, "index"), pkg3, cb2);
  15365. });
  15366. });
  15367. return;
  15368. }
  15369. loadAsFile(path.join(x2, "/index"), pkg, cb2);
  15370. });
  15371. });
  15372. });
  15373. }
  15374. function processDirs(cb2, dirs) {
  15375. if (dirs.length === 0)
  15376. return cb2(null, void 0);
  15377. var dir = dirs[0];
  15378. isDirectory(path.dirname(dir), isdir);
  15379. function isdir(err2, isdir2) {
  15380. if (err2)
  15381. return cb2(err2);
  15382. if (!isdir2)
  15383. return processDirs(cb2, dirs.slice(1));
  15384. loadAsFile(dir, opts.package, onfile2);
  15385. }
  15386. function onfile2(err2, m, pkg) {
  15387. if (err2)
  15388. return cb2(err2);
  15389. if (m)
  15390. return cb2(null, m, pkg);
  15391. loadAsDirectory(dir, opts.package, ondir);
  15392. }
  15393. function ondir(err2, n, pkg) {
  15394. if (err2)
  15395. return cb2(err2);
  15396. if (n)
  15397. return cb2(null, n, pkg);
  15398. processDirs(cb2, dirs.slice(1));
  15399. }
  15400. }
  15401. function loadNodeModules(x2, start, cb2) {
  15402. var thunk = function() {
  15403. return getPackageCandidates(x2, start, opts);
  15404. };
  15405. processDirs(cb2, packageIterator ? packageIterator(x2, start, thunk, opts) : thunk());
  15406. }
  15407. };
  15408. }
  15409. });
  15410. var require_core3 = __commonJS2({
  15411. "node_modules/resolve/lib/core.json"(exports2, module2) {
  15412. module2.exports = {
  15413. assert: true,
  15414. "node:assert": [">= 14.18 && < 15", ">= 16"],
  15415. "assert/strict": ">= 15",
  15416. "node:assert/strict": ">= 16",
  15417. async_hooks: ">= 8",
  15418. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  15419. buffer_ieee754: ">= 0.5 && < 0.9.7",
  15420. buffer: true,
  15421. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  15422. child_process: true,
  15423. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  15424. cluster: ">= 0.5",
  15425. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  15426. console: true,
  15427. "node:console": [">= 14.18 && < 15", ">= 16"],
  15428. constants: true,
  15429. "node:constants": [">= 14.18 && < 15", ">= 16"],
  15430. crypto: true,
  15431. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  15432. _debug_agent: ">= 1 && < 8",
  15433. _debugger: "< 8",
  15434. dgram: true,
  15435. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  15436. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  15437. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  15438. dns: true,
  15439. "node:dns": [">= 14.18 && < 15", ">= 16"],
  15440. "dns/promises": ">= 15",
  15441. "node:dns/promises": ">= 16",
  15442. domain: ">= 0.7.12",
  15443. "node:domain": [">= 14.18 && < 15", ">= 16"],
  15444. events: true,
  15445. "node:events": [">= 14.18 && < 15", ">= 16"],
  15446. freelist: "< 6",
  15447. fs: true,
  15448. "node:fs": [">= 14.18 && < 15", ">= 16"],
  15449. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  15450. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  15451. _http_agent: ">= 0.11.1",
  15452. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  15453. _http_client: ">= 0.11.1",
  15454. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  15455. _http_common: ">= 0.11.1",
  15456. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  15457. _http_incoming: ">= 0.11.1",
  15458. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  15459. _http_outgoing: ">= 0.11.1",
  15460. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  15461. _http_server: ">= 0.11.1",
  15462. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  15463. http: true,
  15464. "node:http": [">= 14.18 && < 15", ">= 16"],
  15465. http2: ">= 8.8",
  15466. "node:http2": [">= 14.18 && < 15", ">= 16"],
  15467. https: true,
  15468. "node:https": [">= 14.18 && < 15", ">= 16"],
  15469. inspector: ">= 8",
  15470. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  15471. _linklist: "< 8",
  15472. module: true,
  15473. "node:module": [">= 14.18 && < 15", ">= 16"],
  15474. net: true,
  15475. "node:net": [">= 14.18 && < 15", ">= 16"],
  15476. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  15477. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  15478. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  15479. os: true,
  15480. "node:os": [">= 14.18 && < 15", ">= 16"],
  15481. path: true,
  15482. "node:path": [">= 14.18 && < 15", ">= 16"],
  15483. "path/posix": ">= 15.3",
  15484. "node:path/posix": ">= 16",
  15485. "path/win32": ">= 15.3",
  15486. "node:path/win32": ">= 16",
  15487. perf_hooks: ">= 8.5",
  15488. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  15489. process: ">= 1",
  15490. "node:process": [">= 14.18 && < 15", ">= 16"],
  15491. punycode: ">= 0.5",
  15492. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  15493. querystring: true,
  15494. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  15495. readline: true,
  15496. "node:readline": [">= 14.18 && < 15", ">= 16"],
  15497. "readline/promises": ">= 17",
  15498. "node:readline/promises": ">= 17",
  15499. repl: true,
  15500. "node:repl": [">= 14.18 && < 15", ">= 16"],
  15501. smalloc: ">= 0.11.5 && < 3",
  15502. _stream_duplex: ">= 0.9.4",
  15503. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  15504. _stream_transform: ">= 0.9.4",
  15505. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  15506. _stream_wrap: ">= 1.4.1",
  15507. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  15508. _stream_passthrough: ">= 0.9.4",
  15509. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  15510. _stream_readable: ">= 0.9.4",
  15511. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  15512. _stream_writable: ">= 0.9.4",
  15513. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  15514. stream: true,
  15515. "node:stream": [">= 14.18 && < 15", ">= 16"],
  15516. "stream/consumers": ">= 16.7",
  15517. "node:stream/consumers": ">= 16.7",
  15518. "stream/promises": ">= 15",
  15519. "node:stream/promises": ">= 16",
  15520. "stream/web": ">= 16.5",
  15521. "node:stream/web": ">= 16.5",
  15522. string_decoder: true,
  15523. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  15524. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  15525. "node:sys": [">= 14.18 && < 15", ">= 16"],
  15526. "node:test": ">= 18",
  15527. timers: true,
  15528. "node:timers": [">= 14.18 && < 15", ">= 16"],
  15529. "timers/promises": ">= 15",
  15530. "node:timers/promises": ">= 16",
  15531. _tls_common: ">= 0.11.13",
  15532. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  15533. _tls_legacy: ">= 0.11.3 && < 10",
  15534. _tls_wrap: ">= 0.11.3",
  15535. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  15536. tls: true,
  15537. "node:tls": [">= 14.18 && < 15", ">= 16"],
  15538. trace_events: ">= 10",
  15539. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  15540. tty: true,
  15541. "node:tty": [">= 14.18 && < 15", ">= 16"],
  15542. url: true,
  15543. "node:url": [">= 14.18 && < 15", ">= 16"],
  15544. util: true,
  15545. "node:util": [">= 14.18 && < 15", ">= 16"],
  15546. "util/types": ">= 15.3",
  15547. "node:util/types": ">= 16",
  15548. "v8/tools/arguments": ">= 10 && < 12",
  15549. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15550. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15551. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15552. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15553. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15554. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15555. v8: ">= 1",
  15556. "node:v8": [">= 14.18 && < 15", ">= 16"],
  15557. vm: true,
  15558. "node:vm": [">= 14.18 && < 15", ">= 16"],
  15559. wasi: ">= 13.4 && < 13.5",
  15560. worker_threads: ">= 11.7",
  15561. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  15562. zlib: ">= 0.5",
  15563. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  15564. };
  15565. }
  15566. });
  15567. var require_core4 = __commonJS2({
  15568. "node_modules/resolve/lib/core.js"(exports2, module2) {
  15569. var current = process.versions && process.versions.node && process.versions.node.split(".") || [];
  15570. function specifierIncluded(specifier) {
  15571. var parts = specifier.split(" ");
  15572. var op = parts.length > 1 ? parts[0] : "=";
  15573. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  15574. for (var i = 0; i < 3; ++i) {
  15575. var cur = parseInt(current[i] || 0, 10);
  15576. var ver = parseInt(versionParts[i] || 0, 10);
  15577. if (cur === ver) {
  15578. continue;
  15579. }
  15580. if (op === "<") {
  15581. return cur < ver;
  15582. } else if (op === ">=") {
  15583. return cur >= ver;
  15584. }
  15585. return false;
  15586. }
  15587. return op === ">=";
  15588. }
  15589. function matchesRange(range) {
  15590. var specifiers = range.split(/ ?&& ?/);
  15591. if (specifiers.length === 0) {
  15592. return false;
  15593. }
  15594. for (var i = 0; i < specifiers.length; ++i) {
  15595. if (!specifierIncluded(specifiers[i])) {
  15596. return false;
  15597. }
  15598. }
  15599. return true;
  15600. }
  15601. function versionIncluded(specifierValue) {
  15602. if (typeof specifierValue === "boolean") {
  15603. return specifierValue;
  15604. }
  15605. if (specifierValue && typeof specifierValue === "object") {
  15606. for (var i = 0; i < specifierValue.length; ++i) {
  15607. if (matchesRange(specifierValue[i])) {
  15608. return true;
  15609. }
  15610. }
  15611. return false;
  15612. }
  15613. return matchesRange(specifierValue);
  15614. }
  15615. var data = require_core3();
  15616. var core2 = {};
  15617. for (mod in data) {
  15618. if (Object.prototype.hasOwnProperty.call(data, mod)) {
  15619. core2[mod] = versionIncluded(data[mod]);
  15620. }
  15621. }
  15622. var mod;
  15623. module2.exports = core2;
  15624. }
  15625. });
  15626. var require_is_core = __commonJS2({
  15627. "node_modules/resolve/lib/is-core.js"(exports2, module2) {
  15628. var isCoreModule = require_is_core_module();
  15629. module2.exports = function isCore(x) {
  15630. return isCoreModule(x);
  15631. };
  15632. }
  15633. });
  15634. var require_sync = __commonJS2({
  15635. "node_modules/resolve/lib/sync.js"(exports2, module2) {
  15636. var isCore = require_is_core_module();
  15637. var fs = require("fs");
  15638. var path = require("path");
  15639. var getHomedir = require_homedir();
  15640. var caller = require_caller();
  15641. var nodeModulesPaths = require_node_modules_paths();
  15642. var normalizeOptions = require_normalize_options();
  15643. var realpathFS = process.platform !== "win32" && fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
  15644. var homedir = getHomedir();
  15645. var defaultPaths = function() {
  15646. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  15647. };
  15648. var defaultIsFile = function isFile(file) {
  15649. try {
  15650. var stat = fs.statSync(file, {
  15651. throwIfNoEntry: false
  15652. });
  15653. } catch (e) {
  15654. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15655. return false;
  15656. throw e;
  15657. }
  15658. return !!stat && (stat.isFile() || stat.isFIFO());
  15659. };
  15660. var defaultIsDir = function isDirectory(dir) {
  15661. try {
  15662. var stat = fs.statSync(dir, {
  15663. throwIfNoEntry: false
  15664. });
  15665. } catch (e) {
  15666. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15667. return false;
  15668. throw e;
  15669. }
  15670. return !!stat && stat.isDirectory();
  15671. };
  15672. var defaultRealpathSync = function realpathSync(x) {
  15673. try {
  15674. return realpathFS(x);
  15675. } catch (realpathErr) {
  15676. if (realpathErr.code !== "ENOENT") {
  15677. throw realpathErr;
  15678. }
  15679. }
  15680. return x;
  15681. };
  15682. var maybeRealpathSync = function maybeRealpathSync2(realpathSync, x, opts) {
  15683. if (opts && opts.preserveSymlinks === false) {
  15684. return realpathSync(x);
  15685. }
  15686. return x;
  15687. };
  15688. var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync, pkgfile) {
  15689. var body = readFileSync(pkgfile);
  15690. try {
  15691. var pkg = JSON.parse(body);
  15692. return pkg;
  15693. } catch (jsonErr) {
  15694. }
  15695. };
  15696. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  15697. var dirs = nodeModulesPaths(start, opts, x);
  15698. for (var i = 0; i < dirs.length; i++) {
  15699. dirs[i] = path.join(dirs[i], x);
  15700. }
  15701. return dirs;
  15702. };
  15703. module2.exports = function resolveSync(x, options) {
  15704. if (typeof x !== "string") {
  15705. throw new TypeError("Path must be a string.");
  15706. }
  15707. var opts = normalizeOptions(x, options);
  15708. var isFile = opts.isFile || defaultIsFile;
  15709. var readFileSync = opts.readFileSync || fs.readFileSync;
  15710. var isDirectory = opts.isDirectory || defaultIsDir;
  15711. var realpathSync = opts.realpathSync || defaultRealpathSync;
  15712. var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
  15713. if (opts.readFileSync && opts.readPackageSync) {
  15714. throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
  15715. }
  15716. var packageIterator = opts.packageIterator;
  15717. var extensions = opts.extensions || [".js"];
  15718. var includeCoreModules = opts.includeCoreModules !== false;
  15719. var basedir = opts.basedir || path.dirname(caller());
  15720. var parent = opts.filename || basedir;
  15721. opts.paths = opts.paths || defaultPaths();
  15722. var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
  15723. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  15724. var res = path.resolve(absoluteStart, x);
  15725. if (x === "." || x === ".." || x.slice(-1) === "/")
  15726. res += "/";
  15727. var m = loadAsFileSync(res) || loadAsDirectorySync(res);
  15728. if (m)
  15729. return maybeRealpathSync(realpathSync, m, opts);
  15730. } else if (includeCoreModules && isCore(x)) {
  15731. return x;
  15732. } else {
  15733. var n = loadNodeModulesSync(x, absoluteStart);
  15734. if (n)
  15735. return maybeRealpathSync(realpathSync, n, opts);
  15736. }
  15737. var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15738. err.code = "MODULE_NOT_FOUND";
  15739. throw err;
  15740. function loadAsFileSync(x2) {
  15741. var pkg = loadpkg(path.dirname(x2));
  15742. if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
  15743. var rfile = path.relative(pkg.dir, x2);
  15744. var r = opts.pathFilter(pkg.pkg, x2, rfile);
  15745. if (r) {
  15746. x2 = path.resolve(pkg.dir, r);
  15747. }
  15748. }
  15749. if (isFile(x2)) {
  15750. return x2;
  15751. }
  15752. for (var i = 0; i < extensions.length; i++) {
  15753. var file = x2 + extensions[i];
  15754. if (isFile(file)) {
  15755. return file;
  15756. }
  15757. }
  15758. }
  15759. function loadpkg(dir) {
  15760. if (dir === "" || dir === "/")
  15761. return;
  15762. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15763. return;
  15764. }
  15765. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15766. return;
  15767. var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
  15768. if (!isFile(pkgfile)) {
  15769. return loadpkg(path.dirname(dir));
  15770. }
  15771. var pkg = readPackageSync(readFileSync, pkgfile);
  15772. if (pkg && opts.packageFilter) {
  15773. pkg = opts.packageFilter(pkg, dir);
  15774. }
  15775. return {
  15776. pkg,
  15777. dir
  15778. };
  15779. }
  15780. function loadAsDirectorySync(x2) {
  15781. var pkgfile = path.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
  15782. if (isFile(pkgfile)) {
  15783. try {
  15784. var pkg = readPackageSync(readFileSync, pkgfile);
  15785. } catch (e) {
  15786. }
  15787. if (pkg && opts.packageFilter) {
  15788. pkg = opts.packageFilter(pkg, x2);
  15789. }
  15790. if (pkg && pkg.main) {
  15791. if (typeof pkg.main !== "string") {
  15792. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15793. mainError.code = "INVALID_PACKAGE_MAIN";
  15794. throw mainError;
  15795. }
  15796. if (pkg.main === "." || pkg.main === "./") {
  15797. pkg.main = "index";
  15798. }
  15799. try {
  15800. var m2 = loadAsFileSync(path.resolve(x2, pkg.main));
  15801. if (m2)
  15802. return m2;
  15803. var n2 = loadAsDirectorySync(path.resolve(x2, pkg.main));
  15804. if (n2)
  15805. return n2;
  15806. } catch (e) {
  15807. }
  15808. }
  15809. }
  15810. return loadAsFileSync(path.join(x2, "/index"));
  15811. }
  15812. function loadNodeModulesSync(x2, start) {
  15813. var thunk = function() {
  15814. return getPackageCandidates(x2, start, opts);
  15815. };
  15816. var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
  15817. for (var i = 0; i < dirs.length; i++) {
  15818. var dir = dirs[i];
  15819. if (isDirectory(path.dirname(dir))) {
  15820. var m2 = loadAsFileSync(dir);
  15821. if (m2)
  15822. return m2;
  15823. var n2 = loadAsDirectorySync(dir);
  15824. if (n2)
  15825. return n2;
  15826. }
  15827. }
  15828. }
  15829. };
  15830. }
  15831. });
  15832. var require_resolve = __commonJS2({
  15833. "node_modules/resolve/index.js"(exports2, module2) {
  15834. var async = require_async();
  15835. async.core = require_core4();
  15836. async.isCore = require_is_core();
  15837. async.sync = require_sync();
  15838. module2.exports = async;
  15839. }
  15840. });
  15841. var require_resolve2 = __commonJS2({
  15842. "src/common/resolve.js"(exports2, module2) {
  15843. "use strict";
  15844. var {
  15845. resolve
  15846. } = require;
  15847. if (resolve.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) {
  15848. resolve = (id, options) => {
  15849. let basedir;
  15850. if (options && options.paths && options.paths.length === 1) {
  15851. basedir = options.paths[0];
  15852. }
  15853. return require_resolve().sync(id, {
  15854. basedir
  15855. });
  15856. };
  15857. }
  15858. module2.exports = resolve;
  15859. }
  15860. });
  15861. function mimicFunction(to, from, {
  15862. ignoreNonConfigurable = false
  15863. } = {}) {
  15864. const {
  15865. name
  15866. } = to;
  15867. for (const property of Reflect.ownKeys(from)) {
  15868. copyProperty(to, from, property, ignoreNonConfigurable);
  15869. }
  15870. changePrototype(to, from);
  15871. changeToString(to, from, name);
  15872. return to;
  15873. }
  15874. var copyProperty;
  15875. var canCopyProperty;
  15876. var changePrototype;
  15877. var wrappedToString;
  15878. var toStringDescriptor;
  15879. var toStringName;
  15880. var changeToString;
  15881. var init_mimic_fn = __esm({
  15882. "node_modules/mimic-fn/index.js"() {
  15883. copyProperty = (to, from, property, ignoreNonConfigurable) => {
  15884. if (property === "length" || property === "prototype") {
  15885. return;
  15886. }
  15887. if (property === "arguments" || property === "caller") {
  15888. return;
  15889. }
  15890. const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
  15891. const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
  15892. if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
  15893. return;
  15894. }
  15895. Object.defineProperty(to, property, fromDescriptor);
  15896. };
  15897. canCopyProperty = function(toDescriptor, fromDescriptor) {
  15898. return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
  15899. };
  15900. changePrototype = (to, from) => {
  15901. const fromPrototype = Object.getPrototypeOf(from);
  15902. if (fromPrototype === Object.getPrototypeOf(to)) {
  15903. return;
  15904. }
  15905. Object.setPrototypeOf(to, fromPrototype);
  15906. };
  15907. wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
  15908. ${fromBody}`;
  15909. toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
  15910. toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
  15911. changeToString = (to, from, name) => {
  15912. const withName = name === "" ? "" : `with ${name.trim()}() `;
  15913. const newToString = wrappedToString.bind(null, withName, from.toString());
  15914. Object.defineProperty(newToString, "name", toStringName);
  15915. Object.defineProperty(to, "toString", Object.assign(Object.assign({}, toStringDescriptor), {}, {
  15916. value: newToString
  15917. }));
  15918. };
  15919. }
  15920. });
  15921. var require_p_defer = __commonJS2({
  15922. "node_modules/p-defer/index.js"(exports2, module2) {
  15923. "use strict";
  15924. module2.exports = () => {
  15925. const ret = {};
  15926. ret.promise = new Promise((resolve, reject) => {
  15927. ret.resolve = resolve;
  15928. ret.reject = reject;
  15929. });
  15930. return ret;
  15931. };
  15932. }
  15933. });
  15934. var require_dist = __commonJS2({
  15935. "node_modules/map-age-cleaner/dist/index.js"(exports2, module2) {
  15936. "use strict";
  15937. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  15938. return new (P || (P = Promise))(function(resolve, reject) {
  15939. function fulfilled(value) {
  15940. try {
  15941. step(generator.next(value));
  15942. } catch (e) {
  15943. reject(e);
  15944. }
  15945. }
  15946. function rejected(value) {
  15947. try {
  15948. step(generator["throw"](value));
  15949. } catch (e) {
  15950. reject(e);
  15951. }
  15952. }
  15953. function step(result) {
  15954. result.done ? resolve(result.value) : new P(function(resolve2) {
  15955. resolve2(result.value);
  15956. }).then(fulfilled, rejected);
  15957. }
  15958. step((generator = generator.apply(thisArg, _arguments || [])).next());
  15959. });
  15960. };
  15961. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  15962. return mod && mod.__esModule ? mod : {
  15963. "default": mod
  15964. };
  15965. };
  15966. Object.defineProperty(exports2, "__esModule", {
  15967. value: true
  15968. });
  15969. var p_defer_1 = __importDefault2(require_p_defer());
  15970. function mapAgeCleaner2(map, property = "maxAge") {
  15971. let processingKey;
  15972. let processingTimer;
  15973. let processingDeferred;
  15974. const cleanup = () => __awaiter2(this, void 0, void 0, function* () {
  15975. if (processingKey !== void 0) {
  15976. return;
  15977. }
  15978. const setupTimer = (item) => __awaiter2(this, void 0, void 0, function* () {
  15979. processingDeferred = p_defer_1.default();
  15980. const delay = item[1][property] - Date.now();
  15981. if (delay <= 0) {
  15982. map.delete(item[0]);
  15983. processingDeferred.resolve();
  15984. return;
  15985. }
  15986. processingKey = item[0];
  15987. processingTimer = setTimeout(() => {
  15988. map.delete(item[0]);
  15989. if (processingDeferred) {
  15990. processingDeferred.resolve();
  15991. }
  15992. }, delay);
  15993. if (typeof processingTimer.unref === "function") {
  15994. processingTimer.unref();
  15995. }
  15996. return processingDeferred.promise;
  15997. });
  15998. try {
  15999. for (const entry of map) {
  16000. yield setupTimer(entry);
  16001. }
  16002. } catch (_a) {
  16003. }
  16004. processingKey = void 0;
  16005. });
  16006. const reset = () => {
  16007. processingKey = void 0;
  16008. if (processingTimer !== void 0) {
  16009. clearTimeout(processingTimer);
  16010. processingTimer = void 0;
  16011. }
  16012. if (processingDeferred !== void 0) {
  16013. processingDeferred.reject(void 0);
  16014. processingDeferred = void 0;
  16015. }
  16016. };
  16017. const originalSet = map.set.bind(map);
  16018. map.set = (key, value) => {
  16019. if (map.has(key)) {
  16020. map.delete(key);
  16021. }
  16022. const result = originalSet(key, value);
  16023. if (processingKey && processingKey === key) {
  16024. reset();
  16025. }
  16026. cleanup();
  16027. return result;
  16028. };
  16029. cleanup();
  16030. return map;
  16031. }
  16032. exports2.default = mapAgeCleaner2;
  16033. module2.exports = mapAgeCleaner2;
  16034. module2.exports.default = mapAgeCleaner2;
  16035. }
  16036. });
  16037. var dist_exports = {};
  16038. __export(dist_exports, {
  16039. default: () => mem,
  16040. memClear: () => memClear,
  16041. memDecorator: () => memDecorator
  16042. });
  16043. function mem(fn, {
  16044. cacheKey,
  16045. cache = /* @__PURE__ */ new Map(),
  16046. maxAge
  16047. } = {}) {
  16048. if (typeof maxAge === "number") {
  16049. (0, import_map_age_cleaner.default)(cache);
  16050. }
  16051. const memoized = function(...arguments_) {
  16052. const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
  16053. const cacheItem = cache.get(key);
  16054. if (cacheItem) {
  16055. return cacheItem.data;
  16056. }
  16057. const result = fn.apply(this, arguments_);
  16058. cache.set(key, {
  16059. data: result,
  16060. maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
  16061. });
  16062. return result;
  16063. };
  16064. mimicFunction(memoized, fn, {
  16065. ignoreNonConfigurable: true
  16066. });
  16067. cacheStore.set(memoized, cache);
  16068. return memoized;
  16069. }
  16070. function memDecorator(options = {}) {
  16071. const instanceMap = /* @__PURE__ */ new WeakMap();
  16072. return (target, propertyKey, descriptor) => {
  16073. const input = target[propertyKey];
  16074. if (typeof input !== "function") {
  16075. throw new TypeError("The decorated value must be a function");
  16076. }
  16077. delete descriptor.value;
  16078. delete descriptor.writable;
  16079. descriptor.get = function() {
  16080. if (!instanceMap.has(this)) {
  16081. const value = mem(input, options);
  16082. instanceMap.set(this, value);
  16083. return value;
  16084. }
  16085. return instanceMap.get(this);
  16086. };
  16087. };
  16088. }
  16089. function memClear(fn) {
  16090. const cache = cacheStore.get(fn);
  16091. if (!cache) {
  16092. throw new TypeError("Can't clear a function that was not memoized!");
  16093. }
  16094. if (typeof cache.clear !== "function") {
  16095. throw new TypeError("The cache Map can't be cleared!");
  16096. }
  16097. cache.clear();
  16098. }
  16099. var import_map_age_cleaner;
  16100. var cacheStore;
  16101. var init_dist = __esm({
  16102. "node_modules/mem/dist/index.js"() {
  16103. init_mimic_fn();
  16104. import_map_age_cleaner = __toESM(require_dist());
  16105. cacheStore = /* @__PURE__ */ new WeakMap();
  16106. }
  16107. });
  16108. var require_pseudomap = __commonJS2({
  16109. "node_modules/pseudomap/pseudomap.js"(exports2, module2) {
  16110. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16111. module2.exports = PseudoMap;
  16112. function PseudoMap(set2) {
  16113. if (!(this instanceof PseudoMap))
  16114. throw new TypeError("Constructor PseudoMap requires 'new'");
  16115. this.clear();
  16116. if (set2) {
  16117. if (set2 instanceof PseudoMap || typeof Map === "function" && set2 instanceof Map)
  16118. set2.forEach(function(value, key) {
  16119. this.set(key, value);
  16120. }, this);
  16121. else if (Array.isArray(set2))
  16122. set2.forEach(function(kv) {
  16123. this.set(kv[0], kv[1]);
  16124. }, this);
  16125. else
  16126. throw new TypeError("invalid argument");
  16127. }
  16128. }
  16129. PseudoMap.prototype.forEach = function(fn, thisp) {
  16130. thisp = thisp || this;
  16131. Object.keys(this._data).forEach(function(k) {
  16132. if (k !== "size")
  16133. fn.call(thisp, this._data[k].value, this._data[k].key);
  16134. }, this);
  16135. };
  16136. PseudoMap.prototype.has = function(k) {
  16137. return !!find(this._data, k);
  16138. };
  16139. PseudoMap.prototype.get = function(k) {
  16140. var res = find(this._data, k);
  16141. return res && res.value;
  16142. };
  16143. PseudoMap.prototype.set = function(k, v) {
  16144. set(this._data, k, v);
  16145. };
  16146. PseudoMap.prototype.delete = function(k) {
  16147. var res = find(this._data, k);
  16148. if (res) {
  16149. delete this._data[res._index];
  16150. this._data.size--;
  16151. }
  16152. };
  16153. PseudoMap.prototype.clear = function() {
  16154. var data = /* @__PURE__ */ Object.create(null);
  16155. data.size = 0;
  16156. Object.defineProperty(this, "_data", {
  16157. value: data,
  16158. enumerable: false,
  16159. configurable: true,
  16160. writable: false
  16161. });
  16162. };
  16163. Object.defineProperty(PseudoMap.prototype, "size", {
  16164. get: function() {
  16165. return this._data.size;
  16166. },
  16167. set: function(n) {
  16168. },
  16169. enumerable: true,
  16170. configurable: true
  16171. });
  16172. PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
  16173. throw new Error("iterators are not implemented in this version");
  16174. };
  16175. function same(a, b) {
  16176. return a === b || a !== a && b !== b;
  16177. }
  16178. function Entry(k, v, i) {
  16179. this.key = k;
  16180. this.value = v;
  16181. this._index = i;
  16182. }
  16183. function find(data, k) {
  16184. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  16185. if (same(data[key].key, k))
  16186. return data[key];
  16187. }
  16188. }
  16189. function set(data, k, v) {
  16190. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  16191. if (same(data[key].key, k)) {
  16192. data[key].value = v;
  16193. return;
  16194. }
  16195. }
  16196. data.size++;
  16197. data[key] = new Entry(k, v, key);
  16198. }
  16199. }
  16200. });
  16201. var require_map = __commonJS2({
  16202. "node_modules/pseudomap/map.js"(exports2, module2) {
  16203. if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
  16204. process.env.TEST_PSEUDOMAP = "true";
  16205. if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
  16206. module2.exports = Map;
  16207. } else {
  16208. module2.exports = require_pseudomap();
  16209. }
  16210. }
  16211. });
  16212. var require_yallist = __commonJS2({
  16213. "node_modules/editorconfig/node_modules/yallist/yallist.js"(exports2, module2) {
  16214. module2.exports = Yallist;
  16215. Yallist.Node = Node;
  16216. Yallist.create = Yallist;
  16217. function Yallist(list) {
  16218. var self2 = this;
  16219. if (!(self2 instanceof Yallist)) {
  16220. self2 = new Yallist();
  16221. }
  16222. self2.tail = null;
  16223. self2.head = null;
  16224. self2.length = 0;
  16225. if (list && typeof list.forEach === "function") {
  16226. list.forEach(function(item) {
  16227. self2.push(item);
  16228. });
  16229. } else if (arguments.length > 0) {
  16230. for (var i = 0, l = arguments.length; i < l; i++) {
  16231. self2.push(arguments[i]);
  16232. }
  16233. }
  16234. return self2;
  16235. }
  16236. Yallist.prototype.removeNode = function(node) {
  16237. if (node.list !== this) {
  16238. throw new Error("removing node which does not belong to this list");
  16239. }
  16240. var next = node.next;
  16241. var prev = node.prev;
  16242. if (next) {
  16243. next.prev = prev;
  16244. }
  16245. if (prev) {
  16246. prev.next = next;
  16247. }
  16248. if (node === this.head) {
  16249. this.head = next;
  16250. }
  16251. if (node === this.tail) {
  16252. this.tail = prev;
  16253. }
  16254. node.list.length--;
  16255. node.next = null;
  16256. node.prev = null;
  16257. node.list = null;
  16258. };
  16259. Yallist.prototype.unshiftNode = function(node) {
  16260. if (node === this.head) {
  16261. return;
  16262. }
  16263. if (node.list) {
  16264. node.list.removeNode(node);
  16265. }
  16266. var head = this.head;
  16267. node.list = this;
  16268. node.next = head;
  16269. if (head) {
  16270. head.prev = node;
  16271. }
  16272. this.head = node;
  16273. if (!this.tail) {
  16274. this.tail = node;
  16275. }
  16276. this.length++;
  16277. };
  16278. Yallist.prototype.pushNode = function(node) {
  16279. if (node === this.tail) {
  16280. return;
  16281. }
  16282. if (node.list) {
  16283. node.list.removeNode(node);
  16284. }
  16285. var tail = this.tail;
  16286. node.list = this;
  16287. node.prev = tail;
  16288. if (tail) {
  16289. tail.next = node;
  16290. }
  16291. this.tail = node;
  16292. if (!this.head) {
  16293. this.head = node;
  16294. }
  16295. this.length++;
  16296. };
  16297. Yallist.prototype.push = function() {
  16298. for (var i = 0, l = arguments.length; i < l; i++) {
  16299. push(this, arguments[i]);
  16300. }
  16301. return this.length;
  16302. };
  16303. Yallist.prototype.unshift = function() {
  16304. for (var i = 0, l = arguments.length; i < l; i++) {
  16305. unshift(this, arguments[i]);
  16306. }
  16307. return this.length;
  16308. };
  16309. Yallist.prototype.pop = function() {
  16310. if (!this.tail) {
  16311. return void 0;
  16312. }
  16313. var res = this.tail.value;
  16314. this.tail = this.tail.prev;
  16315. if (this.tail) {
  16316. this.tail.next = null;
  16317. } else {
  16318. this.head = null;
  16319. }
  16320. this.length--;
  16321. return res;
  16322. };
  16323. Yallist.prototype.shift = function() {
  16324. if (!this.head) {
  16325. return void 0;
  16326. }
  16327. var res = this.head.value;
  16328. this.head = this.head.next;
  16329. if (this.head) {
  16330. this.head.prev = null;
  16331. } else {
  16332. this.tail = null;
  16333. }
  16334. this.length--;
  16335. return res;
  16336. };
  16337. Yallist.prototype.forEach = function(fn, thisp) {
  16338. thisp = thisp || this;
  16339. for (var walker = this.head, i = 0; walker !== null; i++) {
  16340. fn.call(thisp, walker.value, i, this);
  16341. walker = walker.next;
  16342. }
  16343. };
  16344. Yallist.prototype.forEachReverse = function(fn, thisp) {
  16345. thisp = thisp || this;
  16346. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  16347. fn.call(thisp, walker.value, i, this);
  16348. walker = walker.prev;
  16349. }
  16350. };
  16351. Yallist.prototype.get = function(n) {
  16352. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  16353. walker = walker.next;
  16354. }
  16355. if (i === n && walker !== null) {
  16356. return walker.value;
  16357. }
  16358. };
  16359. Yallist.prototype.getReverse = function(n) {
  16360. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  16361. walker = walker.prev;
  16362. }
  16363. if (i === n && walker !== null) {
  16364. return walker.value;
  16365. }
  16366. };
  16367. Yallist.prototype.map = function(fn, thisp) {
  16368. thisp = thisp || this;
  16369. var res = new Yallist();
  16370. for (var walker = this.head; walker !== null; ) {
  16371. res.push(fn.call(thisp, walker.value, this));
  16372. walker = walker.next;
  16373. }
  16374. return res;
  16375. };
  16376. Yallist.prototype.mapReverse = function(fn, thisp) {
  16377. thisp = thisp || this;
  16378. var res = new Yallist();
  16379. for (var walker = this.tail; walker !== null; ) {
  16380. res.push(fn.call(thisp, walker.value, this));
  16381. walker = walker.prev;
  16382. }
  16383. return res;
  16384. };
  16385. Yallist.prototype.reduce = function(fn, initial) {
  16386. var acc;
  16387. var walker = this.head;
  16388. if (arguments.length > 1) {
  16389. acc = initial;
  16390. } else if (this.head) {
  16391. walker = this.head.next;
  16392. acc = this.head.value;
  16393. } else {
  16394. throw new TypeError("Reduce of empty list with no initial value");
  16395. }
  16396. for (var i = 0; walker !== null; i++) {
  16397. acc = fn(acc, walker.value, i);
  16398. walker = walker.next;
  16399. }
  16400. return acc;
  16401. };
  16402. Yallist.prototype.reduceReverse = function(fn, initial) {
  16403. var acc;
  16404. var walker = this.tail;
  16405. if (arguments.length > 1) {
  16406. acc = initial;
  16407. } else if (this.tail) {
  16408. walker = this.tail.prev;
  16409. acc = this.tail.value;
  16410. } else {
  16411. throw new TypeError("Reduce of empty list with no initial value");
  16412. }
  16413. for (var i = this.length - 1; walker !== null; i--) {
  16414. acc = fn(acc, walker.value, i);
  16415. walker = walker.prev;
  16416. }
  16417. return acc;
  16418. };
  16419. Yallist.prototype.toArray = function() {
  16420. var arr = new Array(this.length);
  16421. for (var i = 0, walker = this.head; walker !== null; i++) {
  16422. arr[i] = walker.value;
  16423. walker = walker.next;
  16424. }
  16425. return arr;
  16426. };
  16427. Yallist.prototype.toArrayReverse = function() {
  16428. var arr = new Array(this.length);
  16429. for (var i = 0, walker = this.tail; walker !== null; i++) {
  16430. arr[i] = walker.value;
  16431. walker = walker.prev;
  16432. }
  16433. return arr;
  16434. };
  16435. Yallist.prototype.slice = function(from, to) {
  16436. to = to || this.length;
  16437. if (to < 0) {
  16438. to += this.length;
  16439. }
  16440. from = from || 0;
  16441. if (from < 0) {
  16442. from += this.length;
  16443. }
  16444. var ret = new Yallist();
  16445. if (to < from || to < 0) {
  16446. return ret;
  16447. }
  16448. if (from < 0) {
  16449. from = 0;
  16450. }
  16451. if (to > this.length) {
  16452. to = this.length;
  16453. }
  16454. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  16455. walker = walker.next;
  16456. }
  16457. for (; walker !== null && i < to; i++, walker = walker.next) {
  16458. ret.push(walker.value);
  16459. }
  16460. return ret;
  16461. };
  16462. Yallist.prototype.sliceReverse = function(from, to) {
  16463. to = to || this.length;
  16464. if (to < 0) {
  16465. to += this.length;
  16466. }
  16467. from = from || 0;
  16468. if (from < 0) {
  16469. from += this.length;
  16470. }
  16471. var ret = new Yallist();
  16472. if (to < from || to < 0) {
  16473. return ret;
  16474. }
  16475. if (from < 0) {
  16476. from = 0;
  16477. }
  16478. if (to > this.length) {
  16479. to = this.length;
  16480. }
  16481. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  16482. walker = walker.prev;
  16483. }
  16484. for (; walker !== null && i > from; i--, walker = walker.prev) {
  16485. ret.push(walker.value);
  16486. }
  16487. return ret;
  16488. };
  16489. Yallist.prototype.reverse = function() {
  16490. var head = this.head;
  16491. var tail = this.tail;
  16492. for (var walker = head; walker !== null; walker = walker.prev) {
  16493. var p = walker.prev;
  16494. walker.prev = walker.next;
  16495. walker.next = p;
  16496. }
  16497. this.head = tail;
  16498. this.tail = head;
  16499. return this;
  16500. };
  16501. function push(self2, item) {
  16502. self2.tail = new Node(item, self2.tail, null, self2);
  16503. if (!self2.head) {
  16504. self2.head = self2.tail;
  16505. }
  16506. self2.length++;
  16507. }
  16508. function unshift(self2, item) {
  16509. self2.head = new Node(item, null, self2.head, self2);
  16510. if (!self2.tail) {
  16511. self2.tail = self2.head;
  16512. }
  16513. self2.length++;
  16514. }
  16515. function Node(value, prev, next, list) {
  16516. if (!(this instanceof Node)) {
  16517. return new Node(value, prev, next, list);
  16518. }
  16519. this.list = list;
  16520. this.value = value;
  16521. if (prev) {
  16522. prev.next = this;
  16523. this.prev = prev;
  16524. } else {
  16525. this.prev = null;
  16526. }
  16527. if (next) {
  16528. next.prev = this;
  16529. this.next = next;
  16530. } else {
  16531. this.next = null;
  16532. }
  16533. }
  16534. }
  16535. });
  16536. var require_lru_cache = __commonJS2({
  16537. "node_modules/editorconfig/node_modules/lru-cache/index.js"(exports2, module2) {
  16538. "use strict";
  16539. module2.exports = LRUCache;
  16540. var Map2 = require_map();
  16541. var util = require("util");
  16542. var Yallist = require_yallist();
  16543. var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
  16544. var makeSymbol;
  16545. if (hasSymbol) {
  16546. makeSymbol = function(key) {
  16547. return Symbol(key);
  16548. };
  16549. } else {
  16550. makeSymbol = function(key) {
  16551. return "_" + key;
  16552. };
  16553. }
  16554. var MAX = makeSymbol("max");
  16555. var LENGTH = makeSymbol("length");
  16556. var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
  16557. var ALLOW_STALE = makeSymbol("allowStale");
  16558. var MAX_AGE = makeSymbol("maxAge");
  16559. var DISPOSE = makeSymbol("dispose");
  16560. var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
  16561. var LRU_LIST = makeSymbol("lruList");
  16562. var CACHE = makeSymbol("cache");
  16563. function naiveLength() {
  16564. return 1;
  16565. }
  16566. function LRUCache(options) {
  16567. if (!(this instanceof LRUCache)) {
  16568. return new LRUCache(options);
  16569. }
  16570. if (typeof options === "number") {
  16571. options = {
  16572. max: options
  16573. };
  16574. }
  16575. if (!options) {
  16576. options = {};
  16577. }
  16578. var max = this[MAX] = options.max;
  16579. if (!max || !(typeof max === "number") || max <= 0) {
  16580. this[MAX] = Infinity;
  16581. }
  16582. var lc = options.length || naiveLength;
  16583. if (typeof lc !== "function") {
  16584. lc = naiveLength;
  16585. }
  16586. this[LENGTH_CALCULATOR] = lc;
  16587. this[ALLOW_STALE] = options.stale || false;
  16588. this[MAX_AGE] = options.maxAge || 0;
  16589. this[DISPOSE] = options.dispose;
  16590. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  16591. this.reset();
  16592. }
  16593. Object.defineProperty(LRUCache.prototype, "max", {
  16594. set: function(mL) {
  16595. if (!mL || !(typeof mL === "number") || mL <= 0) {
  16596. mL = Infinity;
  16597. }
  16598. this[MAX] = mL;
  16599. trim(this);
  16600. },
  16601. get: function() {
  16602. return this[MAX];
  16603. },
  16604. enumerable: true
  16605. });
  16606. Object.defineProperty(LRUCache.prototype, "allowStale", {
  16607. set: function(allowStale) {
  16608. this[ALLOW_STALE] = !!allowStale;
  16609. },
  16610. get: function() {
  16611. return this[ALLOW_STALE];
  16612. },
  16613. enumerable: true
  16614. });
  16615. Object.defineProperty(LRUCache.prototype, "maxAge", {
  16616. set: function(mA) {
  16617. if (!mA || !(typeof mA === "number") || mA < 0) {
  16618. mA = 0;
  16619. }
  16620. this[MAX_AGE] = mA;
  16621. trim(this);
  16622. },
  16623. get: function() {
  16624. return this[MAX_AGE];
  16625. },
  16626. enumerable: true
  16627. });
  16628. Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
  16629. set: function(lC) {
  16630. if (typeof lC !== "function") {
  16631. lC = naiveLength;
  16632. }
  16633. if (lC !== this[LENGTH_CALCULATOR]) {
  16634. this[LENGTH_CALCULATOR] = lC;
  16635. this[LENGTH] = 0;
  16636. this[LRU_LIST].forEach(function(hit) {
  16637. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  16638. this[LENGTH] += hit.length;
  16639. }, this);
  16640. }
  16641. trim(this);
  16642. },
  16643. get: function() {
  16644. return this[LENGTH_CALCULATOR];
  16645. },
  16646. enumerable: true
  16647. });
  16648. Object.defineProperty(LRUCache.prototype, "length", {
  16649. get: function() {
  16650. return this[LENGTH];
  16651. },
  16652. enumerable: true
  16653. });
  16654. Object.defineProperty(LRUCache.prototype, "itemCount", {
  16655. get: function() {
  16656. return this[LRU_LIST].length;
  16657. },
  16658. enumerable: true
  16659. });
  16660. LRUCache.prototype.rforEach = function(fn, thisp) {
  16661. thisp = thisp || this;
  16662. for (var walker = this[LRU_LIST].tail; walker !== null; ) {
  16663. var prev = walker.prev;
  16664. forEachStep(this, fn, walker, thisp);
  16665. walker = prev;
  16666. }
  16667. };
  16668. function forEachStep(self2, fn, node, thisp) {
  16669. var hit = node.value;
  16670. if (isStale(self2, hit)) {
  16671. del(self2, node);
  16672. if (!self2[ALLOW_STALE]) {
  16673. hit = void 0;
  16674. }
  16675. }
  16676. if (hit) {
  16677. fn.call(thisp, hit.value, hit.key, self2);
  16678. }
  16679. }
  16680. LRUCache.prototype.forEach = function(fn, thisp) {
  16681. thisp = thisp || this;
  16682. for (var walker = this[LRU_LIST].head; walker !== null; ) {
  16683. var next = walker.next;
  16684. forEachStep(this, fn, walker, thisp);
  16685. walker = next;
  16686. }
  16687. };
  16688. LRUCache.prototype.keys = function() {
  16689. return this[LRU_LIST].toArray().map(function(k) {
  16690. return k.key;
  16691. }, this);
  16692. };
  16693. LRUCache.prototype.values = function() {
  16694. return this[LRU_LIST].toArray().map(function(k) {
  16695. return k.value;
  16696. }, this);
  16697. };
  16698. LRUCache.prototype.reset = function() {
  16699. if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
  16700. this[LRU_LIST].forEach(function(hit) {
  16701. this[DISPOSE](hit.key, hit.value);
  16702. }, this);
  16703. }
  16704. this[CACHE] = new Map2();
  16705. this[LRU_LIST] = new Yallist();
  16706. this[LENGTH] = 0;
  16707. };
  16708. LRUCache.prototype.dump = function() {
  16709. return this[LRU_LIST].map(function(hit) {
  16710. if (!isStale(this, hit)) {
  16711. return {
  16712. k: hit.key,
  16713. v: hit.value,
  16714. e: hit.now + (hit.maxAge || 0)
  16715. };
  16716. }
  16717. }, this).toArray().filter(function(h) {
  16718. return h;
  16719. });
  16720. };
  16721. LRUCache.prototype.dumpLru = function() {
  16722. return this[LRU_LIST];
  16723. };
  16724. LRUCache.prototype.inspect = function(n, opts) {
  16725. var str = "LRUCache {";
  16726. var extras = false;
  16727. var as = this[ALLOW_STALE];
  16728. if (as) {
  16729. str += "\n allowStale: true";
  16730. extras = true;
  16731. }
  16732. var max = this[MAX];
  16733. if (max && max !== Infinity) {
  16734. if (extras) {
  16735. str += ",";
  16736. }
  16737. str += "\n max: " + util.inspect(max, opts);
  16738. extras = true;
  16739. }
  16740. var maxAge = this[MAX_AGE];
  16741. if (maxAge) {
  16742. if (extras) {
  16743. str += ",";
  16744. }
  16745. str += "\n maxAge: " + util.inspect(maxAge, opts);
  16746. extras = true;
  16747. }
  16748. var lc = this[LENGTH_CALCULATOR];
  16749. if (lc && lc !== naiveLength) {
  16750. if (extras) {
  16751. str += ",";
  16752. }
  16753. str += "\n length: " + util.inspect(this[LENGTH], opts);
  16754. extras = true;
  16755. }
  16756. var didFirst = false;
  16757. this[LRU_LIST].forEach(function(item) {
  16758. if (didFirst) {
  16759. str += ",\n ";
  16760. } else {
  16761. if (extras) {
  16762. str += ",\n";
  16763. }
  16764. didFirst = true;
  16765. str += "\n ";
  16766. }
  16767. var key = util.inspect(item.key).split("\n").join("\n ");
  16768. var val = {
  16769. value: item.value
  16770. };
  16771. if (item.maxAge !== maxAge) {
  16772. val.maxAge = item.maxAge;
  16773. }
  16774. if (lc !== naiveLength) {
  16775. val.length = item.length;
  16776. }
  16777. if (isStale(this, item)) {
  16778. val.stale = true;
  16779. }
  16780. val = util.inspect(val, opts).split("\n").join("\n ");
  16781. str += key + " => " + val;
  16782. });
  16783. if (didFirst || extras) {
  16784. str += "\n";
  16785. }
  16786. str += "}";
  16787. return str;
  16788. };
  16789. LRUCache.prototype.set = function(key, value, maxAge) {
  16790. maxAge = maxAge || this[MAX_AGE];
  16791. var now = maxAge ? Date.now() : 0;
  16792. var len = this[LENGTH_CALCULATOR](value, key);
  16793. if (this[CACHE].has(key)) {
  16794. if (len > this[MAX]) {
  16795. del(this, this[CACHE].get(key));
  16796. return false;
  16797. }
  16798. var node = this[CACHE].get(key);
  16799. var item = node.value;
  16800. if (this[DISPOSE]) {
  16801. if (!this[NO_DISPOSE_ON_SET]) {
  16802. this[DISPOSE](key, item.value);
  16803. }
  16804. }
  16805. item.now = now;
  16806. item.maxAge = maxAge;
  16807. item.value = value;
  16808. this[LENGTH] += len - item.length;
  16809. item.length = len;
  16810. this.get(key);
  16811. trim(this);
  16812. return true;
  16813. }
  16814. var hit = new Entry(key, value, len, now, maxAge);
  16815. if (hit.length > this[MAX]) {
  16816. if (this[DISPOSE]) {
  16817. this[DISPOSE](key, value);
  16818. }
  16819. return false;
  16820. }
  16821. this[LENGTH] += hit.length;
  16822. this[LRU_LIST].unshift(hit);
  16823. this[CACHE].set(key, this[LRU_LIST].head);
  16824. trim(this);
  16825. return true;
  16826. };
  16827. LRUCache.prototype.has = function(key) {
  16828. if (!this[CACHE].has(key))
  16829. return false;
  16830. var hit = this[CACHE].get(key).value;
  16831. if (isStale(this, hit)) {
  16832. return false;
  16833. }
  16834. return true;
  16835. };
  16836. LRUCache.prototype.get = function(key) {
  16837. return get(this, key, true);
  16838. };
  16839. LRUCache.prototype.peek = function(key) {
  16840. return get(this, key, false);
  16841. };
  16842. LRUCache.prototype.pop = function() {
  16843. var node = this[LRU_LIST].tail;
  16844. if (!node)
  16845. return null;
  16846. del(this, node);
  16847. return node.value;
  16848. };
  16849. LRUCache.prototype.del = function(key) {
  16850. del(this, this[CACHE].get(key));
  16851. };
  16852. LRUCache.prototype.load = function(arr) {
  16853. this.reset();
  16854. var now = Date.now();
  16855. for (var l = arr.length - 1; l >= 0; l--) {
  16856. var hit = arr[l];
  16857. var expiresAt = hit.e || 0;
  16858. if (expiresAt === 0) {
  16859. this.set(hit.k, hit.v);
  16860. } else {
  16861. var maxAge = expiresAt - now;
  16862. if (maxAge > 0) {
  16863. this.set(hit.k, hit.v, maxAge);
  16864. }
  16865. }
  16866. }
  16867. };
  16868. LRUCache.prototype.prune = function() {
  16869. var self2 = this;
  16870. this[CACHE].forEach(function(value, key) {
  16871. get(self2, key, false);
  16872. });
  16873. };
  16874. function get(self2, key, doUse) {
  16875. var node = self2[CACHE].get(key);
  16876. if (node) {
  16877. var hit = node.value;
  16878. if (isStale(self2, hit)) {
  16879. del(self2, node);
  16880. if (!self2[ALLOW_STALE])
  16881. hit = void 0;
  16882. } else {
  16883. if (doUse) {
  16884. self2[LRU_LIST].unshiftNode(node);
  16885. }
  16886. }
  16887. if (hit)
  16888. hit = hit.value;
  16889. }
  16890. return hit;
  16891. }
  16892. function isStale(self2, hit) {
  16893. if (!hit || !hit.maxAge && !self2[MAX_AGE]) {
  16894. return false;
  16895. }
  16896. var stale = false;
  16897. var diff = Date.now() - hit.now;
  16898. if (hit.maxAge) {
  16899. stale = diff > hit.maxAge;
  16900. } else {
  16901. stale = self2[MAX_AGE] && diff > self2[MAX_AGE];
  16902. }
  16903. return stale;
  16904. }
  16905. function trim(self2) {
  16906. if (self2[LENGTH] > self2[MAX]) {
  16907. for (var walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
  16908. var prev = walker.prev;
  16909. del(self2, walker);
  16910. walker = prev;
  16911. }
  16912. }
  16913. }
  16914. function del(self2, node) {
  16915. if (node) {
  16916. var hit = node.value;
  16917. if (self2[DISPOSE]) {
  16918. self2[DISPOSE](hit.key, hit.value);
  16919. }
  16920. self2[LENGTH] -= hit.length;
  16921. self2[CACHE].delete(hit.key);
  16922. self2[LRU_LIST].removeNode(node);
  16923. }
  16924. }
  16925. function Entry(key, value, length, now, maxAge) {
  16926. this.key = key;
  16927. this.value = value;
  16928. this.length = length;
  16929. this.now = now;
  16930. this.maxAge = maxAge || 0;
  16931. }
  16932. }
  16933. });
  16934. var require_sigmund = __commonJS2({
  16935. "node_modules/sigmund/sigmund.js"(exports2, module2) {
  16936. module2.exports = sigmund;
  16937. function sigmund(subject, maxSessions) {
  16938. maxSessions = maxSessions || 10;
  16939. var notes = [];
  16940. var analysis = "";
  16941. var RE = RegExp;
  16942. function psychoAnalyze(subject2, session) {
  16943. if (session > maxSessions)
  16944. return;
  16945. if (typeof subject2 === "function" || typeof subject2 === "undefined") {
  16946. return;
  16947. }
  16948. if (typeof subject2 !== "object" || !subject2 || subject2 instanceof RE) {
  16949. analysis += subject2;
  16950. return;
  16951. }
  16952. if (notes.indexOf(subject2) !== -1 || session === maxSessions)
  16953. return;
  16954. notes.push(subject2);
  16955. analysis += "{";
  16956. Object.keys(subject2).forEach(function(issue, _, __) {
  16957. if (issue.charAt(0) === "_")
  16958. return;
  16959. var to = typeof subject2[issue];
  16960. if (to === "function" || to === "undefined")
  16961. return;
  16962. analysis += issue;
  16963. psychoAnalyze(subject2[issue], session + 1);
  16964. });
  16965. }
  16966. psychoAnalyze(subject, 0);
  16967. return analysis;
  16968. }
  16969. }
  16970. });
  16971. var require_fnmatch = __commonJS2({
  16972. "node_modules/editorconfig/src/lib/fnmatch.js"(exports2, module2) {
  16973. var platform = typeof process === "object" ? process.platform : "win32";
  16974. if (module2)
  16975. module2.exports = minimatch;
  16976. else
  16977. exports2.minimatch = minimatch;
  16978. minimatch.Minimatch = Minimatch;
  16979. var LRU = require_lru_cache();
  16980. var cache = minimatch.cache = new LRU({
  16981. max: 100
  16982. });
  16983. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
  16984. var sigmund = require_sigmund();
  16985. var path = require("path");
  16986. var qmark = "[^/]";
  16987. var star = qmark + "*?";
  16988. var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
  16989. var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
  16990. var reSpecials = charSet("().*{}+?[]^$\\!");
  16991. function charSet(s) {
  16992. return s.split("").reduce(function(set, c) {
  16993. set[c] = true;
  16994. return set;
  16995. }, {});
  16996. }
  16997. var slashSplit = /\/+/;
  16998. minimatch.monkeyPatch = monkeyPatch;
  16999. function monkeyPatch() {
  17000. var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
  17001. var orig = desc.value;
  17002. desc.value = function(p) {
  17003. if (p instanceof Minimatch)
  17004. return p.match(this);
  17005. return orig.call(this, p);
  17006. };
  17007. Object.defineProperty(String.prototype, desc);
  17008. }
  17009. minimatch.filter = filter;
  17010. function filter(pattern, options) {
  17011. options = options || {};
  17012. return function(p, i, list) {
  17013. return minimatch(p, pattern, options);
  17014. };
  17015. }
  17016. function ext(a, b) {
  17017. a = a || {};
  17018. b = b || {};
  17019. var t = {};
  17020. Object.keys(b).forEach(function(k) {
  17021. t[k] = b[k];
  17022. });
  17023. Object.keys(a).forEach(function(k) {
  17024. t[k] = a[k];
  17025. });
  17026. return t;
  17027. }
  17028. minimatch.defaults = function(def) {
  17029. if (!def || !Object.keys(def).length)
  17030. return minimatch;
  17031. var orig = minimatch;
  17032. var m = function minimatch2(p, pattern, options) {
  17033. return orig.minimatch(p, pattern, ext(def, options));
  17034. };
  17035. m.Minimatch = function Minimatch2(pattern, options) {
  17036. return new orig.Minimatch(pattern, ext(def, options));
  17037. };
  17038. return m;
  17039. };
  17040. Minimatch.defaults = function(def) {
  17041. if (!def || !Object.keys(def).length)
  17042. return Minimatch;
  17043. return minimatch.defaults(def).Minimatch;
  17044. };
  17045. function minimatch(p, pattern, options) {
  17046. if (typeof pattern !== "string") {
  17047. throw new TypeError("glob pattern string required");
  17048. }
  17049. if (!options)
  17050. options = {};
  17051. if (!options.nocomment && pattern.charAt(0) === "#") {
  17052. return false;
  17053. }
  17054. if (pattern.trim() === "")
  17055. return p === "";
  17056. return new Minimatch(pattern, options).match(p);
  17057. }
  17058. function Minimatch(pattern, options) {
  17059. if (!(this instanceof Minimatch)) {
  17060. return new Minimatch(pattern, options, cache);
  17061. }
  17062. if (typeof pattern !== "string") {
  17063. throw new TypeError("glob pattern string required");
  17064. }
  17065. if (!options)
  17066. options = {};
  17067. if (platform === "win32") {
  17068. pattern = pattern.split("\\").join("/");
  17069. }
  17070. var cacheKey = pattern + "\n" + sigmund(options);
  17071. var cached = minimatch.cache.get(cacheKey);
  17072. if (cached)
  17073. return cached;
  17074. minimatch.cache.set(cacheKey, this);
  17075. this.options = options;
  17076. this.set = [];
  17077. this.pattern = pattern;
  17078. this.regexp = null;
  17079. this.negate = false;
  17080. this.comment = false;
  17081. this.empty = false;
  17082. this.make();
  17083. }
  17084. Minimatch.prototype.make = make;
  17085. function make() {
  17086. if (this._made)
  17087. return;
  17088. var pattern = this.pattern;
  17089. var options = this.options;
  17090. if (!options.nocomment && pattern.charAt(0) === "#") {
  17091. this.comment = true;
  17092. return;
  17093. }
  17094. if (!pattern) {
  17095. this.empty = true;
  17096. return;
  17097. }
  17098. this.parseNegate();
  17099. var set = this.globSet = this.braceExpand();
  17100. if (options.debug)
  17101. console.error(this.pattern, set);
  17102. set = this.globParts = set.map(function(s) {
  17103. return s.split(slashSplit);
  17104. });
  17105. if (options.debug)
  17106. console.error(this.pattern, set);
  17107. set = set.map(function(s, si, set2) {
  17108. return s.map(this.parse, this);
  17109. }, this);
  17110. if (options.debug)
  17111. console.error(this.pattern, set);
  17112. set = set.filter(function(s) {
  17113. return -1 === s.indexOf(false);
  17114. });
  17115. if (options.debug)
  17116. console.error(this.pattern, set);
  17117. this.set = set;
  17118. }
  17119. Minimatch.prototype.parseNegate = parseNegate;
  17120. function parseNegate() {
  17121. var pattern = this.pattern, negate = false, options = this.options, negateOffset = 0;
  17122. if (options.nonegate)
  17123. return;
  17124. for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
  17125. negate = !negate;
  17126. negateOffset++;
  17127. }
  17128. if (negateOffset)
  17129. this.pattern = pattern.substr(negateOffset);
  17130. this.negate = negate;
  17131. }
  17132. minimatch.braceExpand = function(pattern, options) {
  17133. return new Minimatch(pattern, options).braceExpand();
  17134. };
  17135. Minimatch.prototype.braceExpand = braceExpand;
  17136. function braceExpand(pattern, options) {
  17137. options = options || this.options;
  17138. pattern = typeof pattern === "undefined" ? this.pattern : pattern;
  17139. if (typeof pattern === "undefined") {
  17140. throw new Error("undefined pattern");
  17141. }
  17142. if (options.nobrace || !pattern.match(/\{.*\}/)) {
  17143. return [pattern];
  17144. }
  17145. var escaping = false;
  17146. if (pattern.charAt(0) !== "{") {
  17147. var prefix = null;
  17148. for (var i = 0, l = pattern.length; i < l; i++) {
  17149. var c = pattern.charAt(i);
  17150. if (c === "\\") {
  17151. escaping = !escaping;
  17152. } else if (c === "{" && !escaping) {
  17153. prefix = pattern.substr(0, i);
  17154. break;
  17155. }
  17156. }
  17157. if (prefix === null) {
  17158. return [pattern];
  17159. }
  17160. var tail = braceExpand(pattern.substr(i), options);
  17161. return tail.map(function(t) {
  17162. return prefix + t;
  17163. });
  17164. }
  17165. var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
  17166. if (numset) {
  17167. var suf = braceExpand(pattern.substr(numset[0].length), options), start = +numset[1], end = +numset[2], inc = start > end ? -1 : 1, set = [];
  17168. for (var i = start; i != end + inc; i += inc) {
  17169. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  17170. set.push(i + suf[ii]);
  17171. }
  17172. }
  17173. return set;
  17174. }
  17175. var i = 1, depth = 1, set = [], member = "", sawEnd = false, escaping = false;
  17176. function addMember() {
  17177. set.push(member);
  17178. member = "";
  17179. }
  17180. FOR:
  17181. for (i = 1, l = pattern.length; i < l; i++) {
  17182. var c = pattern.charAt(i);
  17183. if (escaping) {
  17184. escaping = false;
  17185. member += "\\" + c;
  17186. } else {
  17187. switch (c) {
  17188. case "\\":
  17189. escaping = true;
  17190. continue;
  17191. case "{":
  17192. depth++;
  17193. member += "{";
  17194. continue;
  17195. case "}":
  17196. depth--;
  17197. if (depth === 0) {
  17198. addMember();
  17199. i++;
  17200. break FOR;
  17201. } else {
  17202. member += c;
  17203. continue;
  17204. }
  17205. case ",":
  17206. if (depth === 1) {
  17207. addMember();
  17208. } else {
  17209. member += c;
  17210. }
  17211. continue;
  17212. default:
  17213. member += c;
  17214. continue;
  17215. }
  17216. }
  17217. }
  17218. if (depth !== 0) {
  17219. return braceExpand("\\" + pattern, options);
  17220. }
  17221. var suf = braceExpand(pattern.substr(i), options);
  17222. var addBraces = set.length === 1;
  17223. set = set.map(function(p) {
  17224. return braceExpand(p, options);
  17225. });
  17226. set = set.reduce(function(l2, r) {
  17227. return l2.concat(r);
  17228. });
  17229. if (addBraces) {
  17230. set = set.map(function(s) {
  17231. return "{" + s + "}";
  17232. });
  17233. }
  17234. var ret = [];
  17235. for (var i = 0, l = set.length; i < l; i++) {
  17236. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  17237. ret.push(set[i] + suf[ii]);
  17238. }
  17239. }
  17240. return ret;
  17241. }
  17242. Minimatch.prototype.parse = parse;
  17243. var SUBPARSE = {};
  17244. function parse(pattern, isSub) {
  17245. var options = this.options;
  17246. if (!options.noglobstar && pattern === "**")
  17247. return GLOBSTAR;
  17248. if (pattern === "")
  17249. return "";
  17250. var re = "", hasMagic = !!options.nocase, escaping = false, patternListStack = [], plType, stateChar, inClass = false, reClassStart = -1, classStart = -1, patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
  17251. function clearStateChar() {
  17252. if (stateChar) {
  17253. switch (stateChar) {
  17254. case "*":
  17255. re += star;
  17256. hasMagic = true;
  17257. break;
  17258. case "?":
  17259. re += qmark;
  17260. hasMagic = true;
  17261. break;
  17262. default:
  17263. re += "\\" + stateChar;
  17264. break;
  17265. }
  17266. stateChar = false;
  17267. }
  17268. }
  17269. for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
  17270. if (options.debug) {
  17271. console.error("%s %s %s %j", pattern, i, re, c);
  17272. }
  17273. if (escaping && reSpecials[c]) {
  17274. re += "\\" + c;
  17275. escaping = false;
  17276. continue;
  17277. }
  17278. SWITCH:
  17279. switch (c) {
  17280. case "/":
  17281. return false;
  17282. case "\\":
  17283. clearStateChar();
  17284. escaping = true;
  17285. continue;
  17286. case "?":
  17287. case "*":
  17288. case "+":
  17289. case "@":
  17290. case "!":
  17291. if (options.debug) {
  17292. console.error("%s %s %s %j <-- stateChar", pattern, i, re, c);
  17293. }
  17294. if (inClass) {
  17295. if (c === "!" && i === classStart + 1)
  17296. c = "^";
  17297. re += c;
  17298. continue;
  17299. }
  17300. clearStateChar();
  17301. stateChar = c;
  17302. if (options.noext)
  17303. clearStateChar();
  17304. continue;
  17305. case "(":
  17306. if (inClass) {
  17307. re += "(";
  17308. continue;
  17309. }
  17310. if (!stateChar) {
  17311. re += "\\(";
  17312. continue;
  17313. }
  17314. plType = stateChar;
  17315. patternListStack.push({
  17316. type: plType,
  17317. start: i - 1,
  17318. reStart: re.length
  17319. });
  17320. re += stateChar === "!" ? "(?:(?!" : "(?:";
  17321. stateChar = false;
  17322. continue;
  17323. case ")":
  17324. if (inClass || !patternListStack.length) {
  17325. re += "\\)";
  17326. continue;
  17327. }
  17328. hasMagic = true;
  17329. re += ")";
  17330. plType = patternListStack.pop().type;
  17331. switch (plType) {
  17332. case "!":
  17333. re += "[^/]*?)";
  17334. break;
  17335. case "?":
  17336. case "+":
  17337. case "*":
  17338. re += plType;
  17339. case "@":
  17340. break;
  17341. }
  17342. continue;
  17343. case "|":
  17344. if (inClass || !patternListStack.length || escaping) {
  17345. re += "\\|";
  17346. escaping = false;
  17347. continue;
  17348. }
  17349. re += "|";
  17350. continue;
  17351. case "[":
  17352. clearStateChar();
  17353. if (inClass) {
  17354. re += "\\" + c;
  17355. continue;
  17356. }
  17357. inClass = true;
  17358. classStart = i;
  17359. reClassStart = re.length;
  17360. re += c;
  17361. continue;
  17362. case "]":
  17363. if (i === classStart + 1 || !inClass) {
  17364. re += "\\" + c;
  17365. escaping = false;
  17366. continue;
  17367. }
  17368. hasMagic = true;
  17369. inClass = false;
  17370. re += c;
  17371. continue;
  17372. default:
  17373. clearStateChar();
  17374. if (escaping) {
  17375. escaping = false;
  17376. } else if (reSpecials[c] && !(c === "^" && inClass)) {
  17377. re += "\\";
  17378. }
  17379. re += c;
  17380. }
  17381. }
  17382. if (inClass) {
  17383. var cs = pattern.substr(classStart + 1), sp = this.parse(cs, SUBPARSE);
  17384. re = re.substr(0, reClassStart) + "\\[" + sp[0];
  17385. hasMagic = hasMagic || sp[1];
  17386. }
  17387. var pl;
  17388. while (pl = patternListStack.pop()) {
  17389. var tail = re.slice(pl.reStart + 3);
  17390. tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function(_, $1, $2) {
  17391. if (!$2) {
  17392. $2 = "\\";
  17393. }
  17394. return $1 + $1 + $2 + "|";
  17395. });
  17396. var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
  17397. hasMagic = true;
  17398. re = re.slice(0, pl.reStart) + t + "\\(" + tail;
  17399. }
  17400. clearStateChar();
  17401. if (escaping) {
  17402. re += "\\\\";
  17403. }
  17404. var addPatternStart = false;
  17405. switch (re.charAt(0)) {
  17406. case ".":
  17407. case "[":
  17408. case "(":
  17409. addPatternStart = true;
  17410. }
  17411. if (re !== "" && hasMagic)
  17412. re = "(?=.)" + re;
  17413. if (addPatternStart)
  17414. re = patternStart + re;
  17415. if (isSub === SUBPARSE) {
  17416. return [re, hasMagic];
  17417. }
  17418. if (!hasMagic) {
  17419. return globUnescape(pattern);
  17420. }
  17421. var flags = options.nocase ? "i" : "", regExp = new RegExp("^" + re + "$", flags);
  17422. regExp._glob = pattern;
  17423. regExp._src = re;
  17424. return regExp;
  17425. }
  17426. minimatch.makeRe = function(pattern, options) {
  17427. return new Minimatch(pattern, options || {}).makeRe();
  17428. };
  17429. Minimatch.prototype.makeRe = makeRe;
  17430. function makeRe() {
  17431. if (this.regexp || this.regexp === false)
  17432. return this.regexp;
  17433. var set = this.set;
  17434. if (!set.length)
  17435. return this.regexp = false;
  17436. var options = this.options;
  17437. var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot, flags = options.nocase ? "i" : "";
  17438. var re = set.map(function(pattern) {
  17439. return pattern.map(function(p) {
  17440. return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
  17441. }).join("\\/");
  17442. }).join("|");
  17443. re = "^(?:" + re + ")$";
  17444. if (this.negate)
  17445. re = "^(?!" + re + ").*$";
  17446. try {
  17447. return this.regexp = new RegExp(re, flags);
  17448. } catch (ex) {
  17449. return this.regexp = false;
  17450. }
  17451. }
  17452. minimatch.match = function(list, pattern, options) {
  17453. var mm = new Minimatch(pattern, options);
  17454. list = list.filter(function(f) {
  17455. return mm.match(f);
  17456. });
  17457. if (options.nonull && !list.length) {
  17458. list.push(pattern);
  17459. }
  17460. return list;
  17461. };
  17462. Minimatch.prototype.match = match;
  17463. function match(f, partial) {
  17464. if (this.comment)
  17465. return false;
  17466. if (this.empty)
  17467. return f === "";
  17468. if (f === "/" && partial)
  17469. return true;
  17470. var options = this.options;
  17471. if (platform === "win32") {
  17472. f = f.split("\\").join("/");
  17473. }
  17474. f = f.split(slashSplit);
  17475. if (options.debug) {
  17476. console.error(this.pattern, "split", f);
  17477. }
  17478. var set = this.set;
  17479. for (var i = 0, l = set.length; i < l; i++) {
  17480. var pattern = set[i];
  17481. var hit = this.matchOne(f, pattern, partial);
  17482. if (hit) {
  17483. if (options.flipNegate)
  17484. return true;
  17485. return !this.negate;
  17486. }
  17487. }
  17488. if (options.flipNegate)
  17489. return false;
  17490. return this.negate;
  17491. }
  17492. Minimatch.prototype.matchOne = function(file, pattern, partial) {
  17493. var options = this.options;
  17494. if (options.debug) {
  17495. console.error("matchOne", {
  17496. "this": this,
  17497. file,
  17498. pattern
  17499. });
  17500. }
  17501. if (options.matchBase && pattern.length === 1) {
  17502. file = path.basename(file.join("/")).split("/");
  17503. }
  17504. if (options.debug) {
  17505. console.error("matchOne", file.length, pattern.length);
  17506. }
  17507. for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
  17508. if (options.debug) {
  17509. console.error("matchOne loop");
  17510. }
  17511. var p = pattern[pi], f = file[fi];
  17512. if (options.debug) {
  17513. console.error(pattern, p, f);
  17514. }
  17515. if (p === false)
  17516. return false;
  17517. if (p === GLOBSTAR) {
  17518. if (options.debug)
  17519. console.error("GLOBSTAR", [pattern, p, f]);
  17520. var fr = fi, pr = pi + 1;
  17521. if (pr === pl) {
  17522. if (options.debug)
  17523. console.error("** at the end");
  17524. for (; fi < fl; fi++) {
  17525. if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
  17526. return false;
  17527. }
  17528. return true;
  17529. }
  17530. WHILE:
  17531. while (fr < fl) {
  17532. var swallowee = file[fr];
  17533. if (options.debug) {
  17534. console.error("\nglobstar while", file, fr, pattern, pr, swallowee);
  17535. }
  17536. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  17537. if (options.debug)
  17538. console.error("globstar found match!", fr, fl, swallowee);
  17539. return true;
  17540. } else {
  17541. if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
  17542. if (options.debug)
  17543. console.error("dot detected!", file, fr, pattern, pr);
  17544. break WHILE;
  17545. }
  17546. if (options.debug)
  17547. console.error("globstar swallow a segment, and continue");
  17548. fr++;
  17549. }
  17550. }
  17551. if (partial) {
  17552. if (fr === fl)
  17553. return true;
  17554. }
  17555. return false;
  17556. }
  17557. var hit;
  17558. if (typeof p === "string") {
  17559. if (options.nocase) {
  17560. hit = f.toLowerCase() === p.toLowerCase();
  17561. } else {
  17562. hit = f === p;
  17563. }
  17564. if (options.debug) {
  17565. console.error("string match", p, f, hit);
  17566. }
  17567. } else {
  17568. hit = f.match(p);
  17569. if (options.debug) {
  17570. console.error("pattern match", p, f, hit);
  17571. }
  17572. }
  17573. if (!hit)
  17574. return false;
  17575. }
  17576. if (fi === fl && pi === pl) {
  17577. return true;
  17578. } else if (fi === fl) {
  17579. return partial;
  17580. } else if (pi === pl) {
  17581. var emptyFileEnd = fi === fl - 1 && file[fi] === "";
  17582. return emptyFileEnd;
  17583. }
  17584. throw new Error("wtf?");
  17585. };
  17586. function globUnescape(s) {
  17587. return s.replace(/\\(.)/g, "$1");
  17588. }
  17589. function regExpEscape(s) {
  17590. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  17591. }
  17592. }
  17593. });
  17594. var require_ini = __commonJS2({
  17595. "node_modules/editorconfig/src/lib/ini.js"(exports2) {
  17596. "use strict";
  17597. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17598. return new (P || (P = Promise))(function(resolve, reject) {
  17599. function fulfilled(value) {
  17600. try {
  17601. step(generator.next(value));
  17602. } catch (e) {
  17603. reject(e);
  17604. }
  17605. }
  17606. function rejected(value) {
  17607. try {
  17608. step(generator["throw"](value));
  17609. } catch (e) {
  17610. reject(e);
  17611. }
  17612. }
  17613. function step(result) {
  17614. result.done ? resolve(result.value) : new P(function(resolve2) {
  17615. resolve2(result.value);
  17616. }).then(fulfilled, rejected);
  17617. }
  17618. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17619. });
  17620. };
  17621. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17622. var _ = {
  17623. label: 0,
  17624. sent: function() {
  17625. if (t[0] & 1)
  17626. throw t[1];
  17627. return t[1];
  17628. },
  17629. trys: [],
  17630. ops: []
  17631. }, f, y, t, g;
  17632. return g = {
  17633. next: verb(0),
  17634. "throw": verb(1),
  17635. "return": verb(2)
  17636. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17637. return this;
  17638. }), g;
  17639. function verb(n) {
  17640. return function(v) {
  17641. return step([n, v]);
  17642. };
  17643. }
  17644. function step(op) {
  17645. if (f)
  17646. throw new TypeError("Generator is already executing.");
  17647. while (_)
  17648. try {
  17649. 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)
  17650. return t;
  17651. if (y = 0, t)
  17652. op = [op[0] & 2, t.value];
  17653. switch (op[0]) {
  17654. case 0:
  17655. case 1:
  17656. t = op;
  17657. break;
  17658. case 4:
  17659. _.label++;
  17660. return {
  17661. value: op[1],
  17662. done: false
  17663. };
  17664. case 5:
  17665. _.label++;
  17666. y = op[1];
  17667. op = [0];
  17668. continue;
  17669. case 7:
  17670. op = _.ops.pop();
  17671. _.trys.pop();
  17672. continue;
  17673. default:
  17674. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17675. _ = 0;
  17676. continue;
  17677. }
  17678. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17679. _.label = op[1];
  17680. break;
  17681. }
  17682. if (op[0] === 6 && _.label < t[1]) {
  17683. _.label = t[1];
  17684. t = op;
  17685. break;
  17686. }
  17687. if (t && _.label < t[2]) {
  17688. _.label = t[2];
  17689. _.ops.push(op);
  17690. break;
  17691. }
  17692. if (t[2])
  17693. _.ops.pop();
  17694. _.trys.pop();
  17695. continue;
  17696. }
  17697. op = body.call(thisArg, _);
  17698. } catch (e) {
  17699. op = [6, e];
  17700. y = 0;
  17701. } finally {
  17702. f = t = 0;
  17703. }
  17704. if (op[0] & 5)
  17705. throw op[1];
  17706. return {
  17707. value: op[0] ? op[1] : void 0,
  17708. done: true
  17709. };
  17710. }
  17711. };
  17712. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17713. if (mod && mod.__esModule)
  17714. return mod;
  17715. var result = {};
  17716. if (mod != null) {
  17717. for (var k in mod)
  17718. if (Object.hasOwnProperty.call(mod, k))
  17719. result[k] = mod[k];
  17720. }
  17721. result["default"] = mod;
  17722. return result;
  17723. };
  17724. Object.defineProperty(exports2, "__esModule", {
  17725. value: true
  17726. });
  17727. var fs = __importStar2(require("fs"));
  17728. var regex = {
  17729. section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
  17730. param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
  17731. comment: /^\s*[#;].*$/
  17732. };
  17733. function parse(file) {
  17734. return __awaiter2(this, void 0, void 0, function() {
  17735. return __generator2(this, function(_a) {
  17736. return [2, new Promise(function(resolve, reject) {
  17737. fs.readFile(file, "utf8", function(err, data) {
  17738. if (err) {
  17739. reject(err);
  17740. return;
  17741. }
  17742. resolve(parseString(data));
  17743. });
  17744. })];
  17745. });
  17746. });
  17747. }
  17748. exports2.parse = parse;
  17749. function parseSync(file) {
  17750. return parseString(fs.readFileSync(file, "utf8"));
  17751. }
  17752. exports2.parseSync = parseSync;
  17753. function parseString(data) {
  17754. var sectionBody = {};
  17755. var sectionName = null;
  17756. var value = [[sectionName, sectionBody]];
  17757. var lines = data.split(/\r\n|\r|\n/);
  17758. lines.forEach(function(line) {
  17759. var match;
  17760. if (regex.comment.test(line)) {
  17761. return;
  17762. }
  17763. if (regex.param.test(line)) {
  17764. match = line.match(regex.param);
  17765. sectionBody[match[1]] = match[2];
  17766. } else if (regex.section.test(line)) {
  17767. match = line.match(regex.section);
  17768. sectionName = match[1];
  17769. sectionBody = {};
  17770. value.push([sectionName, sectionBody]);
  17771. }
  17772. });
  17773. return value;
  17774. }
  17775. exports2.parseString = parseString;
  17776. }
  17777. });
  17778. var require_package = __commonJS2({
  17779. "node_modules/editorconfig/package.json"(exports2, module2) {
  17780. module2.exports = {
  17781. name: "editorconfig",
  17782. version: "0.15.3",
  17783. description: "EditorConfig File Locator and Interpreter for Node.js",
  17784. keywords: ["editorconfig", "core"],
  17785. main: "src/index.js",
  17786. contributors: ["Hong Xu (topbug.net)", "Jed Mao (https://github.com/jedmao/)", "Trey Hunner (http://treyhunner.com)"],
  17787. directories: {
  17788. bin: "./bin",
  17789. lib: "./lib"
  17790. },
  17791. scripts: {
  17792. clean: "rimraf dist",
  17793. prebuild: "npm run clean",
  17794. build: "tsc",
  17795. pretest: "npm run lint && npm run build && npm run copy && cmake .",
  17796. test: "ctest .",
  17797. "pretest:ci": "npm run pretest",
  17798. "test:ci": "ctest -VV --output-on-failure .",
  17799. lint: "npm run eclint && npm run tslint",
  17800. eclint: 'eclint check --indent_size ignore "src/**"',
  17801. tslint: "tslint --project tsconfig.json --exclude package.json",
  17802. copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
  17803. prepub: "npm run lint && npm run build && npm run copy",
  17804. pub: "npm publish ./dist"
  17805. },
  17806. repository: {
  17807. type: "git",
  17808. url: "git://github.com/editorconfig/editorconfig-core-js.git"
  17809. },
  17810. bugs: "https://github.com/editorconfig/editorconfig-core-js/issues",
  17811. author: "EditorConfig Team",
  17812. license: "MIT",
  17813. dependencies: {
  17814. commander: "^2.19.0",
  17815. "lru-cache": "^4.1.5",
  17816. semver: "^5.6.0",
  17817. sigmund: "^1.0.1"
  17818. },
  17819. devDependencies: {
  17820. "@types/mocha": "^5.2.6",
  17821. "@types/node": "^10.12.29",
  17822. "@types/semver": "^5.5.0",
  17823. "cpy-cli": "^2.0.0",
  17824. eclint: "^2.8.1",
  17825. mocha: "^5.2.0",
  17826. rimraf: "^2.6.3",
  17827. should: "^13.2.3",
  17828. tslint: "^5.13.1",
  17829. typescript: "^3.3.3333"
  17830. }
  17831. };
  17832. }
  17833. });
  17834. var require_src2 = __commonJS2({
  17835. "node_modules/editorconfig/src/index.js"(exports2) {
  17836. "use strict";
  17837. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17838. return new (P || (P = Promise))(function(resolve, reject) {
  17839. function fulfilled(value) {
  17840. try {
  17841. step(generator.next(value));
  17842. } catch (e) {
  17843. reject(e);
  17844. }
  17845. }
  17846. function rejected(value) {
  17847. try {
  17848. step(generator["throw"](value));
  17849. } catch (e) {
  17850. reject(e);
  17851. }
  17852. }
  17853. function step(result) {
  17854. result.done ? resolve(result.value) : new P(function(resolve2) {
  17855. resolve2(result.value);
  17856. }).then(fulfilled, rejected);
  17857. }
  17858. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17859. });
  17860. };
  17861. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17862. var _ = {
  17863. label: 0,
  17864. sent: function() {
  17865. if (t[0] & 1)
  17866. throw t[1];
  17867. return t[1];
  17868. },
  17869. trys: [],
  17870. ops: []
  17871. }, f, y, t, g;
  17872. return g = {
  17873. next: verb(0),
  17874. "throw": verb(1),
  17875. "return": verb(2)
  17876. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17877. return this;
  17878. }), g;
  17879. function verb(n) {
  17880. return function(v) {
  17881. return step([n, v]);
  17882. };
  17883. }
  17884. function step(op) {
  17885. if (f)
  17886. throw new TypeError("Generator is already executing.");
  17887. while (_)
  17888. try {
  17889. 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)
  17890. return t;
  17891. if (y = 0, t)
  17892. op = [op[0] & 2, t.value];
  17893. switch (op[0]) {
  17894. case 0:
  17895. case 1:
  17896. t = op;
  17897. break;
  17898. case 4:
  17899. _.label++;
  17900. return {
  17901. value: op[1],
  17902. done: false
  17903. };
  17904. case 5:
  17905. _.label++;
  17906. y = op[1];
  17907. op = [0];
  17908. continue;
  17909. case 7:
  17910. op = _.ops.pop();
  17911. _.trys.pop();
  17912. continue;
  17913. default:
  17914. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17915. _ = 0;
  17916. continue;
  17917. }
  17918. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17919. _.label = op[1];
  17920. break;
  17921. }
  17922. if (op[0] === 6 && _.label < t[1]) {
  17923. _.label = t[1];
  17924. t = op;
  17925. break;
  17926. }
  17927. if (t && _.label < t[2]) {
  17928. _.label = t[2];
  17929. _.ops.push(op);
  17930. break;
  17931. }
  17932. if (t[2])
  17933. _.ops.pop();
  17934. _.trys.pop();
  17935. continue;
  17936. }
  17937. op = body.call(thisArg, _);
  17938. } catch (e) {
  17939. op = [6, e];
  17940. y = 0;
  17941. } finally {
  17942. f = t = 0;
  17943. }
  17944. if (op[0] & 5)
  17945. throw op[1];
  17946. return {
  17947. value: op[0] ? op[1] : void 0,
  17948. done: true
  17949. };
  17950. }
  17951. };
  17952. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17953. if (mod && mod.__esModule)
  17954. return mod;
  17955. var result = {};
  17956. if (mod != null) {
  17957. for (var k in mod)
  17958. if (Object.hasOwnProperty.call(mod, k))
  17959. result[k] = mod[k];
  17960. }
  17961. result["default"] = mod;
  17962. return result;
  17963. };
  17964. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  17965. return mod && mod.__esModule ? mod : {
  17966. "default": mod
  17967. };
  17968. };
  17969. Object.defineProperty(exports2, "__esModule", {
  17970. value: true
  17971. });
  17972. var fs = __importStar2(require("fs"));
  17973. var path = __importStar2(require("path"));
  17974. var semver = {
  17975. gte: require_gte()
  17976. };
  17977. var fnmatch_1 = __importDefault2(require_fnmatch());
  17978. var ini_1 = require_ini();
  17979. exports2.parseString = ini_1.parseString;
  17980. var package_json_1 = __importDefault2(require_package());
  17981. var knownProps = {
  17982. end_of_line: true,
  17983. indent_style: true,
  17984. indent_size: true,
  17985. insert_final_newline: true,
  17986. trim_trailing_whitespace: true,
  17987. charset: true
  17988. };
  17989. function fnmatch(filepath, glob) {
  17990. var matchOptions = {
  17991. matchBase: true,
  17992. dot: true,
  17993. noext: true
  17994. };
  17995. glob = glob.replace(/\*\*/g, "{*,**/**/**}");
  17996. return fnmatch_1.default(filepath, glob, matchOptions);
  17997. }
  17998. function getConfigFileNames(filepath, options) {
  17999. var paths = [];
  18000. do {
  18001. filepath = path.dirname(filepath);
  18002. paths.push(path.join(filepath, options.config));
  18003. } while (filepath !== options.root);
  18004. return paths;
  18005. }
  18006. function processMatches(matches, version2) {
  18007. if ("indent_style" in matches && matches.indent_style === "tab" && !("indent_size" in matches) && semver.gte(version2, "0.10.0")) {
  18008. matches.indent_size = "tab";
  18009. }
  18010. if ("indent_size" in matches && !("tab_width" in matches) && matches.indent_size !== "tab") {
  18011. matches.tab_width = matches.indent_size;
  18012. }
  18013. if ("indent_size" in matches && "tab_width" in matches && matches.indent_size === "tab") {
  18014. matches.indent_size = matches.tab_width;
  18015. }
  18016. return matches;
  18017. }
  18018. function processOptions(options, filepath) {
  18019. if (options === void 0) {
  18020. options = {};
  18021. }
  18022. return {
  18023. config: options.config || ".editorconfig",
  18024. version: options.version || package_json_1.default.version,
  18025. root: path.resolve(options.root || path.parse(filepath).root)
  18026. };
  18027. }
  18028. function buildFullGlob(pathPrefix, glob) {
  18029. switch (glob.indexOf("/")) {
  18030. case -1:
  18031. glob = "**/" + glob;
  18032. break;
  18033. case 0:
  18034. glob = glob.substring(1);
  18035. break;
  18036. default:
  18037. break;
  18038. }
  18039. return path.join(pathPrefix, glob);
  18040. }
  18041. function extendProps(props, options) {
  18042. if (props === void 0) {
  18043. props = {};
  18044. }
  18045. if (options === void 0) {
  18046. options = {};
  18047. }
  18048. for (var key in options) {
  18049. if (options.hasOwnProperty(key)) {
  18050. var value = options[key];
  18051. var key2 = key.toLowerCase();
  18052. var value2 = value;
  18053. if (knownProps[key2]) {
  18054. value2 = value.toLowerCase();
  18055. }
  18056. try {
  18057. value2 = JSON.parse(value);
  18058. } catch (e) {
  18059. }
  18060. if (typeof value === "undefined" || value === null) {
  18061. value2 = String(value);
  18062. }
  18063. props[key2] = value2;
  18064. }
  18065. }
  18066. return props;
  18067. }
  18068. function parseFromConfigs(configs, filepath, options) {
  18069. return processMatches(configs.reverse().reduce(function(matches, file) {
  18070. var pathPrefix = path.dirname(file.name);
  18071. file.contents.forEach(function(section) {
  18072. var glob = section[0];
  18073. var options2 = section[1];
  18074. if (!glob) {
  18075. return;
  18076. }
  18077. var fullGlob = buildFullGlob(pathPrefix, glob);
  18078. if (!fnmatch(filepath, fullGlob)) {
  18079. return;
  18080. }
  18081. matches = extendProps(matches, options2);
  18082. });
  18083. return matches;
  18084. }, {}), options.version);
  18085. }
  18086. function getConfigsForFiles(files) {
  18087. var configs = [];
  18088. for (var i in files) {
  18089. if (files.hasOwnProperty(i)) {
  18090. var file = files[i];
  18091. var contents = ini_1.parseString(file.contents);
  18092. configs.push({
  18093. name: file.name,
  18094. contents
  18095. });
  18096. if ((contents[0][1].root || "").toLowerCase() === "true") {
  18097. break;
  18098. }
  18099. }
  18100. }
  18101. return configs;
  18102. }
  18103. function readConfigFiles(filepaths) {
  18104. return __awaiter2(this, void 0, void 0, function() {
  18105. return __generator2(this, function(_a) {
  18106. return [2, Promise.all(filepaths.map(function(name) {
  18107. return new Promise(function(resolve) {
  18108. fs.readFile(name, "utf8", function(err, data) {
  18109. resolve({
  18110. name,
  18111. contents: err ? "" : data
  18112. });
  18113. });
  18114. });
  18115. }))];
  18116. });
  18117. });
  18118. }
  18119. function readConfigFilesSync(filepaths) {
  18120. var files = [];
  18121. var file;
  18122. filepaths.forEach(function(filepath) {
  18123. try {
  18124. file = fs.readFileSync(filepath, "utf8");
  18125. } catch (e) {
  18126. file = "";
  18127. }
  18128. files.push({
  18129. name: filepath,
  18130. contents: file
  18131. });
  18132. });
  18133. return files;
  18134. }
  18135. function opts(filepath, options) {
  18136. if (options === void 0) {
  18137. options = {};
  18138. }
  18139. var resolvedFilePath = path.resolve(filepath);
  18140. return [resolvedFilePath, processOptions(options, resolvedFilePath)];
  18141. }
  18142. function parseFromFiles(filepath, files, options) {
  18143. if (options === void 0) {
  18144. options = {};
  18145. }
  18146. return __awaiter2(this, void 0, void 0, function() {
  18147. var _a, resolvedFilePath, processedOptions;
  18148. return __generator2(this, function(_b) {
  18149. _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  18150. return [2, files.then(getConfigsForFiles).then(function(configs) {
  18151. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  18152. })];
  18153. });
  18154. });
  18155. }
  18156. exports2.parseFromFiles = parseFromFiles;
  18157. function parseFromFilesSync(filepath, files, options) {
  18158. if (options === void 0) {
  18159. options = {};
  18160. }
  18161. var _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  18162. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  18163. }
  18164. exports2.parseFromFilesSync = parseFromFilesSync;
  18165. function parse(_filepath, _options) {
  18166. if (_options === void 0) {
  18167. _options = {};
  18168. }
  18169. return __awaiter2(this, void 0, void 0, function() {
  18170. var _a, resolvedFilePath, processedOptions, filepaths;
  18171. return __generator2(this, function(_b) {
  18172. _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  18173. filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  18174. return [2, readConfigFiles(filepaths).then(getConfigsForFiles).then(function(configs) {
  18175. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  18176. })];
  18177. });
  18178. });
  18179. }
  18180. exports2.parse = parse;
  18181. function parseSync(_filepath, _options) {
  18182. if (_options === void 0) {
  18183. _options = {};
  18184. }
  18185. var _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  18186. var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  18187. var files = readConfigFilesSync(filepaths);
  18188. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  18189. }
  18190. exports2.parseSync = parseSync;
  18191. }
  18192. });
  18193. var require_editorconfig_to_prettier = __commonJS2({
  18194. "node_modules/editorconfig-to-prettier/index.js"(exports2, module2) {
  18195. module2.exports = editorConfigToPrettier;
  18196. function removeUnset(editorConfig) {
  18197. const result = {};
  18198. const keys = Object.keys(editorConfig);
  18199. for (let i = 0; i < keys.length; i++) {
  18200. const key = keys[i];
  18201. if (editorConfig[key] === "unset") {
  18202. continue;
  18203. }
  18204. result[key] = editorConfig[key];
  18205. }
  18206. return result;
  18207. }
  18208. function editorConfigToPrettier(editorConfig) {
  18209. if (!editorConfig) {
  18210. return null;
  18211. }
  18212. editorConfig = removeUnset(editorConfig);
  18213. if (Object.keys(editorConfig).length === 0) {
  18214. return null;
  18215. }
  18216. const result = {};
  18217. if (editorConfig.indent_style) {
  18218. result.useTabs = editorConfig.indent_style === "tab";
  18219. }
  18220. if (editorConfig.indent_size === "tab") {
  18221. result.useTabs = true;
  18222. }
  18223. if (result.useTabs && editorConfig.tab_width) {
  18224. result.tabWidth = editorConfig.tab_width;
  18225. } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
  18226. result.tabWidth = editorConfig.indent_size;
  18227. } else if (editorConfig.tab_width !== void 0) {
  18228. result.tabWidth = editorConfig.tab_width;
  18229. }
  18230. if (editorConfig.max_line_length) {
  18231. if (editorConfig.max_line_length === "off") {
  18232. result.printWidth = Number.POSITIVE_INFINITY;
  18233. } else {
  18234. result.printWidth = editorConfig.max_line_length;
  18235. }
  18236. }
  18237. if (editorConfig.quote_type === "single") {
  18238. result.singleQuote = true;
  18239. } else if (editorConfig.quote_type === "double") {
  18240. result.singleQuote = false;
  18241. }
  18242. if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) {
  18243. result.endOfLine = editorConfig.end_of_line;
  18244. }
  18245. if (editorConfig.insert_final_newline === false || editorConfig.insert_final_newline === true) {
  18246. result.insertFinalNewline = editorConfig.insert_final_newline;
  18247. }
  18248. return result;
  18249. }
  18250. }
  18251. });
  18252. var require_find_project_root = __commonJS2({
  18253. "src/config/find-project-root.js"(exports2, module2) {
  18254. "use strict";
  18255. var fs = require("fs");
  18256. var path = require("path");
  18257. var MARKERS = [".git", ".hg"];
  18258. var markerExists = (directory) => MARKERS.some((mark) => fs.existsSync(path.join(directory, mark)));
  18259. function findProjectRoot(directory) {
  18260. while (!markerExists(directory)) {
  18261. const parentDirectory = path.resolve(directory, "..");
  18262. if (parentDirectory === directory) {
  18263. break;
  18264. }
  18265. directory = parentDirectory;
  18266. }
  18267. return directory;
  18268. }
  18269. module2.exports = findProjectRoot;
  18270. }
  18271. });
  18272. var require_resolve_config_editorconfig = __commonJS2({
  18273. "src/config/resolve-config-editorconfig.js"(exports2, module2) {
  18274. "use strict";
  18275. var path = require("path");
  18276. var editorconfig = require_src2();
  18277. var editorConfigToPrettier = require_editorconfig_to_prettier();
  18278. var {
  18279. default: mem2,
  18280. memClear: memClear2
  18281. } = (init_dist(), __toCommonJS(dist_exports));
  18282. var findProjectRoot = require_find_project_root();
  18283. var jsonStringifyMem = (fn) => mem2(fn, {
  18284. cacheKey: JSON.stringify
  18285. });
  18286. var maybeParse = (filePath, parse) => filePath && parse(filePath, {
  18287. root: findProjectRoot(path.dirname(path.resolve(filePath)))
  18288. });
  18289. var editorconfigAsyncNoCache = async (filePath) => editorConfigToPrettier(await maybeParse(filePath, editorconfig.parse));
  18290. var editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache);
  18291. var editorconfigSyncNoCache = (filePath) => editorConfigToPrettier(maybeParse(filePath, editorconfig.parseSync));
  18292. var editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache);
  18293. function getLoadFunction(opts) {
  18294. if (!opts.editorconfig) {
  18295. return () => null;
  18296. }
  18297. if (opts.sync) {
  18298. return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache;
  18299. }
  18300. return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache;
  18301. }
  18302. function clearCache() {
  18303. memClear2(editorconfigSyncWithCache);
  18304. memClear2(editorconfigAsyncWithCache);
  18305. }
  18306. module2.exports = {
  18307. getLoadFunction,
  18308. clearCache
  18309. };
  18310. }
  18311. });
  18312. var require_resolve_config = __commonJS2({
  18313. "src/config/resolve-config.js"(exports2, module2) {
  18314. "use strict";
  18315. var path = require("path");
  18316. var micromatch = require_micromatch();
  18317. var thirdParty = require("./third-party.js");
  18318. var loadToml = require_load_toml();
  18319. var loadJson5 = require_load_json5();
  18320. var partition = require_partition();
  18321. var resolve = require_resolve2();
  18322. var {
  18323. default: mem2,
  18324. memClear: memClear2
  18325. } = (init_dist(), __toCommonJS(dist_exports));
  18326. var resolveEditorConfig = require_resolve_config_editorconfig();
  18327. var getExplorerMemoized = mem2((opts) => {
  18328. const cosmiconfig = thirdParty["cosmiconfig" + (opts.sync ? "Sync" : "")];
  18329. const explorer = cosmiconfig("prettier", {
  18330. cache: opts.cache,
  18331. transform: (result) => {
  18332. if (result && result.config) {
  18333. if (typeof result.config === "string") {
  18334. const dir = path.dirname(result.filepath);
  18335. const modulePath = resolve(result.config, {
  18336. paths: [dir]
  18337. });
  18338. result.config = require(modulePath);
  18339. }
  18340. if (typeof result.config !== "object") {
  18341. throw new TypeError(`Config is only allowed to be an object, but received ${typeof result.config} in "${result.filepath}"`);
  18342. }
  18343. delete result.config.$schema;
  18344. }
  18345. return result;
  18346. },
  18347. searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.json5", ".prettierrc.js", ".prettierrc.cjs", "prettier.config.js", "prettier.config.cjs", ".prettierrc.toml"],
  18348. loaders: {
  18349. ".toml": loadToml,
  18350. ".json5": loadJson5
  18351. }
  18352. });
  18353. return explorer;
  18354. }, {
  18355. cacheKey: JSON.stringify
  18356. });
  18357. function getExplorer(opts) {
  18358. opts = Object.assign({
  18359. sync: false,
  18360. cache: false
  18361. }, opts);
  18362. return getExplorerMemoized(opts);
  18363. }
  18364. function _resolveConfig(filePath, opts, sync) {
  18365. opts = Object.assign({
  18366. useCache: true
  18367. }, opts);
  18368. const loadOpts = {
  18369. cache: Boolean(opts.useCache),
  18370. sync: Boolean(sync),
  18371. editorconfig: Boolean(opts.editorconfig)
  18372. };
  18373. const {
  18374. load,
  18375. search
  18376. } = getExplorer(loadOpts);
  18377. const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
  18378. const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)];
  18379. const unwrapAndMerge = ([result, editorConfigured]) => {
  18380. const merged = Object.assign(Object.assign({}, editorConfigured), mergeOverrides(result, filePath));
  18381. for (const optionName of ["plugins", "pluginSearchDirs"]) {
  18382. if (Array.isArray(merged[optionName])) {
  18383. merged[optionName] = merged[optionName].map((value) => typeof value === "string" && value.startsWith(".") ? path.resolve(path.dirname(result.filepath), value) : value);
  18384. }
  18385. }
  18386. if (!result && !editorConfigured) {
  18387. return null;
  18388. }
  18389. delete merged.insertFinalNewline;
  18390. return merged;
  18391. };
  18392. if (loadOpts.sync) {
  18393. return unwrapAndMerge(arr);
  18394. }
  18395. return Promise.all(arr).then(unwrapAndMerge);
  18396. }
  18397. var resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false);
  18398. resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true);
  18399. function clearCache() {
  18400. memClear2(getExplorerMemoized);
  18401. resolveEditorConfig.clearCache();
  18402. }
  18403. async function resolveConfigFile(filePath) {
  18404. const {
  18405. search
  18406. } = getExplorer({
  18407. sync: false
  18408. });
  18409. const result = await search(filePath);
  18410. return result ? result.filepath : null;
  18411. }
  18412. resolveConfigFile.sync = (filePath) => {
  18413. const {
  18414. search
  18415. } = getExplorer({
  18416. sync: true
  18417. });
  18418. const result = search(filePath);
  18419. return result ? result.filepath : null;
  18420. };
  18421. function mergeOverrides(configResult, filePath) {
  18422. const {
  18423. config: config2,
  18424. filepath: configPath
  18425. } = configResult || {};
  18426. const _ref = config2 || {}, {
  18427. overrides
  18428. } = _ref, options = _objectWithoutProperties(_ref, _excluded3);
  18429. if (filePath && overrides) {
  18430. const relativeFilePath = path.relative(path.dirname(configPath), filePath);
  18431. for (const override of overrides) {
  18432. if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) {
  18433. Object.assign(options, override.options);
  18434. }
  18435. }
  18436. }
  18437. return options;
  18438. }
  18439. function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
  18440. const patternList = Array.isArray(patterns) ? patterns : [patterns];
  18441. const [withSlashes, withoutSlashes] = partition(patternList, (pattern) => pattern.includes("/"));
  18442. return micromatch.isMatch(filePath, withoutSlashes, {
  18443. ignore: excludedPatterns,
  18444. basename: true,
  18445. dot: true
  18446. }) || micromatch.isMatch(filePath, withSlashes, {
  18447. ignore: excludedPatterns,
  18448. basename: false,
  18449. dot: true
  18450. });
  18451. }
  18452. module2.exports = {
  18453. resolveConfig,
  18454. resolveConfigFile,
  18455. clearCache
  18456. };
  18457. }
  18458. });
  18459. var require_ignore = __commonJS2({
  18460. "node_modules/ignore/index.js"(exports2, module2) {
  18461. function makeArray(subject) {
  18462. return Array.isArray(subject) ? subject : [subject];
  18463. }
  18464. var EMPTY = "";
  18465. var SPACE = " ";
  18466. var ESCAPE = "\\";
  18467. var REGEX_TEST_BLANK_LINE = /^\s+$/;
  18468. var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
  18469. var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
  18470. var REGEX_SPLITALL_CRLF = /\r?\n/g;
  18471. var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
  18472. var SLASH = "/";
  18473. var KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("node-ignore") : "node-ignore";
  18474. var define2 = (object, key, value) => Object.defineProperty(object, key, {
  18475. value
  18476. });
  18477. var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
  18478. var RETURN_FALSE = () => false;
  18479. var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
  18480. var cleanRangeBackSlash = (slashes) => {
  18481. const {
  18482. length
  18483. } = slashes;
  18484. return slashes.slice(0, length - length % 2);
  18485. };
  18486. var REPLACERS = [[/\\?\s+$/, (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY], [/\\\s/g, () => SPACE], [/[\\$.|*+(){^]/g, (match) => `\\${match}`], [/(?!\\)\?/g, () => "[^/]"], [/^\//, () => "^"], [/\//g, () => "\\/"], [/^\^*\\\*\\\*\\\//, () => "^(?:.*\\/)?"], [/^(?=[^^])/, function startingReplacer() {
  18487. return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
  18488. }], [/\\\/\\\*\\\*(?=\\\/|$)/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) => {
  18489. const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
  18490. return `${prefix}(?=$|\\/$)`;
  18491. }]];
  18492. var regexCache = /* @__PURE__ */ Object.create(null);
  18493. var makeRegex = (pattern, ignoreCase) => {
  18494. let source = regexCache[pattern];
  18495. if (!source) {
  18496. source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
  18497. regexCache[pattern] = source;
  18498. }
  18499. return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
  18500. };
  18501. var isString = (subject) => typeof subject === "string";
  18502. var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && pattern.indexOf("#") !== 0;
  18503. var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
  18504. var IgnoreRule = class {
  18505. constructor(origin, pattern, negative, regex) {
  18506. this.origin = origin;
  18507. this.pattern = pattern;
  18508. this.negative = negative;
  18509. this.regex = regex;
  18510. }
  18511. };
  18512. var createRule = (pattern, ignoreCase) => {
  18513. const origin = pattern;
  18514. let negative = false;
  18515. if (pattern.indexOf("!") === 0) {
  18516. negative = true;
  18517. pattern = pattern.substr(1);
  18518. }
  18519. pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
  18520. const regex = makeRegex(pattern, ignoreCase);
  18521. return new IgnoreRule(origin, pattern, negative, regex);
  18522. };
  18523. var throwError = (message, Ctor) => {
  18524. throw new Ctor(message);
  18525. };
  18526. var checkPath = (path, originalPath, doThrow) => {
  18527. if (!isString(path)) {
  18528. return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
  18529. }
  18530. if (!path) {
  18531. return doThrow(`path must not be empty`, TypeError);
  18532. }
  18533. if (checkPath.isNotRelative(path)) {
  18534. const r = "`path.relative()`d";
  18535. return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
  18536. }
  18537. return true;
  18538. };
  18539. var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
  18540. checkPath.isNotRelative = isNotRelative;
  18541. checkPath.convert = (p) => p;
  18542. var Ignore = class {
  18543. constructor({
  18544. ignorecase = true,
  18545. ignoreCase = ignorecase,
  18546. allowRelativePaths = false
  18547. } = {}) {
  18548. define2(this, KEY_IGNORE, true);
  18549. this._rules = [];
  18550. this._ignoreCase = ignoreCase;
  18551. this._allowRelativePaths = allowRelativePaths;
  18552. this._initCache();
  18553. }
  18554. _initCache() {
  18555. this._ignoreCache = /* @__PURE__ */ Object.create(null);
  18556. this._testCache = /* @__PURE__ */ Object.create(null);
  18557. }
  18558. _addPattern(pattern) {
  18559. if (pattern && pattern[KEY_IGNORE]) {
  18560. this._rules = this._rules.concat(pattern._rules);
  18561. this._added = true;
  18562. return;
  18563. }
  18564. if (checkPattern(pattern)) {
  18565. const rule = createRule(pattern, this._ignoreCase);
  18566. this._added = true;
  18567. this._rules.push(rule);
  18568. }
  18569. }
  18570. add(pattern) {
  18571. this._added = false;
  18572. makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
  18573. if (this._added) {
  18574. this._initCache();
  18575. }
  18576. return this;
  18577. }
  18578. addPattern(pattern) {
  18579. return this.add(pattern);
  18580. }
  18581. _testOne(path, checkUnignored) {
  18582. let ignored = false;
  18583. let unignored = false;
  18584. this._rules.forEach((rule) => {
  18585. const {
  18586. negative
  18587. } = rule;
  18588. if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
  18589. return;
  18590. }
  18591. const matched = rule.regex.test(path);
  18592. if (matched) {
  18593. ignored = !negative;
  18594. unignored = negative;
  18595. }
  18596. });
  18597. return {
  18598. ignored,
  18599. unignored
  18600. };
  18601. }
  18602. _test(originalPath, cache, checkUnignored, slices) {
  18603. const path = originalPath && checkPath.convert(originalPath);
  18604. checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
  18605. return this._t(path, cache, checkUnignored, slices);
  18606. }
  18607. _t(path, cache, checkUnignored, slices) {
  18608. if (path in cache) {
  18609. return cache[path];
  18610. }
  18611. if (!slices) {
  18612. slices = path.split(SLASH);
  18613. }
  18614. slices.pop();
  18615. if (!slices.length) {
  18616. return cache[path] = this._testOne(path, checkUnignored);
  18617. }
  18618. const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
  18619. return cache[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
  18620. }
  18621. ignores(path) {
  18622. return this._test(path, this._ignoreCache, false).ignored;
  18623. }
  18624. createFilter() {
  18625. return (path) => !this.ignores(path);
  18626. }
  18627. filter(paths) {
  18628. return makeArray(paths).filter(this.createFilter());
  18629. }
  18630. test(path) {
  18631. return this._test(path, this._testCache, true);
  18632. }
  18633. };
  18634. var factory = (options) => new Ignore(options);
  18635. var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
  18636. factory.isPathValid = isPathValid;
  18637. factory.default = factory;
  18638. module2.exports = factory;
  18639. if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
  18640. const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
  18641. checkPath.convert = makePosix;
  18642. const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
  18643. checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
  18644. }
  18645. }
  18646. });
  18647. var require_get_file_content_or_null = __commonJS2({
  18648. "src/utils/get-file-content-or-null.js"(exports2, module2) {
  18649. "use strict";
  18650. var fs = require("fs");
  18651. var fsAsync = fs.promises;
  18652. async function getFileContentOrNull(filename) {
  18653. try {
  18654. return await fsAsync.readFile(filename, "utf8");
  18655. } catch (error) {
  18656. return handleError(filename, error);
  18657. }
  18658. }
  18659. getFileContentOrNull.sync = function(filename) {
  18660. try {
  18661. return fs.readFileSync(filename, "utf8");
  18662. } catch (error) {
  18663. return handleError(filename, error);
  18664. }
  18665. };
  18666. function handleError(filename, error) {
  18667. if (error && error.code === "ENOENT") {
  18668. return null;
  18669. }
  18670. throw new Error(`Unable to read ${filename}: ${error.message}`);
  18671. }
  18672. module2.exports = getFileContentOrNull;
  18673. }
  18674. });
  18675. var require_create_ignorer = __commonJS2({
  18676. "src/common/create-ignorer.js"(exports2, module2) {
  18677. "use strict";
  18678. var path = require("path");
  18679. var ignore = require_ignore().default;
  18680. var getFileContentOrNull = require_get_file_content_or_null();
  18681. async function createIgnorer(ignorePath, withNodeModules) {
  18682. const ignoreContent = ignorePath ? await getFileContentOrNull(path.resolve(ignorePath)) : null;
  18683. return _createIgnorer(ignoreContent, withNodeModules);
  18684. }
  18685. createIgnorer.sync = function(ignorePath, withNodeModules) {
  18686. const ignoreContent = !ignorePath ? null : getFileContentOrNull.sync(path.resolve(ignorePath));
  18687. return _createIgnorer(ignoreContent, withNodeModules);
  18688. };
  18689. function _createIgnorer(ignoreContent, withNodeModules) {
  18690. const ignorer = ignore({
  18691. allowRelativePaths: true
  18692. }).add(ignoreContent || "");
  18693. if (!withNodeModules) {
  18694. ignorer.add("node_modules");
  18695. }
  18696. return ignorer;
  18697. }
  18698. module2.exports = createIgnorer;
  18699. }
  18700. });
  18701. var require_get_file_info = __commonJS2({
  18702. "src/common/get-file-info.js"(exports2, module2) {
  18703. "use strict";
  18704. var path = require("path");
  18705. var options = require_options();
  18706. var config2 = require_resolve_config();
  18707. var createIgnorer = require_create_ignorer();
  18708. async function getFileInfo2(filePath, opts) {
  18709. if (typeof filePath !== "string") {
  18710. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18711. }
  18712. const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
  18713. return _getFileInfo({
  18714. ignorer,
  18715. filePath,
  18716. plugins: opts.plugins,
  18717. resolveConfig: opts.resolveConfig,
  18718. ignorePath: opts.ignorePath,
  18719. sync: false
  18720. });
  18721. }
  18722. getFileInfo2.sync = function(filePath, opts) {
  18723. if (typeof filePath !== "string") {
  18724. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18725. }
  18726. const ignorer = createIgnorer.sync(opts.ignorePath, opts.withNodeModules);
  18727. return _getFileInfo({
  18728. ignorer,
  18729. filePath,
  18730. plugins: opts.plugins,
  18731. resolveConfig: opts.resolveConfig,
  18732. ignorePath: opts.ignorePath,
  18733. sync: true
  18734. });
  18735. };
  18736. function getFileParser(resolvedConfig, filePath, plugins2) {
  18737. if (resolvedConfig && resolvedConfig.parser) {
  18738. return resolvedConfig.parser;
  18739. }
  18740. const inferredParser = options.inferParser(filePath, plugins2);
  18741. if (inferredParser) {
  18742. return inferredParser;
  18743. }
  18744. return null;
  18745. }
  18746. function _getFileInfo({
  18747. ignorer,
  18748. filePath,
  18749. plugins: plugins2,
  18750. resolveConfig = false,
  18751. ignorePath,
  18752. sync = false
  18753. }) {
  18754. const normalizedFilePath = normalizeFilePath(filePath, ignorePath);
  18755. const fileInfo = {
  18756. ignored: ignorer.ignores(normalizedFilePath),
  18757. inferredParser: null
  18758. };
  18759. if (fileInfo.ignored) {
  18760. return fileInfo;
  18761. }
  18762. let resolvedConfig;
  18763. if (resolveConfig) {
  18764. if (sync) {
  18765. resolvedConfig = config2.resolveConfig.sync(filePath);
  18766. } else {
  18767. return config2.resolveConfig(filePath).then((resolvedConfig2) => {
  18768. fileInfo.inferredParser = getFileParser(resolvedConfig2, filePath, plugins2);
  18769. return fileInfo;
  18770. });
  18771. }
  18772. }
  18773. fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins2);
  18774. return fileInfo;
  18775. }
  18776. function normalizeFilePath(filePath, ignorePath) {
  18777. return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
  18778. }
  18779. module2.exports = getFileInfo2;
  18780. }
  18781. });
  18782. var require_util_shared = __commonJS2({
  18783. "src/common/util-shared.js"(exports2, module2) {
  18784. "use strict";
  18785. var {
  18786. getMaxContinuousCount,
  18787. getStringWidth,
  18788. getAlignmentSize,
  18789. getIndentSize,
  18790. skip,
  18791. skipWhitespace,
  18792. skipSpaces,
  18793. skipNewline,
  18794. skipToLineEnd,
  18795. skipEverythingButNewLine,
  18796. skipInlineComment,
  18797. skipTrailingComment,
  18798. hasNewline,
  18799. hasNewlineInRange,
  18800. hasSpaces,
  18801. isNextLineEmpty,
  18802. isNextLineEmptyAfterIndex,
  18803. isPreviousLineEmpty,
  18804. getNextNonSpaceNonCommentCharacterIndex,
  18805. makeString,
  18806. addLeadingComment,
  18807. addDanglingComment,
  18808. addTrailingComment
  18809. } = require_util();
  18810. module2.exports = {
  18811. getMaxContinuousCount,
  18812. getStringWidth,
  18813. getAlignmentSize,
  18814. getIndentSize,
  18815. skip,
  18816. skipWhitespace,
  18817. skipSpaces,
  18818. skipNewline,
  18819. skipToLineEnd,
  18820. skipEverythingButNewLine,
  18821. skipInlineComment,
  18822. skipTrailingComment,
  18823. hasNewline,
  18824. hasNewlineInRange,
  18825. hasSpaces,
  18826. isNextLineEmpty,
  18827. isNextLineEmptyAfterIndex,
  18828. isPreviousLineEmpty,
  18829. getNextNonSpaceNonCommentCharacterIndex,
  18830. makeString,
  18831. addLeadingComment,
  18832. addDanglingComment,
  18833. addTrailingComment
  18834. };
  18835. }
  18836. });
  18837. var require_array3 = __commonJS2({
  18838. "node_modules/fast-glob/out/utils/array.js"(exports2) {
  18839. "use strict";
  18840. Object.defineProperty(exports2, "__esModule", {
  18841. value: true
  18842. });
  18843. exports2.splitWhen = exports2.flatten = void 0;
  18844. function flatten(items) {
  18845. return items.reduce((collection, item) => [].concat(collection, item), []);
  18846. }
  18847. exports2.flatten = flatten;
  18848. function splitWhen(items, predicate) {
  18849. const result = [[]];
  18850. let groupIndex = 0;
  18851. for (const item of items) {
  18852. if (predicate(item)) {
  18853. groupIndex++;
  18854. result[groupIndex] = [];
  18855. } else {
  18856. result[groupIndex].push(item);
  18857. }
  18858. }
  18859. return result;
  18860. }
  18861. exports2.splitWhen = splitWhen;
  18862. }
  18863. });
  18864. var require_errno = __commonJS2({
  18865. "node_modules/fast-glob/out/utils/errno.js"(exports2) {
  18866. "use strict";
  18867. Object.defineProperty(exports2, "__esModule", {
  18868. value: true
  18869. });
  18870. exports2.isEnoentCodeError = void 0;
  18871. function isEnoentCodeError(error) {
  18872. return error.code === "ENOENT";
  18873. }
  18874. exports2.isEnoentCodeError = isEnoentCodeError;
  18875. }
  18876. });
  18877. var require_fs = __commonJS2({
  18878. "node_modules/fast-glob/out/utils/fs.js"(exports2) {
  18879. "use strict";
  18880. Object.defineProperty(exports2, "__esModule", {
  18881. value: true
  18882. });
  18883. exports2.createDirentFromStats = void 0;
  18884. var DirentFromStats = class {
  18885. constructor(name, stats) {
  18886. this.name = name;
  18887. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  18888. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  18889. this.isDirectory = stats.isDirectory.bind(stats);
  18890. this.isFIFO = stats.isFIFO.bind(stats);
  18891. this.isFile = stats.isFile.bind(stats);
  18892. this.isSocket = stats.isSocket.bind(stats);
  18893. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  18894. }
  18895. };
  18896. function createDirentFromStats(name, stats) {
  18897. return new DirentFromStats(name, stats);
  18898. }
  18899. exports2.createDirentFromStats = createDirentFromStats;
  18900. }
  18901. });
  18902. var require_path = __commonJS2({
  18903. "node_modules/fast-glob/out/utils/path.js"(exports2) {
  18904. "use strict";
  18905. Object.defineProperty(exports2, "__esModule", {
  18906. value: true
  18907. });
  18908. exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
  18909. var path = require("path");
  18910. var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
  18911. var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
  18912. function unixify(filepath) {
  18913. return filepath.replace(/\\/g, "/");
  18914. }
  18915. exports2.unixify = unixify;
  18916. function makeAbsolute(cwd, filepath) {
  18917. return path.resolve(cwd, filepath);
  18918. }
  18919. exports2.makeAbsolute = makeAbsolute;
  18920. function escape(pattern) {
  18921. return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
  18922. }
  18923. exports2.escape = escape;
  18924. function removeLeadingDotSegment(entry) {
  18925. if (entry.charAt(0) === ".") {
  18926. const secondCharactery = entry.charAt(1);
  18927. if (secondCharactery === "/" || secondCharactery === "\\") {
  18928. return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
  18929. }
  18930. }
  18931. return entry;
  18932. }
  18933. exports2.removeLeadingDotSegment = removeLeadingDotSegment;
  18934. }
  18935. });
  18936. var require_is_extglob = __commonJS2({
  18937. "node_modules/is-extglob/index.js"(exports2, module2) {
  18938. module2.exports = function isExtglob(str) {
  18939. if (typeof str !== "string" || str === "") {
  18940. return false;
  18941. }
  18942. var match;
  18943. while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
  18944. if (match[2])
  18945. return true;
  18946. str = str.slice(match.index + match[0].length);
  18947. }
  18948. return false;
  18949. };
  18950. }
  18951. });
  18952. var require_is_glob = __commonJS2({
  18953. "node_modules/is-glob/index.js"(exports2, module2) {
  18954. var isExtglob = require_is_extglob();
  18955. var chars = {
  18956. "{": "}",
  18957. "(": ")",
  18958. "[": "]"
  18959. };
  18960. var strictCheck = function(str) {
  18961. if (str[0] === "!") {
  18962. return true;
  18963. }
  18964. var index = 0;
  18965. var pipeIndex = -2;
  18966. var closeSquareIndex = -2;
  18967. var closeCurlyIndex = -2;
  18968. var closeParenIndex = -2;
  18969. var backSlashIndex = -2;
  18970. while (index < str.length) {
  18971. if (str[index] === "*") {
  18972. return true;
  18973. }
  18974. if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
  18975. return true;
  18976. }
  18977. if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
  18978. if (closeSquareIndex < index) {
  18979. closeSquareIndex = str.indexOf("]", index);
  18980. }
  18981. if (closeSquareIndex > index) {
  18982. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18983. return true;
  18984. }
  18985. backSlashIndex = str.indexOf("\\", index);
  18986. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18987. return true;
  18988. }
  18989. }
  18990. }
  18991. if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
  18992. closeCurlyIndex = str.indexOf("}", index);
  18993. if (closeCurlyIndex > index) {
  18994. backSlashIndex = str.indexOf("\\", index);
  18995. if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
  18996. return true;
  18997. }
  18998. }
  18999. }
  19000. if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
  19001. closeParenIndex = str.indexOf(")", index);
  19002. if (closeParenIndex > index) {
  19003. backSlashIndex = str.indexOf("\\", index);
  19004. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  19005. return true;
  19006. }
  19007. }
  19008. }
  19009. if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
  19010. if (pipeIndex < index) {
  19011. pipeIndex = str.indexOf("|", index);
  19012. }
  19013. if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
  19014. closeParenIndex = str.indexOf(")", pipeIndex);
  19015. if (closeParenIndex > pipeIndex) {
  19016. backSlashIndex = str.indexOf("\\", pipeIndex);
  19017. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  19018. return true;
  19019. }
  19020. }
  19021. }
  19022. }
  19023. if (str[index] === "\\") {
  19024. var open = str[index + 1];
  19025. index += 2;
  19026. var close = chars[open];
  19027. if (close) {
  19028. var n = str.indexOf(close, index);
  19029. if (n !== -1) {
  19030. index = n + 1;
  19031. }
  19032. }
  19033. if (str[index] === "!") {
  19034. return true;
  19035. }
  19036. } else {
  19037. index++;
  19038. }
  19039. }
  19040. return false;
  19041. };
  19042. var relaxedCheck = function(str) {
  19043. if (str[0] === "!") {
  19044. return true;
  19045. }
  19046. var index = 0;
  19047. while (index < str.length) {
  19048. if (/[*?{}()[\]]/.test(str[index])) {
  19049. return true;
  19050. }
  19051. if (str[index] === "\\") {
  19052. var open = str[index + 1];
  19053. index += 2;
  19054. var close = chars[open];
  19055. if (close) {
  19056. var n = str.indexOf(close, index);
  19057. if (n !== -1) {
  19058. index = n + 1;
  19059. }
  19060. }
  19061. if (str[index] === "!") {
  19062. return true;
  19063. }
  19064. } else {
  19065. index++;
  19066. }
  19067. }
  19068. return false;
  19069. };
  19070. module2.exports = function isGlob(str, options) {
  19071. if (typeof str !== "string" || str === "") {
  19072. return false;
  19073. }
  19074. if (isExtglob(str)) {
  19075. return true;
  19076. }
  19077. var check = strictCheck;
  19078. if (options && options.strict === false) {
  19079. check = relaxedCheck;
  19080. }
  19081. return check(str);
  19082. };
  19083. }
  19084. });
  19085. var require_glob_parent = __commonJS2({
  19086. "node_modules/glob-parent/index.js"(exports2, module2) {
  19087. "use strict";
  19088. var isGlob = require_is_glob();
  19089. var pathPosixDirname = require("path").posix.dirname;
  19090. var isWin32 = require("os").platform() === "win32";
  19091. var slash = "/";
  19092. var backslash = /\\/g;
  19093. var enclosure = /[\{\[].*[\}\]]$/;
  19094. var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
  19095. var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
  19096. module2.exports = function globParent(str, opts) {
  19097. var options = Object.assign({
  19098. flipBackslashes: true
  19099. }, opts);
  19100. if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
  19101. str = str.replace(backslash, slash);
  19102. }
  19103. if (enclosure.test(str)) {
  19104. str += slash;
  19105. }
  19106. str += "a";
  19107. do {
  19108. str = pathPosixDirname(str);
  19109. } while (isGlob(str) || globby.test(str));
  19110. return str.replace(escaped, "$1");
  19111. };
  19112. }
  19113. });
  19114. var require_pattern = __commonJS2({
  19115. "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
  19116. "use strict";
  19117. Object.defineProperty(exports2, "__esModule", {
  19118. value: true
  19119. });
  19120. 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;
  19121. var path = require("path");
  19122. var globParent = require_glob_parent();
  19123. var micromatch = require_micromatch();
  19124. var GLOBSTAR = "**";
  19125. var ESCAPE_SYMBOL = "\\";
  19126. var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
  19127. var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
  19128. var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
  19129. var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
  19130. var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
  19131. function isStaticPattern(pattern, options = {}) {
  19132. return !isDynamicPattern(pattern, options);
  19133. }
  19134. exports2.isStaticPattern = isStaticPattern;
  19135. function isDynamicPattern(pattern, options = {}) {
  19136. if (pattern === "") {
  19137. return false;
  19138. }
  19139. if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
  19140. return true;
  19141. }
  19142. if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
  19143. return true;
  19144. }
  19145. if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
  19146. return true;
  19147. }
  19148. if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
  19149. return true;
  19150. }
  19151. return false;
  19152. }
  19153. exports2.isDynamicPattern = isDynamicPattern;
  19154. function hasBraceExpansion(pattern) {
  19155. const openingBraceIndex = pattern.indexOf("{");
  19156. if (openingBraceIndex === -1) {
  19157. return false;
  19158. }
  19159. const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
  19160. if (closingBraceIndex === -1) {
  19161. return false;
  19162. }
  19163. const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
  19164. return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
  19165. }
  19166. function convertToPositivePattern(pattern) {
  19167. return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
  19168. }
  19169. exports2.convertToPositivePattern = convertToPositivePattern;
  19170. function convertToNegativePattern(pattern) {
  19171. return "!" + pattern;
  19172. }
  19173. exports2.convertToNegativePattern = convertToNegativePattern;
  19174. function isNegativePattern(pattern) {
  19175. return pattern.startsWith("!") && pattern[1] !== "(";
  19176. }
  19177. exports2.isNegativePattern = isNegativePattern;
  19178. function isPositivePattern(pattern) {
  19179. return !isNegativePattern(pattern);
  19180. }
  19181. exports2.isPositivePattern = isPositivePattern;
  19182. function getNegativePatterns(patterns) {
  19183. return patterns.filter(isNegativePattern);
  19184. }
  19185. exports2.getNegativePatterns = getNegativePatterns;
  19186. function getPositivePatterns(patterns) {
  19187. return patterns.filter(isPositivePattern);
  19188. }
  19189. exports2.getPositivePatterns = getPositivePatterns;
  19190. function getPatternsInsideCurrentDirectory(patterns) {
  19191. return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
  19192. }
  19193. exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
  19194. function getPatternsOutsideCurrentDirectory(patterns) {
  19195. return patterns.filter(isPatternRelatedToParentDirectory);
  19196. }
  19197. exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
  19198. function isPatternRelatedToParentDirectory(pattern) {
  19199. return pattern.startsWith("..") || pattern.startsWith("./..");
  19200. }
  19201. exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
  19202. function getBaseDirectory(pattern) {
  19203. return globParent(pattern, {
  19204. flipBackslashes: false
  19205. });
  19206. }
  19207. exports2.getBaseDirectory = getBaseDirectory;
  19208. function hasGlobStar(pattern) {
  19209. return pattern.includes(GLOBSTAR);
  19210. }
  19211. exports2.hasGlobStar = hasGlobStar;
  19212. function endsWithSlashGlobStar(pattern) {
  19213. return pattern.endsWith("/" + GLOBSTAR);
  19214. }
  19215. exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
  19216. function isAffectDepthOfReadingPattern(pattern) {
  19217. const basename = path.basename(pattern);
  19218. return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
  19219. }
  19220. exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
  19221. function expandPatternsWithBraceExpansion(patterns) {
  19222. return patterns.reduce((collection, pattern) => {
  19223. return collection.concat(expandBraceExpansion(pattern));
  19224. }, []);
  19225. }
  19226. exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
  19227. function expandBraceExpansion(pattern) {
  19228. return micromatch.braces(pattern, {
  19229. expand: true,
  19230. nodupes: true
  19231. });
  19232. }
  19233. exports2.expandBraceExpansion = expandBraceExpansion;
  19234. function getPatternParts(pattern, options) {
  19235. let {
  19236. parts
  19237. } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
  19238. parts: true
  19239. }));
  19240. if (parts.length === 0) {
  19241. parts = [pattern];
  19242. }
  19243. if (parts[0].startsWith("/")) {
  19244. parts[0] = parts[0].slice(1);
  19245. parts.unshift("");
  19246. }
  19247. return parts;
  19248. }
  19249. exports2.getPatternParts = getPatternParts;
  19250. function makeRe(pattern, options) {
  19251. return micromatch.makeRe(pattern, options);
  19252. }
  19253. exports2.makeRe = makeRe;
  19254. function convertPatternsToRe(patterns, options) {
  19255. return patterns.map((pattern) => makeRe(pattern, options));
  19256. }
  19257. exports2.convertPatternsToRe = convertPatternsToRe;
  19258. function matchAny(entry, patternsRe) {
  19259. return patternsRe.some((patternRe) => patternRe.test(entry));
  19260. }
  19261. exports2.matchAny = matchAny;
  19262. }
  19263. });
  19264. var require_merge2 = __commonJS2({
  19265. "node_modules/merge2/index.js"(exports2, module2) {
  19266. "use strict";
  19267. var Stream = require("stream");
  19268. var PassThrough = Stream.PassThrough;
  19269. var slice = Array.prototype.slice;
  19270. module2.exports = merge2;
  19271. function merge2() {
  19272. const streamsQueue = [];
  19273. const args = slice.call(arguments);
  19274. let merging = false;
  19275. let options = args[args.length - 1];
  19276. if (options && !Array.isArray(options) && options.pipe == null) {
  19277. args.pop();
  19278. } else {
  19279. options = {};
  19280. }
  19281. const doEnd = options.end !== false;
  19282. const doPipeError = options.pipeError === true;
  19283. if (options.objectMode == null) {
  19284. options.objectMode = true;
  19285. }
  19286. if (options.highWaterMark == null) {
  19287. options.highWaterMark = 64 * 1024;
  19288. }
  19289. const mergedStream = PassThrough(options);
  19290. function addStream() {
  19291. for (let i = 0, len = arguments.length; i < len; i++) {
  19292. streamsQueue.push(pauseStreams(arguments[i], options));
  19293. }
  19294. mergeStream();
  19295. return this;
  19296. }
  19297. function mergeStream() {
  19298. if (merging) {
  19299. return;
  19300. }
  19301. merging = true;
  19302. let streams = streamsQueue.shift();
  19303. if (!streams) {
  19304. process.nextTick(endStream);
  19305. return;
  19306. }
  19307. if (!Array.isArray(streams)) {
  19308. streams = [streams];
  19309. }
  19310. let pipesCount = streams.length + 1;
  19311. function next() {
  19312. if (--pipesCount > 0) {
  19313. return;
  19314. }
  19315. merging = false;
  19316. mergeStream();
  19317. }
  19318. function pipe(stream) {
  19319. function onend() {
  19320. stream.removeListener("merge2UnpipeEnd", onend);
  19321. stream.removeListener("end", onend);
  19322. if (doPipeError) {
  19323. stream.removeListener("error", onerror);
  19324. }
  19325. next();
  19326. }
  19327. function onerror(err) {
  19328. mergedStream.emit("error", err);
  19329. }
  19330. if (stream._readableState.endEmitted) {
  19331. return next();
  19332. }
  19333. stream.on("merge2UnpipeEnd", onend);
  19334. stream.on("end", onend);
  19335. if (doPipeError) {
  19336. stream.on("error", onerror);
  19337. }
  19338. stream.pipe(mergedStream, {
  19339. end: false
  19340. });
  19341. stream.resume();
  19342. }
  19343. for (let i = 0; i < streams.length; i++) {
  19344. pipe(streams[i]);
  19345. }
  19346. next();
  19347. }
  19348. function endStream() {
  19349. merging = false;
  19350. mergedStream.emit("queueDrain");
  19351. if (doEnd) {
  19352. mergedStream.end();
  19353. }
  19354. }
  19355. mergedStream.setMaxListeners(0);
  19356. mergedStream.add = addStream;
  19357. mergedStream.on("unpipe", function(stream) {
  19358. stream.emit("merge2UnpipeEnd");
  19359. });
  19360. if (args.length) {
  19361. addStream.apply(null, args);
  19362. }
  19363. return mergedStream;
  19364. }
  19365. function pauseStreams(streams, options) {
  19366. if (!Array.isArray(streams)) {
  19367. if (!streams._readableState && streams.pipe) {
  19368. streams = streams.pipe(PassThrough(options));
  19369. }
  19370. if (!streams._readableState || !streams.pause || !streams.pipe) {
  19371. throw new Error("Only readable stream can be merged.");
  19372. }
  19373. streams.pause();
  19374. } else {
  19375. for (let i = 0, len = streams.length; i < len; i++) {
  19376. streams[i] = pauseStreams(streams[i], options);
  19377. }
  19378. }
  19379. return streams;
  19380. }
  19381. }
  19382. });
  19383. var require_stream = __commonJS2({
  19384. "node_modules/fast-glob/out/utils/stream.js"(exports2) {
  19385. "use strict";
  19386. Object.defineProperty(exports2, "__esModule", {
  19387. value: true
  19388. });
  19389. exports2.merge = void 0;
  19390. var merge2 = require_merge2();
  19391. function merge(streams) {
  19392. const mergedStream = merge2(streams);
  19393. streams.forEach((stream) => {
  19394. stream.once("error", (error) => mergedStream.emit("error", error));
  19395. });
  19396. mergedStream.once("close", () => propagateCloseEventToSources(streams));
  19397. mergedStream.once("end", () => propagateCloseEventToSources(streams));
  19398. return mergedStream;
  19399. }
  19400. exports2.merge = merge;
  19401. function propagateCloseEventToSources(streams) {
  19402. streams.forEach((stream) => stream.emit("close"));
  19403. }
  19404. }
  19405. });
  19406. var require_string2 = __commonJS2({
  19407. "node_modules/fast-glob/out/utils/string.js"(exports2) {
  19408. "use strict";
  19409. Object.defineProperty(exports2, "__esModule", {
  19410. value: true
  19411. });
  19412. exports2.isEmpty = exports2.isString = void 0;
  19413. function isString(input) {
  19414. return typeof input === "string";
  19415. }
  19416. exports2.isString = isString;
  19417. function isEmpty(input) {
  19418. return input === "";
  19419. }
  19420. exports2.isEmpty = isEmpty;
  19421. }
  19422. });
  19423. var require_utils4 = __commonJS2({
  19424. "node_modules/fast-glob/out/utils/index.js"(exports2) {
  19425. "use strict";
  19426. Object.defineProperty(exports2, "__esModule", {
  19427. value: true
  19428. });
  19429. exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
  19430. var array = require_array3();
  19431. exports2.array = array;
  19432. var errno = require_errno();
  19433. exports2.errno = errno;
  19434. var fs = require_fs();
  19435. exports2.fs = fs;
  19436. var path = require_path();
  19437. exports2.path = path;
  19438. var pattern = require_pattern();
  19439. exports2.pattern = pattern;
  19440. var stream = require_stream();
  19441. exports2.stream = stream;
  19442. var string = require_string2();
  19443. exports2.string = string;
  19444. }
  19445. });
  19446. var require_tasks = __commonJS2({
  19447. "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
  19448. "use strict";
  19449. Object.defineProperty(exports2, "__esModule", {
  19450. value: true
  19451. });
  19452. exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
  19453. var utils = require_utils4();
  19454. function generate(patterns, settings) {
  19455. const positivePatterns = getPositivePatterns(patterns);
  19456. const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
  19457. const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
  19458. const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
  19459. const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
  19460. const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
  19461. return staticTasks.concat(dynamicTasks);
  19462. }
  19463. exports2.generate = generate;
  19464. function convertPatternsToTasks(positive, negative, dynamic) {
  19465. const tasks = [];
  19466. const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
  19467. const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
  19468. const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
  19469. const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
  19470. tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
  19471. if ("." in insideCurrentDirectoryGroup) {
  19472. tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
  19473. } else {
  19474. tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
  19475. }
  19476. return tasks;
  19477. }
  19478. exports2.convertPatternsToTasks = convertPatternsToTasks;
  19479. function getPositivePatterns(patterns) {
  19480. return utils.pattern.getPositivePatterns(patterns);
  19481. }
  19482. exports2.getPositivePatterns = getPositivePatterns;
  19483. function getNegativePatternsAsPositive(patterns, ignore) {
  19484. const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
  19485. const positive = negative.map(utils.pattern.convertToPositivePattern);
  19486. return positive;
  19487. }
  19488. exports2.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
  19489. function groupPatternsByBaseDirectory(patterns) {
  19490. const group = {};
  19491. return patterns.reduce((collection, pattern) => {
  19492. const base = utils.pattern.getBaseDirectory(pattern);
  19493. if (base in collection) {
  19494. collection[base].push(pattern);
  19495. } else {
  19496. collection[base] = [pattern];
  19497. }
  19498. return collection;
  19499. }, group);
  19500. }
  19501. exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
  19502. function convertPatternGroupsToTasks(positive, negative, dynamic) {
  19503. return Object.keys(positive).map((base) => {
  19504. return convertPatternGroupToTask(base, positive[base], negative, dynamic);
  19505. });
  19506. }
  19507. exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
  19508. function convertPatternGroupToTask(base, positive, negative, dynamic) {
  19509. return {
  19510. dynamic,
  19511. positive,
  19512. negative,
  19513. base,
  19514. patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
  19515. };
  19516. }
  19517. exports2.convertPatternGroupToTask = convertPatternGroupToTask;
  19518. }
  19519. });
  19520. var require_patterns = __commonJS2({
  19521. "node_modules/fast-glob/out/managers/patterns.js"(exports2) {
  19522. "use strict";
  19523. Object.defineProperty(exports2, "__esModule", {
  19524. value: true
  19525. });
  19526. exports2.removeDuplicateSlashes = exports2.transform = void 0;
  19527. var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
  19528. function transform(patterns) {
  19529. return patterns.map((pattern) => removeDuplicateSlashes(pattern));
  19530. }
  19531. exports2.transform = transform;
  19532. function removeDuplicateSlashes(pattern) {
  19533. return pattern.replace(DOUBLE_SLASH_RE, "/");
  19534. }
  19535. exports2.removeDuplicateSlashes = removeDuplicateSlashes;
  19536. }
  19537. });
  19538. var require_async2 = __commonJS2({
  19539. "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
  19540. "use strict";
  19541. Object.defineProperty(exports2, "__esModule", {
  19542. value: true
  19543. });
  19544. exports2.read = void 0;
  19545. function read(path, settings, callback) {
  19546. settings.fs.lstat(path, (lstatError, lstat) => {
  19547. if (lstatError !== null) {
  19548. callFailureCallback(callback, lstatError);
  19549. return;
  19550. }
  19551. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19552. callSuccessCallback(callback, lstat);
  19553. return;
  19554. }
  19555. settings.fs.stat(path, (statError, stat) => {
  19556. if (statError !== null) {
  19557. if (settings.throwErrorOnBrokenSymbolicLink) {
  19558. callFailureCallback(callback, statError);
  19559. return;
  19560. }
  19561. callSuccessCallback(callback, lstat);
  19562. return;
  19563. }
  19564. if (settings.markSymbolicLink) {
  19565. stat.isSymbolicLink = () => true;
  19566. }
  19567. callSuccessCallback(callback, stat);
  19568. });
  19569. });
  19570. }
  19571. exports2.read = read;
  19572. function callFailureCallback(callback, error) {
  19573. callback(error);
  19574. }
  19575. function callSuccessCallback(callback, result) {
  19576. callback(null, result);
  19577. }
  19578. }
  19579. });
  19580. var require_sync2 = __commonJS2({
  19581. "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
  19582. "use strict";
  19583. Object.defineProperty(exports2, "__esModule", {
  19584. value: true
  19585. });
  19586. exports2.read = void 0;
  19587. function read(path, settings) {
  19588. const lstat = settings.fs.lstatSync(path);
  19589. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19590. return lstat;
  19591. }
  19592. try {
  19593. const stat = settings.fs.statSync(path);
  19594. if (settings.markSymbolicLink) {
  19595. stat.isSymbolicLink = () => true;
  19596. }
  19597. return stat;
  19598. } catch (error) {
  19599. if (!settings.throwErrorOnBrokenSymbolicLink) {
  19600. return lstat;
  19601. }
  19602. throw error;
  19603. }
  19604. }
  19605. exports2.read = read;
  19606. }
  19607. });
  19608. var require_fs2 = __commonJS2({
  19609. "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
  19610. "use strict";
  19611. Object.defineProperty(exports2, "__esModule", {
  19612. value: true
  19613. });
  19614. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19615. var fs = require("fs");
  19616. exports2.FILE_SYSTEM_ADAPTER = {
  19617. lstat: fs.lstat,
  19618. stat: fs.stat,
  19619. lstatSync: fs.lstatSync,
  19620. statSync: fs.statSync
  19621. };
  19622. function createFileSystemAdapter(fsMethods) {
  19623. if (fsMethods === void 0) {
  19624. return exports2.FILE_SYSTEM_ADAPTER;
  19625. }
  19626. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  19627. }
  19628. exports2.createFileSystemAdapter = createFileSystemAdapter;
  19629. }
  19630. });
  19631. var require_settings = __commonJS2({
  19632. "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
  19633. "use strict";
  19634. Object.defineProperty(exports2, "__esModule", {
  19635. value: true
  19636. });
  19637. var fs = require_fs2();
  19638. var Settings = class {
  19639. constructor(_options = {}) {
  19640. this._options = _options;
  19641. this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
  19642. this.fs = fs.createFileSystemAdapter(this._options.fs);
  19643. this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
  19644. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  19645. }
  19646. _getValue(option, value) {
  19647. return option !== null && option !== void 0 ? option : value;
  19648. }
  19649. };
  19650. exports2.default = Settings;
  19651. }
  19652. });
  19653. var require_out = __commonJS2({
  19654. "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
  19655. "use strict";
  19656. Object.defineProperty(exports2, "__esModule", {
  19657. value: true
  19658. });
  19659. exports2.statSync = exports2.stat = exports2.Settings = void 0;
  19660. var async = require_async2();
  19661. var sync = require_sync2();
  19662. var settings_1 = require_settings();
  19663. exports2.Settings = settings_1.default;
  19664. function stat(path, optionsOrSettingsOrCallback, callback) {
  19665. if (typeof optionsOrSettingsOrCallback === "function") {
  19666. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  19667. return;
  19668. }
  19669. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  19670. }
  19671. exports2.stat = stat;
  19672. function statSync(path, optionsOrSettings) {
  19673. const settings = getSettings(optionsOrSettings);
  19674. return sync.read(path, settings);
  19675. }
  19676. exports2.statSync = statSync;
  19677. function getSettings(settingsOrOptions = {}) {
  19678. if (settingsOrOptions instanceof settings_1.default) {
  19679. return settingsOrOptions;
  19680. }
  19681. return new settings_1.default(settingsOrOptions);
  19682. }
  19683. }
  19684. });
  19685. var require_queue_microtask = __commonJS2({
  19686. "node_modules/queue-microtask/index.js"(exports2, module2) {
  19687. var promise;
  19688. module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
  19689. throw err;
  19690. }, 0));
  19691. }
  19692. });
  19693. var require_run_parallel = __commonJS2({
  19694. "node_modules/run-parallel/index.js"(exports2, module2) {
  19695. module2.exports = runParallel;
  19696. var queueMicrotask2 = require_queue_microtask();
  19697. function runParallel(tasks, cb) {
  19698. let results, pending, keys;
  19699. let isSync = true;
  19700. if (Array.isArray(tasks)) {
  19701. results = [];
  19702. pending = tasks.length;
  19703. } else {
  19704. keys = Object.keys(tasks);
  19705. results = {};
  19706. pending = keys.length;
  19707. }
  19708. function done(err) {
  19709. function end() {
  19710. if (cb)
  19711. cb(err, results);
  19712. cb = null;
  19713. }
  19714. if (isSync)
  19715. queueMicrotask2(end);
  19716. else
  19717. end();
  19718. }
  19719. function each(i, err, result) {
  19720. results[i] = result;
  19721. if (--pending === 0 || err) {
  19722. done(err);
  19723. }
  19724. }
  19725. if (!pending) {
  19726. done(null);
  19727. } else if (keys) {
  19728. keys.forEach(function(key) {
  19729. tasks[key](function(err, result) {
  19730. each(key, err, result);
  19731. });
  19732. });
  19733. } else {
  19734. tasks.forEach(function(task, i) {
  19735. task(function(err, result) {
  19736. each(i, err, result);
  19737. });
  19738. });
  19739. }
  19740. isSync = false;
  19741. }
  19742. }
  19743. });
  19744. var require_constants4 = __commonJS2({
  19745. "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
  19746. "use strict";
  19747. Object.defineProperty(exports2, "__esModule", {
  19748. value: true
  19749. });
  19750. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
  19751. var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
  19752. if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
  19753. throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
  19754. }
  19755. var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
  19756. var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
  19757. var SUPPORTED_MAJOR_VERSION = 10;
  19758. var SUPPORTED_MINOR_VERSION = 10;
  19759. var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
  19760. var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
  19761. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
  19762. }
  19763. });
  19764. var require_fs3 = __commonJS2({
  19765. "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
  19766. "use strict";
  19767. Object.defineProperty(exports2, "__esModule", {
  19768. value: true
  19769. });
  19770. exports2.createDirentFromStats = void 0;
  19771. var DirentFromStats = class {
  19772. constructor(name, stats) {
  19773. this.name = name;
  19774. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  19775. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  19776. this.isDirectory = stats.isDirectory.bind(stats);
  19777. this.isFIFO = stats.isFIFO.bind(stats);
  19778. this.isFile = stats.isFile.bind(stats);
  19779. this.isSocket = stats.isSocket.bind(stats);
  19780. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  19781. }
  19782. };
  19783. function createDirentFromStats(name, stats) {
  19784. return new DirentFromStats(name, stats);
  19785. }
  19786. exports2.createDirentFromStats = createDirentFromStats;
  19787. }
  19788. });
  19789. var require_utils5 = __commonJS2({
  19790. "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
  19791. "use strict";
  19792. Object.defineProperty(exports2, "__esModule", {
  19793. value: true
  19794. });
  19795. exports2.fs = void 0;
  19796. var fs = require_fs3();
  19797. exports2.fs = fs;
  19798. }
  19799. });
  19800. var require_common3 = __commonJS2({
  19801. "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
  19802. "use strict";
  19803. Object.defineProperty(exports2, "__esModule", {
  19804. value: true
  19805. });
  19806. exports2.joinPathSegments = void 0;
  19807. function joinPathSegments(a, b, separator) {
  19808. if (a.endsWith(separator)) {
  19809. return a + b;
  19810. }
  19811. return a + separator + b;
  19812. }
  19813. exports2.joinPathSegments = joinPathSegments;
  19814. }
  19815. });
  19816. var require_async3 = __commonJS2({
  19817. "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
  19818. "use strict";
  19819. Object.defineProperty(exports2, "__esModule", {
  19820. value: true
  19821. });
  19822. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19823. var fsStat = require_out();
  19824. var rpl = require_run_parallel();
  19825. var constants_1 = require_constants4();
  19826. var utils = require_utils5();
  19827. var common = require_common3();
  19828. function read(directory, settings, callback) {
  19829. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19830. readdirWithFileTypes(directory, settings, callback);
  19831. return;
  19832. }
  19833. readdir(directory, settings, callback);
  19834. }
  19835. exports2.read = read;
  19836. function readdirWithFileTypes(directory, settings, callback) {
  19837. settings.fs.readdir(directory, {
  19838. withFileTypes: true
  19839. }, (readdirError, dirents) => {
  19840. if (readdirError !== null) {
  19841. callFailureCallback(callback, readdirError);
  19842. return;
  19843. }
  19844. const entries = dirents.map((dirent) => ({
  19845. dirent,
  19846. name: dirent.name,
  19847. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19848. }));
  19849. if (!settings.followSymbolicLinks) {
  19850. callSuccessCallback(callback, entries);
  19851. return;
  19852. }
  19853. const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
  19854. rpl(tasks, (rplError, rplEntries) => {
  19855. if (rplError !== null) {
  19856. callFailureCallback(callback, rplError);
  19857. return;
  19858. }
  19859. callSuccessCallback(callback, rplEntries);
  19860. });
  19861. });
  19862. }
  19863. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19864. function makeRplTaskEntry(entry, settings) {
  19865. return (done) => {
  19866. if (!entry.dirent.isSymbolicLink()) {
  19867. done(null, entry);
  19868. return;
  19869. }
  19870. settings.fs.stat(entry.path, (statError, stats) => {
  19871. if (statError !== null) {
  19872. if (settings.throwErrorOnBrokenSymbolicLink) {
  19873. done(statError);
  19874. return;
  19875. }
  19876. done(null, entry);
  19877. return;
  19878. }
  19879. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19880. done(null, entry);
  19881. });
  19882. };
  19883. }
  19884. function readdir(directory, settings, callback) {
  19885. settings.fs.readdir(directory, (readdirError, names) => {
  19886. if (readdirError !== null) {
  19887. callFailureCallback(callback, readdirError);
  19888. return;
  19889. }
  19890. const tasks = names.map((name) => {
  19891. const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19892. return (done) => {
  19893. fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
  19894. if (error !== null) {
  19895. done(error);
  19896. return;
  19897. }
  19898. const entry = {
  19899. name,
  19900. path,
  19901. dirent: utils.fs.createDirentFromStats(name, stats)
  19902. };
  19903. if (settings.stats) {
  19904. entry.stats = stats;
  19905. }
  19906. done(null, entry);
  19907. });
  19908. };
  19909. });
  19910. rpl(tasks, (rplError, entries) => {
  19911. if (rplError !== null) {
  19912. callFailureCallback(callback, rplError);
  19913. return;
  19914. }
  19915. callSuccessCallback(callback, entries);
  19916. });
  19917. });
  19918. }
  19919. exports2.readdir = readdir;
  19920. function callFailureCallback(callback, error) {
  19921. callback(error);
  19922. }
  19923. function callSuccessCallback(callback, result) {
  19924. callback(null, result);
  19925. }
  19926. }
  19927. });
  19928. var require_sync3 = __commonJS2({
  19929. "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
  19930. "use strict";
  19931. Object.defineProperty(exports2, "__esModule", {
  19932. value: true
  19933. });
  19934. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19935. var fsStat = require_out();
  19936. var constants_1 = require_constants4();
  19937. var utils = require_utils5();
  19938. var common = require_common3();
  19939. function read(directory, settings) {
  19940. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19941. return readdirWithFileTypes(directory, settings);
  19942. }
  19943. return readdir(directory, settings);
  19944. }
  19945. exports2.read = read;
  19946. function readdirWithFileTypes(directory, settings) {
  19947. const dirents = settings.fs.readdirSync(directory, {
  19948. withFileTypes: true
  19949. });
  19950. return dirents.map((dirent) => {
  19951. const entry = {
  19952. dirent,
  19953. name: dirent.name,
  19954. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19955. };
  19956. if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
  19957. try {
  19958. const stats = settings.fs.statSync(entry.path);
  19959. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19960. } catch (error) {
  19961. if (settings.throwErrorOnBrokenSymbolicLink) {
  19962. throw error;
  19963. }
  19964. }
  19965. }
  19966. return entry;
  19967. });
  19968. }
  19969. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19970. function readdir(directory, settings) {
  19971. const names = settings.fs.readdirSync(directory);
  19972. return names.map((name) => {
  19973. const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19974. const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
  19975. const entry = {
  19976. name,
  19977. path: entryPath,
  19978. dirent: utils.fs.createDirentFromStats(name, stats)
  19979. };
  19980. if (settings.stats) {
  19981. entry.stats = stats;
  19982. }
  19983. return entry;
  19984. });
  19985. }
  19986. exports2.readdir = readdir;
  19987. }
  19988. });
  19989. var require_fs4 = __commonJS2({
  19990. "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
  19991. "use strict";
  19992. Object.defineProperty(exports2, "__esModule", {
  19993. value: true
  19994. });
  19995. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19996. var fs = require("fs");
  19997. exports2.FILE_SYSTEM_ADAPTER = {
  19998. lstat: fs.lstat,
  19999. stat: fs.stat,
  20000. lstatSync: fs.lstatSync,
  20001. statSync: fs.statSync,
  20002. readdir: fs.readdir,
  20003. readdirSync: fs.readdirSync
  20004. };
  20005. function createFileSystemAdapter(fsMethods) {
  20006. if (fsMethods === void 0) {
  20007. return exports2.FILE_SYSTEM_ADAPTER;
  20008. }
  20009. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  20010. }
  20011. exports2.createFileSystemAdapter = createFileSystemAdapter;
  20012. }
  20013. });
  20014. var require_settings2 = __commonJS2({
  20015. "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
  20016. "use strict";
  20017. Object.defineProperty(exports2, "__esModule", {
  20018. value: true
  20019. });
  20020. var path = require("path");
  20021. var fsStat = require_out();
  20022. var fs = require_fs4();
  20023. var Settings = class {
  20024. constructor(_options = {}) {
  20025. this._options = _options;
  20026. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
  20027. this.fs = fs.createFileSystemAdapter(this._options.fs);
  20028. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  20029. this.stats = this._getValue(this._options.stats, false);
  20030. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  20031. this.fsStatSettings = new fsStat.Settings({
  20032. followSymbolicLink: this.followSymbolicLinks,
  20033. fs: this.fs,
  20034. throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
  20035. });
  20036. }
  20037. _getValue(option, value) {
  20038. return option !== null && option !== void 0 ? option : value;
  20039. }
  20040. };
  20041. exports2.default = Settings;
  20042. }
  20043. });
  20044. var require_out2 = __commonJS2({
  20045. "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
  20046. "use strict";
  20047. Object.defineProperty(exports2, "__esModule", {
  20048. value: true
  20049. });
  20050. exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
  20051. var async = require_async3();
  20052. var sync = require_sync3();
  20053. var settings_1 = require_settings2();
  20054. exports2.Settings = settings_1.default;
  20055. function scandir(path, optionsOrSettingsOrCallback, callback) {
  20056. if (typeof optionsOrSettingsOrCallback === "function") {
  20057. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  20058. return;
  20059. }
  20060. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  20061. }
  20062. exports2.scandir = scandir;
  20063. function scandirSync(path, optionsOrSettings) {
  20064. const settings = getSettings(optionsOrSettings);
  20065. return sync.read(path, settings);
  20066. }
  20067. exports2.scandirSync = scandirSync;
  20068. function getSettings(settingsOrOptions = {}) {
  20069. if (settingsOrOptions instanceof settings_1.default) {
  20070. return settingsOrOptions;
  20071. }
  20072. return new settings_1.default(settingsOrOptions);
  20073. }
  20074. }
  20075. });
  20076. var require_reusify = __commonJS2({
  20077. "node_modules/reusify/reusify.js"(exports2, module2) {
  20078. "use strict";
  20079. function reusify(Constructor) {
  20080. var head = new Constructor();
  20081. var tail = head;
  20082. function get() {
  20083. var current = head;
  20084. if (current.next) {
  20085. head = current.next;
  20086. } else {
  20087. head = new Constructor();
  20088. tail = head;
  20089. }
  20090. current.next = null;
  20091. return current;
  20092. }
  20093. function release(obj) {
  20094. tail.next = obj;
  20095. tail = obj;
  20096. }
  20097. return {
  20098. get,
  20099. release
  20100. };
  20101. }
  20102. module2.exports = reusify;
  20103. }
  20104. });
  20105. var require_queue = __commonJS2({
  20106. "node_modules/fastq/queue.js"(exports2, module2) {
  20107. "use strict";
  20108. var reusify = require_reusify();
  20109. function fastqueue(context, worker, concurrency) {
  20110. if (typeof context === "function") {
  20111. concurrency = worker;
  20112. worker = context;
  20113. context = null;
  20114. }
  20115. if (concurrency < 1) {
  20116. throw new Error("fastqueue concurrency must be greater than 1");
  20117. }
  20118. var cache = reusify(Task);
  20119. var queueHead = null;
  20120. var queueTail = null;
  20121. var _running = 0;
  20122. var errorHandler = null;
  20123. var self2 = {
  20124. push,
  20125. drain: noop,
  20126. saturated: noop,
  20127. pause,
  20128. paused: false,
  20129. concurrency,
  20130. running,
  20131. resume,
  20132. idle,
  20133. length,
  20134. getQueue,
  20135. unshift,
  20136. empty: noop,
  20137. kill,
  20138. killAndDrain,
  20139. error
  20140. };
  20141. return self2;
  20142. function running() {
  20143. return _running;
  20144. }
  20145. function pause() {
  20146. self2.paused = true;
  20147. }
  20148. function length() {
  20149. var current = queueHead;
  20150. var counter = 0;
  20151. while (current) {
  20152. current = current.next;
  20153. counter++;
  20154. }
  20155. return counter;
  20156. }
  20157. function getQueue() {
  20158. var current = queueHead;
  20159. var tasks = [];
  20160. while (current) {
  20161. tasks.push(current.value);
  20162. current = current.next;
  20163. }
  20164. return tasks;
  20165. }
  20166. function resume() {
  20167. if (!self2.paused)
  20168. return;
  20169. self2.paused = false;
  20170. for (var i = 0; i < self2.concurrency; i++) {
  20171. _running++;
  20172. release();
  20173. }
  20174. }
  20175. function idle() {
  20176. return _running === 0 && self2.length() === 0;
  20177. }
  20178. function push(value, done) {
  20179. var current = cache.get();
  20180. current.context = context;
  20181. current.release = release;
  20182. current.value = value;
  20183. current.callback = done || noop;
  20184. current.errorHandler = errorHandler;
  20185. if (_running === self2.concurrency || self2.paused) {
  20186. if (queueTail) {
  20187. queueTail.next = current;
  20188. queueTail = current;
  20189. } else {
  20190. queueHead = current;
  20191. queueTail = current;
  20192. self2.saturated();
  20193. }
  20194. } else {
  20195. _running++;
  20196. worker.call(context, current.value, current.worked);
  20197. }
  20198. }
  20199. function unshift(value, done) {
  20200. var current = cache.get();
  20201. current.context = context;
  20202. current.release = release;
  20203. current.value = value;
  20204. current.callback = done || noop;
  20205. if (_running === self2.concurrency || self2.paused) {
  20206. if (queueHead) {
  20207. current.next = queueHead;
  20208. queueHead = current;
  20209. } else {
  20210. queueHead = current;
  20211. queueTail = current;
  20212. self2.saturated();
  20213. }
  20214. } else {
  20215. _running++;
  20216. worker.call(context, current.value, current.worked);
  20217. }
  20218. }
  20219. function release(holder) {
  20220. if (holder) {
  20221. cache.release(holder);
  20222. }
  20223. var next = queueHead;
  20224. if (next) {
  20225. if (!self2.paused) {
  20226. if (queueTail === queueHead) {
  20227. queueTail = null;
  20228. }
  20229. queueHead = next.next;
  20230. next.next = null;
  20231. worker.call(context, next.value, next.worked);
  20232. if (queueTail === null) {
  20233. self2.empty();
  20234. }
  20235. } else {
  20236. _running--;
  20237. }
  20238. } else if (--_running === 0) {
  20239. self2.drain();
  20240. }
  20241. }
  20242. function kill() {
  20243. queueHead = null;
  20244. queueTail = null;
  20245. self2.drain = noop;
  20246. }
  20247. function killAndDrain() {
  20248. queueHead = null;
  20249. queueTail = null;
  20250. self2.drain();
  20251. self2.drain = noop;
  20252. }
  20253. function error(handler) {
  20254. errorHandler = handler;
  20255. }
  20256. }
  20257. function noop() {
  20258. }
  20259. function Task() {
  20260. this.value = null;
  20261. this.callback = noop;
  20262. this.next = null;
  20263. this.release = noop;
  20264. this.context = null;
  20265. this.errorHandler = null;
  20266. var self2 = this;
  20267. this.worked = function worked(err, result) {
  20268. var callback = self2.callback;
  20269. var errorHandler = self2.errorHandler;
  20270. var val = self2.value;
  20271. self2.value = null;
  20272. self2.callback = noop;
  20273. if (self2.errorHandler) {
  20274. errorHandler(err, val);
  20275. }
  20276. callback.call(self2.context, err, result);
  20277. self2.release(self2);
  20278. };
  20279. }
  20280. function queueAsPromised(context, worker, concurrency) {
  20281. if (typeof context === "function") {
  20282. concurrency = worker;
  20283. worker = context;
  20284. context = null;
  20285. }
  20286. function asyncWrapper(arg, cb) {
  20287. worker.call(this, arg).then(function(res) {
  20288. cb(null, res);
  20289. }, cb);
  20290. }
  20291. var queue = fastqueue(context, asyncWrapper, concurrency);
  20292. var pushCb = queue.push;
  20293. var unshiftCb = queue.unshift;
  20294. queue.push = push;
  20295. queue.unshift = unshift;
  20296. queue.drained = drained;
  20297. return queue;
  20298. function push(value) {
  20299. var p = new Promise(function(resolve, reject) {
  20300. pushCb(value, function(err, result) {
  20301. if (err) {
  20302. reject(err);
  20303. return;
  20304. }
  20305. resolve(result);
  20306. });
  20307. });
  20308. p.catch(noop);
  20309. return p;
  20310. }
  20311. function unshift(value) {
  20312. var p = new Promise(function(resolve, reject) {
  20313. unshiftCb(value, function(err, result) {
  20314. if (err) {
  20315. reject(err);
  20316. return;
  20317. }
  20318. resolve(result);
  20319. });
  20320. });
  20321. p.catch(noop);
  20322. return p;
  20323. }
  20324. function drained() {
  20325. var previousDrain = queue.drain;
  20326. var p = new Promise(function(resolve) {
  20327. queue.drain = function() {
  20328. previousDrain();
  20329. resolve();
  20330. };
  20331. });
  20332. return p;
  20333. }
  20334. }
  20335. module2.exports = fastqueue;
  20336. module2.exports.promise = queueAsPromised;
  20337. }
  20338. });
  20339. var require_common4 = __commonJS2({
  20340. "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
  20341. "use strict";
  20342. Object.defineProperty(exports2, "__esModule", {
  20343. value: true
  20344. });
  20345. exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
  20346. function isFatalError(settings, error) {
  20347. if (settings.errorFilter === null) {
  20348. return true;
  20349. }
  20350. return !settings.errorFilter(error);
  20351. }
  20352. exports2.isFatalError = isFatalError;
  20353. function isAppliedFilter(filter, value) {
  20354. return filter === null || filter(value);
  20355. }
  20356. exports2.isAppliedFilter = isAppliedFilter;
  20357. function replacePathSegmentSeparator(filepath, separator) {
  20358. return filepath.split(/[/\\]/).join(separator);
  20359. }
  20360. exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
  20361. function joinPathSegments(a, b, separator) {
  20362. if (a === "") {
  20363. return b;
  20364. }
  20365. if (a.endsWith(separator)) {
  20366. return a + b;
  20367. }
  20368. return a + separator + b;
  20369. }
  20370. exports2.joinPathSegments = joinPathSegments;
  20371. }
  20372. });
  20373. var require_reader = __commonJS2({
  20374. "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
  20375. "use strict";
  20376. Object.defineProperty(exports2, "__esModule", {
  20377. value: true
  20378. });
  20379. var common = require_common4();
  20380. var Reader = class {
  20381. constructor(_root, _settings) {
  20382. this._root = _root;
  20383. this._settings = _settings;
  20384. this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
  20385. }
  20386. };
  20387. exports2.default = Reader;
  20388. }
  20389. });
  20390. var require_async4 = __commonJS2({
  20391. "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
  20392. "use strict";
  20393. Object.defineProperty(exports2, "__esModule", {
  20394. value: true
  20395. });
  20396. var events_1 = require("events");
  20397. var fsScandir = require_out2();
  20398. var fastq = require_queue();
  20399. var common = require_common4();
  20400. var reader_1 = require_reader();
  20401. var AsyncReader = class extends reader_1.default {
  20402. constructor(_root, _settings) {
  20403. super(_root, _settings);
  20404. this._settings = _settings;
  20405. this._scandir = fsScandir.scandir;
  20406. this._emitter = new events_1.EventEmitter();
  20407. this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
  20408. this._isFatalError = false;
  20409. this._isDestroyed = false;
  20410. this._queue.drain = () => {
  20411. if (!this._isFatalError) {
  20412. this._emitter.emit("end");
  20413. }
  20414. };
  20415. }
  20416. read() {
  20417. this._isFatalError = false;
  20418. this._isDestroyed = false;
  20419. setImmediate(() => {
  20420. this._pushToQueue(this._root, this._settings.basePath);
  20421. });
  20422. return this._emitter;
  20423. }
  20424. get isDestroyed() {
  20425. return this._isDestroyed;
  20426. }
  20427. destroy() {
  20428. if (this._isDestroyed) {
  20429. throw new Error("The reader is already destroyed");
  20430. }
  20431. this._isDestroyed = true;
  20432. this._queue.killAndDrain();
  20433. }
  20434. onEntry(callback) {
  20435. this._emitter.on("entry", callback);
  20436. }
  20437. onError(callback) {
  20438. this._emitter.once("error", callback);
  20439. }
  20440. onEnd(callback) {
  20441. this._emitter.once("end", callback);
  20442. }
  20443. _pushToQueue(directory, base) {
  20444. const queueItem = {
  20445. directory,
  20446. base
  20447. };
  20448. this._queue.push(queueItem, (error) => {
  20449. if (error !== null) {
  20450. this._handleError(error);
  20451. }
  20452. });
  20453. }
  20454. _worker(item, done) {
  20455. this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
  20456. if (error !== null) {
  20457. done(error, void 0);
  20458. return;
  20459. }
  20460. for (const entry of entries) {
  20461. this._handleEntry(entry, item.base);
  20462. }
  20463. done(null, void 0);
  20464. });
  20465. }
  20466. _handleError(error) {
  20467. if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
  20468. return;
  20469. }
  20470. this._isFatalError = true;
  20471. this._isDestroyed = true;
  20472. this._emitter.emit("error", error);
  20473. }
  20474. _handleEntry(entry, base) {
  20475. if (this._isDestroyed || this._isFatalError) {
  20476. return;
  20477. }
  20478. const fullpath = entry.path;
  20479. if (base !== void 0) {
  20480. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20481. }
  20482. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20483. this._emitEntry(entry);
  20484. }
  20485. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20486. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20487. }
  20488. }
  20489. _emitEntry(entry) {
  20490. this._emitter.emit("entry", entry);
  20491. }
  20492. };
  20493. exports2.default = AsyncReader;
  20494. }
  20495. });
  20496. var require_async5 = __commonJS2({
  20497. "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
  20498. "use strict";
  20499. Object.defineProperty(exports2, "__esModule", {
  20500. value: true
  20501. });
  20502. var async_1 = require_async4();
  20503. var AsyncProvider = class {
  20504. constructor(_root, _settings) {
  20505. this._root = _root;
  20506. this._settings = _settings;
  20507. this._reader = new async_1.default(this._root, this._settings);
  20508. this._storage = [];
  20509. }
  20510. read(callback) {
  20511. this._reader.onError((error) => {
  20512. callFailureCallback(callback, error);
  20513. });
  20514. this._reader.onEntry((entry) => {
  20515. this._storage.push(entry);
  20516. });
  20517. this._reader.onEnd(() => {
  20518. callSuccessCallback(callback, this._storage);
  20519. });
  20520. this._reader.read();
  20521. }
  20522. };
  20523. exports2.default = AsyncProvider;
  20524. function callFailureCallback(callback, error) {
  20525. callback(error);
  20526. }
  20527. function callSuccessCallback(callback, entries) {
  20528. callback(null, entries);
  20529. }
  20530. }
  20531. });
  20532. var require_stream2 = __commonJS2({
  20533. "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
  20534. "use strict";
  20535. Object.defineProperty(exports2, "__esModule", {
  20536. value: true
  20537. });
  20538. var stream_1 = require("stream");
  20539. var async_1 = require_async4();
  20540. var StreamProvider = class {
  20541. constructor(_root, _settings) {
  20542. this._root = _root;
  20543. this._settings = _settings;
  20544. this._reader = new async_1.default(this._root, this._settings);
  20545. this._stream = new stream_1.Readable({
  20546. objectMode: true,
  20547. read: () => {
  20548. },
  20549. destroy: () => {
  20550. if (!this._reader.isDestroyed) {
  20551. this._reader.destroy();
  20552. }
  20553. }
  20554. });
  20555. }
  20556. read() {
  20557. this._reader.onError((error) => {
  20558. this._stream.emit("error", error);
  20559. });
  20560. this._reader.onEntry((entry) => {
  20561. this._stream.push(entry);
  20562. });
  20563. this._reader.onEnd(() => {
  20564. this._stream.push(null);
  20565. });
  20566. this._reader.read();
  20567. return this._stream;
  20568. }
  20569. };
  20570. exports2.default = StreamProvider;
  20571. }
  20572. });
  20573. var require_sync4 = __commonJS2({
  20574. "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
  20575. "use strict";
  20576. Object.defineProperty(exports2, "__esModule", {
  20577. value: true
  20578. });
  20579. var fsScandir = require_out2();
  20580. var common = require_common4();
  20581. var reader_1 = require_reader();
  20582. var SyncReader = class extends reader_1.default {
  20583. constructor() {
  20584. super(...arguments);
  20585. this._scandir = fsScandir.scandirSync;
  20586. this._storage = [];
  20587. this._queue = /* @__PURE__ */ new Set();
  20588. }
  20589. read() {
  20590. this._pushToQueue(this._root, this._settings.basePath);
  20591. this._handleQueue();
  20592. return this._storage;
  20593. }
  20594. _pushToQueue(directory, base) {
  20595. this._queue.add({
  20596. directory,
  20597. base
  20598. });
  20599. }
  20600. _handleQueue() {
  20601. for (const item of this._queue.values()) {
  20602. this._handleDirectory(item.directory, item.base);
  20603. }
  20604. }
  20605. _handleDirectory(directory, base) {
  20606. try {
  20607. const entries = this._scandir(directory, this._settings.fsScandirSettings);
  20608. for (const entry of entries) {
  20609. this._handleEntry(entry, base);
  20610. }
  20611. } catch (error) {
  20612. this._handleError(error);
  20613. }
  20614. }
  20615. _handleError(error) {
  20616. if (!common.isFatalError(this._settings, error)) {
  20617. return;
  20618. }
  20619. throw error;
  20620. }
  20621. _handleEntry(entry, base) {
  20622. const fullpath = entry.path;
  20623. if (base !== void 0) {
  20624. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20625. }
  20626. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20627. this._pushToStorage(entry);
  20628. }
  20629. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20630. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20631. }
  20632. }
  20633. _pushToStorage(entry) {
  20634. this._storage.push(entry);
  20635. }
  20636. };
  20637. exports2.default = SyncReader;
  20638. }
  20639. });
  20640. var require_sync5 = __commonJS2({
  20641. "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
  20642. "use strict";
  20643. Object.defineProperty(exports2, "__esModule", {
  20644. value: true
  20645. });
  20646. var sync_1 = require_sync4();
  20647. var SyncProvider = class {
  20648. constructor(_root, _settings) {
  20649. this._root = _root;
  20650. this._settings = _settings;
  20651. this._reader = new sync_1.default(this._root, this._settings);
  20652. }
  20653. read() {
  20654. return this._reader.read();
  20655. }
  20656. };
  20657. exports2.default = SyncProvider;
  20658. }
  20659. });
  20660. var require_settings3 = __commonJS2({
  20661. "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
  20662. "use strict";
  20663. Object.defineProperty(exports2, "__esModule", {
  20664. value: true
  20665. });
  20666. var path = require("path");
  20667. var fsScandir = require_out2();
  20668. var Settings = class {
  20669. constructor(_options = {}) {
  20670. this._options = _options;
  20671. this.basePath = this._getValue(this._options.basePath, void 0);
  20672. this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
  20673. this.deepFilter = this._getValue(this._options.deepFilter, null);
  20674. this.entryFilter = this._getValue(this._options.entryFilter, null);
  20675. this.errorFilter = this._getValue(this._options.errorFilter, null);
  20676. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  20677. this.fsScandirSettings = new fsScandir.Settings({
  20678. followSymbolicLinks: this._options.followSymbolicLinks,
  20679. fs: this._options.fs,
  20680. pathSegmentSeparator: this._options.pathSegmentSeparator,
  20681. stats: this._options.stats,
  20682. throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
  20683. });
  20684. }
  20685. _getValue(option, value) {
  20686. return option !== null && option !== void 0 ? option : value;
  20687. }
  20688. };
  20689. exports2.default = Settings;
  20690. }
  20691. });
  20692. var require_out3 = __commonJS2({
  20693. "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
  20694. "use strict";
  20695. Object.defineProperty(exports2, "__esModule", {
  20696. value: true
  20697. });
  20698. exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
  20699. var async_1 = require_async5();
  20700. var stream_1 = require_stream2();
  20701. var sync_1 = require_sync5();
  20702. var settings_1 = require_settings3();
  20703. exports2.Settings = settings_1.default;
  20704. function walk(directory, optionsOrSettingsOrCallback, callback) {
  20705. if (typeof optionsOrSettingsOrCallback === "function") {
  20706. new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
  20707. return;
  20708. }
  20709. new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
  20710. }
  20711. exports2.walk = walk;
  20712. function walkSync(directory, optionsOrSettings) {
  20713. const settings = getSettings(optionsOrSettings);
  20714. const provider = new sync_1.default(directory, settings);
  20715. return provider.read();
  20716. }
  20717. exports2.walkSync = walkSync;
  20718. function walkStream(directory, optionsOrSettings) {
  20719. const settings = getSettings(optionsOrSettings);
  20720. const provider = new stream_1.default(directory, settings);
  20721. return provider.read();
  20722. }
  20723. exports2.walkStream = walkStream;
  20724. function getSettings(settingsOrOptions = {}) {
  20725. if (settingsOrOptions instanceof settings_1.default) {
  20726. return settingsOrOptions;
  20727. }
  20728. return new settings_1.default(settingsOrOptions);
  20729. }
  20730. }
  20731. });
  20732. var require_reader2 = __commonJS2({
  20733. "node_modules/fast-glob/out/readers/reader.js"(exports2) {
  20734. "use strict";
  20735. Object.defineProperty(exports2, "__esModule", {
  20736. value: true
  20737. });
  20738. var path = require("path");
  20739. var fsStat = require_out();
  20740. var utils = require_utils4();
  20741. var Reader = class {
  20742. constructor(_settings) {
  20743. this._settings = _settings;
  20744. this._fsStatSettings = new fsStat.Settings({
  20745. followSymbolicLink: this._settings.followSymbolicLinks,
  20746. fs: this._settings.fs,
  20747. throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
  20748. });
  20749. }
  20750. _getFullEntryPath(filepath) {
  20751. return path.resolve(this._settings.cwd, filepath);
  20752. }
  20753. _makeEntry(stats, pattern) {
  20754. const entry = {
  20755. name: pattern,
  20756. path: pattern,
  20757. dirent: utils.fs.createDirentFromStats(pattern, stats)
  20758. };
  20759. if (this._settings.stats) {
  20760. entry.stats = stats;
  20761. }
  20762. return entry;
  20763. }
  20764. _isFatalError(error) {
  20765. return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
  20766. }
  20767. };
  20768. exports2.default = Reader;
  20769. }
  20770. });
  20771. var require_stream3 = __commonJS2({
  20772. "node_modules/fast-glob/out/readers/stream.js"(exports2) {
  20773. "use strict";
  20774. Object.defineProperty(exports2, "__esModule", {
  20775. value: true
  20776. });
  20777. var stream_1 = require("stream");
  20778. var fsStat = require_out();
  20779. var fsWalk = require_out3();
  20780. var reader_1 = require_reader2();
  20781. var ReaderStream = class extends reader_1.default {
  20782. constructor() {
  20783. super(...arguments);
  20784. this._walkStream = fsWalk.walkStream;
  20785. this._stat = fsStat.stat;
  20786. }
  20787. dynamic(root, options) {
  20788. return this._walkStream(root, options);
  20789. }
  20790. static(patterns, options) {
  20791. const filepaths = patterns.map(this._getFullEntryPath, this);
  20792. const stream = new stream_1.PassThrough({
  20793. objectMode: true
  20794. });
  20795. stream._write = (index, _enc, done) => {
  20796. return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
  20797. if (entry !== null && options.entryFilter(entry)) {
  20798. stream.push(entry);
  20799. }
  20800. if (index === filepaths.length - 1) {
  20801. stream.end();
  20802. }
  20803. done();
  20804. }).catch(done);
  20805. };
  20806. for (let i = 0; i < filepaths.length; i++) {
  20807. stream.write(i);
  20808. }
  20809. return stream;
  20810. }
  20811. _getEntry(filepath, pattern, options) {
  20812. return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
  20813. if (options.errorFilter(error)) {
  20814. return null;
  20815. }
  20816. throw error;
  20817. });
  20818. }
  20819. _getStat(filepath) {
  20820. return new Promise((resolve, reject) => {
  20821. this._stat(filepath, this._fsStatSettings, (error, stats) => {
  20822. return error === null ? resolve(stats) : reject(error);
  20823. });
  20824. });
  20825. }
  20826. };
  20827. exports2.default = ReaderStream;
  20828. }
  20829. });
  20830. var require_async6 = __commonJS2({
  20831. "node_modules/fast-glob/out/readers/async.js"(exports2) {
  20832. "use strict";
  20833. Object.defineProperty(exports2, "__esModule", {
  20834. value: true
  20835. });
  20836. var fsWalk = require_out3();
  20837. var reader_1 = require_reader2();
  20838. var stream_1 = require_stream3();
  20839. var ReaderAsync = class extends reader_1.default {
  20840. constructor() {
  20841. super(...arguments);
  20842. this._walkAsync = fsWalk.walk;
  20843. this._readerStream = new stream_1.default(this._settings);
  20844. }
  20845. dynamic(root, options) {
  20846. return new Promise((resolve, reject) => {
  20847. this._walkAsync(root, options, (error, entries) => {
  20848. if (error === null) {
  20849. resolve(entries);
  20850. } else {
  20851. reject(error);
  20852. }
  20853. });
  20854. });
  20855. }
  20856. async static(patterns, options) {
  20857. const entries = [];
  20858. const stream = this._readerStream.static(patterns, options);
  20859. return new Promise((resolve, reject) => {
  20860. stream.once("error", reject);
  20861. stream.on("data", (entry) => entries.push(entry));
  20862. stream.once("end", () => resolve(entries));
  20863. });
  20864. }
  20865. };
  20866. exports2.default = ReaderAsync;
  20867. }
  20868. });
  20869. var require_matcher = __commonJS2({
  20870. "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
  20871. "use strict";
  20872. Object.defineProperty(exports2, "__esModule", {
  20873. value: true
  20874. });
  20875. var utils = require_utils4();
  20876. var Matcher = class {
  20877. constructor(_patterns, _settings, _micromatchOptions) {
  20878. this._patterns = _patterns;
  20879. this._settings = _settings;
  20880. this._micromatchOptions = _micromatchOptions;
  20881. this._storage = [];
  20882. this._fillStorage();
  20883. }
  20884. _fillStorage() {
  20885. const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
  20886. for (const pattern of patterns) {
  20887. const segments = this._getPatternSegments(pattern);
  20888. const sections = this._splitSegmentsIntoSections(segments);
  20889. this._storage.push({
  20890. complete: sections.length <= 1,
  20891. pattern,
  20892. segments,
  20893. sections
  20894. });
  20895. }
  20896. }
  20897. _getPatternSegments(pattern) {
  20898. const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
  20899. return parts.map((part) => {
  20900. const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
  20901. if (!dynamic) {
  20902. return {
  20903. dynamic: false,
  20904. pattern: part
  20905. };
  20906. }
  20907. return {
  20908. dynamic: true,
  20909. pattern: part,
  20910. patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
  20911. };
  20912. });
  20913. }
  20914. _splitSegmentsIntoSections(segments) {
  20915. return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
  20916. }
  20917. };
  20918. exports2.default = Matcher;
  20919. }
  20920. });
  20921. var require_partial = __commonJS2({
  20922. "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
  20923. "use strict";
  20924. Object.defineProperty(exports2, "__esModule", {
  20925. value: true
  20926. });
  20927. var matcher_1 = require_matcher();
  20928. var PartialMatcher = class extends matcher_1.default {
  20929. match(filepath) {
  20930. const parts = filepath.split("/");
  20931. const levels = parts.length;
  20932. const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
  20933. for (const pattern of patterns) {
  20934. const section = pattern.sections[0];
  20935. if (!pattern.complete && levels > section.length) {
  20936. return true;
  20937. }
  20938. const match = parts.every((part, index) => {
  20939. const segment = pattern.segments[index];
  20940. if (segment.dynamic && segment.patternRe.test(part)) {
  20941. return true;
  20942. }
  20943. if (!segment.dynamic && segment.pattern === part) {
  20944. return true;
  20945. }
  20946. return false;
  20947. });
  20948. if (match) {
  20949. return true;
  20950. }
  20951. }
  20952. return false;
  20953. }
  20954. };
  20955. exports2.default = PartialMatcher;
  20956. }
  20957. });
  20958. var require_deep = __commonJS2({
  20959. "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
  20960. "use strict";
  20961. Object.defineProperty(exports2, "__esModule", {
  20962. value: true
  20963. });
  20964. var utils = require_utils4();
  20965. var partial_1 = require_partial();
  20966. var DeepFilter = class {
  20967. constructor(_settings, _micromatchOptions) {
  20968. this._settings = _settings;
  20969. this._micromatchOptions = _micromatchOptions;
  20970. }
  20971. getFilter(basePath, positive, negative) {
  20972. const matcher = this._getMatcher(positive);
  20973. const negativeRe = this._getNegativePatternsRe(negative);
  20974. return (entry) => this._filter(basePath, entry, matcher, negativeRe);
  20975. }
  20976. _getMatcher(patterns) {
  20977. return new partial_1.default(patterns, this._settings, this._micromatchOptions);
  20978. }
  20979. _getNegativePatternsRe(patterns) {
  20980. const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
  20981. return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
  20982. }
  20983. _filter(basePath, entry, matcher, negativeRe) {
  20984. if (this._isSkippedByDeep(basePath, entry.path)) {
  20985. return false;
  20986. }
  20987. if (this._isSkippedSymbolicLink(entry)) {
  20988. return false;
  20989. }
  20990. const filepath = utils.path.removeLeadingDotSegment(entry.path);
  20991. if (this._isSkippedByPositivePatterns(filepath, matcher)) {
  20992. return false;
  20993. }
  20994. return this._isSkippedByNegativePatterns(filepath, negativeRe);
  20995. }
  20996. _isSkippedByDeep(basePath, entryPath) {
  20997. if (this._settings.deep === Infinity) {
  20998. return false;
  20999. }
  21000. return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
  21001. }
  21002. _getEntryLevel(basePath, entryPath) {
  21003. const entryPathDepth = entryPath.split("/").length;
  21004. if (basePath === "") {
  21005. return entryPathDepth;
  21006. }
  21007. const basePathDepth = basePath.split("/").length;
  21008. return entryPathDepth - basePathDepth;
  21009. }
  21010. _isSkippedSymbolicLink(entry) {
  21011. return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
  21012. }
  21013. _isSkippedByPositivePatterns(entryPath, matcher) {
  21014. return !this._settings.baseNameMatch && !matcher.match(entryPath);
  21015. }
  21016. _isSkippedByNegativePatterns(entryPath, patternsRe) {
  21017. return !utils.pattern.matchAny(entryPath, patternsRe);
  21018. }
  21019. };
  21020. exports2.default = DeepFilter;
  21021. }
  21022. });
  21023. var require_entry = __commonJS2({
  21024. "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
  21025. "use strict";
  21026. Object.defineProperty(exports2, "__esModule", {
  21027. value: true
  21028. });
  21029. var utils = require_utils4();
  21030. var EntryFilter = class {
  21031. constructor(_settings, _micromatchOptions) {
  21032. this._settings = _settings;
  21033. this._micromatchOptions = _micromatchOptions;
  21034. this.index = /* @__PURE__ */ new Map();
  21035. }
  21036. getFilter(positive, negative) {
  21037. const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
  21038. const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
  21039. return (entry) => this._filter(entry, positiveRe, negativeRe);
  21040. }
  21041. _filter(entry, positiveRe, negativeRe) {
  21042. if (this._settings.unique && this._isDuplicateEntry(entry)) {
  21043. return false;
  21044. }
  21045. if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
  21046. return false;
  21047. }
  21048. if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
  21049. return false;
  21050. }
  21051. const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
  21052. const isDirectory = entry.dirent.isDirectory();
  21053. const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(entry.path, negativeRe, isDirectory);
  21054. if (this._settings.unique && isMatched) {
  21055. this._createIndexRecord(entry);
  21056. }
  21057. return isMatched;
  21058. }
  21059. _isDuplicateEntry(entry) {
  21060. return this.index.has(entry.path);
  21061. }
  21062. _createIndexRecord(entry) {
  21063. this.index.set(entry.path, void 0);
  21064. }
  21065. _onlyFileFilter(entry) {
  21066. return this._settings.onlyFiles && !entry.dirent.isFile();
  21067. }
  21068. _onlyDirectoryFilter(entry) {
  21069. return this._settings.onlyDirectories && !entry.dirent.isDirectory();
  21070. }
  21071. _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
  21072. if (!this._settings.absolute) {
  21073. return false;
  21074. }
  21075. const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
  21076. return utils.pattern.matchAny(fullpath, patternsRe);
  21077. }
  21078. _isMatchToPatterns(entryPath, patternsRe, isDirectory) {
  21079. const filepath = utils.path.removeLeadingDotSegment(entryPath);
  21080. const isMatched = utils.pattern.matchAny(filepath, patternsRe);
  21081. if (!isMatched && isDirectory) {
  21082. return utils.pattern.matchAny(filepath + "/", patternsRe);
  21083. }
  21084. return isMatched;
  21085. }
  21086. };
  21087. exports2.default = EntryFilter;
  21088. }
  21089. });
  21090. var require_error = __commonJS2({
  21091. "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
  21092. "use strict";
  21093. Object.defineProperty(exports2, "__esModule", {
  21094. value: true
  21095. });
  21096. var utils = require_utils4();
  21097. var ErrorFilter = class {
  21098. constructor(_settings) {
  21099. this._settings = _settings;
  21100. }
  21101. getFilter() {
  21102. return (error) => this._isNonFatalError(error);
  21103. }
  21104. _isNonFatalError(error) {
  21105. return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
  21106. }
  21107. };
  21108. exports2.default = ErrorFilter;
  21109. }
  21110. });
  21111. var require_entry2 = __commonJS2({
  21112. "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
  21113. "use strict";
  21114. Object.defineProperty(exports2, "__esModule", {
  21115. value: true
  21116. });
  21117. var utils = require_utils4();
  21118. var EntryTransformer = class {
  21119. constructor(_settings) {
  21120. this._settings = _settings;
  21121. }
  21122. getTransformer() {
  21123. return (entry) => this._transform(entry);
  21124. }
  21125. _transform(entry) {
  21126. let filepath = entry.path;
  21127. if (this._settings.absolute) {
  21128. filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  21129. filepath = utils.path.unixify(filepath);
  21130. }
  21131. if (this._settings.markDirectories && entry.dirent.isDirectory()) {
  21132. filepath += "/";
  21133. }
  21134. if (!this._settings.objectMode) {
  21135. return filepath;
  21136. }
  21137. return Object.assign(Object.assign({}, entry), {
  21138. path: filepath
  21139. });
  21140. }
  21141. };
  21142. exports2.default = EntryTransformer;
  21143. }
  21144. });
  21145. var require_provider = __commonJS2({
  21146. "node_modules/fast-glob/out/providers/provider.js"(exports2) {
  21147. "use strict";
  21148. Object.defineProperty(exports2, "__esModule", {
  21149. value: true
  21150. });
  21151. var path = require("path");
  21152. var deep_1 = require_deep();
  21153. var entry_1 = require_entry();
  21154. var error_1 = require_error();
  21155. var entry_2 = require_entry2();
  21156. var Provider = class {
  21157. constructor(_settings) {
  21158. this._settings = _settings;
  21159. this.errorFilter = new error_1.default(this._settings);
  21160. this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
  21161. this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
  21162. this.entryTransformer = new entry_2.default(this._settings);
  21163. }
  21164. _getRootDirectory(task) {
  21165. return path.resolve(this._settings.cwd, task.base);
  21166. }
  21167. _getReaderOptions(task) {
  21168. const basePath = task.base === "." ? "" : task.base;
  21169. return {
  21170. basePath,
  21171. pathSegmentSeparator: "/",
  21172. concurrency: this._settings.concurrency,
  21173. deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
  21174. entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
  21175. errorFilter: this.errorFilter.getFilter(),
  21176. followSymbolicLinks: this._settings.followSymbolicLinks,
  21177. fs: this._settings.fs,
  21178. stats: this._settings.stats,
  21179. throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
  21180. transform: this.entryTransformer.getTransformer()
  21181. };
  21182. }
  21183. _getMicromatchOptions() {
  21184. return {
  21185. dot: this._settings.dot,
  21186. matchBase: this._settings.baseNameMatch,
  21187. nobrace: !this._settings.braceExpansion,
  21188. nocase: !this._settings.caseSensitiveMatch,
  21189. noext: !this._settings.extglob,
  21190. noglobstar: !this._settings.globstar,
  21191. posix: true,
  21192. strictSlashes: false
  21193. };
  21194. }
  21195. };
  21196. exports2.default = Provider;
  21197. }
  21198. });
  21199. var require_async7 = __commonJS2({
  21200. "node_modules/fast-glob/out/providers/async.js"(exports2) {
  21201. "use strict";
  21202. Object.defineProperty(exports2, "__esModule", {
  21203. value: true
  21204. });
  21205. var async_1 = require_async6();
  21206. var provider_1 = require_provider();
  21207. var ProviderAsync = class extends provider_1.default {
  21208. constructor() {
  21209. super(...arguments);
  21210. this._reader = new async_1.default(this._settings);
  21211. }
  21212. async read(task) {
  21213. const root = this._getRootDirectory(task);
  21214. const options = this._getReaderOptions(task);
  21215. const entries = await this.api(root, task, options);
  21216. return entries.map((entry) => options.transform(entry));
  21217. }
  21218. api(root, task, options) {
  21219. if (task.dynamic) {
  21220. return this._reader.dynamic(root, options);
  21221. }
  21222. return this._reader.static(task.patterns, options);
  21223. }
  21224. };
  21225. exports2.default = ProviderAsync;
  21226. }
  21227. });
  21228. var require_stream4 = __commonJS2({
  21229. "node_modules/fast-glob/out/providers/stream.js"(exports2) {
  21230. "use strict";
  21231. Object.defineProperty(exports2, "__esModule", {
  21232. value: true
  21233. });
  21234. var stream_1 = require("stream");
  21235. var stream_2 = require_stream3();
  21236. var provider_1 = require_provider();
  21237. var ProviderStream = class extends provider_1.default {
  21238. constructor() {
  21239. super(...arguments);
  21240. this._reader = new stream_2.default(this._settings);
  21241. }
  21242. read(task) {
  21243. const root = this._getRootDirectory(task);
  21244. const options = this._getReaderOptions(task);
  21245. const source = this.api(root, task, options);
  21246. const destination = new stream_1.Readable({
  21247. objectMode: true,
  21248. read: () => {
  21249. }
  21250. });
  21251. source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
  21252. destination.once("close", () => source.destroy());
  21253. return destination;
  21254. }
  21255. api(root, task, options) {
  21256. if (task.dynamic) {
  21257. return this._reader.dynamic(root, options);
  21258. }
  21259. return this._reader.static(task.patterns, options);
  21260. }
  21261. };
  21262. exports2.default = ProviderStream;
  21263. }
  21264. });
  21265. var require_sync6 = __commonJS2({
  21266. "node_modules/fast-glob/out/readers/sync.js"(exports2) {
  21267. "use strict";
  21268. Object.defineProperty(exports2, "__esModule", {
  21269. value: true
  21270. });
  21271. var fsStat = require_out();
  21272. var fsWalk = require_out3();
  21273. var reader_1 = require_reader2();
  21274. var ReaderSync = class extends reader_1.default {
  21275. constructor() {
  21276. super(...arguments);
  21277. this._walkSync = fsWalk.walkSync;
  21278. this._statSync = fsStat.statSync;
  21279. }
  21280. dynamic(root, options) {
  21281. return this._walkSync(root, options);
  21282. }
  21283. static(patterns, options) {
  21284. const entries = [];
  21285. for (const pattern of patterns) {
  21286. const filepath = this._getFullEntryPath(pattern);
  21287. const entry = this._getEntry(filepath, pattern, options);
  21288. if (entry === null || !options.entryFilter(entry)) {
  21289. continue;
  21290. }
  21291. entries.push(entry);
  21292. }
  21293. return entries;
  21294. }
  21295. _getEntry(filepath, pattern, options) {
  21296. try {
  21297. const stats = this._getStat(filepath);
  21298. return this._makeEntry(stats, pattern);
  21299. } catch (error) {
  21300. if (options.errorFilter(error)) {
  21301. return null;
  21302. }
  21303. throw error;
  21304. }
  21305. }
  21306. _getStat(filepath) {
  21307. return this._statSync(filepath, this._fsStatSettings);
  21308. }
  21309. };
  21310. exports2.default = ReaderSync;
  21311. }
  21312. });
  21313. var require_sync7 = __commonJS2({
  21314. "node_modules/fast-glob/out/providers/sync.js"(exports2) {
  21315. "use strict";
  21316. Object.defineProperty(exports2, "__esModule", {
  21317. value: true
  21318. });
  21319. var sync_1 = require_sync6();
  21320. var provider_1 = require_provider();
  21321. var ProviderSync = class extends provider_1.default {
  21322. constructor() {
  21323. super(...arguments);
  21324. this._reader = new sync_1.default(this._settings);
  21325. }
  21326. read(task) {
  21327. const root = this._getRootDirectory(task);
  21328. const options = this._getReaderOptions(task);
  21329. const entries = this.api(root, task, options);
  21330. return entries.map(options.transform);
  21331. }
  21332. api(root, task, options) {
  21333. if (task.dynamic) {
  21334. return this._reader.dynamic(root, options);
  21335. }
  21336. return this._reader.static(task.patterns, options);
  21337. }
  21338. };
  21339. exports2.default = ProviderSync;
  21340. }
  21341. });
  21342. var require_settings4 = __commonJS2({
  21343. "node_modules/fast-glob/out/settings.js"(exports2) {
  21344. "use strict";
  21345. Object.defineProperty(exports2, "__esModule", {
  21346. value: true
  21347. });
  21348. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
  21349. var fs = require("fs");
  21350. var os = require("os");
  21351. var CPU_COUNT = Math.max(os.cpus().length, 1);
  21352. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
  21353. lstat: fs.lstat,
  21354. lstatSync: fs.lstatSync,
  21355. stat: fs.stat,
  21356. statSync: fs.statSync,
  21357. readdir: fs.readdir,
  21358. readdirSync: fs.readdirSync
  21359. };
  21360. var Settings = class {
  21361. constructor(_options = {}) {
  21362. this._options = _options;
  21363. this.absolute = this._getValue(this._options.absolute, false);
  21364. this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
  21365. this.braceExpansion = this._getValue(this._options.braceExpansion, true);
  21366. this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
  21367. this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
  21368. this.cwd = this._getValue(this._options.cwd, process.cwd());
  21369. this.deep = this._getValue(this._options.deep, Infinity);
  21370. this.dot = this._getValue(this._options.dot, false);
  21371. this.extglob = this._getValue(this._options.extglob, true);
  21372. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
  21373. this.fs = this._getFileSystemMethods(this._options.fs);
  21374. this.globstar = this._getValue(this._options.globstar, true);
  21375. this.ignore = this._getValue(this._options.ignore, []);
  21376. this.markDirectories = this._getValue(this._options.markDirectories, false);
  21377. this.objectMode = this._getValue(this._options.objectMode, false);
  21378. this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
  21379. this.onlyFiles = this._getValue(this._options.onlyFiles, true);
  21380. this.stats = this._getValue(this._options.stats, false);
  21381. this.suppressErrors = this._getValue(this._options.suppressErrors, false);
  21382. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
  21383. this.unique = this._getValue(this._options.unique, true);
  21384. if (this.onlyDirectories) {
  21385. this.onlyFiles = false;
  21386. }
  21387. if (this.stats) {
  21388. this.objectMode = true;
  21389. }
  21390. }
  21391. _getValue(option, value) {
  21392. return option === void 0 ? value : option;
  21393. }
  21394. _getFileSystemMethods(methods = {}) {
  21395. return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
  21396. }
  21397. };
  21398. exports2.default = Settings;
  21399. }
  21400. });
  21401. var require_out4 = __commonJS2({
  21402. "node_modules/fast-glob/out/index.js"(exports2, module2) {
  21403. "use strict";
  21404. var taskManager = require_tasks();
  21405. var patternManager = require_patterns();
  21406. var async_1 = require_async7();
  21407. var stream_1 = require_stream4();
  21408. var sync_1 = require_sync7();
  21409. var settings_1 = require_settings4();
  21410. var utils = require_utils4();
  21411. async function FastGlob(source, options) {
  21412. assertPatternsInput(source);
  21413. const works = getWorks(source, async_1.default, options);
  21414. const result = await Promise.all(works);
  21415. return utils.array.flatten(result);
  21416. }
  21417. (function(FastGlob2) {
  21418. function sync(source, options) {
  21419. assertPatternsInput(source);
  21420. const works = getWorks(source, sync_1.default, options);
  21421. return utils.array.flatten(works);
  21422. }
  21423. FastGlob2.sync = sync;
  21424. function stream(source, options) {
  21425. assertPatternsInput(source);
  21426. const works = getWorks(source, stream_1.default, options);
  21427. return utils.stream.merge(works);
  21428. }
  21429. FastGlob2.stream = stream;
  21430. function generateTasks(source, options) {
  21431. assertPatternsInput(source);
  21432. const patterns = patternManager.transform([].concat(source));
  21433. const settings = new settings_1.default(options);
  21434. return taskManager.generate(patterns, settings);
  21435. }
  21436. FastGlob2.generateTasks = generateTasks;
  21437. function isDynamicPattern(source, options) {
  21438. assertPatternsInput(source);
  21439. const settings = new settings_1.default(options);
  21440. return utils.pattern.isDynamicPattern(source, settings);
  21441. }
  21442. FastGlob2.isDynamicPattern = isDynamicPattern;
  21443. function escapePath(source) {
  21444. assertPatternsInput(source);
  21445. return utils.path.escape(source);
  21446. }
  21447. FastGlob2.escapePath = escapePath;
  21448. })(FastGlob || (FastGlob = {}));
  21449. function getWorks(source, _Provider, options) {
  21450. const patterns = patternManager.transform([].concat(source));
  21451. const settings = new settings_1.default(options);
  21452. const tasks = taskManager.generate(patterns, settings);
  21453. const provider = new _Provider(settings);
  21454. return tasks.map(provider.read, provider);
  21455. }
  21456. function assertPatternsInput(input) {
  21457. const source = [].concat(input);
  21458. const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
  21459. if (!isValidSource) {
  21460. throw new TypeError("Patterns must be a string (non empty) or an array of strings");
  21461. }
  21462. }
  21463. module2.exports = FastGlob;
  21464. }
  21465. });
  21466. var require_uniq_by_key = __commonJS2({
  21467. "src/utils/uniq-by-key.js"(exports2, module2) {
  21468. "use strict";
  21469. function uniqByKey(array, key) {
  21470. const result = [];
  21471. const seen = /* @__PURE__ */ new Set();
  21472. for (const element of array) {
  21473. const value = element[key];
  21474. if (!seen.has(value)) {
  21475. seen.add(value);
  21476. result.push(element);
  21477. }
  21478. }
  21479. return result;
  21480. }
  21481. module2.exports = uniqByKey;
  21482. }
  21483. });
  21484. var require_create_language = __commonJS2({
  21485. "src/utils/create-language.js"(exports2, module2) {
  21486. "use strict";
  21487. module2.exports = function(linguistData, override) {
  21488. const {
  21489. languageId
  21490. } = linguistData, rest = _objectWithoutProperties(linguistData, _excluded4);
  21491. return Object.assign(Object.assign({
  21492. linguistLanguageId: languageId
  21493. }, rest), override(linguistData));
  21494. };
  21495. }
  21496. });
  21497. var require_ast = __commonJS2({
  21498. "node_modules/esutils/lib/ast.js"(exports2, module2) {
  21499. (function() {
  21500. "use strict";
  21501. function isExpression(node) {
  21502. if (node == null) {
  21503. return false;
  21504. }
  21505. switch (node.type) {
  21506. case "ArrayExpression":
  21507. case "AssignmentExpression":
  21508. case "BinaryExpression":
  21509. case "CallExpression":
  21510. case "ConditionalExpression":
  21511. case "FunctionExpression":
  21512. case "Identifier":
  21513. case "Literal":
  21514. case "LogicalExpression":
  21515. case "MemberExpression":
  21516. case "NewExpression":
  21517. case "ObjectExpression":
  21518. case "SequenceExpression":
  21519. case "ThisExpression":
  21520. case "UnaryExpression":
  21521. case "UpdateExpression":
  21522. return true;
  21523. }
  21524. return false;
  21525. }
  21526. function isIterationStatement(node) {
  21527. if (node == null) {
  21528. return false;
  21529. }
  21530. switch (node.type) {
  21531. case "DoWhileStatement":
  21532. case "ForInStatement":
  21533. case "ForStatement":
  21534. case "WhileStatement":
  21535. return true;
  21536. }
  21537. return false;
  21538. }
  21539. function isStatement(node) {
  21540. if (node == null) {
  21541. return false;
  21542. }
  21543. switch (node.type) {
  21544. case "BlockStatement":
  21545. case "BreakStatement":
  21546. case "ContinueStatement":
  21547. case "DebuggerStatement":
  21548. case "DoWhileStatement":
  21549. case "EmptyStatement":
  21550. case "ExpressionStatement":
  21551. case "ForInStatement":
  21552. case "ForStatement":
  21553. case "IfStatement":
  21554. case "LabeledStatement":
  21555. case "ReturnStatement":
  21556. case "SwitchStatement":
  21557. case "ThrowStatement":
  21558. case "TryStatement":
  21559. case "VariableDeclaration":
  21560. case "WhileStatement":
  21561. case "WithStatement":
  21562. return true;
  21563. }
  21564. return false;
  21565. }
  21566. function isSourceElement(node) {
  21567. return isStatement(node) || node != null && node.type === "FunctionDeclaration";
  21568. }
  21569. function trailingStatement(node) {
  21570. switch (node.type) {
  21571. case "IfStatement":
  21572. if (node.alternate != null) {
  21573. return node.alternate;
  21574. }
  21575. return node.consequent;
  21576. case "LabeledStatement":
  21577. case "ForStatement":
  21578. case "ForInStatement":
  21579. case "WhileStatement":
  21580. case "WithStatement":
  21581. return node.body;
  21582. }
  21583. return null;
  21584. }
  21585. function isProblematicIfStatement(node) {
  21586. var current;
  21587. if (node.type !== "IfStatement") {
  21588. return false;
  21589. }
  21590. if (node.alternate == null) {
  21591. return false;
  21592. }
  21593. current = node.consequent;
  21594. do {
  21595. if (current.type === "IfStatement") {
  21596. if (current.alternate == null) {
  21597. return true;
  21598. }
  21599. }
  21600. current = trailingStatement(current);
  21601. } while (current);
  21602. return false;
  21603. }
  21604. module2.exports = {
  21605. isExpression,
  21606. isStatement,
  21607. isIterationStatement,
  21608. isSourceElement,
  21609. isProblematicIfStatement,
  21610. trailingStatement
  21611. };
  21612. })();
  21613. }
  21614. });
  21615. var require_code = __commonJS2({
  21616. "node_modules/esutils/lib/code.js"(exports2, module2) {
  21617. (function() {
  21618. "use strict";
  21619. var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
  21620. ES5Regex = {
  21621. 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]/,
  21622. 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]/
  21623. };
  21624. ES6Regex = {
  21625. 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]/,
  21626. 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]/
  21627. };
  21628. function isDecimalDigit(ch2) {
  21629. return 48 <= ch2 && ch2 <= 57;
  21630. }
  21631. function isHexDigit(ch2) {
  21632. return 48 <= ch2 && ch2 <= 57 || 97 <= ch2 && ch2 <= 102 || 65 <= ch2 && ch2 <= 70;
  21633. }
  21634. function isOctalDigit(ch2) {
  21635. return ch2 >= 48 && ch2 <= 55;
  21636. }
  21637. NON_ASCII_WHITESPACES = [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279];
  21638. function isWhiteSpace(ch2) {
  21639. return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && NON_ASCII_WHITESPACES.indexOf(ch2) >= 0;
  21640. }
  21641. function isLineTerminator(ch2) {
  21642. return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233;
  21643. }
  21644. function fromCodePoint(cp) {
  21645. if (cp <= 65535) {
  21646. return String.fromCharCode(cp);
  21647. }
  21648. var cu1 = String.fromCharCode(Math.floor((cp - 65536) / 1024) + 55296);
  21649. var cu2 = String.fromCharCode((cp - 65536) % 1024 + 56320);
  21650. return cu1 + cu2;
  21651. }
  21652. IDENTIFIER_START = new Array(128);
  21653. for (ch = 0; ch < 128; ++ch) {
  21654. IDENTIFIER_START[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch === 36 || ch === 95;
  21655. }
  21656. IDENTIFIER_PART = new Array(128);
  21657. for (ch = 0; ch < 128; ++ch) {
  21658. IDENTIFIER_PART[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95;
  21659. }
  21660. function isIdentifierStartES5(ch2) {
  21661. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21662. }
  21663. function isIdentifierPartES5(ch2) {
  21664. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21665. }
  21666. function isIdentifierStartES6(ch2) {
  21667. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21668. }
  21669. function isIdentifierPartES6(ch2) {
  21670. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21671. }
  21672. module2.exports = {
  21673. isDecimalDigit,
  21674. isHexDigit,
  21675. isOctalDigit,
  21676. isWhiteSpace,
  21677. isLineTerminator,
  21678. isIdentifierStartES5,
  21679. isIdentifierPartES5,
  21680. isIdentifierStartES6,
  21681. isIdentifierPartES6
  21682. };
  21683. })();
  21684. }
  21685. });
  21686. var require_keyword2 = __commonJS2({
  21687. "node_modules/esutils/lib/keyword.js"(exports2, module2) {
  21688. (function() {
  21689. "use strict";
  21690. var code = require_code();
  21691. function isStrictModeReservedWordES6(id) {
  21692. switch (id) {
  21693. case "implements":
  21694. case "interface":
  21695. case "package":
  21696. case "private":
  21697. case "protected":
  21698. case "public":
  21699. case "static":
  21700. case "let":
  21701. return true;
  21702. default:
  21703. return false;
  21704. }
  21705. }
  21706. function isKeywordES5(id, strict) {
  21707. if (!strict && id === "yield") {
  21708. return false;
  21709. }
  21710. return isKeywordES6(id, strict);
  21711. }
  21712. function isKeywordES6(id, strict) {
  21713. if (strict && isStrictModeReservedWordES6(id)) {
  21714. return true;
  21715. }
  21716. switch (id.length) {
  21717. case 2:
  21718. return id === "if" || id === "in" || id === "do";
  21719. case 3:
  21720. return id === "var" || id === "for" || id === "new" || id === "try";
  21721. case 4:
  21722. return id === "this" || id === "else" || id === "case" || id === "void" || id === "with" || id === "enum";
  21723. case 5:
  21724. return id === "while" || id === "break" || id === "catch" || id === "throw" || id === "const" || id === "yield" || id === "class" || id === "super";
  21725. case 6:
  21726. return id === "return" || id === "typeof" || id === "delete" || id === "switch" || id === "export" || id === "import";
  21727. case 7:
  21728. return id === "default" || id === "finally" || id === "extends";
  21729. case 8:
  21730. return id === "function" || id === "continue" || id === "debugger";
  21731. case 10:
  21732. return id === "instanceof";
  21733. default:
  21734. return false;
  21735. }
  21736. }
  21737. function isReservedWordES5(id, strict) {
  21738. return id === "null" || id === "true" || id === "false" || isKeywordES5(id, strict);
  21739. }
  21740. function isReservedWordES6(id, strict) {
  21741. return id === "null" || id === "true" || id === "false" || isKeywordES6(id, strict);
  21742. }
  21743. function isRestrictedWord(id) {
  21744. return id === "eval" || id === "arguments";
  21745. }
  21746. function isIdentifierNameES5(id) {
  21747. var i, iz, ch;
  21748. if (id.length === 0) {
  21749. return false;
  21750. }
  21751. ch = id.charCodeAt(0);
  21752. if (!code.isIdentifierStartES5(ch)) {
  21753. return false;
  21754. }
  21755. for (i = 1, iz = id.length; i < iz; ++i) {
  21756. ch = id.charCodeAt(i);
  21757. if (!code.isIdentifierPartES5(ch)) {
  21758. return false;
  21759. }
  21760. }
  21761. return true;
  21762. }
  21763. function decodeUtf16(lead, trail) {
  21764. return (lead - 55296) * 1024 + (trail - 56320) + 65536;
  21765. }
  21766. function isIdentifierNameES6(id) {
  21767. var i, iz, ch, lowCh, check;
  21768. if (id.length === 0) {
  21769. return false;
  21770. }
  21771. check = code.isIdentifierStartES6;
  21772. for (i = 0, iz = id.length; i < iz; ++i) {
  21773. ch = id.charCodeAt(i);
  21774. if (55296 <= ch && ch <= 56319) {
  21775. ++i;
  21776. if (i >= iz) {
  21777. return false;
  21778. }
  21779. lowCh = id.charCodeAt(i);
  21780. if (!(56320 <= lowCh && lowCh <= 57343)) {
  21781. return false;
  21782. }
  21783. ch = decodeUtf16(ch, lowCh);
  21784. }
  21785. if (!check(ch)) {
  21786. return false;
  21787. }
  21788. check = code.isIdentifierPartES6;
  21789. }
  21790. return true;
  21791. }
  21792. function isIdentifierES5(id, strict) {
  21793. return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
  21794. }
  21795. function isIdentifierES6(id, strict) {
  21796. return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
  21797. }
  21798. module2.exports = {
  21799. isKeywordES5,
  21800. isKeywordES6,
  21801. isReservedWordES5,
  21802. isReservedWordES6,
  21803. isRestrictedWord,
  21804. isIdentifierNameES5,
  21805. isIdentifierNameES6,
  21806. isIdentifierES5,
  21807. isIdentifierES6
  21808. };
  21809. })();
  21810. }
  21811. });
  21812. var require_utils6 = __commonJS2({
  21813. "node_modules/esutils/lib/utils.js"(exports2) {
  21814. (function() {
  21815. "use strict";
  21816. exports2.ast = require_ast();
  21817. exports2.code = require_code();
  21818. exports2.keyword = require_keyword2();
  21819. })();
  21820. }
  21821. });
  21822. var require_is_block_comment = __commonJS2({
  21823. "src/language-js/utils/is-block-comment.js"(exports2, module2) {
  21824. "use strict";
  21825. var BLOCK_COMMENT_TYPES = /* @__PURE__ */ new Set(["Block", "CommentBlock", "MultiLine"]);
  21826. var isBlockComment = (comment) => BLOCK_COMMENT_TYPES.has(comment === null || comment === void 0 ? void 0 : comment.type);
  21827. module2.exports = isBlockComment;
  21828. }
  21829. });
  21830. var require_is_node_matches = __commonJS2({
  21831. "src/language-js/utils/is-node-matches.js"(exports2, module2) {
  21832. "use strict";
  21833. function isNodeMatchesNameOrPath(node, nameOrPath) {
  21834. const names = nameOrPath.split(".");
  21835. for (let index = names.length - 1; index >= 0; index--) {
  21836. const name = names[index];
  21837. if (index === 0) {
  21838. return node.type === "Identifier" && node.name === name;
  21839. }
  21840. if (node.type !== "MemberExpression" || node.optional || node.computed || node.property.type !== "Identifier" || node.property.name !== name) {
  21841. return false;
  21842. }
  21843. node = node.object;
  21844. }
  21845. }
  21846. function isNodeMatches(node, nameOrPaths) {
  21847. return nameOrPaths.some((nameOrPath) => isNodeMatchesNameOrPath(node, nameOrPath));
  21848. }
  21849. module2.exports = isNodeMatches;
  21850. }
  21851. });
  21852. var require_utils7 = __commonJS2({
  21853. "src/language-js/utils/index.js"(exports2, module2) {
  21854. "use strict";
  21855. var isIdentifierName = require_utils6().keyword.isIdentifierNameES5;
  21856. var {
  21857. getLast,
  21858. hasNewline,
  21859. skipWhitespace,
  21860. isNonEmptyArray,
  21861. isNextLineEmptyAfterIndex,
  21862. getStringWidth
  21863. } = require_util();
  21864. var {
  21865. locStart,
  21866. locEnd,
  21867. hasSameLocStart
  21868. } = require_loc();
  21869. var isBlockComment = require_is_block_comment();
  21870. var isNodeMatches = require_is_node_matches();
  21871. var NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
  21872. var FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`);
  21873. var FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`);
  21874. function hasFlowShorthandAnnotationComment(node) {
  21875. var _node$extra, _node$trailingComment;
  21876. 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);
  21877. }
  21878. function hasFlowAnnotationComment(comments) {
  21879. const firstComment = comments === null || comments === void 0 ? void 0 : comments[0];
  21880. return isBlockComment(firstComment) && FLOW_ANNOTATION.test(firstComment.value);
  21881. }
  21882. function hasNode(node, fn) {
  21883. if (!node || typeof node !== "object") {
  21884. return false;
  21885. }
  21886. if (Array.isArray(node)) {
  21887. return node.some((value) => hasNode(value, fn));
  21888. }
  21889. const result = fn(node);
  21890. return typeof result === "boolean" ? result : Object.values(node).some((value) => hasNode(value, fn));
  21891. }
  21892. function hasNakedLeftSide(node) {
  21893. 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";
  21894. }
  21895. function getLeftSide(node) {
  21896. var _ref2, _ref3, _ref4, _ref5, _ref6, _node$left;
  21897. if (node.expressions) {
  21898. return node.expressions[0];
  21899. }
  21900. 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;
  21901. }
  21902. function getLeftSidePathName(path, node) {
  21903. if (node.expressions) {
  21904. return ["expressions", 0];
  21905. }
  21906. if (node.left) {
  21907. return ["left"];
  21908. }
  21909. if (node.test) {
  21910. return ["test"];
  21911. }
  21912. if (node.object) {
  21913. return ["object"];
  21914. }
  21915. if (node.callee) {
  21916. return ["callee"];
  21917. }
  21918. if (node.tag) {
  21919. return ["tag"];
  21920. }
  21921. if (node.argument) {
  21922. return ["argument"];
  21923. }
  21924. if (node.expression) {
  21925. return ["expression"];
  21926. }
  21927. throw new Error("Unexpected node has no left side.");
  21928. }
  21929. function createTypeCheckFunction(types) {
  21930. types = new Set(types);
  21931. return (node) => types.has(node === null || node === void 0 ? void 0 : node.type);
  21932. }
  21933. var isLineComment = createTypeCheckFunction(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose"]);
  21934. var isExportDeclaration = createTypeCheckFunction(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
  21935. function getParentExportDeclaration(path) {
  21936. const parentNode = path.getParentNode();
  21937. if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
  21938. return parentNode;
  21939. }
  21940. return null;
  21941. }
  21942. var isLiteral = createTypeCheckFunction(["BooleanLiteral", "DirectiveLiteral", "Literal", "NullLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "RegExpLiteral", "StringLiteral", "TemplateLiteral", "TSTypeLiteral", "JSXText"]);
  21943. function isNumericLiteral(node) {
  21944. return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
  21945. }
  21946. function isSignedNumericLiteral(node) {
  21947. return node.type === "UnaryExpression" && (node.operator === "+" || node.operator === "-") && isNumericLiteral(node.argument);
  21948. }
  21949. function isStringLiteral(node) {
  21950. return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
  21951. }
  21952. var isObjectType = createTypeCheckFunction(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]);
  21953. var isFunctionOrArrowExpression = createTypeCheckFunction(["FunctionExpression", "ArrowFunctionExpression"]);
  21954. function isFunctionOrArrowExpressionWithBody(node) {
  21955. return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
  21956. }
  21957. function isAngularTestWrapper(node) {
  21958. return isCallExpression(node) && node.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(node.callee.name);
  21959. }
  21960. var isJsxNode = createTypeCheckFunction(["JSXElement", "JSXFragment"]);
  21961. function isTheOnlyJsxElementInMarkdown(options, path) {
  21962. if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
  21963. return false;
  21964. }
  21965. const node = path.getNode();
  21966. if (!node.expression || !isJsxNode(node.expression)) {
  21967. return false;
  21968. }
  21969. const parent = path.getParentNode();
  21970. return parent.type === "Program" && parent.body.length === 1;
  21971. }
  21972. function isGetterOrSetter(node) {
  21973. return node.kind === "get" || node.kind === "set";
  21974. }
  21975. function isFunctionNotation(node) {
  21976. return isGetterOrSetter(node) || hasSameLocStart(node, node.value);
  21977. }
  21978. function isObjectTypePropertyAFunction(node) {
  21979. return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node);
  21980. }
  21981. function isTypeAnnotationAFunction(node) {
  21982. return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !hasSameLocStart(node, node.typeAnnotation);
  21983. }
  21984. var isBinaryish = createTypeCheckFunction(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
  21985. function isMemberish(node) {
  21986. return isMemberExpression(node) || node.type === "BindExpression" && Boolean(node.object);
  21987. }
  21988. 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"]);
  21989. function isSimpleType(node) {
  21990. if (!node) {
  21991. return false;
  21992. }
  21993. if ((node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference") && !node.typeParameters) {
  21994. return true;
  21995. }
  21996. if (simpleTypeAnnotations.has(node.type)) {
  21997. return true;
  21998. }
  21999. return false;
  22000. }
  22001. function isUnitTestSetUp(node) {
  22002. const unitTestSetUpRe = /^(?:before|after)(?:Each|All)$/;
  22003. return node.callee.type === "Identifier" && unitTestSetUpRe.test(node.callee.name) && node.arguments.length === 1;
  22004. }
  22005. 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"];
  22006. function isTestCallCallee(node) {
  22007. return isNodeMatches(node, testCallCalleePatterns);
  22008. }
  22009. function isTestCall(node, parent) {
  22010. if (node.type !== "CallExpression") {
  22011. return false;
  22012. }
  22013. if (node.arguments.length === 1) {
  22014. if (isAngularTestWrapper(node) && parent && isTestCall(parent)) {
  22015. return isFunctionOrArrowExpression(node.arguments[0]);
  22016. }
  22017. if (isUnitTestSetUp(node)) {
  22018. return isAngularTestWrapper(node.arguments[0]);
  22019. }
  22020. } else if (node.arguments.length === 2 || node.arguments.length === 3) {
  22021. if ((node.arguments[0].type === "TemplateLiteral" || isStringLiteral(node.arguments[0])) && isTestCallCallee(node.callee)) {
  22022. if (node.arguments[2] && !isNumericLiteral(node.arguments[2])) {
  22023. return false;
  22024. }
  22025. return (node.arguments.length === 2 ? isFunctionOrArrowExpression(node.arguments[1]) : isFunctionOrArrowExpressionWithBody(node.arguments[1]) && getFunctionParameters(node.arguments[1]).length <= 1) || isAngularTestWrapper(node.arguments[1]);
  22026. }
  22027. }
  22028. return false;
  22029. }
  22030. var isCallExpression = createTypeCheckFunction(["CallExpression", "OptionalCallExpression"]);
  22031. var isMemberExpression = createTypeCheckFunction(["MemberExpression", "OptionalMemberExpression"]);
  22032. function isSimpleTemplateLiteral(node) {
  22033. let expressionsKey = "expressions";
  22034. if (node.type === "TSTemplateLiteralType") {
  22035. expressionsKey = "types";
  22036. }
  22037. const expressions = node[expressionsKey];
  22038. if (expressions.length === 0) {
  22039. return false;
  22040. }
  22041. return expressions.every((expr) => {
  22042. if (hasComment(expr)) {
  22043. return false;
  22044. }
  22045. if (expr.type === "Identifier" || expr.type === "ThisExpression") {
  22046. return true;
  22047. }
  22048. if (isMemberExpression(expr)) {
  22049. let head = expr;
  22050. while (isMemberExpression(head)) {
  22051. if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
  22052. return false;
  22053. }
  22054. head = head.object;
  22055. if (hasComment(head)) {
  22056. return false;
  22057. }
  22058. }
  22059. if (head.type === "Identifier" || head.type === "ThisExpression") {
  22060. return true;
  22061. }
  22062. return false;
  22063. }
  22064. return false;
  22065. });
  22066. }
  22067. function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
  22068. if (tokenNode === "+" || tokenNode === "-") {
  22069. return tokenNode + keyword;
  22070. }
  22071. return keyword;
  22072. }
  22073. function isFlowAnnotationComment(text, typeAnnotation) {
  22074. const start = locStart(typeAnnotation);
  22075. const end = skipWhitespace(text, locEnd(typeAnnotation));
  22076. return end !== false && text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
  22077. }
  22078. function hasLeadingOwnLineComment(text, node) {
  22079. if (isJsxNode(node)) {
  22080. return hasNodeIgnoreComment(node);
  22081. }
  22082. return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(text, locEnd(comment)));
  22083. }
  22084. function isStringPropSafeToUnquote(node, options) {
  22085. 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"));
  22086. }
  22087. function isSimpleNumber(numberString) {
  22088. return /^(?:\d+|\d+\.\d+)$/.test(numberString);
  22089. }
  22090. function isJestEachTemplateLiteral(node, parentNode) {
  22091. const jestEachTriggerRegex = /^[fx]?(?:describe|it|test)$/;
  22092. 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));
  22093. }
  22094. function templateLiteralHasNewLines(template) {
  22095. return template.quasis.some((quasi) => quasi.value.raw.includes("\n"));
  22096. }
  22097. function isTemplateOnItsOwnLine(node, text) {
  22098. return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(text, locStart(node), {
  22099. backwards: true
  22100. });
  22101. }
  22102. function needsHardlineAfterDanglingComment(node) {
  22103. if (!hasComment(node)) {
  22104. return false;
  22105. }
  22106. const lastDanglingComment = getLast(getComments(node, CommentCheckFlags.Dangling));
  22107. return lastDanglingComment && !isBlockComment(lastDanglingComment);
  22108. }
  22109. function isFunctionCompositionArgs(args) {
  22110. if (args.length <= 1) {
  22111. return false;
  22112. }
  22113. let count = 0;
  22114. for (const arg of args) {
  22115. if (isFunctionOrArrowExpression(arg)) {
  22116. count += 1;
  22117. if (count > 1) {
  22118. return true;
  22119. }
  22120. } else if (isCallExpression(arg)) {
  22121. for (const childArg of arg.arguments) {
  22122. if (isFunctionOrArrowExpression(childArg)) {
  22123. return true;
  22124. }
  22125. }
  22126. }
  22127. }
  22128. return false;
  22129. }
  22130. function isLongCurriedCallExpression(path) {
  22131. const node = path.getValue();
  22132. const parent = path.getParentNode();
  22133. return isCallExpression(node) && isCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
  22134. }
  22135. function isSimpleCallArgument(node, depth) {
  22136. if (depth >= 2) {
  22137. return false;
  22138. }
  22139. const isChildSimple = (child) => isSimpleCallArgument(child, depth + 1);
  22140. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  22141. if (regexpPattern && getStringWidth(regexpPattern) > 5) {
  22142. return false;
  22143. }
  22144. 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") {
  22145. return true;
  22146. }
  22147. if (node.type === "TemplateLiteral") {
  22148. return node.quasis.every((element) => !element.value.raw.includes("\n")) && node.expressions.every(isChildSimple);
  22149. }
  22150. if (node.type === "ObjectExpression") {
  22151. return node.properties.every((p) => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
  22152. }
  22153. if (node.type === "ArrayExpression") {
  22154. return node.elements.every((x) => x === null || isChildSimple(x));
  22155. }
  22156. if (isCallLikeExpression(node)) {
  22157. return (node.type === "ImportExpression" || isSimpleCallArgument(node.callee, depth)) && getCallArguments(node).every(isChildSimple);
  22158. }
  22159. if (isMemberExpression(node)) {
  22160. return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
  22161. }
  22162. const targetUnaryExpressionOperators = {
  22163. "!": true,
  22164. "-": true,
  22165. "+": true,
  22166. "~": true
  22167. };
  22168. if (node.type === "UnaryExpression" && targetUnaryExpressionOperators[node.operator]) {
  22169. return isSimpleCallArgument(node.argument, depth);
  22170. }
  22171. const targetUpdateExpressionOperators = {
  22172. "++": true,
  22173. "--": true
  22174. };
  22175. if (node.type === "UpdateExpression" && targetUpdateExpressionOperators[node.operator]) {
  22176. return isSimpleCallArgument(node.argument, depth);
  22177. }
  22178. if (node.type === "TSNonNullExpression") {
  22179. return isSimpleCallArgument(node.expression, depth);
  22180. }
  22181. return false;
  22182. }
  22183. function rawText(node) {
  22184. var _node$extra$raw, _node$extra2;
  22185. 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;
  22186. }
  22187. function identity(x) {
  22188. return x;
  22189. }
  22190. function isTSXFile(options) {
  22191. return options.filepath && /\.tsx$/i.test(options.filepath);
  22192. }
  22193. function shouldPrintComma(options, level = "es5") {
  22194. return options.trailingComma === "es5" && level === "es5" || options.trailingComma === "all" && (level === "all" || level === "es5");
  22195. }
  22196. function startsWithNoLookaheadToken(node, predicate) {
  22197. switch (node.type) {
  22198. case "BinaryExpression":
  22199. case "LogicalExpression":
  22200. case "AssignmentExpression":
  22201. case "NGPipeExpression":
  22202. return startsWithNoLookaheadToken(node.left, predicate);
  22203. case "MemberExpression":
  22204. case "OptionalMemberExpression":
  22205. return startsWithNoLookaheadToken(node.object, predicate);
  22206. case "TaggedTemplateExpression":
  22207. if (node.tag.type === "FunctionExpression") {
  22208. return false;
  22209. }
  22210. return startsWithNoLookaheadToken(node.tag, predicate);
  22211. case "CallExpression":
  22212. case "OptionalCallExpression":
  22213. if (node.callee.type === "FunctionExpression") {
  22214. return false;
  22215. }
  22216. return startsWithNoLookaheadToken(node.callee, predicate);
  22217. case "ConditionalExpression":
  22218. return startsWithNoLookaheadToken(node.test, predicate);
  22219. case "UpdateExpression":
  22220. return !node.prefix && startsWithNoLookaheadToken(node.argument, predicate);
  22221. case "BindExpression":
  22222. return node.object && startsWithNoLookaheadToken(node.object, predicate);
  22223. case "SequenceExpression":
  22224. return startsWithNoLookaheadToken(node.expressions[0], predicate);
  22225. case "TSSatisfiesExpression":
  22226. case "TSAsExpression":
  22227. case "TSNonNullExpression":
  22228. return startsWithNoLookaheadToken(node.expression, predicate);
  22229. default:
  22230. return predicate(node);
  22231. }
  22232. }
  22233. var equalityOperators = {
  22234. "==": true,
  22235. "!=": true,
  22236. "===": true,
  22237. "!==": true
  22238. };
  22239. var multiplicativeOperators = {
  22240. "*": true,
  22241. "/": true,
  22242. "%": true
  22243. };
  22244. var bitshiftOperators = {
  22245. ">>": true,
  22246. ">>>": true,
  22247. "<<": true
  22248. };
  22249. function shouldFlatten(parentOp, nodeOp) {
  22250. if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
  22251. return false;
  22252. }
  22253. if (parentOp === "**") {
  22254. return false;
  22255. }
  22256. if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
  22257. return false;
  22258. }
  22259. if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
  22260. return false;
  22261. }
  22262. if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
  22263. return false;
  22264. }
  22265. if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
  22266. return false;
  22267. }
  22268. return true;
  22269. }
  22270. var PRECEDENCE = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((operators, index) => operators.map((operator) => [operator, index])));
  22271. function getPrecedence(operator) {
  22272. return PRECEDENCE.get(operator);
  22273. }
  22274. function isBitwiseOperator(operator) {
  22275. return Boolean(bitshiftOperators[operator]) || operator === "|" || operator === "^" || operator === "&";
  22276. }
  22277. function hasRestParameter(node) {
  22278. var _getLast;
  22279. if (node.rest) {
  22280. return true;
  22281. }
  22282. const parameters = getFunctionParameters(node);
  22283. return ((_getLast = getLast(parameters)) === null || _getLast === void 0 ? void 0 : _getLast.type) === "RestElement";
  22284. }
  22285. var functionParametersCache = /* @__PURE__ */ new WeakMap();
  22286. function getFunctionParameters(node) {
  22287. if (functionParametersCache.has(node)) {
  22288. return functionParametersCache.get(node);
  22289. }
  22290. const parameters = [];
  22291. if (node.this) {
  22292. parameters.push(node.this);
  22293. }
  22294. if (Array.isArray(node.parameters)) {
  22295. parameters.push(...node.parameters);
  22296. } else if (Array.isArray(node.params)) {
  22297. parameters.push(...node.params);
  22298. }
  22299. if (node.rest) {
  22300. parameters.push(node.rest);
  22301. }
  22302. functionParametersCache.set(node, parameters);
  22303. return parameters;
  22304. }
  22305. function iterateFunctionParametersPath(path, iteratee) {
  22306. const node = path.getValue();
  22307. let index = 0;
  22308. const callback = (childPath) => iteratee(childPath, index++);
  22309. if (node.this) {
  22310. path.call(callback, "this");
  22311. }
  22312. if (Array.isArray(node.parameters)) {
  22313. path.each(callback, "parameters");
  22314. } else if (Array.isArray(node.params)) {
  22315. path.each(callback, "params");
  22316. }
  22317. if (node.rest) {
  22318. path.call(callback, "rest");
  22319. }
  22320. }
  22321. var callArgumentsCache = /* @__PURE__ */ new WeakMap();
  22322. function getCallArguments(node) {
  22323. if (callArgumentsCache.has(node)) {
  22324. return callArgumentsCache.get(node);
  22325. }
  22326. let args = node.arguments;
  22327. if (node.type === "ImportExpression") {
  22328. args = [node.source];
  22329. if (node.attributes) {
  22330. args.push(node.attributes);
  22331. }
  22332. }
  22333. callArgumentsCache.set(node, args);
  22334. return args;
  22335. }
  22336. function iterateCallArgumentsPath(path, iteratee) {
  22337. const node = path.getValue();
  22338. if (node.type === "ImportExpression") {
  22339. path.call((sourcePath) => iteratee(sourcePath, 0), "source");
  22340. if (node.attributes) {
  22341. path.call((sourcePath) => iteratee(sourcePath, 1), "attributes");
  22342. }
  22343. } else {
  22344. path.each(iteratee, "arguments");
  22345. }
  22346. }
  22347. function isPrettierIgnoreComment(comment) {
  22348. return comment.value.trim() === "prettier-ignore" && !comment.unignore;
  22349. }
  22350. function hasNodeIgnoreComment(node) {
  22351. return node && (node.prettierIgnore || hasComment(node, CommentCheckFlags.PrettierIgnore));
  22352. }
  22353. function hasIgnoreComment(path) {
  22354. const node = path.getValue();
  22355. return hasNodeIgnoreComment(node);
  22356. }
  22357. var CommentCheckFlags = {
  22358. Leading: 1 << 1,
  22359. Trailing: 1 << 2,
  22360. Dangling: 1 << 3,
  22361. Block: 1 << 4,
  22362. Line: 1 << 5,
  22363. PrettierIgnore: 1 << 6,
  22364. First: 1 << 7,
  22365. Last: 1 << 8
  22366. };
  22367. var getCommentTestFunction = (flags, fn) => {
  22368. if (typeof flags === "function") {
  22369. fn = flags;
  22370. flags = 0;
  22371. }
  22372. if (flags || fn) {
  22373. 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));
  22374. }
  22375. };
  22376. function hasComment(node, flags, fn) {
  22377. if (!isNonEmptyArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22378. return false;
  22379. }
  22380. const test = getCommentTestFunction(flags, fn);
  22381. return test ? node.comments.some(test) : true;
  22382. }
  22383. function getComments(node, flags, fn) {
  22384. if (!Array.isArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22385. return [];
  22386. }
  22387. const test = getCommentTestFunction(flags, fn);
  22388. return test ? node.comments.filter(test) : node.comments;
  22389. }
  22390. var isNextLineEmpty = (node, {
  22391. originalText
  22392. }) => isNextLineEmptyAfterIndex(originalText, locEnd(node));
  22393. function isCallLikeExpression(node) {
  22394. return isCallExpression(node) || node.type === "NewExpression" || node.type === "ImportExpression";
  22395. }
  22396. function isObjectProperty(node) {
  22397. return node && (node.type === "ObjectProperty" || node.type === "Property" && !node.method && node.kind === "init");
  22398. }
  22399. function isEnabledHackPipeline(options) {
  22400. return Boolean(options.__isUsingHackPipeline);
  22401. }
  22402. var markerForIfWithoutBlockAndSameLineComment = Symbol("ifWithoutBlockAndSameLineComment");
  22403. function isTSTypeExpression(node) {
  22404. return node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression";
  22405. }
  22406. module2.exports = {
  22407. getFunctionParameters,
  22408. iterateFunctionParametersPath,
  22409. getCallArguments,
  22410. iterateCallArgumentsPath,
  22411. hasRestParameter,
  22412. getLeftSide,
  22413. getLeftSidePathName,
  22414. getParentExportDeclaration,
  22415. getTypeScriptMappedTypeModifier,
  22416. hasFlowAnnotationComment,
  22417. hasFlowShorthandAnnotationComment,
  22418. hasLeadingOwnLineComment,
  22419. hasNakedLeftSide,
  22420. hasNode,
  22421. hasIgnoreComment,
  22422. hasNodeIgnoreComment,
  22423. identity,
  22424. isBinaryish,
  22425. isCallLikeExpression,
  22426. isEnabledHackPipeline,
  22427. isLineComment,
  22428. isPrettierIgnoreComment,
  22429. isCallExpression,
  22430. isMemberExpression,
  22431. isExportDeclaration,
  22432. isFlowAnnotationComment,
  22433. isFunctionCompositionArgs,
  22434. isFunctionNotation,
  22435. isFunctionOrArrowExpression,
  22436. isGetterOrSetter,
  22437. isJestEachTemplateLiteral,
  22438. isJsxNode,
  22439. isLiteral,
  22440. isLongCurriedCallExpression,
  22441. isSimpleCallArgument,
  22442. isMemberish,
  22443. isNumericLiteral,
  22444. isSignedNumericLiteral,
  22445. isObjectProperty,
  22446. isObjectType,
  22447. isObjectTypePropertyAFunction,
  22448. isSimpleType,
  22449. isSimpleNumber,
  22450. isSimpleTemplateLiteral,
  22451. isStringLiteral,
  22452. isStringPropSafeToUnquote,
  22453. isTemplateOnItsOwnLine,
  22454. isTestCall,
  22455. isTheOnlyJsxElementInMarkdown,
  22456. isTSXFile,
  22457. isTypeAnnotationAFunction,
  22458. isNextLineEmpty,
  22459. needsHardlineAfterDanglingComment,
  22460. rawText,
  22461. shouldPrintComma,
  22462. isBitwiseOperator,
  22463. shouldFlatten,
  22464. startsWithNoLookaheadToken,
  22465. getPrecedence,
  22466. hasComment,
  22467. getComments,
  22468. CommentCheckFlags,
  22469. markerForIfWithoutBlockAndSameLineComment,
  22470. isTSTypeExpression
  22471. };
  22472. }
  22473. });
  22474. var require_template_literal = __commonJS2({
  22475. "src/language-js/print/template-literal.js"(exports2, module2) {
  22476. "use strict";
  22477. var getLast = require_get_last();
  22478. var {
  22479. getStringWidth,
  22480. getIndentSize
  22481. } = require_util();
  22482. var {
  22483. builders: {
  22484. join,
  22485. hardline,
  22486. softline,
  22487. group,
  22488. indent,
  22489. align,
  22490. lineSuffixBoundary,
  22491. addAlignmentToDoc
  22492. },
  22493. printer: {
  22494. printDocToString
  22495. },
  22496. utils: {
  22497. mapDoc
  22498. }
  22499. } = require("./doc.js");
  22500. var {
  22501. isBinaryish,
  22502. isJestEachTemplateLiteral,
  22503. isSimpleTemplateLiteral,
  22504. hasComment,
  22505. isMemberExpression,
  22506. isTSTypeExpression
  22507. } = require_utils7();
  22508. function printTemplateLiteral(path, print, options) {
  22509. const node = path.getValue();
  22510. const isTemplateLiteral = node.type === "TemplateLiteral";
  22511. if (isTemplateLiteral && isJestEachTemplateLiteral(node, path.getParentNode())) {
  22512. const printed = printJestEachTemplateLiteral(path, options, print);
  22513. if (printed) {
  22514. return printed;
  22515. }
  22516. }
  22517. let expressionsKey = "expressions";
  22518. if (node.type === "TSTemplateLiteralType") {
  22519. expressionsKey = "types";
  22520. }
  22521. const parts = [];
  22522. let expressions = path.map(print, expressionsKey);
  22523. const isSimple = isSimpleTemplateLiteral(node);
  22524. if (isSimple) {
  22525. expressions = expressions.map((doc2) => printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22526. printWidth: Number.POSITIVE_INFINITY
  22527. })).formatted);
  22528. }
  22529. parts.push(lineSuffixBoundary, "`");
  22530. path.each((childPath) => {
  22531. const i = childPath.getName();
  22532. parts.push(print());
  22533. if (i < expressions.length) {
  22534. const {
  22535. tabWidth
  22536. } = options;
  22537. const quasi = childPath.getValue();
  22538. const indentSize = getIndentSize(quasi.value.raw, tabWidth);
  22539. let printed = expressions[i];
  22540. if (!isSimple) {
  22541. const expression = node[expressionsKey][i];
  22542. if (hasComment(expression) || isMemberExpression(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || isTSTypeExpression(expression) || isBinaryish(expression)) {
  22543. printed = [indent([softline, printed]), softline];
  22544. }
  22545. }
  22546. const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align(Number.NEGATIVE_INFINITY, printed) : addAlignmentToDoc(printed, indentSize, tabWidth);
  22547. parts.push(group(["${", aligned, lineSuffixBoundary, "}"]));
  22548. }
  22549. }, "quasis");
  22550. parts.push("`");
  22551. return parts;
  22552. }
  22553. function printJestEachTemplateLiteral(path, options, print) {
  22554. const node = path.getNode();
  22555. const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
  22556. if (headerNames.length > 1 || headerNames.some((headerName) => headerName.length > 0)) {
  22557. options.__inJestEach = true;
  22558. const expressions = path.map(print, "expressions");
  22559. options.__inJestEach = false;
  22560. const parts = [];
  22561. const stringifiedExpressions = expressions.map((doc2) => "${" + printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22562. printWidth: Number.POSITIVE_INFINITY,
  22563. endOfLine: "lf"
  22564. })).formatted + "}");
  22565. const tableBody = [{
  22566. hasLineBreak: false,
  22567. cells: []
  22568. }];
  22569. for (let i = 1; i < node.quasis.length; i++) {
  22570. const row = getLast(tableBody);
  22571. const correspondingExpression = stringifiedExpressions[i - 1];
  22572. row.cells.push(correspondingExpression);
  22573. if (correspondingExpression.includes("\n")) {
  22574. row.hasLineBreak = true;
  22575. }
  22576. if (node.quasis[i].value.raw.includes("\n")) {
  22577. tableBody.push({
  22578. hasLineBreak: false,
  22579. cells: []
  22580. });
  22581. }
  22582. }
  22583. const maxColumnCount = Math.max(headerNames.length, ...tableBody.map((row) => row.cells.length));
  22584. const maxColumnWidths = Array.from({
  22585. length: maxColumnCount
  22586. }).fill(0);
  22587. const table = [{
  22588. cells: headerNames
  22589. }, ...tableBody.filter((row) => row.cells.length > 0)];
  22590. for (const {
  22591. cells
  22592. } of table.filter((row) => !row.hasLineBreak)) {
  22593. for (const [index, cell] of cells.entries()) {
  22594. maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth(cell));
  22595. }
  22596. }
  22597. 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, "`");
  22598. return parts;
  22599. }
  22600. }
  22601. function printTemplateExpression(path, print) {
  22602. const node = path.getValue();
  22603. let printed = print();
  22604. if (hasComment(node)) {
  22605. printed = group([indent([softline, printed]), softline]);
  22606. }
  22607. return ["${", printed, lineSuffixBoundary, "}"];
  22608. }
  22609. function printTemplateExpressions(path, print) {
  22610. return path.map((path2) => printTemplateExpression(path2, print), "expressions");
  22611. }
  22612. function escapeTemplateCharacters(doc2, raw) {
  22613. return mapDoc(doc2, (currentDoc) => {
  22614. if (typeof currentDoc === "string") {
  22615. return raw ? currentDoc.replace(/(\\*)`/g, "$1$1\\`") : uncookTemplateElementValue(currentDoc);
  22616. }
  22617. return currentDoc;
  22618. });
  22619. }
  22620. function uncookTemplateElementValue(cookedValue) {
  22621. return cookedValue.replace(/([\\`]|\${)/g, "\\$1");
  22622. }
  22623. module2.exports = {
  22624. printTemplateLiteral,
  22625. printTemplateExpressions,
  22626. escapeTemplateCharacters,
  22627. uncookTemplateElementValue
  22628. };
  22629. }
  22630. });
  22631. var require_markdown = __commonJS2({
  22632. "src/language-js/embed/markdown.js"(exports2, module2) {
  22633. "use strict";
  22634. var {
  22635. builders: {
  22636. indent,
  22637. softline,
  22638. literalline,
  22639. dedentToRoot
  22640. }
  22641. } = require("./doc.js");
  22642. var {
  22643. escapeTemplateCharacters
  22644. } = require_template_literal();
  22645. function format(path, print, textToDoc) {
  22646. const node = path.getValue();
  22647. let text = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
  22648. const indentation = getIndentation(text);
  22649. const hasIndent = indentation !== "";
  22650. if (hasIndent) {
  22651. text = text.replace(new RegExp(`^${indentation}`, "gm"), "");
  22652. }
  22653. const doc2 = escapeTemplateCharacters(textToDoc(text, {
  22654. parser: "markdown",
  22655. __inJsTemplate: true
  22656. }, {
  22657. stripTrailingHardline: true
  22658. }), true);
  22659. return ["`", hasIndent ? indent([softline, doc2]) : [literalline, dedentToRoot(doc2)], softline, "`"];
  22660. }
  22661. function getIndentation(str) {
  22662. const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
  22663. return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
  22664. }
  22665. module2.exports = format;
  22666. }
  22667. });
  22668. var require_css = __commonJS2({
  22669. "src/language-js/embed/css.js"(exports2, module2) {
  22670. "use strict";
  22671. var {
  22672. isNonEmptyArray
  22673. } = require_util();
  22674. var {
  22675. builders: {
  22676. indent,
  22677. hardline,
  22678. softline
  22679. },
  22680. utils: {
  22681. mapDoc,
  22682. replaceEndOfLine,
  22683. cleanDoc
  22684. }
  22685. } = require("./doc.js");
  22686. var {
  22687. printTemplateExpressions
  22688. } = require_template_literal();
  22689. function format(path, print, textToDoc) {
  22690. const node = path.getValue();
  22691. const rawQuasis = node.quasis.map((q) => q.value.raw);
  22692. let placeholderID = 0;
  22693. const text = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
  22694. const doc2 = textToDoc(text, {
  22695. parser: "scss"
  22696. }, {
  22697. stripTrailingHardline: true
  22698. });
  22699. const expressionDocs = printTemplateExpressions(path, print);
  22700. return transformCssDoc(doc2, node, expressionDocs);
  22701. }
  22702. function transformCssDoc(quasisDoc, parentNode, expressionDocs) {
  22703. const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
  22704. if (isEmpty) {
  22705. return "``";
  22706. }
  22707. const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
  22708. if (!newDoc) {
  22709. throw new Error("Couldn't insert all the expressions");
  22710. }
  22711. return ["`", indent([hardline, newDoc]), softline, "`"];
  22712. }
  22713. function replacePlaceholders(quasisDoc, expressionDocs) {
  22714. if (!isNonEmptyArray(expressionDocs)) {
  22715. return quasisDoc;
  22716. }
  22717. let replaceCounter = 0;
  22718. const newDoc = mapDoc(cleanDoc(quasisDoc), (doc2) => {
  22719. if (typeof doc2 !== "string" || !doc2.includes("@prettier-placeholder")) {
  22720. return doc2;
  22721. }
  22722. return doc2.split(/@prettier-placeholder-(\d+)-id/).map((component, idx) => {
  22723. if (idx % 2 === 0) {
  22724. return replaceEndOfLine(component);
  22725. }
  22726. replaceCounter++;
  22727. return expressionDocs[component];
  22728. });
  22729. });
  22730. return expressionDocs.length === replaceCounter ? newDoc : null;
  22731. }
  22732. module2.exports = format;
  22733. }
  22734. });
  22735. var require_graphql = __commonJS2({
  22736. "src/language-js/embed/graphql.js"(exports2, module2) {
  22737. "use strict";
  22738. var {
  22739. builders: {
  22740. indent,
  22741. join,
  22742. hardline
  22743. }
  22744. } = require("./doc.js");
  22745. var {
  22746. escapeTemplateCharacters,
  22747. printTemplateExpressions
  22748. } = require_template_literal();
  22749. function format(path, print, textToDoc) {
  22750. const node = path.getValue();
  22751. const numQuasis = node.quasis.length;
  22752. if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
  22753. return "``";
  22754. }
  22755. const expressionDocs = printTemplateExpressions(path, print);
  22756. const parts = [];
  22757. for (let i = 0; i < numQuasis; i++) {
  22758. const templateElement = node.quasis[i];
  22759. const isFirst = i === 0;
  22760. const isLast = i === numQuasis - 1;
  22761. const text = templateElement.value.cooked;
  22762. const lines = text.split("\n");
  22763. const numLines = lines.length;
  22764. const expressionDoc = expressionDocs[i];
  22765. const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
  22766. const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
  22767. const commentsAndWhitespaceOnly = lines.every((line) => /^\s*(?:#[^\n\r]*)?$/.test(line));
  22768. if (!isLast && /#[^\n\r]*$/.test(lines[numLines - 1])) {
  22769. return null;
  22770. }
  22771. let doc2 = null;
  22772. if (commentsAndWhitespaceOnly) {
  22773. doc2 = printGraphqlComments(lines);
  22774. } else {
  22775. doc2 = textToDoc(text, {
  22776. parser: "graphql"
  22777. }, {
  22778. stripTrailingHardline: true
  22779. });
  22780. }
  22781. if (doc2) {
  22782. doc2 = escapeTemplateCharacters(doc2, false);
  22783. if (!isFirst && startsWithBlankLine) {
  22784. parts.push("");
  22785. }
  22786. parts.push(doc2);
  22787. if (!isLast && endsWithBlankLine) {
  22788. parts.push("");
  22789. }
  22790. } else if (!isFirst && !isLast && startsWithBlankLine) {
  22791. parts.push("");
  22792. }
  22793. if (expressionDoc) {
  22794. parts.push(expressionDoc);
  22795. }
  22796. }
  22797. return ["`", indent([hardline, join(hardline, parts)]), hardline, "`"];
  22798. }
  22799. function printGraphqlComments(lines) {
  22800. const parts = [];
  22801. let seenComment = false;
  22802. const array = lines.map((textLine) => textLine.trim());
  22803. for (const [i, textLine] of array.entries()) {
  22804. if (textLine === "") {
  22805. continue;
  22806. }
  22807. if (array[i - 1] === "" && seenComment) {
  22808. parts.push([hardline, textLine]);
  22809. } else {
  22810. parts.push(textLine);
  22811. }
  22812. seenComment = true;
  22813. }
  22814. return parts.length === 0 ? null : join(hardline, parts);
  22815. }
  22816. module2.exports = format;
  22817. }
  22818. });
  22819. var require_html = __commonJS2({
  22820. "src/language-js/embed/html.js"(exports2, module2) {
  22821. "use strict";
  22822. var {
  22823. builders: {
  22824. indent,
  22825. line,
  22826. hardline,
  22827. group
  22828. },
  22829. utils: {
  22830. mapDoc
  22831. }
  22832. } = require("./doc.js");
  22833. var {
  22834. printTemplateExpressions,
  22835. uncookTemplateElementValue
  22836. } = require_template_literal();
  22837. var htmlTemplateLiteralCounter = 0;
  22838. function format(path, print, textToDoc, options, {
  22839. parser
  22840. }) {
  22841. const node = path.getValue();
  22842. const counter = htmlTemplateLiteralCounter;
  22843. htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
  22844. const composePlaceholder = (index) => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
  22845. const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
  22846. const expressionDocs = printTemplateExpressions(path, print);
  22847. if (expressionDocs.length === 0 && text.trim().length === 0) {
  22848. return "``";
  22849. }
  22850. const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
  22851. let topLevelCount = 0;
  22852. const doc2 = textToDoc(text, {
  22853. parser,
  22854. __onHtmlRoot(root) {
  22855. topLevelCount = root.children.length;
  22856. }
  22857. }, {
  22858. stripTrailingHardline: true
  22859. });
  22860. const contentDoc = mapDoc(doc2, (doc3) => {
  22861. if (typeof doc3 !== "string") {
  22862. return doc3;
  22863. }
  22864. const parts = [];
  22865. const components = doc3.split(placeholderRegex);
  22866. for (let i = 0; i < components.length; i++) {
  22867. let component = components[i];
  22868. if (i % 2 === 0) {
  22869. if (component) {
  22870. component = uncookTemplateElementValue(component);
  22871. if (options.__embeddedInHtml) {
  22872. component = component.replace(/<\/(script)\b/gi, "<\\/$1");
  22873. }
  22874. parts.push(component);
  22875. }
  22876. continue;
  22877. }
  22878. const placeholderIndex = Number(component);
  22879. parts.push(expressionDocs[placeholderIndex]);
  22880. }
  22881. return parts;
  22882. });
  22883. const leadingWhitespace = /^\s/.test(text) ? " " : "";
  22884. const trailingWhitespace = /\s$/.test(text) ? " " : "";
  22885. const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline : leadingWhitespace && trailingWhitespace ? line : null;
  22886. if (linebreak) {
  22887. return group(["`", indent([linebreak, group(contentDoc)]), linebreak, "`"]);
  22888. }
  22889. return group(["`", leadingWhitespace, topLevelCount > 1 ? indent(group(contentDoc)) : group(contentDoc), trailingWhitespace, "`"]);
  22890. }
  22891. module2.exports = format;
  22892. }
  22893. });
  22894. var require_embed = __commonJS2({
  22895. "src/language-js/embed.js"(exports2, module2) {
  22896. "use strict";
  22897. var {
  22898. hasComment,
  22899. CommentCheckFlags,
  22900. isObjectProperty
  22901. } = require_utils7();
  22902. var formatMarkdown = require_markdown();
  22903. var formatCss = require_css();
  22904. var formatGraphql = require_graphql();
  22905. var formatHtml = require_html();
  22906. function getLanguage(path) {
  22907. if (isStyledJsx(path) || isStyledComponents(path) || isCssProp(path) || isAngularComponentStyles(path)) {
  22908. return "css";
  22909. }
  22910. if (isGraphQL(path)) {
  22911. return "graphql";
  22912. }
  22913. if (isHtml(path)) {
  22914. return "html";
  22915. }
  22916. if (isAngularComponentTemplate(path)) {
  22917. return "angular";
  22918. }
  22919. if (isMarkdown(path)) {
  22920. return "markdown";
  22921. }
  22922. }
  22923. function embed(path, print, textToDoc, options) {
  22924. const node = path.getValue();
  22925. if (node.type !== "TemplateLiteral" || hasInvalidCookedValue(node)) {
  22926. return;
  22927. }
  22928. const language = getLanguage(path);
  22929. if (!language) {
  22930. return;
  22931. }
  22932. if (language === "markdown") {
  22933. return formatMarkdown(path, print, textToDoc);
  22934. }
  22935. if (language === "css") {
  22936. return formatCss(path, print, textToDoc);
  22937. }
  22938. if (language === "graphql") {
  22939. return formatGraphql(path, print, textToDoc);
  22940. }
  22941. if (language === "html" || language === "angular") {
  22942. return formatHtml(path, print, textToDoc, options, {
  22943. parser: language
  22944. });
  22945. }
  22946. }
  22947. function isMarkdown(path) {
  22948. const node = path.getValue();
  22949. const parent = path.getParentNode();
  22950. return parent && parent.type === "TaggedTemplateExpression" && node.quasis.length === 1 && parent.tag.type === "Identifier" && (parent.tag.name === "md" || parent.tag.name === "markdown");
  22951. }
  22952. function isStyledJsx(path) {
  22953. const node = path.getValue();
  22954. const parent = path.getParentNode();
  22955. const parentParent = path.getParentNode(1);
  22956. 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");
  22957. }
  22958. function isAngularComponentStyles(path) {
  22959. 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);
  22960. }
  22961. function isAngularComponentTemplate(path) {
  22962. return path.match((node) => node.type === "TemplateLiteral", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
  22963. }
  22964. 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"];
  22965. function isStyledComponents(path) {
  22966. const parent = path.getParentNode();
  22967. if (!parent || parent.type !== "TaggedTemplateExpression") {
  22968. return false;
  22969. }
  22970. const tag = parent.tag.type === "ParenthesizedExpression" ? parent.tag.expression : parent.tag;
  22971. switch (tag.type) {
  22972. case "MemberExpression":
  22973. return isStyledIdentifier(tag.object) || isStyledExtend(tag);
  22974. case "CallExpression":
  22975. 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));
  22976. case "Identifier":
  22977. return tag.name === "css";
  22978. default:
  22979. return false;
  22980. }
  22981. }
  22982. function isCssProp(path) {
  22983. const parent = path.getParentNode();
  22984. const parentParent = path.getParentNode(1);
  22985. return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
  22986. }
  22987. function isStyledIdentifier(node) {
  22988. return node.type === "Identifier" && node.name === "styled";
  22989. }
  22990. function isStyledExtend(node) {
  22991. return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
  22992. }
  22993. function isGraphQL(path) {
  22994. const node = path.getValue();
  22995. const parent = path.getParentNode();
  22996. 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");
  22997. }
  22998. function hasLanguageComment(node, languageName) {
  22999. return hasComment(node, CommentCheckFlags.Block | CommentCheckFlags.Leading, ({
  23000. value
  23001. }) => value === ` ${languageName} `);
  23002. }
  23003. function isHtml(path) {
  23004. 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");
  23005. }
  23006. function hasInvalidCookedValue({
  23007. quasis
  23008. }) {
  23009. return quasis.some(({
  23010. value: {
  23011. cooked
  23012. }
  23013. }) => cooked === null);
  23014. }
  23015. module2.exports = embed;
  23016. }
  23017. });
  23018. var require_clean = __commonJS2({
  23019. "src/language-js/clean.js"(exports2, module2) {
  23020. "use strict";
  23021. var isBlockComment = require_is_block_comment();
  23022. var ignoredProperties = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
  23023. var removeTemplateElementsValue = (node) => {
  23024. for (const templateElement of node.quasis) {
  23025. delete templateElement.value;
  23026. }
  23027. };
  23028. function clean(ast, newObj, parent) {
  23029. if (ast.type === "Program") {
  23030. delete newObj.sourceType;
  23031. }
  23032. if (ast.type === "BigIntLiteral" || ast.type === "BigIntLiteralTypeAnnotation") {
  23033. if (newObj.value) {
  23034. newObj.value = newObj.value.toLowerCase();
  23035. }
  23036. }
  23037. if (ast.type === "BigIntLiteral" || ast.type === "Literal") {
  23038. if (newObj.bigint) {
  23039. newObj.bigint = newObj.bigint.toLowerCase();
  23040. }
  23041. }
  23042. if (ast.type === "DecimalLiteral") {
  23043. newObj.value = Number(newObj.value);
  23044. }
  23045. if (ast.type === "Literal" && newObj.decimal) {
  23046. newObj.decimal = Number(newObj.decimal);
  23047. }
  23048. if (ast.type === "EmptyStatement") {
  23049. return null;
  23050. }
  23051. if (ast.type === "JSXText") {
  23052. return null;
  23053. }
  23054. if (ast.type === "JSXExpressionContainer" && (ast.expression.type === "Literal" || ast.expression.type === "StringLiteral") && ast.expression.value === " ") {
  23055. return null;
  23056. }
  23057. 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")) {
  23058. delete newObj.key;
  23059. }
  23060. if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some((attr) => attr.name.name === "jsx")) {
  23061. for (const {
  23062. type,
  23063. expression: expression2
  23064. } of newObj.children) {
  23065. if (type === "JSXExpressionContainer" && expression2.type === "TemplateLiteral") {
  23066. removeTemplateElementsValue(expression2);
  23067. }
  23068. }
  23069. }
  23070. if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
  23071. removeTemplateElementsValue(newObj.value.expression);
  23072. }
  23073. if (ast.type === "JSXAttribute" && ast.value && ast.value.type === "Literal" && /["']|&quot;|&apos;/.test(ast.value.value)) {
  23074. newObj.value.value = newObj.value.value.replace(/["']|&quot;|&apos;/g, '"');
  23075. }
  23076. const expression = ast.expression || ast.callee;
  23077. if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
  23078. const astProps = ast.expression.arguments[0].properties;
  23079. for (const [index, prop] of newObj.expression.arguments[0].properties.entries()) {
  23080. switch (astProps[index].key.name) {
  23081. case "styles":
  23082. if (prop.value.type === "ArrayExpression") {
  23083. removeTemplateElementsValue(prop.value.elements[0]);
  23084. }
  23085. break;
  23086. case "template":
  23087. if (prop.value.type === "TemplateLiteral") {
  23088. removeTemplateElementsValue(prop.value);
  23089. }
  23090. break;
  23091. }
  23092. }
  23093. }
  23094. 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")) {
  23095. removeTemplateElementsValue(newObj.quasi);
  23096. }
  23097. if (ast.type === "TemplateLiteral") {
  23098. var _ast$leadingComments;
  23099. 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} `));
  23100. if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql" || !ast.leadingComments) {
  23101. removeTemplateElementsValue(newObj);
  23102. }
  23103. }
  23104. if (ast.type === "InterpreterDirective") {
  23105. newObj.value = newObj.value.trimEnd();
  23106. }
  23107. if ((ast.type === "TSIntersectionType" || ast.type === "TSUnionType") && ast.types.length === 1) {
  23108. return newObj.types[0];
  23109. }
  23110. }
  23111. clean.ignoredProperties = ignoredProperties;
  23112. module2.exports = clean;
  23113. }
  23114. });
  23115. var require_detect_newline = __commonJS2({
  23116. "node_modules/detect-newline/index.js"(exports2, module2) {
  23117. "use strict";
  23118. var detectNewline = (string) => {
  23119. if (typeof string !== "string") {
  23120. throw new TypeError("Expected a string");
  23121. }
  23122. const newlines = string.match(/(?:\r?\n)/g) || [];
  23123. if (newlines.length === 0) {
  23124. return;
  23125. }
  23126. const crlf = newlines.filter((newline) => newline === "\r\n").length;
  23127. const lf = newlines.length - crlf;
  23128. return crlf > lf ? "\r\n" : "\n";
  23129. };
  23130. module2.exports = detectNewline;
  23131. module2.exports.graceful = (string) => typeof string === "string" && detectNewline(string) || "\n";
  23132. }
  23133. });
  23134. var require_build = __commonJS2({
  23135. "node_modules/jest-docblock/build/index.js"(exports2) {
  23136. "use strict";
  23137. Object.defineProperty(exports2, "__esModule", {
  23138. value: true
  23139. });
  23140. exports2.extract = extract;
  23141. exports2.parse = parse;
  23142. exports2.parseWithComments = parseWithComments;
  23143. exports2.print = print;
  23144. exports2.strip = strip;
  23145. function _os() {
  23146. const data = require("os");
  23147. _os = function() {
  23148. return data;
  23149. };
  23150. return data;
  23151. }
  23152. function _detectNewline() {
  23153. const data = _interopRequireDefault(require_detect_newline());
  23154. _detectNewline = function() {
  23155. return data;
  23156. };
  23157. return data;
  23158. }
  23159. function _interopRequireDefault(obj) {
  23160. return obj && obj.__esModule ? obj : {
  23161. default: obj
  23162. };
  23163. }
  23164. var commentEndRe = /\*\/$/;
  23165. var commentStartRe = /^\/\*\*?/;
  23166. var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
  23167. var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
  23168. var ltrimNewlineRe = /^(\r?\n)+/;
  23169. var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
  23170. var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
  23171. var stringStartRe = /(\r?\n|^) *\* ?/g;
  23172. var STRING_ARRAY = [];
  23173. function extract(contents) {
  23174. const match = contents.match(docblockRe);
  23175. return match ? match[0].trimLeft() : "";
  23176. }
  23177. function strip(contents) {
  23178. const match = contents.match(docblockRe);
  23179. return match && match[0] ? contents.substring(match[0].length) : contents;
  23180. }
  23181. function parse(docblock) {
  23182. return parseWithComments(docblock).pragmas;
  23183. }
  23184. function parseWithComments(docblock) {
  23185. const line = (0, _detectNewline().default)(docblock) || _os().EOL;
  23186. docblock = docblock.replace(commentStartRe, "").replace(commentEndRe, "").replace(stringStartRe, "$1");
  23187. let prev = "";
  23188. while (prev !== docblock) {
  23189. prev = docblock;
  23190. docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`);
  23191. }
  23192. docblock = docblock.replace(ltrimNewlineRe, "").trimRight();
  23193. const result = /* @__PURE__ */ Object.create(null);
  23194. const comments = docblock.replace(propertyRe, "").replace(ltrimNewlineRe, "").trimRight();
  23195. let match;
  23196. while (match = propertyRe.exec(docblock)) {
  23197. const nextPragma = match[2].replace(lineCommentRe, "");
  23198. if (typeof result[match[1]] === "string" || Array.isArray(result[match[1]])) {
  23199. result[match[1]] = STRING_ARRAY.concat(result[match[1]], nextPragma);
  23200. } else {
  23201. result[match[1]] = nextPragma;
  23202. }
  23203. }
  23204. return {
  23205. comments,
  23206. pragmas: result
  23207. };
  23208. }
  23209. function print({
  23210. comments = "",
  23211. pragmas = {}
  23212. }) {
  23213. const line = (0, _detectNewline().default)(comments) || _os().EOL;
  23214. const head = "/**";
  23215. const start = " *";
  23216. const tail = " */";
  23217. const keys = Object.keys(pragmas);
  23218. const printedObject = keys.map((key) => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map((keyValue) => `${start} ${keyValue}${line}`).join("");
  23219. if (!comments) {
  23220. if (keys.length === 0) {
  23221. return "";
  23222. }
  23223. if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
  23224. const value = pragmas[keys[0]];
  23225. return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`;
  23226. }
  23227. }
  23228. const printedComments = comments.split(line).map((textLine) => `${start} ${textLine}`).join(line) + line;
  23229. return head + line + (comments ? printedComments : "") + (comments && keys.length ? start + line : "") + printedObject + tail;
  23230. }
  23231. function printKeyValues(key, valueOrArray) {
  23232. return STRING_ARRAY.concat(valueOrArray).map((value) => `@${key} ${value}`.trim());
  23233. }
  23234. }
  23235. });
  23236. var require_get_shebang = __commonJS2({
  23237. "src/language-js/utils/get-shebang.js"(exports2, module2) {
  23238. "use strict";
  23239. function getShebang(text) {
  23240. if (!text.startsWith("#!")) {
  23241. return "";
  23242. }
  23243. const index = text.indexOf("\n");
  23244. if (index === -1) {
  23245. return text;
  23246. }
  23247. return text.slice(0, index);
  23248. }
  23249. module2.exports = getShebang;
  23250. }
  23251. });
  23252. var require_pragma = __commonJS2({
  23253. "src/language-js/pragma.js"(exports2, module2) {
  23254. "use strict";
  23255. var {
  23256. parseWithComments,
  23257. strip,
  23258. extract,
  23259. print
  23260. } = require_build();
  23261. var {
  23262. normalizeEndOfLine
  23263. } = require_end_of_line();
  23264. var getShebang = require_get_shebang();
  23265. function parseDocBlock(text) {
  23266. const shebang = getShebang(text);
  23267. if (shebang) {
  23268. text = text.slice(shebang.length + 1);
  23269. }
  23270. const docBlock = extract(text);
  23271. const {
  23272. pragmas,
  23273. comments
  23274. } = parseWithComments(docBlock);
  23275. return {
  23276. shebang,
  23277. text,
  23278. pragmas,
  23279. comments
  23280. };
  23281. }
  23282. function hasPragma(text) {
  23283. const pragmas = Object.keys(parseDocBlock(text).pragmas);
  23284. return pragmas.includes("prettier") || pragmas.includes("format");
  23285. }
  23286. function insertPragma(originalText) {
  23287. const {
  23288. shebang,
  23289. text,
  23290. pragmas,
  23291. comments
  23292. } = parseDocBlock(originalText);
  23293. const strippedText = strip(text);
  23294. const docBlock = print({
  23295. pragmas: Object.assign({
  23296. format: ""
  23297. }, pragmas),
  23298. comments: comments.trimStart()
  23299. });
  23300. return (shebang ? `${shebang}
  23301. ` : "") + normalizeEndOfLine(docBlock) + (strippedText.startsWith("\n") ? "\n" : "\n\n") + strippedText;
  23302. }
  23303. module2.exports = {
  23304. hasPragma,
  23305. insertPragma
  23306. };
  23307. }
  23308. });
  23309. var require_is_type_cast_comment = __commonJS2({
  23310. "src/language-js/utils/is-type-cast-comment.js"(exports2, module2) {
  23311. "use strict";
  23312. var isBlockComment = require_is_block_comment();
  23313. function isTypeCastComment(comment) {
  23314. return isBlockComment(comment) && comment.value[0] === "*" && /@(?:type|satisfies)\b/.test(comment.value);
  23315. }
  23316. module2.exports = isTypeCastComment;
  23317. }
  23318. });
  23319. var require_comments2 = __commonJS2({
  23320. "src/language-js/comments.js"(exports2, module2) {
  23321. "use strict";
  23322. var {
  23323. getLast,
  23324. hasNewline,
  23325. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  23326. getNextNonSpaceNonCommentCharacter,
  23327. hasNewlineInRange,
  23328. addLeadingComment,
  23329. addTrailingComment,
  23330. addDanglingComment,
  23331. getNextNonSpaceNonCommentCharacterIndex,
  23332. isNonEmptyArray
  23333. } = require_util();
  23334. var {
  23335. getFunctionParameters,
  23336. isPrettierIgnoreComment,
  23337. isJsxNode,
  23338. hasFlowShorthandAnnotationComment,
  23339. hasFlowAnnotationComment,
  23340. hasIgnoreComment,
  23341. isCallLikeExpression,
  23342. getCallArguments,
  23343. isCallExpression,
  23344. isMemberExpression,
  23345. isObjectProperty,
  23346. isLineComment,
  23347. getComments,
  23348. CommentCheckFlags,
  23349. markerForIfWithoutBlockAndSameLineComment
  23350. } = require_utils7();
  23351. var {
  23352. locStart,
  23353. locEnd
  23354. } = require_loc();
  23355. var isBlockComment = require_is_block_comment();
  23356. var isTypeCastComment = require_is_type_cast_comment();
  23357. function handleOwnLineComment(context) {
  23358. return [handleIgnoreComments, handleLastFunctionArgComments, handleMemberExpressionComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleForComments, handleUnionTypeComments, handleOnlyComments, handleModuleSpecifiersComments, handleAssignmentPatternComments, handleMethodNameComments, handleLabeledStatementComments, handleBreakAndContinueStatementComments].some((fn) => fn(context));
  23359. }
  23360. function handleEndOfLineComment(context) {
  23361. return [handleClosureTypeCastComments, handleLastFunctionArgComments, handleConditionalExpressionComments, handleModuleSpecifiersComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, handleOnlyComments, handleVariableDeclaratorComments, handleBreakAndContinueStatementComments, handleSwitchDefaultCaseComments].some((fn) => fn(context));
  23362. }
  23363. function handleRemainingComment(context) {
  23364. return [handleIgnoreComments, handleIfStatementComments, handleWhileComments, handleObjectPropertyAssignment, handleCommentInEmptyParens, handleMethodNameComments, handleOnlyComments, handleCommentAfterArrowParams, handleFunctionNameComments, handleTSMappedTypeComments, handleBreakAndContinueStatementComments, handleTSFunctionTrailingComments].some((fn) => fn(context));
  23365. }
  23366. function addBlockStatementFirstComment(node, comment) {
  23367. const firstNonEmptyNode = (node.body || node.properties).find(({
  23368. type
  23369. }) => type !== "EmptyStatement");
  23370. if (firstNonEmptyNode) {
  23371. addLeadingComment(firstNonEmptyNode, comment);
  23372. } else {
  23373. addDanglingComment(node, comment);
  23374. }
  23375. }
  23376. function addBlockOrNotComment(node, comment) {
  23377. if (node.type === "BlockStatement") {
  23378. addBlockStatementFirstComment(node, comment);
  23379. } else {
  23380. addLeadingComment(node, comment);
  23381. }
  23382. }
  23383. function handleClosureTypeCastComments({
  23384. comment,
  23385. followingNode
  23386. }) {
  23387. if (followingNode && isTypeCastComment(comment)) {
  23388. addLeadingComment(followingNode, comment);
  23389. return true;
  23390. }
  23391. return false;
  23392. }
  23393. function handleIfStatementComments({
  23394. comment,
  23395. precedingNode,
  23396. enclosingNode,
  23397. followingNode,
  23398. text
  23399. }) {
  23400. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "IfStatement" || !followingNode) {
  23401. return false;
  23402. }
  23403. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23404. if (nextCharacter === ")") {
  23405. addTrailingComment(precedingNode, comment);
  23406. return true;
  23407. }
  23408. if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
  23409. if (precedingNode.type === "BlockStatement") {
  23410. addTrailingComment(precedingNode, comment);
  23411. } else {
  23412. const isSingleLineComment = comment.type === "SingleLine" || comment.loc.start.line === comment.loc.end.line;
  23413. const isSameLineComment = comment.loc.start.line === precedingNode.loc.start.line;
  23414. if (isSingleLineComment && isSameLineComment) {
  23415. addDanglingComment(precedingNode, comment, markerForIfWithoutBlockAndSameLineComment);
  23416. } else {
  23417. addDanglingComment(enclosingNode, comment);
  23418. }
  23419. }
  23420. return true;
  23421. }
  23422. if (followingNode.type === "BlockStatement") {
  23423. addBlockStatementFirstComment(followingNode, comment);
  23424. return true;
  23425. }
  23426. if (followingNode.type === "IfStatement") {
  23427. addBlockOrNotComment(followingNode.consequent, comment);
  23428. return true;
  23429. }
  23430. if (enclosingNode.consequent === followingNode) {
  23431. addLeadingComment(followingNode, comment);
  23432. return true;
  23433. }
  23434. return false;
  23435. }
  23436. function handleWhileComments({
  23437. comment,
  23438. precedingNode,
  23439. enclosingNode,
  23440. followingNode,
  23441. text
  23442. }) {
  23443. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "WhileStatement" || !followingNode) {
  23444. return false;
  23445. }
  23446. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23447. if (nextCharacter === ")") {
  23448. addTrailingComment(precedingNode, comment);
  23449. return true;
  23450. }
  23451. if (followingNode.type === "BlockStatement") {
  23452. addBlockStatementFirstComment(followingNode, comment);
  23453. return true;
  23454. }
  23455. if (enclosingNode.body === followingNode) {
  23456. addLeadingComment(followingNode, comment);
  23457. return true;
  23458. }
  23459. return false;
  23460. }
  23461. function handleTryStatementComments({
  23462. comment,
  23463. precedingNode,
  23464. enclosingNode,
  23465. followingNode
  23466. }) {
  23467. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TryStatement" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "CatchClause" || !followingNode) {
  23468. return false;
  23469. }
  23470. if (enclosingNode.type === "CatchClause" && precedingNode) {
  23471. addTrailingComment(precedingNode, comment);
  23472. return true;
  23473. }
  23474. if (followingNode.type === "BlockStatement") {
  23475. addBlockStatementFirstComment(followingNode, comment);
  23476. return true;
  23477. }
  23478. if (followingNode.type === "TryStatement") {
  23479. addBlockOrNotComment(followingNode.finalizer, comment);
  23480. return true;
  23481. }
  23482. if (followingNode.type === "CatchClause") {
  23483. addBlockOrNotComment(followingNode.body, comment);
  23484. return true;
  23485. }
  23486. return false;
  23487. }
  23488. function handleMemberExpressionComments({
  23489. comment,
  23490. enclosingNode,
  23491. followingNode
  23492. }) {
  23493. if (isMemberExpression(enclosingNode) && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Identifier") {
  23494. addLeadingComment(enclosingNode, comment);
  23495. return true;
  23496. }
  23497. return false;
  23498. }
  23499. function handleConditionalExpressionComments({
  23500. comment,
  23501. precedingNode,
  23502. enclosingNode,
  23503. followingNode,
  23504. text
  23505. }) {
  23506. const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment));
  23507. if ((!precedingNode || !isSameLineAsPrecedingNode) && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ConditionalExpression" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSConditionalType") && followingNode) {
  23508. addLeadingComment(followingNode, comment);
  23509. return true;
  23510. }
  23511. return false;
  23512. }
  23513. function handleObjectPropertyAssignment({
  23514. comment,
  23515. precedingNode,
  23516. enclosingNode
  23517. }) {
  23518. if (isObjectProperty(enclosingNode) && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
  23519. addTrailingComment(enclosingNode.value.left, comment);
  23520. return true;
  23521. }
  23522. return false;
  23523. }
  23524. var classLikeNodeTypes = /* @__PURE__ */ new Set(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
  23525. function handleClassComments({
  23526. comment,
  23527. precedingNode,
  23528. enclosingNode,
  23529. followingNode
  23530. }) {
  23531. if (classLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23532. if (isNonEmptyArray(enclosingNode.decorators) && !(followingNode && followingNode.type === "Decorator")) {
  23533. addTrailingComment(getLast(enclosingNode.decorators), comment);
  23534. return true;
  23535. }
  23536. if (enclosingNode.body && followingNode === enclosingNode.body) {
  23537. addBlockStatementFirstComment(enclosingNode.body, comment);
  23538. return true;
  23539. }
  23540. if (followingNode) {
  23541. if (enclosingNode.superClass && followingNode === enclosingNode.superClass && precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters)) {
  23542. addTrailingComment(precedingNode, comment);
  23543. return true;
  23544. }
  23545. for (const prop of ["implements", "extends", "mixins"]) {
  23546. if (enclosingNode[prop] && followingNode === enclosingNode[prop][0]) {
  23547. if (precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters || precedingNode === enclosingNode.superClass)) {
  23548. addTrailingComment(precedingNode, comment);
  23549. } else {
  23550. addDanglingComment(enclosingNode, comment, prop);
  23551. }
  23552. return true;
  23553. }
  23554. }
  23555. }
  23556. }
  23557. return false;
  23558. }
  23559. var propertyLikeNodeTypes = /* @__PURE__ */ new Set(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition", "ClassAccessorProperty", "AccessorProperty", "TSAbstractAccessorProperty"]);
  23560. function handleMethodNameComments({
  23561. comment,
  23562. precedingNode,
  23563. enclosingNode,
  23564. text
  23565. }) {
  23566. 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) !== ":") {
  23567. addTrailingComment(precedingNode, comment);
  23568. return true;
  23569. }
  23570. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Decorator" && propertyLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23571. addTrailingComment(precedingNode, comment);
  23572. return true;
  23573. }
  23574. return false;
  23575. }
  23576. var functionLikeNodeTypes = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
  23577. function handleFunctionNameComments({
  23578. comment,
  23579. precedingNode,
  23580. enclosingNode,
  23581. text
  23582. }) {
  23583. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== "(") {
  23584. return false;
  23585. }
  23586. if (precedingNode && functionLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23587. addTrailingComment(precedingNode, comment);
  23588. return true;
  23589. }
  23590. return false;
  23591. }
  23592. function handleCommentAfterArrowParams({
  23593. comment,
  23594. enclosingNode,
  23595. text
  23596. }) {
  23597. if (!((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ArrowFunctionExpression")) {
  23598. return false;
  23599. }
  23600. const index = getNextNonSpaceNonCommentCharacterIndex(text, comment, locEnd);
  23601. if (index !== false && text.slice(index, index + 2) === "=>") {
  23602. addDanglingComment(enclosingNode, comment);
  23603. return true;
  23604. }
  23605. return false;
  23606. }
  23607. function handleCommentInEmptyParens({
  23608. comment,
  23609. enclosingNode,
  23610. text
  23611. }) {
  23612. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== ")") {
  23613. return false;
  23614. }
  23615. if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters(enclosingNode).length === 0 || isCallLikeExpression(enclosingNode) && getCallArguments(enclosingNode).length === 0)) {
  23616. addDanglingComment(enclosingNode, comment);
  23617. return true;
  23618. }
  23619. 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) {
  23620. addDanglingComment(enclosingNode.value, comment);
  23621. return true;
  23622. }
  23623. return false;
  23624. }
  23625. function handleLastFunctionArgComments({
  23626. comment,
  23627. precedingNode,
  23628. enclosingNode,
  23629. followingNode,
  23630. text
  23631. }) {
  23632. 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") {
  23633. addTrailingComment(precedingNode, comment);
  23634. return true;
  23635. }
  23636. 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) === ")") {
  23637. addTrailingComment(precedingNode, comment);
  23638. return true;
  23639. }
  23640. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionDeclaration" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "BlockStatement") {
  23641. const functionParamRightParenIndex = (() => {
  23642. const parameters = getFunctionParameters(enclosingNode);
  23643. if (parameters.length > 0) {
  23644. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(getLast(parameters)));
  23645. }
  23646. const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(enclosingNode.id));
  23647. return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
  23648. })();
  23649. if (locStart(comment) > functionParamRightParenIndex) {
  23650. addBlockStatementFirstComment(followingNode, comment);
  23651. return true;
  23652. }
  23653. }
  23654. return false;
  23655. }
  23656. function handleLabeledStatementComments({
  23657. comment,
  23658. enclosingNode
  23659. }) {
  23660. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "LabeledStatement") {
  23661. addLeadingComment(enclosingNode, comment);
  23662. return true;
  23663. }
  23664. return false;
  23665. }
  23666. function handleBreakAndContinueStatementComments({
  23667. comment,
  23668. enclosingNode
  23669. }) {
  23670. if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ContinueStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "BreakStatement") && !enclosingNode.label) {
  23671. addTrailingComment(enclosingNode, comment);
  23672. return true;
  23673. }
  23674. return false;
  23675. }
  23676. function handleCallExpressionComments({
  23677. comment,
  23678. precedingNode,
  23679. enclosingNode
  23680. }) {
  23681. if (isCallExpression(enclosingNode) && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
  23682. addLeadingComment(enclosingNode.arguments[0], comment);
  23683. return true;
  23684. }
  23685. return false;
  23686. }
  23687. function handleUnionTypeComments({
  23688. comment,
  23689. precedingNode,
  23690. enclosingNode,
  23691. followingNode
  23692. }) {
  23693. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "UnionTypeAnnotation" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSUnionType") {
  23694. if (isPrettierIgnoreComment(comment)) {
  23695. followingNode.prettierIgnore = true;
  23696. comment.unignore = true;
  23697. }
  23698. if (precedingNode) {
  23699. addTrailingComment(precedingNode, comment);
  23700. return true;
  23701. }
  23702. return false;
  23703. }
  23704. if (((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "UnionTypeAnnotation" || (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSUnionType") && isPrettierIgnoreComment(comment)) {
  23705. followingNode.types[0].prettierIgnore = true;
  23706. comment.unignore = true;
  23707. }
  23708. return false;
  23709. }
  23710. function handlePropertyComments({
  23711. comment,
  23712. enclosingNode
  23713. }) {
  23714. if (isObjectProperty(enclosingNode)) {
  23715. addLeadingComment(enclosingNode, comment);
  23716. return true;
  23717. }
  23718. return false;
  23719. }
  23720. function handleOnlyComments({
  23721. comment,
  23722. enclosingNode,
  23723. followingNode,
  23724. ast,
  23725. isLastComment
  23726. }) {
  23727. if (ast && ast.body && ast.body.length === 0) {
  23728. if (isLastComment) {
  23729. addDanglingComment(ast, comment);
  23730. } else {
  23731. addLeadingComment(ast, comment);
  23732. }
  23733. return true;
  23734. }
  23735. 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)) {
  23736. if (isLastComment) {
  23737. addDanglingComment(enclosingNode, comment);
  23738. } else {
  23739. addLeadingComment(enclosingNode, comment);
  23740. }
  23741. return true;
  23742. }
  23743. 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") {
  23744. addDanglingComment(followingNode, comment);
  23745. return true;
  23746. }
  23747. return false;
  23748. }
  23749. function handleForComments({
  23750. comment,
  23751. enclosingNode
  23752. }) {
  23753. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForInStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForOfStatement") {
  23754. addLeadingComment(enclosingNode, comment);
  23755. return true;
  23756. }
  23757. return false;
  23758. }
  23759. function handleModuleSpecifiersComments({
  23760. comment,
  23761. precedingNode,
  23762. enclosingNode,
  23763. text
  23764. }) {
  23765. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportSpecifier" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportSpecifier") {
  23766. addLeadingComment(enclosingNode, comment);
  23767. return true;
  23768. }
  23769. const isImportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ImportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportDeclaration";
  23770. const isExportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ExportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportNamedDeclaration";
  23771. if ((isImportDeclaration || isExportDeclaration) && hasNewline(text, locEnd(comment))) {
  23772. addTrailingComment(precedingNode, comment);
  23773. return true;
  23774. }
  23775. return false;
  23776. }
  23777. function handleAssignmentPatternComments({
  23778. comment,
  23779. enclosingNode
  23780. }) {
  23781. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "AssignmentPattern") {
  23782. addLeadingComment(enclosingNode, comment);
  23783. return true;
  23784. }
  23785. return false;
  23786. }
  23787. var assignmentLikeNodeTypes = /* @__PURE__ */ new Set(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]);
  23788. var complexExprNodeTypes = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
  23789. function handleVariableDeclaratorComments({
  23790. comment,
  23791. enclosingNode,
  23792. followingNode
  23793. }) {
  23794. if (assignmentLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) && followingNode && (complexExprNodeTypes.has(followingNode.type) || isBlockComment(comment))) {
  23795. addLeadingComment(followingNode, comment);
  23796. return true;
  23797. }
  23798. return false;
  23799. }
  23800. function handleTSFunctionTrailingComments({
  23801. comment,
  23802. enclosingNode,
  23803. followingNode,
  23804. text
  23805. }) {
  23806. 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) === ";") {
  23807. addTrailingComment(enclosingNode, comment);
  23808. return true;
  23809. }
  23810. return false;
  23811. }
  23812. function handleIgnoreComments({
  23813. comment,
  23814. enclosingNode,
  23815. followingNode
  23816. }) {
  23817. 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) {
  23818. enclosingNode.prettierIgnore = true;
  23819. comment.unignore = true;
  23820. return true;
  23821. }
  23822. }
  23823. function handleTSMappedTypeComments({
  23824. comment,
  23825. precedingNode,
  23826. enclosingNode,
  23827. followingNode
  23828. }) {
  23829. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TSMappedType") {
  23830. return false;
  23831. }
  23832. if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.name) {
  23833. addLeadingComment(followingNode.name, comment);
  23834. return true;
  23835. }
  23836. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "TSTypeParameter" && precedingNode.constraint) {
  23837. addTrailingComment(precedingNode.constraint, comment);
  23838. return true;
  23839. }
  23840. return false;
  23841. }
  23842. function handleSwitchDefaultCaseComments({
  23843. comment,
  23844. enclosingNode,
  23845. followingNode
  23846. }) {
  23847. if (!enclosingNode || enclosingNode.type !== "SwitchCase" || enclosingNode.test || !followingNode || followingNode !== enclosingNode.consequent[0]) {
  23848. return false;
  23849. }
  23850. if (followingNode.type === "BlockStatement" && isLineComment(comment)) {
  23851. addBlockStatementFirstComment(followingNode, comment);
  23852. } else {
  23853. addDanglingComment(enclosingNode, comment);
  23854. }
  23855. return true;
  23856. }
  23857. function isRealFunctionLikeNode(node) {
  23858. 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";
  23859. }
  23860. function getCommentChildNodes(node, options) {
  23861. 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) {
  23862. return [...node.decorators || [], node.key, node.value.body];
  23863. }
  23864. }
  23865. function willPrintOwnComments(path) {
  23866. const node = path.getValue();
  23867. const parent = path.getParentNode();
  23868. const hasFlowAnnotations = (node2) => hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Leading)) || hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Trailing));
  23869. 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");
  23870. }
  23871. module2.exports = {
  23872. handleOwnLineComment,
  23873. handleEndOfLineComment,
  23874. handleRemainingComment,
  23875. getCommentChildNodes,
  23876. willPrintOwnComments
  23877. };
  23878. }
  23879. });
  23880. var require_needs_parens = __commonJS2({
  23881. "src/language-js/needs-parens.js"(exports2, module2) {
  23882. "use strict";
  23883. var getLast = require_get_last();
  23884. var isNonEmptyArray = require_is_non_empty_array();
  23885. var {
  23886. getFunctionParameters,
  23887. getLeftSidePathName,
  23888. hasFlowShorthandAnnotationComment,
  23889. hasNakedLeftSide,
  23890. hasNode,
  23891. isBitwiseOperator,
  23892. startsWithNoLookaheadToken,
  23893. shouldFlatten,
  23894. getPrecedence,
  23895. isCallExpression,
  23896. isMemberExpression,
  23897. isObjectProperty,
  23898. isTSTypeExpression
  23899. } = require_utils7();
  23900. function needsParens(path, options) {
  23901. const parent = path.getParentNode();
  23902. if (!parent) {
  23903. return false;
  23904. }
  23905. const name = path.getName();
  23906. const node = path.getNode();
  23907. if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
  23908. return true;
  23909. }
  23910. if (isStatement(node)) {
  23911. return false;
  23912. }
  23913. if (options.parser !== "flow" && hasFlowShorthandAnnotationComment(path.getValue())) {
  23914. return true;
  23915. }
  23916. if (node.type === "Identifier") {
  23917. if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
  23918. return true;
  23919. }
  23920. if (name === "left" && (node.name === "async" && !parent.await || node.name === "let") && parent.type === "ForOfStatement") {
  23921. return true;
  23922. }
  23923. if (node.name === "let") {
  23924. var _path$findAncestor;
  23925. const expression = (_path$findAncestor = path.findAncestor((node2) => node2.type === "ForOfStatement")) === null || _path$findAncestor === void 0 ? void 0 : _path$findAncestor.left;
  23926. if (expression && startsWithNoLookaheadToken(expression, (leftmostNode) => leftmostNode === node)) {
  23927. return true;
  23928. }
  23929. }
  23930. if (name === "object" && node.name === "let" && parent.type === "MemberExpression" && parent.computed && !parent.optional) {
  23931. const statement = path.findAncestor((node2) => node2.type === "ExpressionStatement" || node2.type === "ForStatement" || node2.type === "ForInStatement");
  23932. const expression = !statement ? void 0 : statement.type === "ExpressionStatement" ? statement.expression : statement.type === "ForStatement" ? statement.init : statement.left;
  23933. if (expression && startsWithNoLookaheadToken(expression, (leftmostNode) => leftmostNode === node)) {
  23934. return true;
  23935. }
  23936. }
  23937. return false;
  23938. }
  23939. if (node.type === "ObjectExpression" || node.type === "FunctionExpression" || node.type === "ClassExpression" || node.type === "DoExpression") {
  23940. var _path$findAncestor2;
  23941. const expression = (_path$findAncestor2 = path.findAncestor((node2) => node2.type === "ExpressionStatement")) === null || _path$findAncestor2 === void 0 ? void 0 : _path$findAncestor2.expression;
  23942. if (expression && startsWithNoLookaheadToken(expression, (leftmostNode) => leftmostNode === node)) {
  23943. return true;
  23944. }
  23945. }
  23946. switch (parent.type) {
  23947. case "ParenthesizedExpression":
  23948. return false;
  23949. case "ClassDeclaration":
  23950. case "ClassExpression": {
  23951. 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")) {
  23952. return true;
  23953. }
  23954. break;
  23955. }
  23956. case "ExportDefaultDeclaration": {
  23957. return shouldWrapFunctionForExportDefault(path, options) || node.type === "SequenceExpression";
  23958. }
  23959. case "Decorator": {
  23960. if (name === "expression") {
  23961. if (isMemberExpression(node) && node.computed) {
  23962. return true;
  23963. }
  23964. let hasCallExpression = false;
  23965. let hasMemberExpression = false;
  23966. let current = node;
  23967. while (current) {
  23968. switch (current.type) {
  23969. case "MemberExpression":
  23970. hasMemberExpression = true;
  23971. current = current.object;
  23972. break;
  23973. case "CallExpression":
  23974. if (hasMemberExpression || hasCallExpression) {
  23975. return options.parser !== "typescript";
  23976. }
  23977. hasCallExpression = true;
  23978. current = current.callee;
  23979. break;
  23980. case "Identifier":
  23981. return false;
  23982. case "TaggedTemplateExpression":
  23983. return options.parser !== "typescript";
  23984. default:
  23985. return true;
  23986. }
  23987. }
  23988. return true;
  23989. }
  23990. break;
  23991. }
  23992. case "ArrowFunctionExpression": {
  23993. if (name === "body" && node.type !== "SequenceExpression" && startsWithNoLookaheadToken(node, (node2) => node2.type === "ObjectExpression")) {
  23994. return true;
  23995. }
  23996. break;
  23997. }
  23998. }
  23999. switch (node.type) {
  24000. case "UpdateExpression":
  24001. if (parent.type === "UnaryExpression") {
  24002. return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
  24003. }
  24004. case "UnaryExpression":
  24005. switch (parent.type) {
  24006. case "UnaryExpression":
  24007. return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
  24008. case "BindExpression":
  24009. return true;
  24010. case "MemberExpression":
  24011. case "OptionalMemberExpression":
  24012. return name === "object";
  24013. case "TaggedTemplateExpression":
  24014. return true;
  24015. case "NewExpression":
  24016. case "CallExpression":
  24017. case "OptionalCallExpression":
  24018. return name === "callee";
  24019. case "BinaryExpression":
  24020. return name === "left" && parent.operator === "**";
  24021. case "TSNonNullExpression":
  24022. return true;
  24023. default:
  24024. return false;
  24025. }
  24026. case "BinaryExpression": {
  24027. if (parent.type === "UpdateExpression") {
  24028. return true;
  24029. }
  24030. if (node.operator === "in" && isPathInForStatementInitializer(path)) {
  24031. return true;
  24032. }
  24033. if (node.operator === "|>" && node.extra && node.extra.parenthesized) {
  24034. const grandParent = path.getParentNode(1);
  24035. if (grandParent.type === "BinaryExpression" && grandParent.operator === "|>") {
  24036. return true;
  24037. }
  24038. }
  24039. }
  24040. case "TSTypeAssertion":
  24041. case "TSAsExpression":
  24042. case "TSSatisfiesExpression":
  24043. case "LogicalExpression":
  24044. switch (parent.type) {
  24045. case "TSSatisfiesExpression":
  24046. case "TSAsExpression":
  24047. return !isTSTypeExpression(node);
  24048. case "ConditionalExpression":
  24049. return isTSTypeExpression(node);
  24050. case "CallExpression":
  24051. case "NewExpression":
  24052. case "OptionalCallExpression":
  24053. return name === "callee";
  24054. case "ClassExpression":
  24055. case "ClassDeclaration":
  24056. return name === "superClass";
  24057. case "TSTypeAssertion":
  24058. case "TaggedTemplateExpression":
  24059. case "UnaryExpression":
  24060. case "JSXSpreadAttribute":
  24061. case "SpreadElement":
  24062. case "SpreadProperty":
  24063. case "BindExpression":
  24064. case "AwaitExpression":
  24065. case "TSNonNullExpression":
  24066. case "UpdateExpression":
  24067. return true;
  24068. case "MemberExpression":
  24069. case "OptionalMemberExpression":
  24070. return name === "object";
  24071. case "AssignmentExpression":
  24072. case "AssignmentPattern":
  24073. return name === "left" && (node.type === "TSTypeAssertion" || isTSTypeExpression(node));
  24074. case "LogicalExpression":
  24075. if (node.type === "LogicalExpression") {
  24076. return parent.operator !== node.operator;
  24077. }
  24078. case "BinaryExpression": {
  24079. const {
  24080. operator,
  24081. type
  24082. } = node;
  24083. if (!operator && type !== "TSTypeAssertion") {
  24084. return true;
  24085. }
  24086. const precedence = getPrecedence(operator);
  24087. const parentOperator = parent.operator;
  24088. const parentPrecedence = getPrecedence(parentOperator);
  24089. if (parentPrecedence > precedence) {
  24090. return true;
  24091. }
  24092. if (name === "right" && parentPrecedence === precedence) {
  24093. return true;
  24094. }
  24095. if (parentPrecedence === precedence && !shouldFlatten(parentOperator, operator)) {
  24096. return true;
  24097. }
  24098. if (parentPrecedence < precedence && operator === "%") {
  24099. return parentOperator === "+" || parentOperator === "-";
  24100. }
  24101. if (isBitwiseOperator(parentOperator)) {
  24102. return true;
  24103. }
  24104. return false;
  24105. }
  24106. default:
  24107. return false;
  24108. }
  24109. case "SequenceExpression":
  24110. switch (parent.type) {
  24111. case "ReturnStatement":
  24112. return false;
  24113. case "ForStatement":
  24114. return false;
  24115. case "ExpressionStatement":
  24116. return name !== "expression";
  24117. case "ArrowFunctionExpression":
  24118. return name !== "body";
  24119. default:
  24120. return true;
  24121. }
  24122. case "YieldExpression":
  24123. if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || isTSTypeExpression(parent) || parent.type === "TSNonNullExpression") {
  24124. return true;
  24125. }
  24126. case "AwaitExpression":
  24127. switch (parent.type) {
  24128. case "TaggedTemplateExpression":
  24129. case "UnaryExpression":
  24130. case "LogicalExpression":
  24131. case "SpreadElement":
  24132. case "SpreadProperty":
  24133. case "TSAsExpression":
  24134. case "TSSatisfiesExpression":
  24135. case "TSNonNullExpression":
  24136. case "BindExpression":
  24137. return true;
  24138. case "MemberExpression":
  24139. case "OptionalMemberExpression":
  24140. return name === "object";
  24141. case "NewExpression":
  24142. case "CallExpression":
  24143. case "OptionalCallExpression":
  24144. return name === "callee";
  24145. case "ConditionalExpression":
  24146. return name === "test";
  24147. case "BinaryExpression": {
  24148. if (!node.argument && parent.operator === "|>") {
  24149. return false;
  24150. }
  24151. return true;
  24152. }
  24153. default:
  24154. return false;
  24155. }
  24156. case "TSConditionalType":
  24157. case "TSFunctionType":
  24158. case "TSConstructorType":
  24159. if (name === "extendsType" && parent.type === "TSConditionalType") {
  24160. if (node.type === "TSConditionalType") {
  24161. return true;
  24162. }
  24163. let {
  24164. typeAnnotation
  24165. } = node.returnType || node.typeAnnotation;
  24166. if (typeAnnotation.type === "TSTypePredicate" && typeAnnotation.typeAnnotation) {
  24167. typeAnnotation = typeAnnotation.typeAnnotation.typeAnnotation;
  24168. }
  24169. if (typeAnnotation.type === "TSInferType" && typeAnnotation.typeParameter.constraint) {
  24170. return true;
  24171. }
  24172. }
  24173. if (name === "checkType" && parent.type === "TSConditionalType") {
  24174. return true;
  24175. }
  24176. case "TSUnionType":
  24177. case "TSIntersectionType":
  24178. if ((parent.type === "TSUnionType" || parent.type === "TSIntersectionType") && parent.types.length > 1 && (!node.types || node.types.length > 1)) {
  24179. return true;
  24180. }
  24181. case "TSInferType":
  24182. if (node.type === "TSInferType" && parent.type === "TSRestType") {
  24183. return false;
  24184. }
  24185. case "TSTypeOperator":
  24186. 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");
  24187. case "TSTypeQuery":
  24188. return name === "objectType" && parent.type === "TSIndexedAccessType" || name === "elementType" && parent.type === "TSArrayType";
  24189. case "TypeofTypeAnnotation":
  24190. return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType") || name === "elementType" && parent.type === "ArrayTypeAnnotation";
  24191. case "ArrayTypeAnnotation":
  24192. return parent.type === "NullableTypeAnnotation";
  24193. case "IntersectionTypeAnnotation":
  24194. case "UnionTypeAnnotation":
  24195. return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  24196. case "NullableTypeAnnotation":
  24197. return parent.type === "ArrayTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  24198. case "FunctionTypeAnnotation": {
  24199. const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
  24200. 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");
  24201. }
  24202. case "OptionalIndexedAccessType":
  24203. return name === "objectType" && parent.type === "IndexedAccessType";
  24204. case "StringLiteral":
  24205. case "NumericLiteral":
  24206. case "Literal":
  24207. if (typeof node.value === "string" && parent.type === "ExpressionStatement" && !parent.directive) {
  24208. const grandParent = path.getParentNode(1);
  24209. return grandParent.type === "Program" || grandParent.type === "BlockStatement";
  24210. }
  24211. return name === "object" && parent.type === "MemberExpression" && typeof node.value === "number";
  24212. case "AssignmentExpression": {
  24213. const grandParent = path.getParentNode(1);
  24214. if (name === "body" && parent.type === "ArrowFunctionExpression") {
  24215. return true;
  24216. }
  24217. if (name === "key" && (parent.type === "ClassProperty" || parent.type === "PropertyDefinition") && parent.computed) {
  24218. return false;
  24219. }
  24220. if ((name === "init" || name === "update") && parent.type === "ForStatement") {
  24221. return false;
  24222. }
  24223. if (parent.type === "ExpressionStatement") {
  24224. return node.left.type === "ObjectPattern";
  24225. }
  24226. if (name === "key" && parent.type === "TSPropertySignature") {
  24227. return false;
  24228. }
  24229. if (parent.type === "AssignmentExpression") {
  24230. return false;
  24231. }
  24232. if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
  24233. return false;
  24234. }
  24235. if (name === "value" && parent.type === "Property" && grandParent && grandParent.type === "ObjectPattern" && grandParent.properties.includes(parent)) {
  24236. return false;
  24237. }
  24238. if (parent.type === "NGChainedExpression") {
  24239. return false;
  24240. }
  24241. return true;
  24242. }
  24243. case "ConditionalExpression":
  24244. switch (parent.type) {
  24245. case "TaggedTemplateExpression":
  24246. case "UnaryExpression":
  24247. case "SpreadElement":
  24248. case "SpreadProperty":
  24249. case "BinaryExpression":
  24250. case "LogicalExpression":
  24251. case "NGPipeExpression":
  24252. case "ExportDefaultDeclaration":
  24253. case "AwaitExpression":
  24254. case "JSXSpreadAttribute":
  24255. case "TSTypeAssertion":
  24256. case "TypeCastExpression":
  24257. case "TSAsExpression":
  24258. case "TSSatisfiesExpression":
  24259. case "TSNonNullExpression":
  24260. return true;
  24261. case "NewExpression":
  24262. case "CallExpression":
  24263. case "OptionalCallExpression":
  24264. return name === "callee";
  24265. case "ConditionalExpression":
  24266. return name === "test";
  24267. case "MemberExpression":
  24268. case "OptionalMemberExpression":
  24269. return name === "object";
  24270. default:
  24271. return false;
  24272. }
  24273. case "FunctionExpression":
  24274. switch (parent.type) {
  24275. case "NewExpression":
  24276. case "CallExpression":
  24277. case "OptionalCallExpression":
  24278. return name === "callee";
  24279. case "TaggedTemplateExpression":
  24280. return true;
  24281. default:
  24282. return false;
  24283. }
  24284. case "ArrowFunctionExpression":
  24285. switch (parent.type) {
  24286. case "BinaryExpression":
  24287. return parent.operator !== "|>" || node.extra && node.extra.parenthesized;
  24288. case "NewExpression":
  24289. case "CallExpression":
  24290. case "OptionalCallExpression":
  24291. return name === "callee";
  24292. case "MemberExpression":
  24293. case "OptionalMemberExpression":
  24294. return name === "object";
  24295. case "TSAsExpression":
  24296. case "TSSatisfiesExpression":
  24297. case "TSNonNullExpression":
  24298. case "BindExpression":
  24299. case "TaggedTemplateExpression":
  24300. case "UnaryExpression":
  24301. case "LogicalExpression":
  24302. case "AwaitExpression":
  24303. case "TSTypeAssertion":
  24304. return true;
  24305. case "ConditionalExpression":
  24306. return name === "test";
  24307. default:
  24308. return false;
  24309. }
  24310. case "ClassExpression":
  24311. if (isNonEmptyArray(node.decorators)) {
  24312. return true;
  24313. }
  24314. switch (parent.type) {
  24315. case "NewExpression":
  24316. return name === "callee";
  24317. default:
  24318. return false;
  24319. }
  24320. case "OptionalMemberExpression":
  24321. case "OptionalCallExpression": {
  24322. const parentParent = path.getParentNode(1);
  24323. if (name === "object" && parent.type === "MemberExpression" || name === "callee" && (parent.type === "CallExpression" || parent.type === "NewExpression") || parent.type === "TSNonNullExpression" && parentParent.type === "MemberExpression" && parentParent.object === parent) {
  24324. return true;
  24325. }
  24326. }
  24327. case "CallExpression":
  24328. case "MemberExpression":
  24329. case "TaggedTemplateExpression":
  24330. case "TSNonNullExpression":
  24331. if (name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression")) {
  24332. let object = node;
  24333. while (object) {
  24334. switch (object.type) {
  24335. case "CallExpression":
  24336. case "OptionalCallExpression":
  24337. return true;
  24338. case "MemberExpression":
  24339. case "OptionalMemberExpression":
  24340. case "BindExpression":
  24341. object = object.object;
  24342. break;
  24343. case "TaggedTemplateExpression":
  24344. object = object.tag;
  24345. break;
  24346. case "TSNonNullExpression":
  24347. object = object.expression;
  24348. break;
  24349. default:
  24350. return false;
  24351. }
  24352. }
  24353. }
  24354. return false;
  24355. case "BindExpression":
  24356. return name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression") || name === "object" && isMemberExpression(parent);
  24357. case "NGPipeExpression":
  24358. 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") {
  24359. return false;
  24360. }
  24361. return true;
  24362. case "JSXFragment":
  24363. case "JSXElement":
  24364. 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";
  24365. case "TypeAnnotation":
  24366. return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
  24367. }
  24368. return false;
  24369. }
  24370. function isStatement(node) {
  24371. 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";
  24372. }
  24373. function isPathInForStatementInitializer(path) {
  24374. let i = 0;
  24375. let node = path.getValue();
  24376. while (node) {
  24377. const parent = path.getParentNode(i++);
  24378. if (parent && parent.type === "ForStatement" && parent.init === node) {
  24379. return true;
  24380. }
  24381. node = parent;
  24382. }
  24383. return false;
  24384. }
  24385. function includesFunctionTypeInObjectType(node) {
  24386. return hasNode(node, (n1) => n1.type === "ObjectTypeAnnotation" && hasNode(n1, (n2) => n2.type === "FunctionTypeAnnotation" || void 0) || void 0);
  24387. }
  24388. function endsWithRightBracket(node) {
  24389. switch (node.type) {
  24390. case "ObjectExpression":
  24391. return true;
  24392. default:
  24393. return false;
  24394. }
  24395. }
  24396. function isFollowedByRightBracket(path) {
  24397. const node = path.getValue();
  24398. const parent = path.getParentNode();
  24399. const name = path.getName();
  24400. switch (parent.type) {
  24401. case "NGPipeExpression":
  24402. if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
  24403. return path.callParent(isFollowedByRightBracket);
  24404. }
  24405. break;
  24406. case "ObjectProperty":
  24407. if (name === "value") {
  24408. const parentParent = path.getParentNode(1);
  24409. return getLast(parentParent.properties) === parent;
  24410. }
  24411. break;
  24412. case "BinaryExpression":
  24413. case "LogicalExpression":
  24414. if (name === "right") {
  24415. return path.callParent(isFollowedByRightBracket);
  24416. }
  24417. break;
  24418. case "ConditionalExpression":
  24419. if (name === "alternate") {
  24420. return path.callParent(isFollowedByRightBracket);
  24421. }
  24422. break;
  24423. case "UnaryExpression":
  24424. if (parent.prefix) {
  24425. return path.callParent(isFollowedByRightBracket);
  24426. }
  24427. break;
  24428. }
  24429. return false;
  24430. }
  24431. function shouldWrapFunctionForExportDefault(path, options) {
  24432. const node = path.getValue();
  24433. const parent = path.getParentNode();
  24434. if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
  24435. return parent.type === "ExportDefaultDeclaration" || !needsParens(path, options);
  24436. }
  24437. if (!hasNakedLeftSide(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
  24438. return false;
  24439. }
  24440. return path.call((childPath) => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName(path, node));
  24441. }
  24442. module2.exports = needsParens;
  24443. }
  24444. });
  24445. var require_print_preprocess = __commonJS2({
  24446. "src/language-js/print-preprocess.js"(exports2, module2) {
  24447. "use strict";
  24448. function preprocess(ast, options) {
  24449. switch (options.parser) {
  24450. case "json":
  24451. case "json5":
  24452. case "json-stringify":
  24453. case "__js_expression":
  24454. case "__vue_expression":
  24455. case "__vue_ts_expression":
  24456. return Object.assign(Object.assign({}, ast), {}, {
  24457. type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
  24458. node: ast,
  24459. comments: [],
  24460. rootMarker: options.rootMarker
  24461. });
  24462. default:
  24463. return ast;
  24464. }
  24465. }
  24466. module2.exports = preprocess;
  24467. }
  24468. });
  24469. var require_html_binding = __commonJS2({
  24470. "src/language-js/print/html-binding.js"(exports2, module2) {
  24471. "use strict";
  24472. var {
  24473. builders: {
  24474. join,
  24475. line,
  24476. group,
  24477. softline,
  24478. indent
  24479. }
  24480. } = require("./doc.js");
  24481. function printHtmlBinding(path, options, print) {
  24482. const node = path.getValue();
  24483. if (options.__onHtmlBindingRoot && path.getName() === null) {
  24484. options.__onHtmlBindingRoot(node, options);
  24485. }
  24486. if (node.type !== "File") {
  24487. return;
  24488. }
  24489. if (options.__isVueForBindingLeft) {
  24490. return path.call((functionDeclarationPath) => {
  24491. const printed = join([",", line], functionDeclarationPath.map(print, "params"));
  24492. const {
  24493. params
  24494. } = functionDeclarationPath.getValue();
  24495. if (params.length === 1) {
  24496. return printed;
  24497. }
  24498. return ["(", indent([softline, group(printed)]), softline, ")"];
  24499. }, "program", "body", 0);
  24500. }
  24501. if (options.__isVueBindings) {
  24502. return path.call((functionDeclarationPath) => join([",", line], functionDeclarationPath.map(print, "params")), "program", "body", 0);
  24503. }
  24504. }
  24505. function isVueEventBindingExpression(node) {
  24506. switch (node.type) {
  24507. case "MemberExpression":
  24508. switch (node.property.type) {
  24509. case "Identifier":
  24510. case "NumericLiteral":
  24511. case "StringLiteral":
  24512. return isVueEventBindingExpression(node.object);
  24513. }
  24514. return false;
  24515. case "Identifier":
  24516. return true;
  24517. default:
  24518. return false;
  24519. }
  24520. }
  24521. module2.exports = {
  24522. isVueEventBindingExpression,
  24523. printHtmlBinding
  24524. };
  24525. }
  24526. });
  24527. var require_binaryish = __commonJS2({
  24528. "src/language-js/print/binaryish.js"(exports2, module2) {
  24529. "use strict";
  24530. var {
  24531. printComments
  24532. } = require_comments();
  24533. var {
  24534. getLast
  24535. } = require_util();
  24536. var {
  24537. builders: {
  24538. join,
  24539. line,
  24540. softline,
  24541. group,
  24542. indent,
  24543. align,
  24544. indentIfBreak
  24545. },
  24546. utils: {
  24547. cleanDoc,
  24548. getDocParts,
  24549. isConcat
  24550. }
  24551. } = require("./doc.js");
  24552. var {
  24553. hasLeadingOwnLineComment,
  24554. isBinaryish,
  24555. isJsxNode,
  24556. shouldFlatten,
  24557. hasComment,
  24558. CommentCheckFlags,
  24559. isCallExpression,
  24560. isMemberExpression,
  24561. isObjectProperty,
  24562. isEnabledHackPipeline
  24563. } = require_utils7();
  24564. var uid = 0;
  24565. function printBinaryishExpression(path, options, print) {
  24566. const node = path.getValue();
  24567. const parent = path.getParentNode();
  24568. const parentParent = path.getParentNode(1);
  24569. const isInsideParenthesis = node !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
  24570. const isHackPipeline = isEnabledHackPipeline(options) && node.operator === "|>";
  24571. const parts = printBinaryishExpressions(path, print, options, false, isInsideParenthesis);
  24572. if (isInsideParenthesis) {
  24573. return parts;
  24574. }
  24575. if (isHackPipeline) {
  24576. return group(parts);
  24577. }
  24578. if (isCallExpression(parent) && parent.callee === node || parent.type === "UnaryExpression" || isMemberExpression(parent) && !parent.computed) {
  24579. return group([indent([softline, ...parts]), softline]);
  24580. }
  24581. 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";
  24582. const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "PropertyDefinition" || parent.type === "TSAbstractPropertyDefinition" || parent.type === "ClassPrivateProperty" || isObjectProperty(parent);
  24583. const samePrecedenceSubExpression = isBinaryish(node.left) && shouldFlatten(node.operator, node.left.operator);
  24584. if (shouldNotIndent || shouldInlineLogicalExpression(node) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(node) && shouldIndentIfInlining) {
  24585. return group(parts);
  24586. }
  24587. if (parts.length === 0) {
  24588. return "";
  24589. }
  24590. const hasJsx = isJsxNode(node.right);
  24591. const firstGroupIndex = parts.findIndex((part) => typeof part !== "string" && !Array.isArray(part) && part.type === "group");
  24592. const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
  24593. const rest = parts.slice(headParts.length, hasJsx ? -1 : void 0);
  24594. const groupId = Symbol("logicalChain-" + ++uid);
  24595. const chain = group([...headParts, indent(rest)], {
  24596. id: groupId
  24597. });
  24598. if (!hasJsx) {
  24599. return chain;
  24600. }
  24601. const jsxPart = getLast(parts);
  24602. return group([chain, indentIfBreak(jsxPart, {
  24603. groupId
  24604. })]);
  24605. }
  24606. function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
  24607. const node = path.getValue();
  24608. if (!isBinaryish(node)) {
  24609. return [group(print())];
  24610. }
  24611. let parts = [];
  24612. if (shouldFlatten(node.operator, node.left.operator)) {
  24613. parts = path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "left");
  24614. } else {
  24615. parts.push(group(print("left")));
  24616. }
  24617. const shouldInline = shouldInlineLogicalExpression(node);
  24618. const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment(options.originalText, node.right);
  24619. const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
  24620. const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length > 0 ? group(indent([line, ": ", join([line, ": "], path.map(print, "arguments").map((arg) => align(2, group(arg))))])) : "";
  24621. let right;
  24622. if (shouldInline) {
  24623. right = [operator, " ", print("right"), rightSuffix];
  24624. } else {
  24625. const isHackPipeline = isEnabledHackPipeline(options) && operator === "|>";
  24626. const rightContent = isHackPipeline ? path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "right") : print("right");
  24627. right = [lineBeforeOperator ? line : "", operator, lineBeforeOperator ? " " : line, rightContent, rightSuffix];
  24628. }
  24629. const parent = path.getParentNode();
  24630. const shouldBreak = hasComment(node.left, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  24631. const shouldGroup = shouldBreak || !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
  24632. parts.push(lineBeforeOperator ? "" : " ", shouldGroup ? group(right, {
  24633. shouldBreak
  24634. }) : right);
  24635. if (isNested && hasComment(node)) {
  24636. const printed = cleanDoc(printComments(path, parts, options));
  24637. if (isConcat(printed) || printed.type === "fill") {
  24638. return getDocParts(printed);
  24639. }
  24640. return [printed];
  24641. }
  24642. return parts;
  24643. }
  24644. function shouldInlineLogicalExpression(node) {
  24645. if (node.type !== "LogicalExpression") {
  24646. return false;
  24647. }
  24648. if (node.right.type === "ObjectExpression" && node.right.properties.length > 0) {
  24649. return true;
  24650. }
  24651. if (node.right.type === "ArrayExpression" && node.right.elements.length > 0) {
  24652. return true;
  24653. }
  24654. if (isJsxNode(node.right)) {
  24655. return true;
  24656. }
  24657. return false;
  24658. }
  24659. module2.exports = {
  24660. printBinaryishExpression,
  24661. shouldInlineLogicalExpression
  24662. };
  24663. }
  24664. });
  24665. var require_angular = __commonJS2({
  24666. "src/language-js/print/angular.js"(exports2, module2) {
  24667. "use strict";
  24668. var {
  24669. builders: {
  24670. join,
  24671. line,
  24672. group
  24673. }
  24674. } = require("./doc.js");
  24675. var {
  24676. hasNode,
  24677. hasComment,
  24678. getComments
  24679. } = require_utils7();
  24680. var {
  24681. printBinaryishExpression
  24682. } = require_binaryish();
  24683. function printAngular(path, options, print) {
  24684. const node = path.getValue();
  24685. if (!node.type.startsWith("NG")) {
  24686. return;
  24687. }
  24688. switch (node.type) {
  24689. case "NGRoot":
  24690. return [print("node"), !hasComment(node.node) ? "" : " //" + getComments(node.node)[0].value.trimEnd()];
  24691. case "NGPipeExpression":
  24692. return printBinaryishExpression(path, options, print);
  24693. case "NGChainedExpression":
  24694. return group(join([";", line], path.map((childPath) => hasNgSideEffect(childPath) ? print() : ["(", print(), ")"], "expressions")));
  24695. case "NGEmptyExpression":
  24696. return "";
  24697. case "NGQuotedExpression":
  24698. return [node.prefix, ": ", node.value.trim()];
  24699. case "NGMicrosyntax":
  24700. return path.map((childPath, index) => [index === 0 ? "" : isNgForOf(childPath.getValue(), index, node) ? " " : [";", line], print()], "body");
  24701. case "NGMicrosyntaxKey":
  24702. return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/i.test(node.name) ? node.name : JSON.stringify(node.name);
  24703. case "NGMicrosyntaxExpression":
  24704. return [print("expression"), node.alias === null ? "" : [" as ", print("alias")]];
  24705. case "NGMicrosyntaxKeyedExpression": {
  24706. const index = path.getName();
  24707. const parentNode = path.getParentNode();
  24708. 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";
  24709. return [print("key"), shouldNotPrintColon ? " " : ": ", print("expression")];
  24710. }
  24711. case "NGMicrosyntaxLet":
  24712. return ["let ", print("key"), node.value === null ? "" : [" = ", print("value")]];
  24713. case "NGMicrosyntaxAs":
  24714. return [print("key"), " as ", print("alias")];
  24715. default:
  24716. throw new Error(`Unknown Angular node type: ${JSON.stringify(node.type)}.`);
  24717. }
  24718. }
  24719. function isNgForOf(node, index, parentNode) {
  24720. return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
  24721. }
  24722. function hasNgSideEffect(path) {
  24723. return hasNode(path.getValue(), (node) => {
  24724. switch (node.type) {
  24725. case void 0:
  24726. return false;
  24727. case "CallExpression":
  24728. case "OptionalCallExpression":
  24729. case "AssignmentExpression":
  24730. return true;
  24731. }
  24732. });
  24733. }
  24734. module2.exports = {
  24735. printAngular
  24736. };
  24737. }
  24738. });
  24739. var require_jsx = __commonJS2({
  24740. "src/language-js/print/jsx.js"(exports2, module2) {
  24741. "use strict";
  24742. var {
  24743. printComments,
  24744. printDanglingComments,
  24745. printCommentsSeparately
  24746. } = require_comments();
  24747. var {
  24748. builders: {
  24749. line,
  24750. hardline,
  24751. softline,
  24752. group,
  24753. indent,
  24754. conditionalGroup,
  24755. fill,
  24756. ifBreak,
  24757. lineSuffixBoundary,
  24758. join
  24759. },
  24760. utils: {
  24761. willBreak
  24762. }
  24763. } = require("./doc.js");
  24764. var {
  24765. getLast,
  24766. getPreferredQuote
  24767. } = require_util();
  24768. var {
  24769. isJsxNode,
  24770. rawText,
  24771. isCallExpression,
  24772. isStringLiteral,
  24773. isBinaryish,
  24774. hasComment,
  24775. CommentCheckFlags,
  24776. hasNodeIgnoreComment
  24777. } = require_utils7();
  24778. var pathNeedsParens = require_needs_parens();
  24779. var {
  24780. willPrintOwnComments
  24781. } = require_comments2();
  24782. var isEmptyStringOrAnyLine = (doc2) => doc2 === "" || doc2 === line || doc2 === hardline || doc2 === softline;
  24783. function printJsxElementInternal(path, options, print) {
  24784. const node = path.getValue();
  24785. if (node.type === "JSXElement" && isEmptyJsxElement(node)) {
  24786. return [print("openingElement"), print("closingElement")];
  24787. }
  24788. const openingLines = node.type === "JSXElement" ? print("openingElement") : print("openingFragment");
  24789. const closingLines = node.type === "JSXElement" ? print("closingElement") : print("closingFragment");
  24790. if (node.children.length === 1 && node.children[0].type === "JSXExpressionContainer" && (node.children[0].expression.type === "TemplateLiteral" || node.children[0].expression.type === "TaggedTemplateExpression")) {
  24791. return [openingLines, ...path.map(print, "children"), closingLines];
  24792. }
  24793. node.children = node.children.map((child) => {
  24794. if (isJsxWhitespaceExpression(child)) {
  24795. return {
  24796. type: "JSXText",
  24797. value: " ",
  24798. raw: " "
  24799. };
  24800. }
  24801. return child;
  24802. });
  24803. const containsTag = node.children.some(isJsxNode);
  24804. const containsMultipleExpressions = node.children.filter((child) => child.type === "JSXExpressionContainer").length > 1;
  24805. const containsMultipleAttributes = node.type === "JSXElement" && node.openingElement.attributes.length > 1;
  24806. let forcedBreak = willBreak(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
  24807. const isMdxBlock = path.getParentNode().rootMarker === "mdx";
  24808. const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
  24809. const jsxWhitespace = isMdxBlock ? " " : ifBreak([rawJsxWhitespace, softline], " ");
  24810. const isFacebookTranslationTag = node.openingElement && node.openingElement.name && node.openingElement.name.name === "fbt";
  24811. const children = printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
  24812. const containsText = node.children.some((child) => isMeaningfulJsxText(child));
  24813. for (let i = children.length - 2; i >= 0; i--) {
  24814. const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
  24815. const isPairOfHardlines = children[i] === hardline && children[i + 1] === "" && children[i + 2] === hardline;
  24816. const isLineFollowedByJsxWhitespace = (children[i] === softline || children[i] === hardline) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24817. const isJsxWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline || children[i + 2] === hardline);
  24818. const isDoubleJsxWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24819. const isPairOfHardOrSoftLines = children[i] === softline && children[i + 1] === "" && children[i + 2] === hardline || children[i] === hardline && children[i + 1] === "" && children[i + 2] === softline;
  24820. if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJsxWhitespace || isDoubleJsxWhitespace || isPairOfHardOrSoftLines) {
  24821. children.splice(i, 2);
  24822. } else if (isJsxWhitespaceFollowedByLine) {
  24823. children.splice(i + 1, 2);
  24824. }
  24825. }
  24826. while (children.length > 0 && isEmptyStringOrAnyLine(getLast(children))) {
  24827. children.pop();
  24828. }
  24829. while (children.length > 1 && isEmptyStringOrAnyLine(children[0]) && isEmptyStringOrAnyLine(children[1])) {
  24830. children.shift();
  24831. children.shift();
  24832. }
  24833. const multilineChildren = [];
  24834. for (const [i, child] of children.entries()) {
  24835. if (child === jsxWhitespace) {
  24836. if (i === 1 && children[i - 1] === "") {
  24837. if (children.length === 2) {
  24838. multilineChildren.push(rawJsxWhitespace);
  24839. continue;
  24840. }
  24841. multilineChildren.push([rawJsxWhitespace, hardline]);
  24842. continue;
  24843. } else if (i === children.length - 1) {
  24844. multilineChildren.push(rawJsxWhitespace);
  24845. continue;
  24846. } else if (children[i - 1] === "" && children[i - 2] === hardline) {
  24847. multilineChildren.push(rawJsxWhitespace);
  24848. continue;
  24849. }
  24850. }
  24851. multilineChildren.push(child);
  24852. if (willBreak(child)) {
  24853. forcedBreak = true;
  24854. }
  24855. }
  24856. const content = containsText ? fill(multilineChildren) : group(multilineChildren, {
  24857. shouldBreak: true
  24858. });
  24859. if (isMdxBlock) {
  24860. return content;
  24861. }
  24862. const multiLineElem = group([openingLines, indent([hardline, content]), hardline, closingLines]);
  24863. if (forcedBreak) {
  24864. return multiLineElem;
  24865. }
  24866. return conditionalGroup([group([openingLines, ...children, closingLines]), multiLineElem]);
  24867. }
  24868. function printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
  24869. const parts = [];
  24870. path.each((childPath, i, children) => {
  24871. const child = childPath.getValue();
  24872. if (child.type === "JSXText") {
  24873. const text = rawText(child);
  24874. if (isMeaningfulJsxText(child)) {
  24875. const words = text.split(matchJsxWhitespaceRegex);
  24876. if (words[0] === "") {
  24877. parts.push("");
  24878. words.shift();
  24879. if (/\n/.test(words[0])) {
  24880. const next = children[i + 1];
  24881. parts.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
  24882. } else {
  24883. parts.push(jsxWhitespace);
  24884. }
  24885. words.shift();
  24886. }
  24887. let endWhitespace;
  24888. if (getLast(words) === "") {
  24889. words.pop();
  24890. endWhitespace = words.pop();
  24891. }
  24892. if (words.length === 0) {
  24893. return;
  24894. }
  24895. for (const [i2, word] of words.entries()) {
  24896. if (i2 % 2 === 1) {
  24897. parts.push(line);
  24898. } else {
  24899. parts.push(word);
  24900. }
  24901. }
  24902. if (endWhitespace !== void 0) {
  24903. if (/\n/.test(endWhitespace)) {
  24904. const next = children[i + 1];
  24905. parts.push(separatorWithWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24906. } else {
  24907. parts.push(jsxWhitespace);
  24908. }
  24909. } else {
  24910. const next = children[i + 1];
  24911. parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24912. }
  24913. } else if (/\n/.test(text)) {
  24914. if (text.match(/\n/g).length > 1) {
  24915. parts.push("", hardline);
  24916. }
  24917. } else {
  24918. parts.push("", jsxWhitespace);
  24919. }
  24920. } else {
  24921. const printedChild = print();
  24922. parts.push(printedChild);
  24923. const next = children[i + 1];
  24924. const directlyFollowedByMeaningfulText = next && isMeaningfulJsxText(next);
  24925. if (directlyFollowedByMeaningfulText) {
  24926. const firstWord = trimJsxWhitespace(rawText(next)).split(matchJsxWhitespaceRegex)[0];
  24927. parts.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
  24928. } else {
  24929. parts.push(hardline);
  24930. }
  24931. }
  24932. }, "children");
  24933. return parts;
  24934. }
  24935. function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24936. if (isFacebookTranslationTag) {
  24937. return "";
  24938. }
  24939. if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
  24940. return child.length === 1 ? softline : hardline;
  24941. }
  24942. return softline;
  24943. }
  24944. function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24945. if (isFacebookTranslationTag) {
  24946. return hardline;
  24947. }
  24948. if (child.length === 1) {
  24949. return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline : softline;
  24950. }
  24951. return hardline;
  24952. }
  24953. function maybeWrapJsxElementInParens(path, elem, options) {
  24954. const parent = path.getParentNode();
  24955. if (!parent) {
  24956. return elem;
  24957. }
  24958. const NO_WRAP_PARENTS = {
  24959. ArrayExpression: true,
  24960. JSXAttribute: true,
  24961. JSXElement: true,
  24962. JSXExpressionContainer: true,
  24963. JSXFragment: true,
  24964. ExpressionStatement: true,
  24965. CallExpression: true,
  24966. OptionalCallExpression: true,
  24967. ConditionalExpression: true,
  24968. JsExpressionRoot: true
  24969. };
  24970. if (NO_WRAP_PARENTS[parent.type]) {
  24971. return elem;
  24972. }
  24973. const shouldBreak = path.match(void 0, (node) => node.type === "ArrowFunctionExpression", isCallExpression, (node) => node.type === "JSXExpressionContainer");
  24974. const needsParens = pathNeedsParens(path, options);
  24975. return group([needsParens ? "" : ifBreak("("), indent([softline, elem]), softline, needsParens ? "" : ifBreak(")")], {
  24976. shouldBreak
  24977. });
  24978. }
  24979. function printJsxAttribute(path, options, print) {
  24980. const node = path.getValue();
  24981. const parts = [];
  24982. parts.push(print("name"));
  24983. if (node.value) {
  24984. let res;
  24985. if (isStringLiteral(node.value)) {
  24986. const raw = rawText(node.value);
  24987. let final = raw.slice(1, -1).replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  24988. const {
  24989. escaped,
  24990. quote,
  24991. regex
  24992. } = getPreferredQuote(final, options.jsxSingleQuote ? "'" : '"');
  24993. final = final.replace(regex, escaped);
  24994. const {
  24995. leading,
  24996. trailing
  24997. } = path.call(() => printCommentsSeparately(path, options), "value");
  24998. res = [leading, quote, final, quote, trailing];
  24999. } else {
  25000. res = print("value");
  25001. }
  25002. parts.push("=", res);
  25003. }
  25004. return parts;
  25005. }
  25006. function printJsxExpressionContainer(path, options, print) {
  25007. const node = path.getValue();
  25008. 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)));
  25009. if (shouldInline(node.expression, path.getParentNode(0))) {
  25010. return group(["{", print("expression"), lineSuffixBoundary, "}"]);
  25011. }
  25012. return group(["{", indent([softline, print("expression")]), softline, lineSuffixBoundary, "}"]);
  25013. }
  25014. function printJsxOpeningElement(path, options, print) {
  25015. const node = path.getValue();
  25016. const nameHasComments = node.name && hasComment(node.name) || node.typeParameters && hasComment(node.typeParameters);
  25017. if (node.selfClosing && node.attributes.length === 0 && !nameHasComments) {
  25018. return ["<", print("name"), print("typeParameters"), " />"];
  25019. }
  25020. 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])) {
  25021. return group(["<", print("name"), print("typeParameters"), " ", ...path.map(print, "attributes"), node.selfClosing ? " />" : ">"]);
  25022. }
  25023. const shouldBreak = node.attributes && node.attributes.some((attr) => attr.value && isStringLiteral(attr.value) && attr.value.value.includes("\n"));
  25024. const attributeLine = options.singleAttributePerLine && node.attributes.length > 1 ? hardline : line;
  25025. return group(["<", print("name"), print("typeParameters"), indent(path.map(() => [attributeLine, print()], "attributes")), ...printEndOfOpeningTag(node, options, nameHasComments)], {
  25026. shouldBreak
  25027. });
  25028. }
  25029. function printEndOfOpeningTag(node, options, nameHasComments) {
  25030. if (node.selfClosing) {
  25031. return [line, "/>"];
  25032. }
  25033. const bracketSameLine = shouldPrintBracketSameLine(node, options, nameHasComments);
  25034. if (bracketSameLine) {
  25035. return [">"];
  25036. }
  25037. return [softline, ">"];
  25038. }
  25039. function shouldPrintBracketSameLine(node, options, nameHasComments) {
  25040. const lastAttrHasTrailingComments = node.attributes.length > 0 && hasComment(getLast(node.attributes), CommentCheckFlags.Trailing);
  25041. return node.attributes.length === 0 && !nameHasComments || (options.bracketSameLine || options.jsxBracketSameLine) && (!nameHasComments || node.attributes.length > 0) && !lastAttrHasTrailingComments;
  25042. }
  25043. function printJsxClosingElement(path, options, print) {
  25044. const node = path.getValue();
  25045. const parts = [];
  25046. parts.push("</");
  25047. const printed = print("name");
  25048. if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Line)) {
  25049. parts.push(indent([hardline, printed]), hardline);
  25050. } else if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Block)) {
  25051. parts.push(" ", printed);
  25052. } else {
  25053. parts.push(printed);
  25054. }
  25055. parts.push(">");
  25056. return parts;
  25057. }
  25058. function printJsxOpeningClosingFragment(path, options) {
  25059. const node = path.getValue();
  25060. const nodeHasComment = hasComment(node);
  25061. const hasOwnLineComment = hasComment(node, CommentCheckFlags.Line);
  25062. const isOpeningFragment = node.type === "JSXOpeningFragment";
  25063. return [isOpeningFragment ? "<" : "</", indent([hasOwnLineComment ? hardline : nodeHasComment && !isOpeningFragment ? " " : "", printDanglingComments(path, options, true)]), hasOwnLineComment ? hardline : "", ">"];
  25064. }
  25065. function printJsxElement(path, options, print) {
  25066. const elem = printComments(path, printJsxElementInternal(path, options, print), options);
  25067. return maybeWrapJsxElementInParens(path, elem, options);
  25068. }
  25069. function printJsxEmptyExpression(path, options) {
  25070. const node = path.getValue();
  25071. const requiresHardline = hasComment(node, CommentCheckFlags.Line);
  25072. return [printDanglingComments(path, options, !requiresHardline), requiresHardline ? hardline : ""];
  25073. }
  25074. function printJsxSpreadAttribute(path, options, print) {
  25075. const node = path.getValue();
  25076. return ["{", path.call((p) => {
  25077. const printed = ["...", print()];
  25078. const node2 = p.getValue();
  25079. if (!hasComment(node2) || !willPrintOwnComments(p)) {
  25080. return printed;
  25081. }
  25082. return [indent([softline, printComments(p, printed, options)]), softline];
  25083. }, node.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
  25084. }
  25085. function printJsx(path, options, print) {
  25086. const node = path.getValue();
  25087. if (!node.type.startsWith("JSX")) {
  25088. return;
  25089. }
  25090. switch (node.type) {
  25091. case "JSXAttribute":
  25092. return printJsxAttribute(path, options, print);
  25093. case "JSXIdentifier":
  25094. return String(node.name);
  25095. case "JSXNamespacedName":
  25096. return join(":", [print("namespace"), print("name")]);
  25097. case "JSXMemberExpression":
  25098. return join(".", [print("object"), print("property")]);
  25099. case "JSXSpreadAttribute":
  25100. return printJsxSpreadAttribute(path, options, print);
  25101. case "JSXSpreadChild": {
  25102. const printJsxSpreadChild = printJsxSpreadAttribute;
  25103. return printJsxSpreadChild(path, options, print);
  25104. }
  25105. case "JSXExpressionContainer":
  25106. return printJsxExpressionContainer(path, options, print);
  25107. case "JSXFragment":
  25108. case "JSXElement":
  25109. return printJsxElement(path, options, print);
  25110. case "JSXOpeningElement":
  25111. return printJsxOpeningElement(path, options, print);
  25112. case "JSXClosingElement":
  25113. return printJsxClosingElement(path, options, print);
  25114. case "JSXOpeningFragment":
  25115. case "JSXClosingFragment":
  25116. return printJsxOpeningClosingFragment(path, options);
  25117. case "JSXEmptyExpression":
  25118. return printJsxEmptyExpression(path, options);
  25119. case "JSXText":
  25120. throw new Error("JSXText should be handled by JSXElement");
  25121. default:
  25122. throw new Error(`Unknown JSX node type: ${JSON.stringify(node.type)}.`);
  25123. }
  25124. }
  25125. var jsxWhitespaceChars = " \n\r ";
  25126. var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
  25127. var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
  25128. var trimJsxWhitespace = (text) => text.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
  25129. function isEmptyJsxElement(node) {
  25130. if (node.children.length === 0) {
  25131. return true;
  25132. }
  25133. if (node.children.length > 1) {
  25134. return false;
  25135. }
  25136. const child = node.children[0];
  25137. return child.type === "JSXText" && !isMeaningfulJsxText(child);
  25138. }
  25139. function isMeaningfulJsxText(node) {
  25140. return node.type === "JSXText" && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
  25141. }
  25142. function isJsxWhitespaceExpression(node) {
  25143. return node.type === "JSXExpressionContainer" && isStringLiteral(node.expression) && node.expression.value === " " && !hasComment(node.expression);
  25144. }
  25145. function hasJsxIgnoreComment(path) {
  25146. const node = path.getValue();
  25147. const parent = path.getParentNode();
  25148. if (!parent || !node || !isJsxNode(node) || !isJsxNode(parent)) {
  25149. return false;
  25150. }
  25151. const index = parent.children.indexOf(node);
  25152. let prevSibling = null;
  25153. for (let i = index; i > 0; i--) {
  25154. const candidate = parent.children[i - 1];
  25155. if (candidate.type === "JSXText" && !isMeaningfulJsxText(candidate)) {
  25156. continue;
  25157. }
  25158. prevSibling = candidate;
  25159. break;
  25160. }
  25161. return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && hasNodeIgnoreComment(prevSibling.expression);
  25162. }
  25163. module2.exports = {
  25164. hasJsxIgnoreComment,
  25165. printJsx
  25166. };
  25167. }
  25168. });
  25169. var require_doc_builders = __commonJS2({
  25170. "src/document/doc-builders.js"(exports2, module2) {
  25171. "use strict";
  25172. function concat(parts) {
  25173. if (false) {
  25174. for (const part of parts) {
  25175. assertDoc(part);
  25176. }
  25177. }
  25178. return {
  25179. type: "concat",
  25180. parts
  25181. };
  25182. }
  25183. function indent(contents) {
  25184. if (false) {
  25185. assertDoc(contents);
  25186. }
  25187. return {
  25188. type: "indent",
  25189. contents
  25190. };
  25191. }
  25192. function align(widthOrString, contents) {
  25193. if (false) {
  25194. assertDoc(contents);
  25195. }
  25196. return {
  25197. type: "align",
  25198. contents,
  25199. n: widthOrString
  25200. };
  25201. }
  25202. function group(contents, opts = {}) {
  25203. if (false) {
  25204. assertDoc(contents);
  25205. }
  25206. return {
  25207. type: "group",
  25208. id: opts.id,
  25209. contents,
  25210. break: Boolean(opts.shouldBreak),
  25211. expandedStates: opts.expandedStates
  25212. };
  25213. }
  25214. function dedentToRoot(contents) {
  25215. return align(Number.NEGATIVE_INFINITY, contents);
  25216. }
  25217. function markAsRoot(contents) {
  25218. return align({
  25219. type: "root"
  25220. }, contents);
  25221. }
  25222. function dedent(contents) {
  25223. return align(-1, contents);
  25224. }
  25225. function conditionalGroup(states, opts) {
  25226. return group(states[0], Object.assign(Object.assign({}, opts), {}, {
  25227. expandedStates: states
  25228. }));
  25229. }
  25230. function fill(parts) {
  25231. if (false) {
  25232. for (const part of parts) {
  25233. assertDoc(part);
  25234. }
  25235. }
  25236. return {
  25237. type: "fill",
  25238. parts
  25239. };
  25240. }
  25241. function ifBreak(breakContents, flatContents, opts = {}) {
  25242. if (false) {
  25243. if (breakContents) {
  25244. assertDoc(breakContents);
  25245. }
  25246. if (flatContents) {
  25247. assertDoc(flatContents);
  25248. }
  25249. }
  25250. return {
  25251. type: "if-break",
  25252. breakContents,
  25253. flatContents,
  25254. groupId: opts.groupId
  25255. };
  25256. }
  25257. function indentIfBreak(contents, opts) {
  25258. return {
  25259. type: "indent-if-break",
  25260. contents,
  25261. groupId: opts.groupId,
  25262. negate: opts.negate
  25263. };
  25264. }
  25265. function lineSuffix(contents) {
  25266. if (false) {
  25267. assertDoc(contents);
  25268. }
  25269. return {
  25270. type: "line-suffix",
  25271. contents
  25272. };
  25273. }
  25274. var lineSuffixBoundary = {
  25275. type: "line-suffix-boundary"
  25276. };
  25277. var breakParent = {
  25278. type: "break-parent"
  25279. };
  25280. var trim = {
  25281. type: "trim"
  25282. };
  25283. var hardlineWithoutBreakParent = {
  25284. type: "line",
  25285. hard: true
  25286. };
  25287. var literallineWithoutBreakParent = {
  25288. type: "line",
  25289. hard: true,
  25290. literal: true
  25291. };
  25292. var line = {
  25293. type: "line"
  25294. };
  25295. var softline = {
  25296. type: "line",
  25297. soft: true
  25298. };
  25299. var hardline = concat([hardlineWithoutBreakParent, breakParent]);
  25300. var literalline = concat([literallineWithoutBreakParent, breakParent]);
  25301. var cursor = {
  25302. type: "cursor",
  25303. placeholder: Symbol("cursor")
  25304. };
  25305. function join(sep, arr) {
  25306. const res = [];
  25307. for (let i = 0; i < arr.length; i++) {
  25308. if (i !== 0) {
  25309. res.push(sep);
  25310. }
  25311. res.push(arr[i]);
  25312. }
  25313. return concat(res);
  25314. }
  25315. function addAlignmentToDoc(doc2, size, tabWidth) {
  25316. let aligned = doc2;
  25317. if (size > 0) {
  25318. for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
  25319. aligned = indent(aligned);
  25320. }
  25321. aligned = align(size % tabWidth, aligned);
  25322. aligned = align(Number.NEGATIVE_INFINITY, aligned);
  25323. }
  25324. return aligned;
  25325. }
  25326. function label(label2, contents) {
  25327. return {
  25328. type: "label",
  25329. label: label2,
  25330. contents
  25331. };
  25332. }
  25333. module2.exports = {
  25334. concat,
  25335. join,
  25336. line,
  25337. softline,
  25338. hardline,
  25339. literalline,
  25340. group,
  25341. conditionalGroup,
  25342. fill,
  25343. lineSuffix,
  25344. lineSuffixBoundary,
  25345. cursor,
  25346. breakParent,
  25347. ifBreak,
  25348. trim,
  25349. indent,
  25350. indentIfBreak,
  25351. align,
  25352. addAlignmentToDoc,
  25353. markAsRoot,
  25354. dedentToRoot,
  25355. dedent,
  25356. hardlineWithoutBreakParent,
  25357. literallineWithoutBreakParent,
  25358. label
  25359. };
  25360. }
  25361. });
  25362. var require_doc_utils = __commonJS2({
  25363. "src/document/doc-utils.js"(exports2, module2) {
  25364. "use strict";
  25365. var getLast = require_get_last();
  25366. var {
  25367. literalline,
  25368. join
  25369. } = require_doc_builders();
  25370. var isConcat = (doc2) => Array.isArray(doc2) || doc2 && doc2.type === "concat";
  25371. var getDocParts = (doc2) => {
  25372. if (Array.isArray(doc2)) {
  25373. return doc2;
  25374. }
  25375. if (doc2.type !== "concat" && doc2.type !== "fill") {
  25376. throw new Error("Expect doc type to be `concat` or `fill`.");
  25377. }
  25378. return doc2.parts;
  25379. };
  25380. var traverseDocOnExitStackMarker = {};
  25381. function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) {
  25382. const docsStack = [doc2];
  25383. while (docsStack.length > 0) {
  25384. const doc3 = docsStack.pop();
  25385. if (doc3 === traverseDocOnExitStackMarker) {
  25386. onExit(docsStack.pop());
  25387. continue;
  25388. }
  25389. if (onExit) {
  25390. docsStack.push(doc3, traverseDocOnExitStackMarker);
  25391. }
  25392. if (!onEnter || onEnter(doc3) !== false) {
  25393. if (isConcat(doc3) || doc3.type === "fill") {
  25394. const parts = getDocParts(doc3);
  25395. for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
  25396. docsStack.push(parts[i]);
  25397. }
  25398. } else if (doc3.type === "if-break") {
  25399. if (doc3.flatContents) {
  25400. docsStack.push(doc3.flatContents);
  25401. }
  25402. if (doc3.breakContents) {
  25403. docsStack.push(doc3.breakContents);
  25404. }
  25405. } else if (doc3.type === "group" && doc3.expandedStates) {
  25406. if (shouldTraverseConditionalGroups) {
  25407. for (let ic = doc3.expandedStates.length, i = ic - 1; i >= 0; --i) {
  25408. docsStack.push(doc3.expandedStates[i]);
  25409. }
  25410. } else {
  25411. docsStack.push(doc3.contents);
  25412. }
  25413. } else if (doc3.contents) {
  25414. docsStack.push(doc3.contents);
  25415. }
  25416. }
  25417. }
  25418. }
  25419. function mapDoc(doc2, cb) {
  25420. const mapped = /* @__PURE__ */ new Map();
  25421. return rec(doc2);
  25422. function rec(doc3) {
  25423. if (mapped.has(doc3)) {
  25424. return mapped.get(doc3);
  25425. }
  25426. const result = process2(doc3);
  25427. mapped.set(doc3, result);
  25428. return result;
  25429. }
  25430. function process2(doc3) {
  25431. if (Array.isArray(doc3)) {
  25432. return cb(doc3.map(rec));
  25433. }
  25434. if (doc3.type === "concat" || doc3.type === "fill") {
  25435. const parts = doc3.parts.map(rec);
  25436. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25437. parts
  25438. }));
  25439. }
  25440. if (doc3.type === "if-break") {
  25441. const breakContents = doc3.breakContents && rec(doc3.breakContents);
  25442. const flatContents = doc3.flatContents && rec(doc3.flatContents);
  25443. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25444. breakContents,
  25445. flatContents
  25446. }));
  25447. }
  25448. if (doc3.type === "group" && doc3.expandedStates) {
  25449. const expandedStates = doc3.expandedStates.map(rec);
  25450. const contents = expandedStates[0];
  25451. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25452. contents,
  25453. expandedStates
  25454. }));
  25455. }
  25456. if (doc3.contents) {
  25457. const contents = rec(doc3.contents);
  25458. return cb(Object.assign(Object.assign({}, doc3), {}, {
  25459. contents
  25460. }));
  25461. }
  25462. return cb(doc3);
  25463. }
  25464. }
  25465. function findInDoc(doc2, fn, defaultValue) {
  25466. let result = defaultValue;
  25467. let hasStopped = false;
  25468. function findInDocOnEnterFn(doc3) {
  25469. const maybeResult = fn(doc3);
  25470. if (maybeResult !== void 0) {
  25471. hasStopped = true;
  25472. result = maybeResult;
  25473. }
  25474. if (hasStopped) {
  25475. return false;
  25476. }
  25477. }
  25478. traverseDoc(doc2, findInDocOnEnterFn);
  25479. return result;
  25480. }
  25481. function willBreakFn(doc2) {
  25482. if (doc2.type === "group" && doc2.break) {
  25483. return true;
  25484. }
  25485. if (doc2.type === "line" && doc2.hard) {
  25486. return true;
  25487. }
  25488. if (doc2.type === "break-parent") {
  25489. return true;
  25490. }
  25491. }
  25492. function willBreak(doc2) {
  25493. return findInDoc(doc2, willBreakFn, false);
  25494. }
  25495. function breakParentGroup(groupStack) {
  25496. if (groupStack.length > 0) {
  25497. const parentGroup = getLast(groupStack);
  25498. if (!parentGroup.expandedStates && !parentGroup.break) {
  25499. parentGroup.break = "propagated";
  25500. }
  25501. }
  25502. return null;
  25503. }
  25504. function propagateBreaks(doc2) {
  25505. const alreadyVisitedSet = /* @__PURE__ */ new Set();
  25506. const groupStack = [];
  25507. function propagateBreaksOnEnterFn(doc3) {
  25508. if (doc3.type === "break-parent") {
  25509. breakParentGroup(groupStack);
  25510. }
  25511. if (doc3.type === "group") {
  25512. groupStack.push(doc3);
  25513. if (alreadyVisitedSet.has(doc3)) {
  25514. return false;
  25515. }
  25516. alreadyVisitedSet.add(doc3);
  25517. }
  25518. }
  25519. function propagateBreaksOnExitFn(doc3) {
  25520. if (doc3.type === "group") {
  25521. const group = groupStack.pop();
  25522. if (group.break) {
  25523. breakParentGroup(groupStack);
  25524. }
  25525. }
  25526. }
  25527. traverseDoc(doc2, propagateBreaksOnEnterFn, propagateBreaksOnExitFn, true);
  25528. }
  25529. function removeLinesFn(doc2) {
  25530. if (doc2.type === "line" && !doc2.hard) {
  25531. return doc2.soft ? "" : " ";
  25532. }
  25533. if (doc2.type === "if-break") {
  25534. return doc2.flatContents || "";
  25535. }
  25536. return doc2;
  25537. }
  25538. function removeLines(doc2) {
  25539. return mapDoc(doc2, removeLinesFn);
  25540. }
  25541. var isHardline = (doc2, nextDoc) => doc2 && doc2.type === "line" && doc2.hard && nextDoc && nextDoc.type === "break-parent";
  25542. function stripDocTrailingHardlineFromDoc(doc2) {
  25543. if (!doc2) {
  25544. return doc2;
  25545. }
  25546. if (isConcat(doc2) || doc2.type === "fill") {
  25547. const parts = getDocParts(doc2);
  25548. while (parts.length > 1 && isHardline(...parts.slice(-2))) {
  25549. parts.length -= 2;
  25550. }
  25551. if (parts.length > 0) {
  25552. const lastPart = stripDocTrailingHardlineFromDoc(getLast(parts));
  25553. parts[parts.length - 1] = lastPart;
  25554. }
  25555. return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
  25556. parts
  25557. });
  25558. }
  25559. switch (doc2.type) {
  25560. case "align":
  25561. case "indent":
  25562. case "indent-if-break":
  25563. case "group":
  25564. case "line-suffix":
  25565. case "label": {
  25566. const contents = stripDocTrailingHardlineFromDoc(doc2.contents);
  25567. return Object.assign(Object.assign({}, doc2), {}, {
  25568. contents
  25569. });
  25570. }
  25571. case "if-break": {
  25572. const breakContents = stripDocTrailingHardlineFromDoc(doc2.breakContents);
  25573. const flatContents = stripDocTrailingHardlineFromDoc(doc2.flatContents);
  25574. return Object.assign(Object.assign({}, doc2), {}, {
  25575. breakContents,
  25576. flatContents
  25577. });
  25578. }
  25579. }
  25580. return doc2;
  25581. }
  25582. function stripTrailingHardline(doc2) {
  25583. return stripDocTrailingHardlineFromDoc(cleanDoc(doc2));
  25584. }
  25585. function cleanDocFn(doc2) {
  25586. switch (doc2.type) {
  25587. case "fill":
  25588. if (doc2.parts.every((part) => part === "")) {
  25589. return "";
  25590. }
  25591. break;
  25592. case "group":
  25593. if (!doc2.contents && !doc2.id && !doc2.break && !doc2.expandedStates) {
  25594. return "";
  25595. }
  25596. if (doc2.contents.type === "group" && doc2.contents.id === doc2.id && doc2.contents.break === doc2.break && doc2.contents.expandedStates === doc2.expandedStates) {
  25597. return doc2.contents;
  25598. }
  25599. break;
  25600. case "align":
  25601. case "indent":
  25602. case "indent-if-break":
  25603. case "line-suffix":
  25604. if (!doc2.contents) {
  25605. return "";
  25606. }
  25607. break;
  25608. case "if-break":
  25609. if (!doc2.flatContents && !doc2.breakContents) {
  25610. return "";
  25611. }
  25612. break;
  25613. }
  25614. if (!isConcat(doc2)) {
  25615. return doc2;
  25616. }
  25617. const parts = [];
  25618. for (const part of getDocParts(doc2)) {
  25619. if (!part) {
  25620. continue;
  25621. }
  25622. const [currentPart, ...restParts] = isConcat(part) ? getDocParts(part) : [part];
  25623. if (typeof currentPart === "string" && typeof getLast(parts) === "string") {
  25624. parts[parts.length - 1] += currentPart;
  25625. } else {
  25626. parts.push(currentPart);
  25627. }
  25628. parts.push(...restParts);
  25629. }
  25630. if (parts.length === 0) {
  25631. return "";
  25632. }
  25633. if (parts.length === 1) {
  25634. return parts[0];
  25635. }
  25636. return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
  25637. parts
  25638. });
  25639. }
  25640. function cleanDoc(doc2) {
  25641. return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
  25642. }
  25643. function normalizeParts(parts) {
  25644. const newParts = [];
  25645. const restParts = parts.filter(Boolean);
  25646. while (restParts.length > 0) {
  25647. const part = restParts.shift();
  25648. if (!part) {
  25649. continue;
  25650. }
  25651. if (isConcat(part)) {
  25652. restParts.unshift(...getDocParts(part));
  25653. continue;
  25654. }
  25655. if (newParts.length > 0 && typeof getLast(newParts) === "string" && typeof part === "string") {
  25656. newParts[newParts.length - 1] += part;
  25657. continue;
  25658. }
  25659. newParts.push(part);
  25660. }
  25661. return newParts;
  25662. }
  25663. function normalizeDoc(doc2) {
  25664. return mapDoc(doc2, (currentDoc) => {
  25665. if (Array.isArray(currentDoc)) {
  25666. return normalizeParts(currentDoc);
  25667. }
  25668. if (!currentDoc.parts) {
  25669. return currentDoc;
  25670. }
  25671. return Object.assign(Object.assign({}, currentDoc), {}, {
  25672. parts: normalizeParts(currentDoc.parts)
  25673. });
  25674. });
  25675. }
  25676. function replaceEndOfLine(doc2) {
  25677. return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" && currentDoc.includes("\n") ? replaceTextEndOfLine(currentDoc) : currentDoc);
  25678. }
  25679. function replaceTextEndOfLine(text, replacement = literalline) {
  25680. return join(replacement, text.split("\n")).parts;
  25681. }
  25682. function canBreakFn(doc2) {
  25683. if (doc2.type === "line") {
  25684. return true;
  25685. }
  25686. }
  25687. function canBreak(doc2) {
  25688. return findInDoc(doc2, canBreakFn, false);
  25689. }
  25690. module2.exports = {
  25691. isConcat,
  25692. getDocParts,
  25693. willBreak,
  25694. traverseDoc,
  25695. findInDoc,
  25696. mapDoc,
  25697. propagateBreaks,
  25698. removeLines,
  25699. stripTrailingHardline,
  25700. normalizeParts,
  25701. normalizeDoc,
  25702. cleanDoc,
  25703. replaceTextEndOfLine,
  25704. replaceEndOfLine,
  25705. canBreak
  25706. };
  25707. }
  25708. });
  25709. var require_misc = __commonJS2({
  25710. "src/language-js/print/misc.js"(exports2, module2) {
  25711. "use strict";
  25712. var {
  25713. isNonEmptyArray
  25714. } = require_util();
  25715. var {
  25716. builders: {
  25717. indent,
  25718. join,
  25719. line
  25720. }
  25721. } = require("./doc.js");
  25722. var {
  25723. isFlowAnnotationComment
  25724. } = require_utils7();
  25725. function printOptionalToken(path) {
  25726. const node = path.getValue();
  25727. if (!node.optional || node.type === "Identifier" && node === path.getParentNode().key) {
  25728. return "";
  25729. }
  25730. if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
  25731. return "?.";
  25732. }
  25733. return "?";
  25734. }
  25735. function printDefiniteToken(path) {
  25736. return path.getValue().definite || path.match(void 0, (node, name) => name === "id" && node.type === "VariableDeclarator" && node.definite) ? "!" : "";
  25737. }
  25738. function printFunctionTypeParameters(path, options, print) {
  25739. const fun = path.getValue();
  25740. if (fun.typeArguments) {
  25741. return print("typeArguments");
  25742. }
  25743. if (fun.typeParameters) {
  25744. return print("typeParameters");
  25745. }
  25746. return "";
  25747. }
  25748. function printTypeAnnotation(path, options, print) {
  25749. const node = path.getValue();
  25750. if (!node.typeAnnotation) {
  25751. return "";
  25752. }
  25753. const parentNode = path.getParentNode();
  25754. const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
  25755. if (isFlowAnnotationComment(options.originalText, node.typeAnnotation)) {
  25756. return [" /*: ", print("typeAnnotation"), " */"];
  25757. }
  25758. return [isFunctionDeclarationIdentifier ? "" : ": ", print("typeAnnotation")];
  25759. }
  25760. function printBindExpressionCallee(path, options, print) {
  25761. return ["::", print("callee")];
  25762. }
  25763. function printTypeScriptModifiers(path, options, print) {
  25764. const node = path.getValue();
  25765. if (!isNonEmptyArray(node.modifiers)) {
  25766. return "";
  25767. }
  25768. return [join(" ", path.map(print, "modifiers")), " "];
  25769. }
  25770. function adjustClause(node, clause, forceSpace) {
  25771. if (node.type === "EmptyStatement") {
  25772. return ";";
  25773. }
  25774. if (node.type === "BlockStatement" || forceSpace) {
  25775. return [" ", clause];
  25776. }
  25777. return indent([line, clause]);
  25778. }
  25779. function printRestSpread(path, options, print) {
  25780. return ["...", print("argument"), printTypeAnnotation(path, options, print)];
  25781. }
  25782. function printDirective(rawText, options) {
  25783. const rawContent = rawText.slice(1, -1);
  25784. if (rawContent.includes('"') || rawContent.includes("'")) {
  25785. return rawText;
  25786. }
  25787. const enclosingQuote = options.singleQuote ? "'" : '"';
  25788. return enclosingQuote + rawContent + enclosingQuote;
  25789. }
  25790. module2.exports = {
  25791. printOptionalToken,
  25792. printDefiniteToken,
  25793. printFunctionTypeParameters,
  25794. printBindExpressionCallee,
  25795. printTypeScriptModifiers,
  25796. printTypeAnnotation,
  25797. printRestSpread,
  25798. adjustClause,
  25799. printDirective
  25800. };
  25801. }
  25802. });
  25803. var require_array4 = __commonJS2({
  25804. "src/language-js/print/array.js"(exports2, module2) {
  25805. "use strict";
  25806. var {
  25807. printDanglingComments
  25808. } = require_comments();
  25809. var {
  25810. builders: {
  25811. line,
  25812. softline,
  25813. hardline,
  25814. group,
  25815. indent,
  25816. ifBreak,
  25817. fill
  25818. }
  25819. } = require("./doc.js");
  25820. var {
  25821. getLast,
  25822. hasNewline
  25823. } = require_util();
  25824. var {
  25825. shouldPrintComma,
  25826. hasComment,
  25827. CommentCheckFlags,
  25828. isNextLineEmpty,
  25829. isNumericLiteral,
  25830. isSignedNumericLiteral
  25831. } = require_utils7();
  25832. var {
  25833. locStart
  25834. } = require_loc();
  25835. var {
  25836. printOptionalToken,
  25837. printTypeAnnotation
  25838. } = require_misc();
  25839. function printArray(path, options, print) {
  25840. const node = path.getValue();
  25841. const parts = [];
  25842. const openBracket = node.type === "TupleExpression" ? "#[" : "[";
  25843. const closeBracket = "]";
  25844. if (node.elements.length === 0) {
  25845. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  25846. parts.push(openBracket, closeBracket);
  25847. } else {
  25848. parts.push(group([openBracket, printDanglingComments(path, options), softline, closeBracket]));
  25849. }
  25850. } else {
  25851. const lastElem = getLast(node.elements);
  25852. const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement");
  25853. const needsForcedTrailingComma = lastElem === null;
  25854. const groupId = Symbol("array");
  25855. const shouldBreak = !options.__inJestEach && node.elements.length > 1 && node.elements.every((element, i, elements) => {
  25856. const elementType = element && element.type;
  25857. if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
  25858. return false;
  25859. }
  25860. const nextElement = elements[i + 1];
  25861. if (nextElement && elementType !== nextElement.type) {
  25862. return false;
  25863. }
  25864. const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
  25865. return element[itemsKey] && element[itemsKey].length > 1;
  25866. });
  25867. const shouldUseConciseFormatting = isConciselyPrintedArray(node, options);
  25868. const trailingComma = !canHaveTrailingComma ? "" : needsForcedTrailingComma ? "," : !shouldPrintComma(options) ? "" : shouldUseConciseFormatting ? ifBreak(",", "", {
  25869. groupId
  25870. }) : ifBreak(",");
  25871. parts.push(group([openBracket, indent([softline, shouldUseConciseFormatting ? printArrayItemsConcisely(path, options, print, trailingComma) : [printArrayItems(path, options, "elements", print), trailingComma], printDanglingComments(path, options, true)]), softline, closeBracket], {
  25872. shouldBreak,
  25873. id: groupId
  25874. }));
  25875. }
  25876. parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
  25877. return parts;
  25878. }
  25879. function isConciselyPrintedArray(node, options) {
  25880. 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), {
  25881. backwards: true
  25882. })));
  25883. }
  25884. function printArrayItems(path, options, printPath, print) {
  25885. const printedElements = [];
  25886. let separatorParts = [];
  25887. path.each((childPath) => {
  25888. printedElements.push(separatorParts, group(print()));
  25889. separatorParts = [",", line];
  25890. if (childPath.getValue() && isNextLineEmpty(childPath.getValue(), options)) {
  25891. separatorParts.push(softline);
  25892. }
  25893. }, printPath);
  25894. return printedElements;
  25895. }
  25896. function printArrayItemsConcisely(path, options, print, trailingComma) {
  25897. const parts = [];
  25898. path.each((childPath, i, elements) => {
  25899. const isLast = i === elements.length - 1;
  25900. parts.push([print(), isLast ? trailingComma : ","]);
  25901. if (!isLast) {
  25902. parts.push(isNextLineEmpty(childPath.getValue(), options) ? [hardline, hardline] : hasComment(elements[i + 1], CommentCheckFlags.Leading | CommentCheckFlags.Line) ? hardline : line);
  25903. }
  25904. }, "elements");
  25905. return fill(parts);
  25906. }
  25907. module2.exports = {
  25908. printArray,
  25909. printArrayItems,
  25910. isConciselyPrintedArray
  25911. };
  25912. }
  25913. });
  25914. var require_call_arguments = __commonJS2({
  25915. "src/language-js/print/call-arguments.js"(exports2, module2) {
  25916. "use strict";
  25917. var {
  25918. printDanglingComments
  25919. } = require_comments();
  25920. var {
  25921. getLast,
  25922. getPenultimate
  25923. } = require_util();
  25924. var {
  25925. getFunctionParameters,
  25926. hasComment,
  25927. CommentCheckFlags,
  25928. isFunctionCompositionArgs,
  25929. isJsxNode,
  25930. isLongCurriedCallExpression,
  25931. shouldPrintComma,
  25932. getCallArguments,
  25933. iterateCallArgumentsPath,
  25934. isNextLineEmpty,
  25935. isCallExpression,
  25936. isStringLiteral,
  25937. isObjectProperty,
  25938. isTSTypeExpression
  25939. } = require_utils7();
  25940. var {
  25941. builders: {
  25942. line,
  25943. hardline,
  25944. softline,
  25945. group,
  25946. indent,
  25947. conditionalGroup,
  25948. ifBreak,
  25949. breakParent
  25950. },
  25951. utils: {
  25952. willBreak
  25953. }
  25954. } = require("./doc.js");
  25955. var {
  25956. ArgExpansionBailout
  25957. } = require_errors();
  25958. var {
  25959. isConciselyPrintedArray
  25960. } = require_array4();
  25961. function printCallArguments(path, options, print) {
  25962. const node = path.getValue();
  25963. const isDynamicImport = node.type === "ImportExpression";
  25964. const args = getCallArguments(node);
  25965. if (args.length === 0) {
  25966. return ["(", printDanglingComments(path, options, true), ")"];
  25967. }
  25968. if (isReactHookCallWithDepsArray(args)) {
  25969. return ["(", print(["arguments", 0]), ", ", print(["arguments", 1]), ")"];
  25970. }
  25971. let anyArgEmptyLine = false;
  25972. let hasEmptyLineFollowingFirstArg = false;
  25973. const lastArgIndex = args.length - 1;
  25974. const printedArguments = [];
  25975. iterateCallArgumentsPath(path, (argPath, index) => {
  25976. const arg = argPath.getNode();
  25977. const parts = [print()];
  25978. if (index === lastArgIndex) {
  25979. } else if (isNextLineEmpty(arg, options)) {
  25980. if (index === 0) {
  25981. hasEmptyLineFollowingFirstArg = true;
  25982. }
  25983. anyArgEmptyLine = true;
  25984. parts.push(",", hardline, hardline);
  25985. } else {
  25986. parts.push(",", line);
  25987. }
  25988. printedArguments.push(parts);
  25989. });
  25990. const maybeTrailingComma = !(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : "";
  25991. function allArgsBrokenOut() {
  25992. return group(["(", indent([line, ...printedArguments]), maybeTrailingComma, line, ")"], {
  25993. shouldBreak: true
  25994. });
  25995. }
  25996. if (anyArgEmptyLine || path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs(args)) {
  25997. return allArgsBrokenOut();
  25998. }
  25999. const shouldGroupFirst = shouldGroupFirstArg(args);
  26000. const shouldGroupLast = shouldGroupLastArg(args, options);
  26001. if (shouldGroupFirst || shouldGroupLast) {
  26002. if (shouldGroupFirst ? printedArguments.slice(1).some(willBreak) : printedArguments.slice(0, -1).some(willBreak)) {
  26003. return allArgsBrokenOut();
  26004. }
  26005. let printedExpanded = [];
  26006. try {
  26007. path.try(() => {
  26008. iterateCallArgumentsPath(path, (argPath, i) => {
  26009. if (shouldGroupFirst && i === 0) {
  26010. printedExpanded = [[print([], {
  26011. expandFirstArg: true
  26012. }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline : line, hasEmptyLineFollowingFirstArg ? hardline : ""], ...printedArguments.slice(1)];
  26013. }
  26014. if (shouldGroupLast && i === lastArgIndex) {
  26015. printedExpanded = [...printedArguments.slice(0, -1), print([], {
  26016. expandLastArg: true
  26017. })];
  26018. }
  26019. });
  26020. });
  26021. } catch (caught) {
  26022. if (caught instanceof ArgExpansionBailout) {
  26023. return allArgsBrokenOut();
  26024. }
  26025. throw caught;
  26026. }
  26027. return [printedArguments.some(willBreak) ? breakParent : "", conditionalGroup([["(", ...printedExpanded, ")"], shouldGroupFirst ? ["(", group(printedExpanded[0], {
  26028. shouldBreak: true
  26029. }), ...printedExpanded.slice(1), ")"] : ["(", ...printedArguments.slice(0, -1), group(getLast(printedExpanded), {
  26030. shouldBreak: true
  26031. }), ")"], allArgsBrokenOut()])];
  26032. }
  26033. const contents = ["(", indent([softline, ...printedArguments]), ifBreak(maybeTrailingComma), softline, ")"];
  26034. if (isLongCurriedCallExpression(path)) {
  26035. return contents;
  26036. }
  26037. return group(contents, {
  26038. shouldBreak: printedArguments.some(willBreak) || anyArgEmptyLine
  26039. });
  26040. }
  26041. function couldGroupArg(arg, arrowChainRecursion = false) {
  26042. 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";
  26043. }
  26044. function shouldGroupLastArg(args, options) {
  26045. const lastArg = getLast(args);
  26046. const penultimateArg = getPenultimate(args);
  26047. 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));
  26048. }
  26049. function shouldGroupFirstArg(args) {
  26050. if (args.length !== 2) {
  26051. return false;
  26052. }
  26053. const [firstArg, secondArg] = args;
  26054. if (firstArg.type === "ModuleExpression" && isTypeModuleObjectExpression(secondArg)) {
  26055. return true;
  26056. }
  26057. return !hasComment(firstArg) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
  26058. }
  26059. function isReactHookCallWithDepsArray(args) {
  26060. 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));
  26061. }
  26062. function isNonEmptyBlockStatement(node) {
  26063. return node.type === "BlockStatement" && (node.body.some((node2) => node2.type !== "EmptyStatement") || hasComment(node, CommentCheckFlags.Dangling));
  26064. }
  26065. function isTypeModuleObjectExpression(node) {
  26066. 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";
  26067. }
  26068. module2.exports = printCallArguments;
  26069. }
  26070. });
  26071. var require_member = __commonJS2({
  26072. "src/language-js/print/member.js"(exports2, module2) {
  26073. "use strict";
  26074. var {
  26075. builders: {
  26076. softline,
  26077. group,
  26078. indent,
  26079. label
  26080. }
  26081. } = require("./doc.js");
  26082. var {
  26083. isNumericLiteral,
  26084. isMemberExpression,
  26085. isCallExpression
  26086. } = require_utils7();
  26087. var {
  26088. printOptionalToken
  26089. } = require_misc();
  26090. function printMemberExpression(path, options, print) {
  26091. const node = path.getValue();
  26092. const parent = path.getParentNode();
  26093. let firstNonMemberParent;
  26094. let i = 0;
  26095. do {
  26096. firstNonMemberParent = path.getParentNode(i);
  26097. i++;
  26098. } while (firstNonMemberParent && (isMemberExpression(firstNonMemberParent) || firstNonMemberParent.type === "TSNonNullExpression"));
  26099. const objectDoc = print("object");
  26100. const lookupDoc = printMemberLookup(path, options, print);
  26101. 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");
  26102. return label(objectDoc.label === "member-chain" ? "member-chain" : "member", [objectDoc, shouldInline ? lookupDoc : group(indent([softline, lookupDoc]))]);
  26103. }
  26104. function printMemberLookup(path, options, print) {
  26105. const property = print("property");
  26106. const node = path.getValue();
  26107. const optional = printOptionalToken(path);
  26108. if (!node.computed) {
  26109. return [optional, ".", property];
  26110. }
  26111. if (!node.property || isNumericLiteral(node.property)) {
  26112. return [optional, "[", property, "]"];
  26113. }
  26114. return group([optional, "[", indent([softline, property]), softline, "]"]);
  26115. }
  26116. module2.exports = {
  26117. printMemberExpression,
  26118. printMemberLookup
  26119. };
  26120. }
  26121. });
  26122. var require_member_chain = __commonJS2({
  26123. "src/language-js/print/member-chain.js"(exports2, module2) {
  26124. "use strict";
  26125. var {
  26126. printComments
  26127. } = require_comments();
  26128. var {
  26129. getLast,
  26130. isNextLineEmptyAfterIndex,
  26131. getNextNonSpaceNonCommentCharacterIndex
  26132. } = require_util();
  26133. var pathNeedsParens = require_needs_parens();
  26134. var {
  26135. isCallExpression,
  26136. isMemberExpression,
  26137. isFunctionOrArrowExpression,
  26138. isLongCurriedCallExpression,
  26139. isMemberish,
  26140. isNumericLiteral,
  26141. isSimpleCallArgument,
  26142. hasComment,
  26143. CommentCheckFlags,
  26144. isNextLineEmpty
  26145. } = require_utils7();
  26146. var {
  26147. locEnd
  26148. } = require_loc();
  26149. var {
  26150. builders: {
  26151. join,
  26152. hardline,
  26153. group,
  26154. indent,
  26155. conditionalGroup,
  26156. breakParent,
  26157. label
  26158. },
  26159. utils: {
  26160. willBreak
  26161. }
  26162. } = require("./doc.js");
  26163. var printCallArguments = require_call_arguments();
  26164. var {
  26165. printMemberLookup
  26166. } = require_member();
  26167. var {
  26168. printOptionalToken,
  26169. printFunctionTypeParameters,
  26170. printBindExpressionCallee
  26171. } = require_misc();
  26172. function printMemberChain(path, options, print) {
  26173. const parent = path.getParentNode();
  26174. const isExpressionStatement = !parent || parent.type === "ExpressionStatement";
  26175. const printedNodes = [];
  26176. function shouldInsertEmptyLineAfter(node2) {
  26177. const {
  26178. originalText
  26179. } = options;
  26180. const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex(originalText, node2, locEnd);
  26181. const nextChar = originalText.charAt(nextCharIndex);
  26182. if (nextChar === ")") {
  26183. return nextCharIndex !== false && isNextLineEmptyAfterIndex(originalText, nextCharIndex + 1);
  26184. }
  26185. return isNextLineEmpty(node2, options);
  26186. }
  26187. function rec(path2) {
  26188. const node2 = path2.getValue();
  26189. if (isCallExpression(node2) && (isMemberish(node2.callee) || isCallExpression(node2.callee))) {
  26190. printedNodes.unshift({
  26191. node: node2,
  26192. printed: [printComments(path2, [printOptionalToken(path2), printFunctionTypeParameters(path2, options, print), printCallArguments(path2, options, print)], options), shouldInsertEmptyLineAfter(node2) ? hardline : ""]
  26193. });
  26194. path2.call((callee) => rec(callee), "callee");
  26195. } else if (isMemberish(node2)) {
  26196. printedNodes.unshift({
  26197. node: node2,
  26198. needsParens: pathNeedsParens(path2, options),
  26199. printed: printComments(path2, isMemberExpression(node2) ? printMemberLookup(path2, options, print) : printBindExpressionCallee(path2, options, print), options)
  26200. });
  26201. path2.call((object) => rec(object), "object");
  26202. } else if (node2.type === "TSNonNullExpression") {
  26203. printedNodes.unshift({
  26204. node: node2,
  26205. printed: printComments(path2, "!", options)
  26206. });
  26207. path2.call((expression) => rec(expression), "expression");
  26208. } else {
  26209. printedNodes.unshift({
  26210. node: node2,
  26211. printed: print()
  26212. });
  26213. }
  26214. }
  26215. const node = path.getValue();
  26216. printedNodes.unshift({
  26217. node,
  26218. printed: [printOptionalToken(path), printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)]
  26219. });
  26220. if (node.callee) {
  26221. path.call((callee) => rec(callee), "callee");
  26222. }
  26223. const groups = [];
  26224. let currentGroup = [printedNodes[0]];
  26225. let i = 1;
  26226. for (; i < printedNodes.length; ++i) {
  26227. if (printedNodes[i].node.type === "TSNonNullExpression" || isCallExpression(printedNodes[i].node) || isMemberExpression(printedNodes[i].node) && printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  26228. currentGroup.push(printedNodes[i]);
  26229. } else {
  26230. break;
  26231. }
  26232. }
  26233. if (!isCallExpression(printedNodes[0].node)) {
  26234. for (; i + 1 < printedNodes.length; ++i) {
  26235. if (isMemberish(printedNodes[i].node) && isMemberish(printedNodes[i + 1].node)) {
  26236. currentGroup.push(printedNodes[i]);
  26237. } else {
  26238. break;
  26239. }
  26240. }
  26241. }
  26242. groups.push(currentGroup);
  26243. currentGroup = [];
  26244. let hasSeenCallExpression = false;
  26245. for (; i < printedNodes.length; ++i) {
  26246. if (hasSeenCallExpression && isMemberish(printedNodes[i].node)) {
  26247. if (printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  26248. currentGroup.push(printedNodes[i]);
  26249. continue;
  26250. }
  26251. groups.push(currentGroup);
  26252. currentGroup = [];
  26253. hasSeenCallExpression = false;
  26254. }
  26255. if (isCallExpression(printedNodes[i].node) || printedNodes[i].node.type === "ImportExpression") {
  26256. hasSeenCallExpression = true;
  26257. }
  26258. currentGroup.push(printedNodes[i]);
  26259. if (hasComment(printedNodes[i].node, CommentCheckFlags.Trailing)) {
  26260. groups.push(currentGroup);
  26261. currentGroup = [];
  26262. hasSeenCallExpression = false;
  26263. }
  26264. }
  26265. if (currentGroup.length > 0) {
  26266. groups.push(currentGroup);
  26267. }
  26268. function isFactory(name) {
  26269. return /^[A-Z]|^[$_]+$/.test(name);
  26270. }
  26271. function isShort(name) {
  26272. return name.length <= options.tabWidth;
  26273. }
  26274. function shouldNotWrap(groups2) {
  26275. const hasComputed = groups2[1].length > 0 && groups2[1][0].node.computed;
  26276. if (groups2[0].length === 1) {
  26277. const firstNode = groups2[0][0].node;
  26278. return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpressionStatement && isShort(firstNode.name) || hasComputed);
  26279. }
  26280. const lastNode = getLast(groups2[0]).node;
  26281. return isMemberExpression(lastNode) && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
  26282. }
  26283. const shouldMerge = groups.length >= 2 && !hasComment(groups[1][0].node) && shouldNotWrap(groups);
  26284. function printGroup(printedGroup) {
  26285. const printed = printedGroup.map((tuple) => tuple.printed);
  26286. if (printedGroup.length > 0 && getLast(printedGroup).needsParens) {
  26287. return ["(", ...printed, ")"];
  26288. }
  26289. return printed;
  26290. }
  26291. function printIndentedGroup(groups2) {
  26292. if (groups2.length === 0) {
  26293. return "";
  26294. }
  26295. return indent(group([hardline, join(hardline, groups2.map(printGroup))]));
  26296. }
  26297. const printedGroups = groups.map(printGroup);
  26298. const oneLine = printedGroups;
  26299. const cutoff = shouldMerge ? 3 : 2;
  26300. const flatGroups = groups.flat();
  26301. 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);
  26302. if (groups.length <= cutoff && !nodeHasComment) {
  26303. if (isLongCurriedCallExpression(path)) {
  26304. return oneLine;
  26305. }
  26306. return group(oneLine);
  26307. }
  26308. const lastNodeBeforeIndent = getLast(groups[shouldMerge ? 1 : 0]).node;
  26309. const shouldHaveEmptyLineBeforeIndent = !isCallExpression(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
  26310. const expanded = [printGroup(groups[0]), shouldMerge ? groups.slice(1, 2).map(printGroup) : "", shouldHaveEmptyLineBeforeIndent ? hardline : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))];
  26311. const callExpressions = printedNodes.map(({
  26312. node: node2
  26313. }) => node2).filter(isCallExpression);
  26314. function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
  26315. const lastGroupNode = getLast(getLast(groups)).node;
  26316. const lastGroupDoc = getLast(printedGroups);
  26317. return isCallExpression(lastGroupNode) && willBreak(lastGroupDoc) && callExpressions.slice(0, -1).some((node2) => node2.arguments.some(isFunctionOrArrowExpression));
  26318. }
  26319. let result;
  26320. if (nodeHasComment || callExpressions.length > 2 && callExpressions.some((expr) => !expr.arguments.every((arg) => isSimpleCallArgument(arg, 0))) || printedGroups.slice(0, -1).some(willBreak) || lastGroupWillBreakAndOtherCallsHaveFunctionArguments()) {
  26321. result = group(expanded);
  26322. } else {
  26323. result = [willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", conditionalGroup([oneLine, expanded])];
  26324. }
  26325. return label("member-chain", result);
  26326. }
  26327. module2.exports = printMemberChain;
  26328. }
  26329. });
  26330. var require_call_expression = __commonJS2({
  26331. "src/language-js/print/call-expression.js"(exports2, module2) {
  26332. "use strict";
  26333. var {
  26334. builders: {
  26335. join,
  26336. group
  26337. }
  26338. } = require("./doc.js");
  26339. var pathNeedsParens = require_needs_parens();
  26340. var {
  26341. getCallArguments,
  26342. hasFlowAnnotationComment,
  26343. isCallExpression,
  26344. isMemberish,
  26345. isStringLiteral,
  26346. isTemplateOnItsOwnLine,
  26347. isTestCall,
  26348. iterateCallArgumentsPath
  26349. } = require_utils7();
  26350. var printMemberChain = require_member_chain();
  26351. var printCallArguments = require_call_arguments();
  26352. var {
  26353. printOptionalToken,
  26354. printFunctionTypeParameters
  26355. } = require_misc();
  26356. function printCallExpression(path, options, print) {
  26357. const node = path.getValue();
  26358. const parentNode = path.getParentNode();
  26359. const isNew = node.type === "NewExpression";
  26360. const isDynamicImport = node.type === "ImportExpression";
  26361. const optional = printOptionalToken(path);
  26362. const args = getCallArguments(node);
  26363. if (args.length > 0 && (!isDynamicImport && !isNew && isCommonsJsOrAmdCall(node, parentNode) || args.length === 1 && isTemplateOnItsOwnLine(args[0], options.originalText) || !isNew && isTestCall(node, parentNode))) {
  26364. const printed = [];
  26365. iterateCallArgumentsPath(path, () => {
  26366. printed.push(print());
  26367. });
  26368. return [isNew ? "new " : "", print("callee"), optional, printFunctionTypeParameters(path, options, print), "(", join(", ", printed), ")"];
  26369. }
  26370. const isIdentifierWithFlowAnnotation = (options.parser === "babel" || options.parser === "babel-flow") && node.callee && node.callee.type === "Identifier" && hasFlowAnnotationComment(node.callee.trailingComments);
  26371. if (isIdentifierWithFlowAnnotation) {
  26372. node.callee.trailingComments[0].printed = true;
  26373. }
  26374. if (!isDynamicImport && !isNew && isMemberish(node.callee) && !path.call((path2) => pathNeedsParens(path2, options), "callee")) {
  26375. return printMemberChain(path, options, print);
  26376. }
  26377. 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)];
  26378. if (isDynamicImport || isCallExpression(node.callee)) {
  26379. return group(contents);
  26380. }
  26381. return contents;
  26382. }
  26383. function isCommonsJsOrAmdCall(node, parentNode) {
  26384. if (node.callee.type !== "Identifier") {
  26385. return false;
  26386. }
  26387. if (node.callee.name === "require") {
  26388. return true;
  26389. }
  26390. if (node.callee.name === "define") {
  26391. const args = getCallArguments(node);
  26392. return parentNode.type === "ExpressionStatement" && (args.length === 1 || args.length === 2 && args[0].type === "ArrayExpression" || args.length === 3 && isStringLiteral(args[0]) && args[1].type === "ArrayExpression");
  26393. }
  26394. return false;
  26395. }
  26396. module2.exports = {
  26397. printCallExpression
  26398. };
  26399. }
  26400. });
  26401. var require_assignment = __commonJS2({
  26402. "src/language-js/print/assignment.js"(exports2, module2) {
  26403. "use strict";
  26404. var {
  26405. isNonEmptyArray,
  26406. getStringWidth
  26407. } = require_util();
  26408. var {
  26409. builders: {
  26410. line,
  26411. group,
  26412. indent,
  26413. indentIfBreak,
  26414. lineSuffixBoundary
  26415. },
  26416. utils: {
  26417. cleanDoc,
  26418. willBreak,
  26419. canBreak
  26420. }
  26421. } = require("./doc.js");
  26422. var {
  26423. hasLeadingOwnLineComment,
  26424. isBinaryish,
  26425. isStringLiteral,
  26426. isLiteral,
  26427. isNumericLiteral,
  26428. isCallExpression,
  26429. isMemberExpression,
  26430. getCallArguments,
  26431. rawText,
  26432. hasComment,
  26433. isSignedNumericLiteral,
  26434. isObjectProperty
  26435. } = require_utils7();
  26436. var {
  26437. shouldInlineLogicalExpression
  26438. } = require_binaryish();
  26439. var {
  26440. printCallExpression
  26441. } = require_call_expression();
  26442. function printAssignment(path, options, print, leftDoc, operator, rightPropertyName) {
  26443. const layout = chooseLayout(path, options, print, leftDoc, rightPropertyName);
  26444. const rightDoc = print(rightPropertyName, {
  26445. assignmentLayout: layout
  26446. });
  26447. switch (layout) {
  26448. case "break-after-operator":
  26449. return group([group(leftDoc), operator, group(indent([line, rightDoc]))]);
  26450. case "never-break-after-operator":
  26451. return group([group(leftDoc), operator, " ", rightDoc]);
  26452. case "fluid": {
  26453. const groupId = Symbol("assignment");
  26454. return group([group(leftDoc), operator, group(indent(line), {
  26455. id: groupId
  26456. }), lineSuffixBoundary, indentIfBreak(rightDoc, {
  26457. groupId
  26458. })]);
  26459. }
  26460. case "break-lhs":
  26461. return group([leftDoc, operator, " ", group(rightDoc)]);
  26462. case "chain":
  26463. return [group(leftDoc), operator, line, rightDoc];
  26464. case "chain-tail":
  26465. return [group(leftDoc), operator, indent([line, rightDoc])];
  26466. case "chain-tail-arrow-chain":
  26467. return [group(leftDoc), operator, rightDoc];
  26468. case "only-left":
  26469. return leftDoc;
  26470. }
  26471. }
  26472. function printAssignmentExpression(path, options, print) {
  26473. const node = path.getValue();
  26474. return printAssignment(path, options, print, print("left"), [" ", node.operator], "right");
  26475. }
  26476. function printVariableDeclarator(path, options, print) {
  26477. return printAssignment(path, options, print, print("id"), " =", "init");
  26478. }
  26479. function chooseLayout(path, options, print, leftDoc, rightPropertyName) {
  26480. const node = path.getValue();
  26481. const rightNode = node[rightPropertyName];
  26482. if (!rightNode) {
  26483. return "only-left";
  26484. }
  26485. const isTail = !isAssignment(rightNode);
  26486. const shouldUseChainFormatting = path.match(isAssignment, isAssignmentOrVariableDeclarator, (node2) => !isTail || node2.type !== "ExpressionStatement" && node2.type !== "VariableDeclaration");
  26487. if (shouldUseChainFormatting) {
  26488. return !isTail ? "chain" : rightNode.type === "ArrowFunctionExpression" && rightNode.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail";
  26489. }
  26490. const isHeadOfLongChain = !isTail && isAssignment(rightNode.right);
  26491. if (isHeadOfLongChain || hasLeadingOwnLineComment(options.originalText, rightNode)) {
  26492. return "break-after-operator";
  26493. }
  26494. if (rightNode.type === "CallExpression" && rightNode.callee.name === "require" || options.parser === "json5" || options.parser === "json") {
  26495. return "never-break-after-operator";
  26496. }
  26497. if (isComplexDestructuring(node) || isComplexTypeAliasParams(node) || hasComplexTypeAnnotation(node) || isArrowFunctionVariableDeclarator(node) && canBreak(leftDoc)) {
  26498. return "break-lhs";
  26499. }
  26500. const hasShortKey = isObjectPropertyWithShortKey(node, leftDoc, options);
  26501. if (path.call(() => shouldBreakAfterOperator(path, options, print, hasShortKey), rightPropertyName)) {
  26502. return "break-after-operator";
  26503. }
  26504. if (hasShortKey || rightNode.type === "TemplateLiteral" || rightNode.type === "TaggedTemplateExpression" || rightNode.type === "BooleanLiteral" || isNumericLiteral(rightNode) || rightNode.type === "ClassExpression") {
  26505. return "never-break-after-operator";
  26506. }
  26507. return "fluid";
  26508. }
  26509. function shouldBreakAfterOperator(path, options, print, hasShortKey) {
  26510. const rightNode = path.getValue();
  26511. if (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
  26512. return true;
  26513. }
  26514. switch (rightNode.type) {
  26515. case "StringLiteralTypeAnnotation":
  26516. case "SequenceExpression":
  26517. return true;
  26518. case "ConditionalExpression": {
  26519. const {
  26520. test
  26521. } = rightNode;
  26522. return isBinaryish(test) && !shouldInlineLogicalExpression(test);
  26523. }
  26524. case "ClassExpression":
  26525. return isNonEmptyArray(rightNode.decorators);
  26526. }
  26527. if (hasShortKey) {
  26528. return false;
  26529. }
  26530. let node = rightNode;
  26531. const propertiesForPath = [];
  26532. for (; ; ) {
  26533. if (node.type === "UnaryExpression") {
  26534. node = node.argument;
  26535. propertiesForPath.push("argument");
  26536. } else if (node.type === "TSNonNullExpression") {
  26537. node = node.expression;
  26538. propertiesForPath.push("expression");
  26539. } else {
  26540. break;
  26541. }
  26542. }
  26543. if (isStringLiteral(node) || path.call(() => isPoorlyBreakableMemberOrCallChain(path, options, print), ...propertiesForPath)) {
  26544. return true;
  26545. }
  26546. return false;
  26547. }
  26548. function isComplexDestructuring(node) {
  26549. if (isAssignmentOrVariableDeclarator(node)) {
  26550. const leftNode = node.left || node.id;
  26551. return leftNode.type === "ObjectPattern" && leftNode.properties.length > 2 && leftNode.properties.some((property) => isObjectProperty(property) && (!property.shorthand || property.value && property.value.type === "AssignmentPattern"));
  26552. }
  26553. return false;
  26554. }
  26555. function isAssignment(node) {
  26556. return node.type === "AssignmentExpression";
  26557. }
  26558. function isAssignmentOrVariableDeclarator(node) {
  26559. return isAssignment(node) || node.type === "VariableDeclarator";
  26560. }
  26561. function isComplexTypeAliasParams(node) {
  26562. const typeParams = getTypeParametersFromTypeAlias(node);
  26563. if (isNonEmptyArray(typeParams)) {
  26564. const constraintPropertyName = node.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
  26565. if (typeParams.length > 1 && typeParams.some((param) => param[constraintPropertyName] || param.default)) {
  26566. return true;
  26567. }
  26568. }
  26569. return false;
  26570. }
  26571. function getTypeParametersFromTypeAlias(node) {
  26572. if (isTypeAlias(node) && node.typeParameters && node.typeParameters.params) {
  26573. return node.typeParameters.params;
  26574. }
  26575. return null;
  26576. }
  26577. function isTypeAlias(node) {
  26578. return node.type === "TSTypeAliasDeclaration" || node.type === "TypeAlias";
  26579. }
  26580. function hasComplexTypeAnnotation(node) {
  26581. if (node.type !== "VariableDeclarator") {
  26582. return false;
  26583. }
  26584. const {
  26585. typeAnnotation
  26586. } = node.id;
  26587. if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
  26588. return false;
  26589. }
  26590. const typeParams = getTypeParametersFromTypeReference(typeAnnotation.typeAnnotation);
  26591. return isNonEmptyArray(typeParams) && typeParams.length > 1 && typeParams.some((param) => isNonEmptyArray(getTypeParametersFromTypeReference(param)) || param.type === "TSConditionalType");
  26592. }
  26593. function isArrowFunctionVariableDeclarator(node) {
  26594. return node.type === "VariableDeclarator" && node.init && node.init.type === "ArrowFunctionExpression";
  26595. }
  26596. function getTypeParametersFromTypeReference(node) {
  26597. if (isTypeReference(node) && node.typeParameters && node.typeParameters.params) {
  26598. return node.typeParameters.params;
  26599. }
  26600. return null;
  26601. }
  26602. function isTypeReference(node) {
  26603. return node.type === "TSTypeReference" || node.type === "GenericTypeAnnotation";
  26604. }
  26605. function isPoorlyBreakableMemberOrCallChain(path, options, print, deep = false) {
  26606. const node = path.getValue();
  26607. const goDeeper = () => isPoorlyBreakableMemberOrCallChain(path, options, print, true);
  26608. if (node.type === "TSNonNullExpression") {
  26609. return path.call(goDeeper, "expression");
  26610. }
  26611. if (isCallExpression(node)) {
  26612. const doc2 = printCallExpression(path, options, print);
  26613. if (doc2.label === "member-chain") {
  26614. return false;
  26615. }
  26616. const args = getCallArguments(node);
  26617. const isPoorlyBreakableCall = args.length === 0 || args.length === 1 && isLoneShortArgument(args[0], options);
  26618. if (!isPoorlyBreakableCall) {
  26619. return false;
  26620. }
  26621. if (isCallExpressionWithComplexTypeArguments(node, print)) {
  26622. return false;
  26623. }
  26624. return path.call(goDeeper, "callee");
  26625. }
  26626. if (isMemberExpression(node)) {
  26627. return path.call(goDeeper, "object");
  26628. }
  26629. return deep && (node.type === "Identifier" || node.type === "ThisExpression");
  26630. }
  26631. var LONE_SHORT_ARGUMENT_THRESHOLD_RATE = 0.25;
  26632. function isLoneShortArgument(node, {
  26633. printWidth
  26634. }) {
  26635. if (hasComment(node)) {
  26636. return false;
  26637. }
  26638. const threshold = printWidth * LONE_SHORT_ARGUMENT_THRESHOLD_RATE;
  26639. if (node.type === "ThisExpression" || node.type === "Identifier" && node.name.length <= threshold || isSignedNumericLiteral(node) && !hasComment(node.argument)) {
  26640. return true;
  26641. }
  26642. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  26643. if (regexpPattern) {
  26644. return regexpPattern.length <= threshold;
  26645. }
  26646. if (isStringLiteral(node)) {
  26647. return rawText(node).length <= threshold;
  26648. }
  26649. if (node.type === "TemplateLiteral") {
  26650. return node.expressions.length === 0 && node.quasis[0].value.raw.length <= threshold && !node.quasis[0].value.raw.includes("\n");
  26651. }
  26652. return isLiteral(node);
  26653. }
  26654. function isObjectPropertyWithShortKey(node, keyDoc, options) {
  26655. if (!isObjectProperty(node)) {
  26656. return false;
  26657. }
  26658. keyDoc = cleanDoc(keyDoc);
  26659. const MIN_OVERLAP_FOR_BREAK = 3;
  26660. return typeof keyDoc === "string" && getStringWidth(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK;
  26661. }
  26662. function isCallExpressionWithComplexTypeArguments(node, print) {
  26663. const typeArgs = getTypeArgumentsFromCallExpression(node);
  26664. if (isNonEmptyArray(typeArgs)) {
  26665. if (typeArgs.length > 1) {
  26666. return true;
  26667. }
  26668. if (typeArgs.length === 1) {
  26669. const firstArg = typeArgs[0];
  26670. if (firstArg.type === "TSUnionType" || firstArg.type === "UnionTypeAnnotation" || firstArg.type === "TSIntersectionType" || firstArg.type === "IntersectionTypeAnnotation" || firstArg.type === "TSTypeLiteral" || firstArg.type === "ObjectTypeAnnotation") {
  26671. return true;
  26672. }
  26673. }
  26674. const typeArgsKeyName = node.typeParameters ? "typeParameters" : "typeArguments";
  26675. if (willBreak(print(typeArgsKeyName))) {
  26676. return true;
  26677. }
  26678. }
  26679. return false;
  26680. }
  26681. function getTypeArgumentsFromCallExpression(node) {
  26682. return node.typeParameters && node.typeParameters.params || node.typeArguments && node.typeArguments.params;
  26683. }
  26684. module2.exports = {
  26685. printVariableDeclarator,
  26686. printAssignmentExpression,
  26687. printAssignment,
  26688. isArrowFunctionVariableDeclarator
  26689. };
  26690. }
  26691. });
  26692. var require_function_parameters = __commonJS2({
  26693. "src/language-js/print/function-parameters.js"(exports2, module2) {
  26694. "use strict";
  26695. var {
  26696. getNextNonSpaceNonCommentCharacter
  26697. } = require_util();
  26698. var {
  26699. printDanglingComments
  26700. } = require_comments();
  26701. var {
  26702. builders: {
  26703. line,
  26704. hardline,
  26705. softline,
  26706. group,
  26707. indent,
  26708. ifBreak
  26709. },
  26710. utils: {
  26711. removeLines,
  26712. willBreak
  26713. }
  26714. } = require("./doc.js");
  26715. var {
  26716. getFunctionParameters,
  26717. iterateFunctionParametersPath,
  26718. isSimpleType,
  26719. isTestCall,
  26720. isTypeAnnotationAFunction,
  26721. isObjectType,
  26722. isObjectTypePropertyAFunction,
  26723. hasRestParameter,
  26724. shouldPrintComma,
  26725. hasComment,
  26726. isNextLineEmpty
  26727. } = require_utils7();
  26728. var {
  26729. locEnd
  26730. } = require_loc();
  26731. var {
  26732. ArgExpansionBailout
  26733. } = require_errors();
  26734. var {
  26735. printFunctionTypeParameters
  26736. } = require_misc();
  26737. function printFunctionParameters(path, print, options, expandArg, printTypeParams) {
  26738. const functionNode = path.getValue();
  26739. const parameters = getFunctionParameters(functionNode);
  26740. const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
  26741. if (parameters.length === 0) {
  26742. return [typeParams, "(", printDanglingComments(path, options, true, (comment) => getNextNonSpaceNonCommentCharacter(options.originalText, comment, locEnd) === ")"), ")"];
  26743. }
  26744. const parent = path.getParentNode();
  26745. const isParametersInTestCall = isTestCall(parent);
  26746. const shouldHugParameters = shouldHugFunctionParameters(functionNode);
  26747. const printed = [];
  26748. iterateFunctionParametersPath(path, (parameterPath, index) => {
  26749. const isLastParameter = index === parameters.length - 1;
  26750. if (isLastParameter && functionNode.rest) {
  26751. printed.push("...");
  26752. }
  26753. printed.push(print());
  26754. if (isLastParameter) {
  26755. return;
  26756. }
  26757. printed.push(",");
  26758. if (isParametersInTestCall || shouldHugParameters) {
  26759. printed.push(" ");
  26760. } else if (isNextLineEmpty(parameters[index], options)) {
  26761. printed.push(hardline, hardline);
  26762. } else {
  26763. printed.push(line);
  26764. }
  26765. });
  26766. if (expandArg) {
  26767. if (willBreak(typeParams) || willBreak(printed)) {
  26768. throw new ArgExpansionBailout();
  26769. }
  26770. return group([removeLines(typeParams), "(", removeLines(printed), ")"]);
  26771. }
  26772. const hasNotParameterDecorator = parameters.every((node) => !node.decorators);
  26773. if (shouldHugParameters && hasNotParameterDecorator) {
  26774. return [typeParams, "(", ...printed, ")"];
  26775. }
  26776. if (isParametersInTestCall) {
  26777. return [typeParams, "(", ...printed, ")"];
  26778. }
  26779. 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;
  26780. if (isFlowShorthandWithOneArg) {
  26781. if (options.arrowParens === "always") {
  26782. return ["(", ...printed, ")"];
  26783. }
  26784. return printed;
  26785. }
  26786. return [typeParams, "(", indent([softline, ...printed]), ifBreak(!hasRestParameter(functionNode) && shouldPrintComma(options, "all") ? "," : ""), softline, ")"];
  26787. }
  26788. function shouldHugFunctionParameters(node) {
  26789. if (!node) {
  26790. return false;
  26791. }
  26792. const parameters = getFunctionParameters(node);
  26793. if (parameters.length !== 1) {
  26794. return false;
  26795. }
  26796. const [parameter] = parameters;
  26797. 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));
  26798. }
  26799. function getReturnTypeNode(functionNode) {
  26800. let returnTypeNode;
  26801. if (functionNode.returnType) {
  26802. returnTypeNode = functionNode.returnType;
  26803. if (returnTypeNode.typeAnnotation) {
  26804. returnTypeNode = returnTypeNode.typeAnnotation;
  26805. }
  26806. } else if (functionNode.typeAnnotation) {
  26807. returnTypeNode = functionNode.typeAnnotation;
  26808. }
  26809. return returnTypeNode;
  26810. }
  26811. function shouldGroupFunctionParameters(functionNode, returnTypeDoc) {
  26812. const returnTypeNode = getReturnTypeNode(functionNode);
  26813. if (!returnTypeNode) {
  26814. return false;
  26815. }
  26816. const typeParameters = functionNode.typeParameters && functionNode.typeParameters.params;
  26817. if (typeParameters) {
  26818. if (typeParameters.length > 1) {
  26819. return false;
  26820. }
  26821. if (typeParameters.length === 1) {
  26822. const typeParameter = typeParameters[0];
  26823. if (typeParameter.constraint || typeParameter.default) {
  26824. return false;
  26825. }
  26826. }
  26827. }
  26828. return getFunctionParameters(functionNode).length === 1 && (isObjectType(returnTypeNode) || willBreak(returnTypeDoc));
  26829. }
  26830. module2.exports = {
  26831. printFunctionParameters,
  26832. shouldHugFunctionParameters,
  26833. shouldGroupFunctionParameters
  26834. };
  26835. }
  26836. });
  26837. var require_type_annotation = __commonJS2({
  26838. "src/language-js/print/type-annotation.js"(exports2, module2) {
  26839. "use strict";
  26840. var {
  26841. printComments,
  26842. printDanglingComments
  26843. } = require_comments();
  26844. var {
  26845. isNonEmptyArray
  26846. } = require_util();
  26847. var {
  26848. builders: {
  26849. group,
  26850. join,
  26851. line,
  26852. softline,
  26853. indent,
  26854. align,
  26855. ifBreak
  26856. }
  26857. } = require("./doc.js");
  26858. var pathNeedsParens = require_needs_parens();
  26859. var {
  26860. locStart
  26861. } = require_loc();
  26862. var {
  26863. isSimpleType,
  26864. isObjectType,
  26865. hasLeadingOwnLineComment,
  26866. isObjectTypePropertyAFunction,
  26867. shouldPrintComma
  26868. } = require_utils7();
  26869. var {
  26870. printAssignment
  26871. } = require_assignment();
  26872. var {
  26873. printFunctionParameters,
  26874. shouldGroupFunctionParameters
  26875. } = require_function_parameters();
  26876. var {
  26877. printArrayItems
  26878. } = require_array4();
  26879. function shouldHugType(node) {
  26880. if (isSimpleType(node) || isObjectType(node)) {
  26881. return true;
  26882. }
  26883. if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
  26884. const voidCount = node.types.filter((node2) => node2.type === "VoidTypeAnnotation" || node2.type === "TSVoidKeyword" || node2.type === "NullLiteralTypeAnnotation" || node2.type === "TSNullKeyword").length;
  26885. const hasObject = node.types.some((node2) => node2.type === "ObjectTypeAnnotation" || node2.type === "TSTypeLiteral" || node2.type === "GenericTypeAnnotation" || node2.type === "TSTypeReference");
  26886. if (node.types.length - 1 === voidCount && hasObject) {
  26887. return true;
  26888. }
  26889. }
  26890. return false;
  26891. }
  26892. function printOpaqueType(path, options, print) {
  26893. const semi = options.semi ? ";" : "";
  26894. const node = path.getValue();
  26895. const parts = [];
  26896. parts.push("opaque type ", print("id"), print("typeParameters"));
  26897. if (node.supertype) {
  26898. parts.push(": ", print("supertype"));
  26899. }
  26900. if (node.impltype) {
  26901. parts.push(" = ", print("impltype"));
  26902. }
  26903. parts.push(semi);
  26904. return parts;
  26905. }
  26906. function printTypeAlias(path, options, print) {
  26907. const semi = options.semi ? ";" : "";
  26908. const node = path.getValue();
  26909. const parts = [];
  26910. if (node.declare) {
  26911. parts.push("declare ");
  26912. }
  26913. parts.push("type ", print("id"), print("typeParameters"));
  26914. const rightPropertyName = node.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
  26915. return [printAssignment(path, options, print, parts, " =", rightPropertyName), semi];
  26916. }
  26917. function printIntersectionType(path, options, print) {
  26918. const node = path.getValue();
  26919. const types = path.map(print, "types");
  26920. const result = [];
  26921. let wasIndented = false;
  26922. for (let i = 0; i < types.length; ++i) {
  26923. if (i === 0) {
  26924. result.push(types[i]);
  26925. } else if (isObjectType(node.types[i - 1]) && isObjectType(node.types[i])) {
  26926. result.push([" & ", wasIndented ? indent(types[i]) : types[i]]);
  26927. } else if (!isObjectType(node.types[i - 1]) && !isObjectType(node.types[i])) {
  26928. result.push(indent([" &", line, types[i]]));
  26929. } else {
  26930. if (i > 1) {
  26931. wasIndented = true;
  26932. }
  26933. result.push(" & ", i > 1 ? indent(types[i]) : types[i]);
  26934. }
  26935. }
  26936. return group(result);
  26937. }
  26938. function printUnionType(path, options, print) {
  26939. const node = path.getValue();
  26940. const parent = path.getParentNode();
  26941. 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));
  26942. const shouldHug = shouldHugType(node);
  26943. const printed = path.map((typePath) => {
  26944. let printedType = print();
  26945. if (!shouldHug) {
  26946. printedType = align(2, printedType);
  26947. }
  26948. return printComments(typePath, printedType, options);
  26949. }, "types");
  26950. if (shouldHug) {
  26951. return join(" | ", printed);
  26952. }
  26953. const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, node);
  26954. const code = [ifBreak([shouldAddStartLine ? line : "", "| "]), join([line, "| "], printed)];
  26955. if (pathNeedsParens(path, options)) {
  26956. return group([indent(code), softline]);
  26957. }
  26958. if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
  26959. return group([indent([ifBreak(["(", softline]), code]), softline, ifBreak(")")]);
  26960. }
  26961. return group(shouldIndent ? indent(code) : code);
  26962. }
  26963. function printFunctionType(path, options, print) {
  26964. const node = path.getValue();
  26965. const parts = [];
  26966. const parent = path.getParentNode(0);
  26967. const parentParent = path.getParentNode(1);
  26968. const parentParentParent = path.getParentNode(2);
  26969. 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");
  26970. let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation");
  26971. const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
  26972. if (isObjectTypePropertyAFunction(parent)) {
  26973. isArrowFunctionTypeAnnotation = true;
  26974. needsColon = true;
  26975. }
  26976. if (needsParens) {
  26977. parts.push("(");
  26978. }
  26979. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  26980. const returnTypeDoc = node.returnType || node.predicate || node.typeAnnotation ? [isArrowFunctionTypeAnnotation ? " => " : ": ", print("returnType"), print("predicate"), print("typeAnnotation")] : "";
  26981. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26982. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  26983. if (returnTypeDoc) {
  26984. parts.push(returnTypeDoc);
  26985. }
  26986. if (needsParens) {
  26987. parts.push(")");
  26988. }
  26989. return group(parts);
  26990. }
  26991. function printTupleType(path, options, print) {
  26992. const node = path.getValue();
  26993. const typesField = node.type === "TSTupleType" ? "elementTypes" : "types";
  26994. const types = node[typesField];
  26995. const isNonEmptyTuple = isNonEmptyArray(types);
  26996. const bracketsDelimiterLine = isNonEmptyTuple ? softline : "";
  26997. return group(["[", indent([bracketsDelimiterLine, printArrayItems(path, options, typesField, print)]), ifBreak(isNonEmptyTuple && shouldPrintComma(options, "all") ? "," : ""), printDanglingComments(path, options, true), bracketsDelimiterLine, "]"]);
  26998. }
  26999. function printIndexedAccessType(path, options, print) {
  27000. const node = path.getValue();
  27001. const leftDelimiter = node.type === "OptionalIndexedAccessType" && node.optional ? "?.[" : "[";
  27002. return [print("objectType"), leftDelimiter, print("indexType"), "]"];
  27003. }
  27004. function printJSDocType(path, print, token) {
  27005. const node = path.getValue();
  27006. return [node.postfix ? "" : token, print("typeAnnotation"), node.postfix ? token : ""];
  27007. }
  27008. module2.exports = {
  27009. printOpaqueType,
  27010. printTypeAlias,
  27011. printIntersectionType,
  27012. printUnionType,
  27013. printFunctionType,
  27014. printTupleType,
  27015. printIndexedAccessType,
  27016. shouldHugType,
  27017. printJSDocType
  27018. };
  27019. }
  27020. });
  27021. var require_type_parameters = __commonJS2({
  27022. "src/language-js/print/type-parameters.js"(exports2, module2) {
  27023. "use strict";
  27024. var {
  27025. printDanglingComments
  27026. } = require_comments();
  27027. var {
  27028. builders: {
  27029. join,
  27030. line,
  27031. hardline,
  27032. softline,
  27033. group,
  27034. indent,
  27035. ifBreak
  27036. }
  27037. } = require("./doc.js");
  27038. var {
  27039. isTestCall,
  27040. hasComment,
  27041. CommentCheckFlags,
  27042. isTSXFile,
  27043. shouldPrintComma,
  27044. getFunctionParameters,
  27045. isObjectType,
  27046. getTypeScriptMappedTypeModifier
  27047. } = require_utils7();
  27048. var {
  27049. createGroupIdMapper
  27050. } = require_util();
  27051. var {
  27052. shouldHugType
  27053. } = require_type_annotation();
  27054. var {
  27055. isArrowFunctionVariableDeclarator
  27056. } = require_assignment();
  27057. var getTypeParametersGroupId = createGroupIdMapper("typeParameters");
  27058. function printTypeParameters(path, options, print, paramsKey) {
  27059. const node = path.getValue();
  27060. if (!node[paramsKey]) {
  27061. return "";
  27062. }
  27063. if (!Array.isArray(node[paramsKey])) {
  27064. return print(paramsKey);
  27065. }
  27066. const grandparent = path.getNode(2);
  27067. const isParameterInTestCall = grandparent && isTestCall(grandparent);
  27068. const isArrowFunctionVariable = path.match((node2) => !(node2[paramsKey].length === 1 && isObjectType(node2[paramsKey][0])), void 0, (node2, name) => name === "typeAnnotation", (node2) => node2.type === "Identifier", isArrowFunctionVariableDeclarator);
  27069. const shouldInline = node[paramsKey].length === 0 || !isArrowFunctionVariable && (isParameterInTestCall || node[paramsKey].length === 1 && (node[paramsKey][0].type === "NullableTypeAnnotation" || shouldHugType(node[paramsKey][0])));
  27070. if (shouldInline) {
  27071. return ["<", join(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(path, options), ">"];
  27072. }
  27073. const trailingComma = node.type === "TSTypeParameterInstantiation" ? "" : getFunctionParameters(node).length === 1 && isTSXFile(options) && !node[paramsKey][0].constraint && path.getParentNode().type === "ArrowFunctionExpression" ? "," : shouldPrintComma(options, "all") ? ifBreak(",") : "";
  27074. return group(["<", indent([softline, join([",", line], path.map(print, paramsKey))]), trailingComma, softline, ">"], {
  27075. id: getTypeParametersGroupId(node)
  27076. });
  27077. }
  27078. function printDanglingCommentsForInline(path, options) {
  27079. const node = path.getValue();
  27080. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  27081. return "";
  27082. }
  27083. const hasOnlyBlockComments = !hasComment(node, CommentCheckFlags.Line);
  27084. const printed = printDanglingComments(path, options, hasOnlyBlockComments);
  27085. if (hasOnlyBlockComments) {
  27086. return printed;
  27087. }
  27088. return [printed, hardline];
  27089. }
  27090. function printTypeParameter(path, options, print) {
  27091. const node = path.getValue();
  27092. const parts = [node.type === "TSTypeParameter" && node.const ? "const " : ""];
  27093. const parent = path.getParentNode();
  27094. if (parent.type === "TSMappedType") {
  27095. if (parent.readonly) {
  27096. parts.push(getTypeScriptMappedTypeModifier(parent.readonly, "readonly"), " ");
  27097. }
  27098. parts.push("[", print("name"));
  27099. if (node.constraint) {
  27100. parts.push(" in ", print("constraint"));
  27101. }
  27102. if (parent.nameType) {
  27103. parts.push(" as ", path.callParent(() => print("nameType")));
  27104. }
  27105. parts.push("]");
  27106. return parts;
  27107. }
  27108. if (node.variance) {
  27109. parts.push(print("variance"));
  27110. }
  27111. if (node.in) {
  27112. parts.push("in ");
  27113. }
  27114. if (node.out) {
  27115. parts.push("out ");
  27116. }
  27117. parts.push(print("name"));
  27118. if (node.bound) {
  27119. parts.push(": ", print("bound"));
  27120. }
  27121. if (node.constraint) {
  27122. parts.push(" extends ", print("constraint"));
  27123. }
  27124. if (node.default) {
  27125. parts.push(" = ", print("default"));
  27126. }
  27127. return parts;
  27128. }
  27129. module2.exports = {
  27130. printTypeParameter,
  27131. printTypeParameters,
  27132. getTypeParametersGroupId
  27133. };
  27134. }
  27135. });
  27136. var require_property = __commonJS2({
  27137. "src/language-js/print/property.js"(exports2, module2) {
  27138. "use strict";
  27139. var {
  27140. printComments
  27141. } = require_comments();
  27142. var {
  27143. printString,
  27144. printNumber
  27145. } = require_util();
  27146. var {
  27147. isNumericLiteral,
  27148. isSimpleNumber,
  27149. isStringLiteral,
  27150. isStringPropSafeToUnquote,
  27151. rawText
  27152. } = require_utils7();
  27153. var {
  27154. printAssignment
  27155. } = require_assignment();
  27156. var needsQuoteProps = /* @__PURE__ */ new WeakMap();
  27157. function printPropertyKey(path, options, print) {
  27158. const node = path.getNode();
  27159. if (node.computed) {
  27160. return ["[", print("key"), "]"];
  27161. }
  27162. const parent = path.getParentNode();
  27163. const {
  27164. key
  27165. } = node;
  27166. if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
  27167. const objectHasStringProp = (parent.properties || parent.body || parent.members).some((prop) => !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToUnquote(prop, options));
  27168. needsQuoteProps.set(parent, objectHasStringProp);
  27169. }
  27170. 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))) {
  27171. const prop = printString(JSON.stringify(key.type === "Identifier" ? key.name : key.value.toString()), options);
  27172. return path.call((keyPath) => printComments(keyPath, prop, options), "key");
  27173. }
  27174. if (isStringPropSafeToUnquote(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
  27175. return path.call((keyPath) => printComments(keyPath, /^\d/.test(key.value) ? printNumber(key.value) : key.value, options), "key");
  27176. }
  27177. return print("key");
  27178. }
  27179. function printProperty(path, options, print) {
  27180. const node = path.getValue();
  27181. if (node.shorthand) {
  27182. return print("value");
  27183. }
  27184. return printAssignment(path, options, print, printPropertyKey(path, options, print), ":", "value");
  27185. }
  27186. module2.exports = {
  27187. printProperty,
  27188. printPropertyKey
  27189. };
  27190. }
  27191. });
  27192. var require_function = __commonJS2({
  27193. "src/language-js/print/function.js"(exports2, module2) {
  27194. "use strict";
  27195. var assert = require("assert");
  27196. var {
  27197. printDanglingComments,
  27198. printCommentsSeparately
  27199. } = require_comments();
  27200. var getLast = require_get_last();
  27201. var {
  27202. getNextNonSpaceNonCommentCharacterIndex
  27203. } = require_util();
  27204. var {
  27205. builders: {
  27206. line,
  27207. softline,
  27208. group,
  27209. indent,
  27210. ifBreak,
  27211. hardline,
  27212. join,
  27213. indentIfBreak
  27214. },
  27215. utils: {
  27216. removeLines,
  27217. willBreak
  27218. }
  27219. } = require("./doc.js");
  27220. var {
  27221. ArgExpansionBailout
  27222. } = require_errors();
  27223. var {
  27224. getFunctionParameters,
  27225. hasLeadingOwnLineComment,
  27226. isFlowAnnotationComment,
  27227. isJsxNode,
  27228. isTemplateOnItsOwnLine,
  27229. shouldPrintComma,
  27230. startsWithNoLookaheadToken,
  27231. isBinaryish,
  27232. isLineComment,
  27233. hasComment,
  27234. getComments,
  27235. CommentCheckFlags,
  27236. isCallLikeExpression,
  27237. isCallExpression,
  27238. getCallArguments,
  27239. hasNakedLeftSide,
  27240. getLeftSide
  27241. } = require_utils7();
  27242. var {
  27243. locEnd
  27244. } = require_loc();
  27245. var {
  27246. printFunctionParameters,
  27247. shouldGroupFunctionParameters
  27248. } = require_function_parameters();
  27249. var {
  27250. printPropertyKey
  27251. } = require_property();
  27252. var {
  27253. printFunctionTypeParameters
  27254. } = require_misc();
  27255. function printFunction(path, print, options, args) {
  27256. const node = path.getValue();
  27257. let expandArg = false;
  27258. if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && args && args.expandLastArg) {
  27259. const parent = path.getParentNode();
  27260. if (isCallExpression(parent) && getCallArguments(parent).length > 1) {
  27261. expandArg = true;
  27262. }
  27263. }
  27264. const parts = [];
  27265. if (node.type === "TSDeclareFunction" && node.declare) {
  27266. parts.push("declare ");
  27267. }
  27268. if (node.async) {
  27269. parts.push("async ");
  27270. }
  27271. if (node.generator) {
  27272. parts.push("function* ");
  27273. } else {
  27274. parts.push("function ");
  27275. }
  27276. if (node.id) {
  27277. parts.push(print("id"));
  27278. }
  27279. const parametersDoc = printFunctionParameters(path, print, options, expandArg);
  27280. const returnTypeDoc = printReturnType(path, print, options);
  27281. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  27282. parts.push(printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc]), node.body ? " " : "", print("body"));
  27283. if (options.semi && (node.declare || !node.body)) {
  27284. parts.push(";");
  27285. }
  27286. return parts;
  27287. }
  27288. function printMethod(path, options, print) {
  27289. const node = path.getNode();
  27290. const {
  27291. kind
  27292. } = node;
  27293. const value = node.value || node;
  27294. const parts = [];
  27295. if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
  27296. if (value.async) {
  27297. parts.push("async ");
  27298. }
  27299. } else {
  27300. assert.ok(kind === "get" || kind === "set");
  27301. parts.push(kind, " ");
  27302. }
  27303. if (value.generator) {
  27304. parts.push("*");
  27305. }
  27306. parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "");
  27307. if (node === value) {
  27308. parts.push(printMethodInternal(path, options, print));
  27309. } else if (value.type === "FunctionExpression") {
  27310. parts.push(path.call((path2) => printMethodInternal(path2, options, print), "value"));
  27311. } else {
  27312. parts.push(print("value"));
  27313. }
  27314. return parts;
  27315. }
  27316. function printMethodInternal(path, options, print) {
  27317. const node = path.getNode();
  27318. const parametersDoc = printFunctionParameters(path, print, options);
  27319. const returnTypeDoc = printReturnType(path, print, options);
  27320. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  27321. const parts = [printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc])];
  27322. if (node.body) {
  27323. parts.push(" ", print("body"));
  27324. } else {
  27325. parts.push(options.semi ? ";" : "");
  27326. }
  27327. return parts;
  27328. }
  27329. function printArrowFunctionSignature(path, options, print, args) {
  27330. const node = path.getValue();
  27331. const parts = [];
  27332. if (node.async) {
  27333. parts.push("async ");
  27334. }
  27335. if (shouldPrintParamsWithoutParens(path, options)) {
  27336. parts.push(print(["params", 0]));
  27337. } else {
  27338. const expandArg = args && (args.expandLastArg || args.expandFirstArg);
  27339. let returnTypeDoc = printReturnType(path, print, options);
  27340. if (expandArg) {
  27341. if (willBreak(returnTypeDoc)) {
  27342. throw new ArgExpansionBailout();
  27343. }
  27344. returnTypeDoc = group(removeLines(returnTypeDoc));
  27345. }
  27346. parts.push(group([printFunctionParameters(path, print, options, expandArg, true), returnTypeDoc]));
  27347. }
  27348. const dangling = printDanglingComments(path, options, true, (comment) => {
  27349. const nextCharacter = getNextNonSpaceNonCommentCharacterIndex(options.originalText, comment, locEnd);
  27350. return nextCharacter !== false && options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
  27351. });
  27352. if (dangling) {
  27353. parts.push(" ", dangling);
  27354. }
  27355. return parts;
  27356. }
  27357. function printArrowChain(path, args, signatures, shouldBreak, bodyDoc, tailNode) {
  27358. const name = path.getName();
  27359. const parent = path.getParentNode();
  27360. const isCallee = isCallLikeExpression(parent) && name === "callee";
  27361. const isAssignmentRhs = Boolean(args && args.assignmentLayout);
  27362. const shouldPutBodyOnSeparateLine = tailNode.body.type !== "BlockStatement" && tailNode.body.type !== "ObjectExpression" && tailNode.body.type !== "SequenceExpression";
  27363. const shouldBreakBeforeChain = isCallee && shouldPutBodyOnSeparateLine || args && args.assignmentLayout === "chain-tail-arrow-chain";
  27364. const groupId = Symbol("arrow-chain");
  27365. if (tailNode.body.type === "SequenceExpression") {
  27366. bodyDoc = group(["(", indent([softline, bodyDoc]), softline, ")"]);
  27367. }
  27368. return group([group(indent([isCallee || isAssignmentRhs ? softline : "", group(join([" =>", line], signatures), {
  27369. shouldBreak
  27370. })]), {
  27371. id: groupId,
  27372. shouldBreak: shouldBreakBeforeChain
  27373. }), " =>", indentIfBreak(shouldPutBodyOnSeparateLine ? indent([line, bodyDoc]) : [" ", bodyDoc], {
  27374. groupId
  27375. }), isCallee ? ifBreak(softline, "", {
  27376. groupId
  27377. }) : ""]);
  27378. }
  27379. function printArrowFunction(path, options, print, args) {
  27380. let node = path.getValue();
  27381. const signatures = [];
  27382. const body = [];
  27383. let chainShouldBreak = false;
  27384. (function rec() {
  27385. const doc2 = printArrowFunctionSignature(path, options, print, args);
  27386. if (signatures.length === 0) {
  27387. signatures.push(doc2);
  27388. } else {
  27389. const {
  27390. leading,
  27391. trailing
  27392. } = printCommentsSeparately(path, options);
  27393. signatures.push([leading, doc2]);
  27394. body.unshift(trailing);
  27395. }
  27396. chainShouldBreak = chainShouldBreak || node.returnType && getFunctionParameters(node).length > 0 || node.typeParameters || getFunctionParameters(node).some((param) => param.type !== "Identifier");
  27397. if (node.body.type !== "ArrowFunctionExpression" || args && args.expandLastArg) {
  27398. body.unshift(print("body", args));
  27399. } else {
  27400. node = node.body;
  27401. path.call(rec, "body");
  27402. }
  27403. })();
  27404. if (signatures.length > 1) {
  27405. return printArrowChain(path, args, signatures, chainShouldBreak, body, node);
  27406. }
  27407. const parts = signatures;
  27408. parts.push(" =>");
  27409. 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")) {
  27410. return group([...parts, " ", body]);
  27411. }
  27412. if (node.body.type === "SequenceExpression") {
  27413. return group([...parts, group([" (", indent([softline, body]), softline, ")"])]);
  27414. }
  27415. const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !hasComment(node);
  27416. const printTrailingComma = args && args.expandLastArg && shouldPrintComma(options, "all");
  27417. const shouldAddParens = node.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken(node.body, (node2) => node2.type === "ObjectExpression");
  27418. return group([...parts, group([indent([line, shouldAddParens ? ifBreak("", "(") : "", body, shouldAddParens ? ifBreak("", ")") : ""]), shouldAddSoftLine ? [ifBreak(printTrailingComma ? "," : ""), softline] : ""])]);
  27419. }
  27420. function canPrintParamsWithoutParens(node) {
  27421. const parameters = getFunctionParameters(node);
  27422. 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;
  27423. }
  27424. function shouldPrintParamsWithoutParens(path, options) {
  27425. if (options.arrowParens === "always") {
  27426. return false;
  27427. }
  27428. if (options.arrowParens === "avoid") {
  27429. const node = path.getValue();
  27430. return canPrintParamsWithoutParens(node);
  27431. }
  27432. return false;
  27433. }
  27434. function printReturnType(path, print, options) {
  27435. const node = path.getValue();
  27436. const returnType = print("returnType");
  27437. if (node.returnType && isFlowAnnotationComment(options.originalText, node.returnType)) {
  27438. return [" /*: ", returnType, " */"];
  27439. }
  27440. const parts = [returnType];
  27441. if (node.returnType && node.returnType.typeAnnotation) {
  27442. parts.unshift(": ");
  27443. }
  27444. if (node.predicate) {
  27445. parts.push(node.returnType ? " " : ": ", print("predicate"));
  27446. }
  27447. return parts;
  27448. }
  27449. function printReturnOrThrowArgument(path, options, print) {
  27450. const node = path.getValue();
  27451. const semi = options.semi ? ";" : "";
  27452. const parts = [];
  27453. if (node.argument) {
  27454. if (returnArgumentHasLeadingComment(options, node.argument)) {
  27455. parts.push([" (", indent([hardline, print("argument")]), hardline, ")"]);
  27456. } else if (isBinaryish(node.argument) || node.argument.type === "SequenceExpression") {
  27457. parts.push(group([ifBreak(" (", " "), indent([softline, print("argument")]), softline, ifBreak(")")]));
  27458. } else {
  27459. parts.push(" ", print("argument"));
  27460. }
  27461. }
  27462. const comments = getComments(node);
  27463. const lastComment = getLast(comments);
  27464. const isLastCommentLine = lastComment && isLineComment(lastComment);
  27465. if (isLastCommentLine) {
  27466. parts.push(semi);
  27467. }
  27468. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27469. parts.push(" ", printDanglingComments(path, options, true));
  27470. }
  27471. if (!isLastCommentLine) {
  27472. parts.push(semi);
  27473. }
  27474. return parts;
  27475. }
  27476. function printReturnStatement(path, options, print) {
  27477. return ["return", printReturnOrThrowArgument(path, options, print)];
  27478. }
  27479. function printThrowStatement(path, options, print) {
  27480. return ["throw", printReturnOrThrowArgument(path, options, print)];
  27481. }
  27482. function returnArgumentHasLeadingComment(options, argument) {
  27483. if (hasLeadingOwnLineComment(options.originalText, argument)) {
  27484. return true;
  27485. }
  27486. if (hasNakedLeftSide(argument)) {
  27487. let leftMost = argument;
  27488. let newLeftMost;
  27489. while (newLeftMost = getLeftSide(leftMost)) {
  27490. leftMost = newLeftMost;
  27491. if (hasLeadingOwnLineComment(options.originalText, leftMost)) {
  27492. return true;
  27493. }
  27494. }
  27495. }
  27496. return false;
  27497. }
  27498. module2.exports = {
  27499. printFunction,
  27500. printArrowFunction,
  27501. printMethod,
  27502. printReturnStatement,
  27503. printThrowStatement,
  27504. printMethodInternal,
  27505. shouldPrintParamsWithoutParens
  27506. };
  27507. }
  27508. });
  27509. var require_decorators = __commonJS2({
  27510. "src/language-js/print/decorators.js"(exports2, module2) {
  27511. "use strict";
  27512. var {
  27513. isNonEmptyArray,
  27514. hasNewline
  27515. } = require_util();
  27516. var {
  27517. builders: {
  27518. line,
  27519. hardline,
  27520. join,
  27521. breakParent,
  27522. group
  27523. }
  27524. } = require("./doc.js");
  27525. var {
  27526. locStart,
  27527. locEnd
  27528. } = require_loc();
  27529. var {
  27530. getParentExportDeclaration
  27531. } = require_utils7();
  27532. function printClassMemberDecorators(path, options, print) {
  27533. const node = path.getValue();
  27534. return group([join(line, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators(node, options) ? hardline : line]);
  27535. }
  27536. function printDecoratorsBeforeExport(path, options, print) {
  27537. return [join(hardline, path.map(print, "declaration", "decorators")), hardline];
  27538. }
  27539. function printDecorators(path, options, print) {
  27540. const node = path.getValue();
  27541. const {
  27542. decorators
  27543. } = node;
  27544. if (!isNonEmptyArray(decorators) || hasDecoratorsBeforeExport(path.getParentNode())) {
  27545. return;
  27546. }
  27547. const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators(node, options);
  27548. return [getParentExportDeclaration(path) ? hardline : shouldBreak ? breakParent : "", join(line, path.map(print, "decorators")), line];
  27549. }
  27550. function hasNewlineBetweenOrAfterDecorators(node, options) {
  27551. return node.decorators.some((decorator) => hasNewline(options.originalText, locEnd(decorator)));
  27552. }
  27553. function hasDecoratorsBeforeExport(node) {
  27554. if (node.type !== "ExportDefaultDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "DeclareExportDeclaration") {
  27555. return false;
  27556. }
  27557. const decorators = node.declaration && node.declaration.decorators;
  27558. return isNonEmptyArray(decorators) && locStart(node) === locStart(decorators[0]);
  27559. }
  27560. module2.exports = {
  27561. printDecorators,
  27562. printClassMemberDecorators,
  27563. printDecoratorsBeforeExport,
  27564. hasDecoratorsBeforeExport
  27565. };
  27566. }
  27567. });
  27568. var require_class = __commonJS2({
  27569. "src/language-js/print/class.js"(exports2, module2) {
  27570. "use strict";
  27571. var {
  27572. isNonEmptyArray,
  27573. createGroupIdMapper
  27574. } = require_util();
  27575. var {
  27576. printComments,
  27577. printDanglingComments
  27578. } = require_comments();
  27579. var {
  27580. builders: {
  27581. join,
  27582. line,
  27583. hardline,
  27584. softline,
  27585. group,
  27586. indent,
  27587. ifBreak
  27588. }
  27589. } = require("./doc.js");
  27590. var {
  27591. hasComment,
  27592. CommentCheckFlags
  27593. } = require_utils7();
  27594. var {
  27595. getTypeParametersGroupId
  27596. } = require_type_parameters();
  27597. var {
  27598. printMethod
  27599. } = require_function();
  27600. var {
  27601. printOptionalToken,
  27602. printTypeAnnotation,
  27603. printDefiniteToken
  27604. } = require_misc();
  27605. var {
  27606. printPropertyKey
  27607. } = require_property();
  27608. var {
  27609. printAssignment
  27610. } = require_assignment();
  27611. var {
  27612. printClassMemberDecorators
  27613. } = require_decorators();
  27614. function printClass(path, options, print) {
  27615. const node = path.getValue();
  27616. const parts = [];
  27617. if (node.declare) {
  27618. parts.push("declare ");
  27619. }
  27620. if (node.abstract) {
  27621. parts.push("abstract ");
  27622. }
  27623. parts.push("class");
  27624. 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);
  27625. const partsGroup = [];
  27626. const extendsParts = [];
  27627. if (node.id) {
  27628. partsGroup.push(" ", print("id"));
  27629. }
  27630. partsGroup.push(print("typeParameters"));
  27631. if (node.superClass) {
  27632. const printed = [printSuperClass(path, options, print), print("superTypeParameters")];
  27633. const printedWithComments = path.call((superClass) => ["extends ", printComments(superClass, printed, options)], "superClass");
  27634. if (groupMode) {
  27635. extendsParts.push(line, group(printedWithComments));
  27636. } else {
  27637. extendsParts.push(" ", printedWithComments);
  27638. }
  27639. } else {
  27640. extendsParts.push(printList(path, options, print, "extends"));
  27641. }
  27642. extendsParts.push(printList(path, options, print, "mixins"), printList(path, options, print, "implements"));
  27643. if (groupMode) {
  27644. let printedPartsGroup;
  27645. if (shouldIndentOnlyHeritageClauses(node)) {
  27646. printedPartsGroup = [...partsGroup, indent(extendsParts)];
  27647. } else {
  27648. printedPartsGroup = indent([...partsGroup, extendsParts]);
  27649. }
  27650. parts.push(group(printedPartsGroup, {
  27651. id: getHeritageGroupId(node)
  27652. }));
  27653. } else {
  27654. parts.push(...partsGroup, ...extendsParts);
  27655. }
  27656. parts.push(" ", print("body"));
  27657. return parts;
  27658. }
  27659. var getHeritageGroupId = createGroupIdMapper("heritageGroup");
  27660. function printHardlineAfterHeritage(node) {
  27661. return ifBreak(hardline, "", {
  27662. groupId: getHeritageGroupId(node)
  27663. });
  27664. }
  27665. function hasMultipleHeritage(node) {
  27666. return ["superClass", "extends", "mixins", "implements"].filter((key) => Boolean(node[key])).length > 1;
  27667. }
  27668. function shouldIndentOnlyHeritageClauses(node) {
  27669. return node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line) && !hasMultipleHeritage(node);
  27670. }
  27671. function printList(path, options, print, listName) {
  27672. const node = path.getValue();
  27673. if (!isNonEmptyArray(node[listName])) {
  27674. return "";
  27675. }
  27676. const printedLeadingComments = printDanglingComments(path, options, true, ({
  27677. marker
  27678. }) => marker === listName);
  27679. return [shouldIndentOnlyHeritageClauses(node) ? ifBreak(" ", line, {
  27680. groupId: getTypeParametersGroupId(node.typeParameters)
  27681. }) : line, printedLeadingComments, printedLeadingComments && hardline, listName, group(indent([line, join([",", line], path.map(print, listName))]))];
  27682. }
  27683. function printSuperClass(path, options, print) {
  27684. const printed = print("superClass");
  27685. const parent = path.getParentNode();
  27686. if (parent.type === "AssignmentExpression") {
  27687. return group(ifBreak(["(", indent([softline, printed]), softline, ")"], printed));
  27688. }
  27689. return printed;
  27690. }
  27691. function printClassMethod(path, options, print) {
  27692. const node = path.getValue();
  27693. const parts = [];
  27694. if (isNonEmptyArray(node.decorators)) {
  27695. parts.push(printClassMemberDecorators(path, options, print));
  27696. }
  27697. if (node.accessibility) {
  27698. parts.push(node.accessibility + " ");
  27699. }
  27700. if (node.readonly) {
  27701. parts.push("readonly ");
  27702. }
  27703. if (node.declare) {
  27704. parts.push("declare ");
  27705. }
  27706. if (node.static) {
  27707. parts.push("static ");
  27708. }
  27709. if (node.type === "TSAbstractMethodDefinition" || node.abstract) {
  27710. parts.push("abstract ");
  27711. }
  27712. if (node.override) {
  27713. parts.push("override ");
  27714. }
  27715. parts.push(printMethod(path, options, print));
  27716. return parts;
  27717. }
  27718. function printClassProperty(path, options, print) {
  27719. const node = path.getValue();
  27720. const parts = [];
  27721. const semi = options.semi ? ";" : "";
  27722. if (isNonEmptyArray(node.decorators)) {
  27723. parts.push(printClassMemberDecorators(path, options, print));
  27724. }
  27725. if (node.accessibility) {
  27726. parts.push(node.accessibility + " ");
  27727. }
  27728. if (node.declare) {
  27729. parts.push("declare ");
  27730. }
  27731. if (node.static) {
  27732. parts.push("static ");
  27733. }
  27734. if (node.type === "TSAbstractPropertyDefinition" || node.type === "TSAbstractAccessorProperty" || node.abstract) {
  27735. parts.push("abstract ");
  27736. }
  27737. if (node.override) {
  27738. parts.push("override ");
  27739. }
  27740. if (node.readonly) {
  27741. parts.push("readonly ");
  27742. }
  27743. if (node.variance) {
  27744. parts.push(print("variance"));
  27745. }
  27746. if (node.type === "ClassAccessorProperty" || node.type === "AccessorProperty" || node.type === "TSAbstractAccessorProperty") {
  27747. parts.push("accessor ");
  27748. }
  27749. parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print));
  27750. return [printAssignment(path, options, print, parts, " =", "value"), semi];
  27751. }
  27752. module2.exports = {
  27753. printClass,
  27754. printClassMethod,
  27755. printClassProperty,
  27756. printHardlineAfterHeritage
  27757. };
  27758. }
  27759. });
  27760. var require_interface = __commonJS2({
  27761. "src/language-js/print/interface.js"(exports2, module2) {
  27762. "use strict";
  27763. var {
  27764. isNonEmptyArray
  27765. } = require_util();
  27766. var {
  27767. builders: {
  27768. join,
  27769. line,
  27770. group,
  27771. indent,
  27772. ifBreak
  27773. }
  27774. } = require("./doc.js");
  27775. var {
  27776. hasComment,
  27777. identity,
  27778. CommentCheckFlags
  27779. } = require_utils7();
  27780. var {
  27781. getTypeParametersGroupId
  27782. } = require_type_parameters();
  27783. var {
  27784. printTypeScriptModifiers
  27785. } = require_misc();
  27786. function printInterface(path, options, print) {
  27787. const node = path.getValue();
  27788. const parts = [];
  27789. if (node.declare) {
  27790. parts.push("declare ");
  27791. }
  27792. if (node.type === "TSInterfaceDeclaration") {
  27793. parts.push(node.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print));
  27794. }
  27795. parts.push("interface");
  27796. const partsGroup = [];
  27797. const extendsParts = [];
  27798. if (node.type !== "InterfaceTypeAnnotation") {
  27799. partsGroup.push(" ", print("id"), print("typeParameters"));
  27800. }
  27801. const shouldIndentOnlyHeritageClauses = node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  27802. if (isNonEmptyArray(node.extends)) {
  27803. extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak(" ", line, {
  27804. groupId: getTypeParametersGroupId(node.typeParameters)
  27805. }) : line, "extends ", (node.extends.length === 1 ? identity : indent)(join([",", line], path.map(print, "extends"))));
  27806. }
  27807. if (node.id && hasComment(node.id, CommentCheckFlags.Trailing) || isNonEmptyArray(node.extends)) {
  27808. if (shouldIndentOnlyHeritageClauses) {
  27809. parts.push(group([...partsGroup, indent(extendsParts)]));
  27810. } else {
  27811. parts.push(group(indent([...partsGroup, ...extendsParts])));
  27812. }
  27813. } else {
  27814. parts.push(...partsGroup, ...extendsParts);
  27815. }
  27816. parts.push(" ", print("body"));
  27817. return group(parts);
  27818. }
  27819. module2.exports = {
  27820. printInterface
  27821. };
  27822. }
  27823. });
  27824. var require_module = __commonJS2({
  27825. "src/language-js/print/module.js"(exports2, module2) {
  27826. "use strict";
  27827. var {
  27828. isNonEmptyArray
  27829. } = require_util();
  27830. var {
  27831. builders: {
  27832. softline,
  27833. group,
  27834. indent,
  27835. join,
  27836. line,
  27837. ifBreak,
  27838. hardline
  27839. }
  27840. } = require("./doc.js");
  27841. var {
  27842. printDanglingComments
  27843. } = require_comments();
  27844. var {
  27845. hasComment,
  27846. CommentCheckFlags,
  27847. shouldPrintComma,
  27848. needsHardlineAfterDanglingComment,
  27849. isStringLiteral,
  27850. rawText
  27851. } = require_utils7();
  27852. var {
  27853. locStart,
  27854. hasSameLoc
  27855. } = require_loc();
  27856. var {
  27857. hasDecoratorsBeforeExport,
  27858. printDecoratorsBeforeExport
  27859. } = require_decorators();
  27860. function printImportDeclaration(path, options, print) {
  27861. const node = path.getValue();
  27862. const semi = options.semi ? ";" : "";
  27863. const parts = [];
  27864. const {
  27865. importKind
  27866. } = node;
  27867. parts.push("import");
  27868. if (importKind && importKind !== "value") {
  27869. parts.push(" ", importKind);
  27870. }
  27871. parts.push(printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27872. return parts;
  27873. }
  27874. function printExportDeclaration(path, options, print) {
  27875. const node = path.getValue();
  27876. const parts = [];
  27877. if (hasDecoratorsBeforeExport(node)) {
  27878. parts.push(printDecoratorsBeforeExport(path, options, print));
  27879. }
  27880. const {
  27881. type,
  27882. exportKind,
  27883. declaration
  27884. } = node;
  27885. parts.push("export");
  27886. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27887. if (isDefaultExport) {
  27888. parts.push(" default");
  27889. }
  27890. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27891. parts.push(" ", printDanglingComments(path, options, true));
  27892. if (needsHardlineAfterDanglingComment(node)) {
  27893. parts.push(hardline);
  27894. }
  27895. }
  27896. if (declaration) {
  27897. parts.push(" ", print("declaration"));
  27898. } else {
  27899. parts.push(exportKind === "type" ? " type" : "", printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print));
  27900. }
  27901. if (shouldExportDeclarationPrintSemi(node, options)) {
  27902. parts.push(";");
  27903. }
  27904. return parts;
  27905. }
  27906. function printExportAllDeclaration(path, options, print) {
  27907. const node = path.getValue();
  27908. const semi = options.semi ? ";" : "";
  27909. const parts = [];
  27910. const {
  27911. exportKind,
  27912. exported
  27913. } = node;
  27914. parts.push("export");
  27915. if (exportKind === "type") {
  27916. parts.push(" type");
  27917. }
  27918. parts.push(" *");
  27919. if (exported) {
  27920. parts.push(" as ", print("exported"));
  27921. }
  27922. parts.push(printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27923. return parts;
  27924. }
  27925. function shouldExportDeclarationPrintSemi(node, options) {
  27926. if (!options.semi) {
  27927. return false;
  27928. }
  27929. const {
  27930. type,
  27931. declaration
  27932. } = node;
  27933. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27934. if (!declaration) {
  27935. return true;
  27936. }
  27937. const {
  27938. type: declarationType
  27939. } = declaration;
  27940. if (isDefaultExport && declarationType !== "ClassDeclaration" && declarationType !== "FunctionDeclaration" && declarationType !== "TSInterfaceDeclaration" && declarationType !== "DeclareClass" && declarationType !== "DeclareFunction" && declarationType !== "TSDeclareFunction" && declarationType !== "EnumDeclaration") {
  27941. return true;
  27942. }
  27943. return false;
  27944. }
  27945. function printModuleSource(path, options, print) {
  27946. const node = path.getValue();
  27947. if (!node.source) {
  27948. return "";
  27949. }
  27950. const parts = [];
  27951. if (!shouldNotPrintSpecifiers(node, options)) {
  27952. parts.push(" from");
  27953. }
  27954. parts.push(" ", print("source"));
  27955. return parts;
  27956. }
  27957. function printModuleSpecifiers(path, options, print) {
  27958. const node = path.getValue();
  27959. if (shouldNotPrintSpecifiers(node, options)) {
  27960. return "";
  27961. }
  27962. const parts = [" "];
  27963. if (isNonEmptyArray(node.specifiers)) {
  27964. const standaloneSpecifiers = [];
  27965. const groupedSpecifiers = [];
  27966. path.each(() => {
  27967. const specifierType = path.getValue().type;
  27968. if (specifierType === "ExportNamespaceSpecifier" || specifierType === "ExportDefaultSpecifier" || specifierType === "ImportNamespaceSpecifier" || specifierType === "ImportDefaultSpecifier") {
  27969. standaloneSpecifiers.push(print());
  27970. } else if (specifierType === "ExportSpecifier" || specifierType === "ImportSpecifier") {
  27971. groupedSpecifiers.push(print());
  27972. } else {
  27973. throw new Error(`Unknown specifier type ${JSON.stringify(specifierType)}`);
  27974. }
  27975. }, "specifiers");
  27976. parts.push(join(", ", standaloneSpecifiers));
  27977. if (groupedSpecifiers.length > 0) {
  27978. if (standaloneSpecifiers.length > 0) {
  27979. parts.push(", ");
  27980. }
  27981. const canBreak = groupedSpecifiers.length > 1 || standaloneSpecifiers.length > 0 || node.specifiers.some((node2) => hasComment(node2));
  27982. if (canBreak) {
  27983. parts.push(group(["{", indent([options.bracketSpacing ? line : softline, join([",", line], groupedSpecifiers)]), ifBreak(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line : softline, "}"]));
  27984. } else {
  27985. parts.push(["{", options.bracketSpacing ? " " : "", ...groupedSpecifiers, options.bracketSpacing ? " " : "", "}"]);
  27986. }
  27987. }
  27988. } else {
  27989. parts.push("{}");
  27990. }
  27991. return parts;
  27992. }
  27993. function shouldNotPrintSpecifiers(node, options) {
  27994. const {
  27995. type,
  27996. importKind,
  27997. source,
  27998. specifiers
  27999. } = node;
  28000. if (type !== "ImportDeclaration" || isNonEmptyArray(specifiers) || importKind === "type") {
  28001. return false;
  28002. }
  28003. return !/{\s*}/.test(options.originalText.slice(locStart(node), locStart(source)));
  28004. }
  28005. function printImportAssertions(path, options, print) {
  28006. const node = path.getNode();
  28007. if (isNonEmptyArray(node.assertions)) {
  28008. return [" assert {", options.bracketSpacing ? " " : "", join(", ", path.map(print, "assertions")), options.bracketSpacing ? " " : "", "}"];
  28009. }
  28010. return "";
  28011. }
  28012. function printModuleSpecifier(path, options, print) {
  28013. const node = path.getNode();
  28014. const {
  28015. type
  28016. } = node;
  28017. const parts = [];
  28018. const kind = type === "ImportSpecifier" ? node.importKind : node.exportKind;
  28019. if (kind && kind !== "value") {
  28020. parts.push(kind, " ");
  28021. }
  28022. const isImport = type.startsWith("Import");
  28023. const leftSideProperty = isImport ? "imported" : "local";
  28024. const rightSideProperty = isImport ? "local" : "exported";
  28025. const leftSideNode = node[leftSideProperty];
  28026. const rightSideNode = node[rightSideProperty];
  28027. let left = "";
  28028. let right = "";
  28029. if (type === "ExportNamespaceSpecifier" || type === "ImportNamespaceSpecifier") {
  28030. left = "*";
  28031. } else if (leftSideNode) {
  28032. left = print(leftSideProperty);
  28033. }
  28034. if (rightSideNode && !isShorthandSpecifier(node)) {
  28035. right = print(rightSideProperty);
  28036. }
  28037. parts.push(left, left && right ? " as " : "", right);
  28038. return parts;
  28039. }
  28040. function isShorthandSpecifier(specifier) {
  28041. if (specifier.type !== "ImportSpecifier" && specifier.type !== "ExportSpecifier") {
  28042. return false;
  28043. }
  28044. const {
  28045. local,
  28046. [specifier.type === "ImportSpecifier" ? "imported" : "exported"]: importedOrExported
  28047. } = specifier;
  28048. if (local.type !== importedOrExported.type || !hasSameLoc(local, importedOrExported)) {
  28049. return false;
  28050. }
  28051. if (isStringLiteral(local)) {
  28052. return local.value === importedOrExported.value && rawText(local) === rawText(importedOrExported);
  28053. }
  28054. switch (local.type) {
  28055. case "Identifier":
  28056. return local.name === importedOrExported.name;
  28057. default:
  28058. return false;
  28059. }
  28060. }
  28061. module2.exports = {
  28062. printImportDeclaration,
  28063. printExportDeclaration,
  28064. printExportAllDeclaration,
  28065. printModuleSpecifier
  28066. };
  28067. }
  28068. });
  28069. var require_object = __commonJS2({
  28070. "src/language-js/print/object.js"(exports2, module2) {
  28071. "use strict";
  28072. var {
  28073. printDanglingComments
  28074. } = require_comments();
  28075. var {
  28076. builders: {
  28077. line,
  28078. softline,
  28079. group,
  28080. indent,
  28081. ifBreak,
  28082. hardline
  28083. }
  28084. } = require("./doc.js");
  28085. var {
  28086. getLast,
  28087. hasNewlineInRange,
  28088. hasNewline,
  28089. isNonEmptyArray
  28090. } = require_util();
  28091. var {
  28092. shouldPrintComma,
  28093. hasComment,
  28094. getComments,
  28095. CommentCheckFlags,
  28096. isNextLineEmpty
  28097. } = require_utils7();
  28098. var {
  28099. locStart,
  28100. locEnd
  28101. } = require_loc();
  28102. var {
  28103. printOptionalToken,
  28104. printTypeAnnotation
  28105. } = require_misc();
  28106. var {
  28107. shouldHugFunctionParameters
  28108. } = require_function_parameters();
  28109. var {
  28110. shouldHugType
  28111. } = require_type_annotation();
  28112. var {
  28113. printHardlineAfterHeritage
  28114. } = require_class();
  28115. function printObject(path, options, print) {
  28116. const semi = options.semi ? ";" : "";
  28117. const node = path.getValue();
  28118. let propertiesField;
  28119. if (node.type === "TSTypeLiteral") {
  28120. propertiesField = "members";
  28121. } else if (node.type === "TSInterfaceBody") {
  28122. propertiesField = "body";
  28123. } else {
  28124. propertiesField = "properties";
  28125. }
  28126. const isTypeAnnotation = node.type === "ObjectTypeAnnotation";
  28127. const fields = [propertiesField];
  28128. if (isTypeAnnotation) {
  28129. fields.push("indexers", "callProperties", "internalSlots");
  28130. }
  28131. const firstProperty = fields.map((field) => node[field][0]).sort((a, b) => locStart(a) - locStart(b))[0];
  28132. const parent = path.getParentNode(0);
  28133. const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
  28134. 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));
  28135. const separator = isFlowInterfaceLikeBody ? ";" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" ? ifBreak(semi, ";") : ",";
  28136. const leftBrace = node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
  28137. const rightBrace = node.exact ? "|}" : "}";
  28138. const propsAndLoc = [];
  28139. for (const field of fields) {
  28140. path.each((childPath) => {
  28141. const node2 = childPath.getValue();
  28142. propsAndLoc.push({
  28143. node: node2,
  28144. printed: print(),
  28145. loc: locStart(node2)
  28146. });
  28147. }, field);
  28148. }
  28149. if (fields.length > 1) {
  28150. propsAndLoc.sort((a, b) => a.loc - b.loc);
  28151. }
  28152. let separatorParts = [];
  28153. const props = propsAndLoc.map((prop) => {
  28154. const result = [...separatorParts, group(prop.printed)];
  28155. separatorParts = [separator, line];
  28156. if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasComment(prop.node, CommentCheckFlags.PrettierIgnore)) {
  28157. separatorParts.shift();
  28158. }
  28159. if (isNextLineEmpty(prop.node, options)) {
  28160. separatorParts.push(hardline);
  28161. }
  28162. return result;
  28163. });
  28164. if (node.inexact) {
  28165. let printed;
  28166. if (hasComment(node, CommentCheckFlags.Dangling)) {
  28167. const hasLineComments = hasComment(node, CommentCheckFlags.Line);
  28168. const printedDanglingComments = printDanglingComments(path, options, true);
  28169. printed = [printedDanglingComments, hasLineComments || hasNewline(options.originalText, locEnd(getLast(getComments(node)))) ? hardline : line, "..."];
  28170. } else {
  28171. printed = ["..."];
  28172. }
  28173. props.push([...separatorParts, ...printed]);
  28174. }
  28175. const lastElem = getLast(node[propertiesField]);
  28176. 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));
  28177. let content;
  28178. if (props.length === 0) {
  28179. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  28180. return [leftBrace, rightBrace, printTypeAnnotation(path, options, print)];
  28181. }
  28182. content = group([leftBrace, printDanglingComments(path, options), softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
  28183. } else {
  28184. 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)];
  28185. }
  28186. 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")) {
  28187. return content;
  28188. }
  28189. return group(content, {
  28190. shouldBreak
  28191. });
  28192. }
  28193. module2.exports = {
  28194. printObject
  28195. };
  28196. }
  28197. });
  28198. var require_flow = __commonJS2({
  28199. "src/language-js/print/flow.js"(exports2, module2) {
  28200. "use strict";
  28201. var assert = require("assert");
  28202. var {
  28203. printDanglingComments
  28204. } = require_comments();
  28205. var {
  28206. printString,
  28207. printNumber
  28208. } = require_util();
  28209. var {
  28210. builders: {
  28211. hardline,
  28212. softline,
  28213. group,
  28214. indent
  28215. }
  28216. } = require("./doc.js");
  28217. var {
  28218. getParentExportDeclaration,
  28219. isFunctionNotation,
  28220. isGetterOrSetter,
  28221. rawText,
  28222. shouldPrintComma
  28223. } = require_utils7();
  28224. var {
  28225. locStart,
  28226. locEnd
  28227. } = require_loc();
  28228. var {
  28229. replaceTextEndOfLine
  28230. } = require_doc_utils();
  28231. var {
  28232. printClass
  28233. } = require_class();
  28234. var {
  28235. printOpaqueType,
  28236. printTypeAlias,
  28237. printIntersectionType,
  28238. printUnionType,
  28239. printFunctionType,
  28240. printTupleType,
  28241. printIndexedAccessType
  28242. } = require_type_annotation();
  28243. var {
  28244. printInterface
  28245. } = require_interface();
  28246. var {
  28247. printTypeParameter,
  28248. printTypeParameters
  28249. } = require_type_parameters();
  28250. var {
  28251. printExportDeclaration,
  28252. printExportAllDeclaration
  28253. } = require_module();
  28254. var {
  28255. printArrayItems
  28256. } = require_array4();
  28257. var {
  28258. printObject
  28259. } = require_object();
  28260. var {
  28261. printPropertyKey
  28262. } = require_property();
  28263. var {
  28264. printOptionalToken,
  28265. printTypeAnnotation,
  28266. printRestSpread
  28267. } = require_misc();
  28268. function printFlow(path, options, print) {
  28269. const node = path.getValue();
  28270. const semi = options.semi ? ";" : "";
  28271. const parts = [];
  28272. switch (node.type) {
  28273. case "DeclareClass":
  28274. return printFlowDeclaration(path, printClass(path, options, print));
  28275. case "DeclareFunction":
  28276. return printFlowDeclaration(path, ["function ", print("id"), node.predicate ? " " : "", print("predicate"), semi]);
  28277. case "DeclareModule":
  28278. return printFlowDeclaration(path, ["module ", print("id"), " ", print("body")]);
  28279. case "DeclareModuleExports":
  28280. return printFlowDeclaration(path, ["module.exports", ": ", print("typeAnnotation"), semi]);
  28281. case "DeclareVariable":
  28282. return printFlowDeclaration(path, ["var ", print("id"), semi]);
  28283. case "DeclareOpaqueType":
  28284. return printFlowDeclaration(path, printOpaqueType(path, options, print));
  28285. case "DeclareInterface":
  28286. return printFlowDeclaration(path, printInterface(path, options, print));
  28287. case "DeclareTypeAlias":
  28288. return printFlowDeclaration(path, printTypeAlias(path, options, print));
  28289. case "DeclareExportDeclaration":
  28290. return printFlowDeclaration(path, printExportDeclaration(path, options, print));
  28291. case "DeclareExportAllDeclaration":
  28292. return printFlowDeclaration(path, printExportAllDeclaration(path, options, print));
  28293. case "OpaqueType":
  28294. return printOpaqueType(path, options, print);
  28295. case "TypeAlias":
  28296. return printTypeAlias(path, options, print);
  28297. case "IntersectionTypeAnnotation":
  28298. return printIntersectionType(path, options, print);
  28299. case "UnionTypeAnnotation":
  28300. return printUnionType(path, options, print);
  28301. case "FunctionTypeAnnotation":
  28302. return printFunctionType(path, options, print);
  28303. case "TupleTypeAnnotation":
  28304. return printTupleType(path, options, print);
  28305. case "GenericTypeAnnotation":
  28306. return [print("id"), printTypeParameters(path, options, print, "typeParameters")];
  28307. case "IndexedAccessType":
  28308. case "OptionalIndexedAccessType":
  28309. return printIndexedAccessType(path, options, print);
  28310. case "TypeAnnotation":
  28311. return print("typeAnnotation");
  28312. case "TypeParameter":
  28313. return printTypeParameter(path, options, print);
  28314. case "TypeofTypeAnnotation":
  28315. return ["typeof ", print("argument")];
  28316. case "ExistsTypeAnnotation":
  28317. return "*";
  28318. case "EmptyTypeAnnotation":
  28319. return "empty";
  28320. case "MixedTypeAnnotation":
  28321. return "mixed";
  28322. case "ArrayTypeAnnotation":
  28323. return [print("elementType"), "[]"];
  28324. case "BooleanLiteralTypeAnnotation":
  28325. return String(node.value);
  28326. case "EnumDeclaration":
  28327. return ["enum ", print("id"), " ", print("body")];
  28328. case "EnumBooleanBody":
  28329. case "EnumNumberBody":
  28330. case "EnumStringBody":
  28331. case "EnumSymbolBody": {
  28332. if (node.type === "EnumSymbolBody" || node.explicitType) {
  28333. let type = null;
  28334. switch (node.type) {
  28335. case "EnumBooleanBody":
  28336. type = "boolean";
  28337. break;
  28338. case "EnumNumberBody":
  28339. type = "number";
  28340. break;
  28341. case "EnumStringBody":
  28342. type = "string";
  28343. break;
  28344. case "EnumSymbolBody":
  28345. type = "symbol";
  28346. break;
  28347. }
  28348. parts.push("of ", type, " ");
  28349. }
  28350. if (node.members.length === 0 && !node.hasUnknownMembers) {
  28351. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  28352. } else {
  28353. const members = node.members.length > 0 ? [hardline, printArrayItems(path, options, "members", print), node.hasUnknownMembers || shouldPrintComma(options) ? "," : ""] : [];
  28354. parts.push(group(["{", indent([...members, ...node.hasUnknownMembers ? [hardline, "..."] : []]), printDanglingComments(path, options, true), hardline, "}"]));
  28355. }
  28356. return parts;
  28357. }
  28358. case "EnumBooleanMember":
  28359. case "EnumNumberMember":
  28360. case "EnumStringMember":
  28361. return [print("id"), " = ", typeof node.init === "object" ? print("init") : String(node.init)];
  28362. case "EnumDefaultedMember":
  28363. return print("id");
  28364. case "FunctionTypeParam": {
  28365. const name = node.name ? print("name") : path.getParentNode().this === node ? "this" : "";
  28366. return [name, printOptionalToken(path), name ? ": " : "", print("typeAnnotation")];
  28367. }
  28368. case "InterfaceDeclaration":
  28369. case "InterfaceTypeAnnotation":
  28370. return printInterface(path, options, print);
  28371. case "ClassImplements":
  28372. case "InterfaceExtends":
  28373. return [print("id"), print("typeParameters")];
  28374. case "NullableTypeAnnotation":
  28375. return ["?", print("typeAnnotation")];
  28376. case "Variance": {
  28377. const {
  28378. kind
  28379. } = node;
  28380. assert.ok(kind === "plus" || kind === "minus");
  28381. return kind === "plus" ? "+" : "-";
  28382. }
  28383. case "ObjectTypeCallProperty":
  28384. if (node.static) {
  28385. parts.push("static ");
  28386. }
  28387. parts.push(print("value"));
  28388. return parts;
  28389. case "ObjectTypeIndexer": {
  28390. return [node.static ? "static " : "", node.variance ? print("variance") : "", "[", print("id"), node.id ? ": " : "", print("key"), "]: ", print("value")];
  28391. }
  28392. case "ObjectTypeProperty": {
  28393. let modifier = "";
  28394. if (node.proto) {
  28395. modifier = "proto ";
  28396. } else if (node.static) {
  28397. modifier = "static ";
  28398. }
  28399. return [modifier, isGetterOrSetter(node) ? node.kind + " " : "", node.variance ? print("variance") : "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation(node) ? "" : ": ", print("value")];
  28400. }
  28401. case "ObjectTypeAnnotation":
  28402. return printObject(path, options, print);
  28403. case "ObjectTypeInternalSlot":
  28404. return [node.static ? "static " : "", "[[", print("id"), "]]", printOptionalToken(path), node.method ? "" : ": ", print("value")];
  28405. case "ObjectTypeSpreadProperty":
  28406. return printRestSpread(path, options, print);
  28407. case "QualifiedTypeofIdentifier":
  28408. case "QualifiedTypeIdentifier":
  28409. return [print("qualification"), ".", print("id")];
  28410. case "StringLiteralTypeAnnotation":
  28411. return replaceTextEndOfLine(printString(rawText(node), options));
  28412. case "NumberLiteralTypeAnnotation":
  28413. assert.strictEqual(typeof node.value, "number");
  28414. case "BigIntLiteralTypeAnnotation":
  28415. if (node.extra) {
  28416. return printNumber(node.extra.raw);
  28417. }
  28418. return printNumber(node.raw);
  28419. case "TypeCastExpression": {
  28420. return ["(", print("expression"), printTypeAnnotation(path, options, print), ")"];
  28421. }
  28422. case "TypeParameterDeclaration":
  28423. case "TypeParameterInstantiation": {
  28424. const printed = printTypeParameters(path, options, print, "params");
  28425. if (options.parser === "flow") {
  28426. const start = locStart(node);
  28427. const end = locEnd(node);
  28428. const commentStartIndex = options.originalText.lastIndexOf("/*", start);
  28429. const commentEndIndex = options.originalText.indexOf("*/", end);
  28430. if (commentStartIndex !== -1 && commentEndIndex !== -1) {
  28431. const comment = options.originalText.slice(commentStartIndex + 2, commentEndIndex).trim();
  28432. if (comment.startsWith("::") && !comment.includes("/*") && !comment.includes("*/")) {
  28433. return ["/*:: ", printed, " */"];
  28434. }
  28435. }
  28436. }
  28437. return printed;
  28438. }
  28439. case "InferredPredicate":
  28440. return "%checks";
  28441. case "DeclaredPredicate":
  28442. return ["%checks(", print("value"), ")"];
  28443. case "AnyTypeAnnotation":
  28444. return "any";
  28445. case "BooleanTypeAnnotation":
  28446. return "boolean";
  28447. case "BigIntTypeAnnotation":
  28448. return "bigint";
  28449. case "NullLiteralTypeAnnotation":
  28450. return "null";
  28451. case "NumberTypeAnnotation":
  28452. return "number";
  28453. case "SymbolTypeAnnotation":
  28454. return "symbol";
  28455. case "StringTypeAnnotation":
  28456. return "string";
  28457. case "VoidTypeAnnotation":
  28458. return "void";
  28459. case "ThisTypeAnnotation":
  28460. return "this";
  28461. case "Node":
  28462. case "Printable":
  28463. case "SourceLocation":
  28464. case "Position":
  28465. case "Statement":
  28466. case "Function":
  28467. case "Pattern":
  28468. case "Expression":
  28469. case "Declaration":
  28470. case "Specifier":
  28471. case "NamedSpecifier":
  28472. case "Comment":
  28473. case "MemberTypeAnnotation":
  28474. case "Type":
  28475. throw new Error("unprintable type: " + JSON.stringify(node.type));
  28476. }
  28477. }
  28478. function printFlowDeclaration(path, printed) {
  28479. const parentExportDecl = getParentExportDeclaration(path);
  28480. if (parentExportDecl) {
  28481. assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
  28482. return printed;
  28483. }
  28484. return ["declare ", printed];
  28485. }
  28486. module2.exports = {
  28487. printFlow
  28488. };
  28489. }
  28490. });
  28491. var require_is_ts_keyword_type = __commonJS2({
  28492. "src/language-js/utils/is-ts-keyword-type.js"(exports2, module2) {
  28493. "use strict";
  28494. function isTsKeywordType({
  28495. type
  28496. }) {
  28497. return type.startsWith("TS") && type.endsWith("Keyword");
  28498. }
  28499. module2.exports = isTsKeywordType;
  28500. }
  28501. });
  28502. var require_ternary = __commonJS2({
  28503. "src/language-js/print/ternary.js"(exports2, module2) {
  28504. "use strict";
  28505. var {
  28506. hasNewlineInRange
  28507. } = require_util();
  28508. var {
  28509. isJsxNode,
  28510. getComments,
  28511. isCallExpression,
  28512. isMemberExpression,
  28513. isTSTypeExpression
  28514. } = require_utils7();
  28515. var {
  28516. locStart,
  28517. locEnd
  28518. } = require_loc();
  28519. var isBlockComment = require_is_block_comment();
  28520. var {
  28521. builders: {
  28522. line,
  28523. softline,
  28524. group,
  28525. indent,
  28526. align,
  28527. ifBreak,
  28528. dedent,
  28529. breakParent
  28530. }
  28531. } = require("./doc.js");
  28532. function conditionalExpressionChainContainsJsx(node) {
  28533. const conditionalExpressions = [node];
  28534. for (let index = 0; index < conditionalExpressions.length; index++) {
  28535. const conditionalExpression = conditionalExpressions[index];
  28536. for (const property of ["test", "consequent", "alternate"]) {
  28537. const node2 = conditionalExpression[property];
  28538. if (isJsxNode(node2)) {
  28539. return true;
  28540. }
  28541. if (node2.type === "ConditionalExpression") {
  28542. conditionalExpressions.push(node2);
  28543. }
  28544. }
  28545. }
  28546. return false;
  28547. }
  28548. function printTernaryTest(path, options, print) {
  28549. const node = path.getValue();
  28550. const isConditionalExpression = node.type === "ConditionalExpression";
  28551. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  28552. const parent = path.getParentNode();
  28553. const printed = isConditionalExpression ? print("test") : [print("checkType"), " ", "extends", " ", print("extendsType")];
  28554. if (parent.type === node.type && parent[alternateNodePropertyName] === node) {
  28555. return align(2, printed);
  28556. }
  28557. return printed;
  28558. }
  28559. var ancestorNameMap = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"]]);
  28560. function shouldExtraIndentForConditionalExpression(path) {
  28561. const node = path.getValue();
  28562. if (node.type !== "ConditionalExpression") {
  28563. return false;
  28564. }
  28565. let parent;
  28566. let child = node;
  28567. for (let ancestorCount = 0; !parent; ancestorCount++) {
  28568. const node2 = path.getParentNode(ancestorCount);
  28569. if (isCallExpression(node2) && node2.callee === child || isMemberExpression(node2) && node2.object === child || node2.type === "TSNonNullExpression" && node2.expression === child) {
  28570. child = node2;
  28571. continue;
  28572. }
  28573. if (node2.type === "NewExpression" && node2.callee === child || isTSTypeExpression(node2) && node2.expression === child) {
  28574. parent = path.getParentNode(ancestorCount + 1);
  28575. child = node2;
  28576. } else {
  28577. parent = node2;
  28578. }
  28579. }
  28580. if (child === node) {
  28581. return false;
  28582. }
  28583. return parent[ancestorNameMap.get(parent.type)] === child;
  28584. }
  28585. function printTernary(path, options, print) {
  28586. const node = path.getValue();
  28587. const isConditionalExpression = node.type === "ConditionalExpression";
  28588. const consequentNodePropertyName = isConditionalExpression ? "consequent" : "trueType";
  28589. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  28590. const testNodePropertyNames = isConditionalExpression ? ["test"] : ["checkType", "extendsType"];
  28591. const consequentNode = node[consequentNodePropertyName];
  28592. const alternateNode = node[alternateNodePropertyName];
  28593. const parts = [];
  28594. let jsxMode = false;
  28595. const parent = path.getParentNode();
  28596. const isParentTest = parent.type === node.type && testNodePropertyNames.some((prop) => parent[prop] === node);
  28597. let forceNoIndent = parent.type === node.type && !isParentTest;
  28598. let currentParent;
  28599. let previousParent;
  28600. let i = 0;
  28601. do {
  28602. previousParent = currentParent || node;
  28603. currentParent = path.getParentNode(i);
  28604. i++;
  28605. } while (currentParent && currentParent.type === node.type && testNodePropertyNames.every((prop) => currentParent[prop] !== previousParent));
  28606. const firstNonConditionalParent = currentParent || parent;
  28607. const lastConditionalParent = previousParent;
  28608. if (isConditionalExpression && (isJsxNode(node[testNodePropertyNames[0]]) || isJsxNode(consequentNode) || isJsxNode(alternateNode) || conditionalExpressionChainContainsJsx(lastConditionalParent))) {
  28609. jsxMode = true;
  28610. forceNoIndent = true;
  28611. const wrap = (doc2) => [ifBreak("("), indent([softline, doc2]), softline, ifBreak(")")];
  28612. const isNil = (node2) => node2.type === "NullLiteral" || node2.type === "Literal" && node2.value === null || node2.type === "Identifier" && node2.name === "undefined";
  28613. parts.push(" ? ", isNil(consequentNode) ? print(consequentNodePropertyName) : wrap(print(consequentNodePropertyName)), " : ", alternateNode.type === node.type || isNil(alternateNode) ? print(alternateNodePropertyName) : wrap(print(alternateNodePropertyName)));
  28614. } else {
  28615. 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))];
  28616. parts.push(parent.type !== node.type || parent[alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent(indent(part)) : align(Math.max(0, options.tabWidth - 2), part));
  28617. }
  28618. const comments = [...testNodePropertyNames.map((propertyName) => getComments(node[propertyName])), getComments(consequentNode), getComments(alternateNode)].flat();
  28619. const shouldBreak = comments.some((comment) => isBlockComment(comment) && hasNewlineInRange(options.originalText, locStart(comment), locEnd(comment)));
  28620. const maybeGroup = (doc2) => parent === firstNonConditionalParent ? group(doc2, {
  28621. shouldBreak
  28622. }) : shouldBreak ? [doc2, breakParent] : doc2;
  28623. const breakClosingParen = !jsxMode && (isMemberExpression(parent) || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
  28624. const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
  28625. const result = maybeGroup([printTernaryTest(path, options, print), forceNoIndent ? parts : indent(parts), isConditionalExpression && breakClosingParen && !shouldExtraIndent ? softline : ""]);
  28626. return isParentTest || shouldExtraIndent ? group([indent([softline, result]), softline]) : result;
  28627. }
  28628. module2.exports = {
  28629. printTernary
  28630. };
  28631. }
  28632. });
  28633. var require_statement = __commonJS2({
  28634. "src/language-js/print/statement.js"(exports2, module2) {
  28635. "use strict";
  28636. var {
  28637. builders: {
  28638. hardline
  28639. }
  28640. } = require("./doc.js");
  28641. var pathNeedsParens = require_needs_parens();
  28642. var {
  28643. getLeftSidePathName,
  28644. hasNakedLeftSide,
  28645. isJsxNode,
  28646. isTheOnlyJsxElementInMarkdown,
  28647. hasComment,
  28648. CommentCheckFlags,
  28649. isNextLineEmpty
  28650. } = require_utils7();
  28651. var {
  28652. shouldPrintParamsWithoutParens
  28653. } = require_function();
  28654. function printStatementSequence(path, options, print, property) {
  28655. const node = path.getValue();
  28656. const parts = [];
  28657. const isClassBody = node.type === "ClassBody";
  28658. const lastStatement = getLastStatement(node[property]);
  28659. path.each((path2, index, statements) => {
  28660. const node2 = path2.getValue();
  28661. if (node2.type === "EmptyStatement") {
  28662. return;
  28663. }
  28664. const printed = print();
  28665. if (!options.semi && !isClassBody && !isTheOnlyJsxElementInMarkdown(options, path2) && statementNeedsASIProtection(path2, options)) {
  28666. if (hasComment(node2, CommentCheckFlags.Leading)) {
  28667. parts.push(print([], {
  28668. needsSemi: true
  28669. }));
  28670. } else {
  28671. parts.push(";", printed);
  28672. }
  28673. } else {
  28674. parts.push(printed);
  28675. }
  28676. if (!options.semi && isClassBody && isClassProperty(node2) && shouldPrintSemicolonAfterClassProperty(node2, statements[index + 1])) {
  28677. parts.push(";");
  28678. }
  28679. if (node2 !== lastStatement) {
  28680. parts.push(hardline);
  28681. if (isNextLineEmpty(node2, options)) {
  28682. parts.push(hardline);
  28683. }
  28684. }
  28685. }, property);
  28686. return parts;
  28687. }
  28688. function getLastStatement(statements) {
  28689. for (let i = statements.length - 1; i >= 0; i--) {
  28690. const statement = statements[i];
  28691. if (statement.type !== "EmptyStatement") {
  28692. return statement;
  28693. }
  28694. }
  28695. }
  28696. function statementNeedsASIProtection(path, options) {
  28697. const node = path.getNode();
  28698. if (node.type !== "ExpressionStatement") {
  28699. return false;
  28700. }
  28701. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), "expression");
  28702. }
  28703. function expressionNeedsASIProtection(path, options) {
  28704. const node = path.getValue();
  28705. switch (node.type) {
  28706. case "ParenthesizedExpression":
  28707. case "TypeCastExpression":
  28708. case "ArrayExpression":
  28709. case "ArrayPattern":
  28710. case "TemplateLiteral":
  28711. case "TemplateElement":
  28712. case "RegExpLiteral":
  28713. return true;
  28714. case "ArrowFunctionExpression": {
  28715. if (!shouldPrintParamsWithoutParens(path, options)) {
  28716. return true;
  28717. }
  28718. break;
  28719. }
  28720. case "UnaryExpression": {
  28721. const {
  28722. prefix,
  28723. operator
  28724. } = node;
  28725. if (prefix && (operator === "+" || operator === "-")) {
  28726. return true;
  28727. }
  28728. break;
  28729. }
  28730. case "BindExpression": {
  28731. if (!node.object) {
  28732. return true;
  28733. }
  28734. break;
  28735. }
  28736. case "Literal": {
  28737. if (node.regex) {
  28738. return true;
  28739. }
  28740. break;
  28741. }
  28742. default: {
  28743. if (isJsxNode(node)) {
  28744. return true;
  28745. }
  28746. }
  28747. }
  28748. if (pathNeedsParens(path, options)) {
  28749. return true;
  28750. }
  28751. if (!hasNakedLeftSide(node)) {
  28752. return false;
  28753. }
  28754. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), ...getLeftSidePathName(path, node));
  28755. }
  28756. function printBody(path, options, print) {
  28757. return printStatementSequence(path, options, print, "body");
  28758. }
  28759. function printSwitchCaseConsequent(path, options, print) {
  28760. return printStatementSequence(path, options, print, "consequent");
  28761. }
  28762. var isClassProperty = ({
  28763. type
  28764. }) => type === "ClassProperty" || type === "PropertyDefinition" || type === "ClassPrivateProperty" || type === "ClassAccessorProperty" || type === "AccessorProperty" || type === "TSAbstractPropertyDefinition" || type === "TSAbstractAccessorProperty";
  28765. function shouldPrintSemicolonAfterClassProperty(node, nextNode) {
  28766. const {
  28767. type,
  28768. name
  28769. } = node.key;
  28770. if (!node.computed && type === "Identifier" && (name === "static" || name === "get" || name === "set" || name === "accessor") && !node.value && !node.typeAnnotation) {
  28771. return true;
  28772. }
  28773. if (!nextNode) {
  28774. return false;
  28775. }
  28776. if (nextNode.static || nextNode.accessibility) {
  28777. return false;
  28778. }
  28779. if (!nextNode.computed) {
  28780. const name2 = nextNode.key && nextNode.key.name;
  28781. if (name2 === "in" || name2 === "instanceof") {
  28782. return true;
  28783. }
  28784. }
  28785. if (isClassProperty(nextNode) && nextNode.variance && !nextNode.static && !nextNode.declare) {
  28786. return true;
  28787. }
  28788. switch (nextNode.type) {
  28789. case "ClassProperty":
  28790. case "PropertyDefinition":
  28791. case "TSAbstractPropertyDefinition":
  28792. return nextNode.computed;
  28793. case "MethodDefinition":
  28794. case "TSAbstractMethodDefinition":
  28795. case "ClassMethod":
  28796. case "ClassPrivateMethod": {
  28797. const isAsync = nextNode.value ? nextNode.value.async : nextNode.async;
  28798. if (isAsync || nextNode.kind === "get" || nextNode.kind === "set") {
  28799. return false;
  28800. }
  28801. const isGenerator = nextNode.value ? nextNode.value.generator : nextNode.generator;
  28802. if (nextNode.computed || isGenerator) {
  28803. return true;
  28804. }
  28805. return false;
  28806. }
  28807. case "TSIndexSignature":
  28808. return true;
  28809. }
  28810. return false;
  28811. }
  28812. module2.exports = {
  28813. printBody,
  28814. printSwitchCaseConsequent
  28815. };
  28816. }
  28817. });
  28818. var require_block = __commonJS2({
  28819. "src/language-js/print/block.js"(exports2, module2) {
  28820. "use strict";
  28821. var {
  28822. printDanglingComments
  28823. } = require_comments();
  28824. var {
  28825. isNonEmptyArray
  28826. } = require_util();
  28827. var {
  28828. builders: {
  28829. hardline,
  28830. indent
  28831. }
  28832. } = require("./doc.js");
  28833. var {
  28834. hasComment,
  28835. CommentCheckFlags,
  28836. isNextLineEmpty
  28837. } = require_utils7();
  28838. var {
  28839. printHardlineAfterHeritage
  28840. } = require_class();
  28841. var {
  28842. printBody
  28843. } = require_statement();
  28844. function printBlock(path, options, print) {
  28845. const node = path.getValue();
  28846. const parts = [];
  28847. if (node.type === "StaticBlock") {
  28848. parts.push("static ");
  28849. }
  28850. if (node.type === "ClassBody" && isNonEmptyArray(node.body)) {
  28851. const parent = path.getParentNode();
  28852. parts.push(printHardlineAfterHeritage(parent));
  28853. }
  28854. parts.push("{");
  28855. const printed = printBlockBody(path, options, print);
  28856. if (printed) {
  28857. parts.push(indent([hardline, printed]), hardline);
  28858. } else {
  28859. const parent = path.getParentNode();
  28860. const parentParent = path.getParentNode(1);
  28861. 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")) {
  28862. parts.push(hardline);
  28863. }
  28864. }
  28865. parts.push("}");
  28866. return parts;
  28867. }
  28868. function printBlockBody(path, options, print) {
  28869. const node = path.getValue();
  28870. const nodeHasDirectives = isNonEmptyArray(node.directives);
  28871. const nodeHasBody = node.body.some((node2) => node2.type !== "EmptyStatement");
  28872. const nodeHasComment = hasComment(node, CommentCheckFlags.Dangling);
  28873. if (!nodeHasDirectives && !nodeHasBody && !nodeHasComment) {
  28874. return "";
  28875. }
  28876. const parts = [];
  28877. if (nodeHasDirectives) {
  28878. path.each((childPath, index, directives) => {
  28879. parts.push(print());
  28880. if (index < directives.length - 1 || nodeHasBody || nodeHasComment) {
  28881. parts.push(hardline);
  28882. if (isNextLineEmpty(childPath.getValue(), options)) {
  28883. parts.push(hardline);
  28884. }
  28885. }
  28886. }, "directives");
  28887. }
  28888. if (nodeHasBody) {
  28889. parts.push(printBody(path, options, print));
  28890. }
  28891. if (nodeHasComment) {
  28892. parts.push(printDanglingComments(path, options, true));
  28893. }
  28894. if (node.type === "Program") {
  28895. const parent = path.getParentNode();
  28896. if (!parent || parent.type !== "ModuleExpression") {
  28897. parts.push(hardline);
  28898. }
  28899. }
  28900. return parts;
  28901. }
  28902. module2.exports = {
  28903. printBlock,
  28904. printBlockBody
  28905. };
  28906. }
  28907. });
  28908. var require_typescript = __commonJS2({
  28909. "src/language-js/print/typescript.js"(exports2, module2) {
  28910. "use strict";
  28911. var {
  28912. printDanglingComments
  28913. } = require_comments();
  28914. var {
  28915. hasNewlineInRange
  28916. } = require_util();
  28917. var {
  28918. builders: {
  28919. join,
  28920. line,
  28921. hardline,
  28922. softline,
  28923. group,
  28924. indent,
  28925. conditionalGroup,
  28926. ifBreak
  28927. }
  28928. } = require("./doc.js");
  28929. var {
  28930. isStringLiteral,
  28931. getTypeScriptMappedTypeModifier,
  28932. shouldPrintComma,
  28933. isCallExpression,
  28934. isMemberExpression
  28935. } = require_utils7();
  28936. var isTsKeywordType = require_is_ts_keyword_type();
  28937. var {
  28938. locStart,
  28939. locEnd
  28940. } = require_loc();
  28941. var {
  28942. printOptionalToken,
  28943. printTypeScriptModifiers
  28944. } = require_misc();
  28945. var {
  28946. printTernary
  28947. } = require_ternary();
  28948. var {
  28949. printFunctionParameters,
  28950. shouldGroupFunctionParameters
  28951. } = require_function_parameters();
  28952. var {
  28953. printTemplateLiteral
  28954. } = require_template_literal();
  28955. var {
  28956. printArrayItems
  28957. } = require_array4();
  28958. var {
  28959. printObject
  28960. } = require_object();
  28961. var {
  28962. printClassProperty,
  28963. printClassMethod
  28964. } = require_class();
  28965. var {
  28966. printTypeParameter,
  28967. printTypeParameters
  28968. } = require_type_parameters();
  28969. var {
  28970. printPropertyKey
  28971. } = require_property();
  28972. var {
  28973. printFunction,
  28974. printMethodInternal
  28975. } = require_function();
  28976. var {
  28977. printInterface
  28978. } = require_interface();
  28979. var {
  28980. printBlock
  28981. } = require_block();
  28982. var {
  28983. printTypeAlias,
  28984. printIntersectionType,
  28985. printUnionType,
  28986. printFunctionType,
  28987. printTupleType,
  28988. printIndexedAccessType,
  28989. printJSDocType
  28990. } = require_type_annotation();
  28991. function printTypescript(path, options, print) {
  28992. const node = path.getValue();
  28993. if (!node.type.startsWith("TS")) {
  28994. return;
  28995. }
  28996. if (isTsKeywordType(node)) {
  28997. return node.type.slice(2, -7).toLowerCase();
  28998. }
  28999. const semi = options.semi ? ";" : "";
  29000. const parts = [];
  29001. switch (node.type) {
  29002. case "TSThisType":
  29003. return "this";
  29004. case "TSTypeAssertion": {
  29005. const shouldBreakAfterCast = !(node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression");
  29006. const castGroup = group(["<", indent([softline, print("typeAnnotation")]), softline, ">"]);
  29007. const exprContents = [ifBreak("("), indent([softline, print("expression")]), softline, ifBreak(")")];
  29008. if (shouldBreakAfterCast) {
  29009. return conditionalGroup([[castGroup, print("expression")], [castGroup, group(exprContents, {
  29010. shouldBreak: true
  29011. })], [castGroup, print("expression")]]);
  29012. }
  29013. return group([castGroup, print("expression")]);
  29014. }
  29015. case "TSDeclareFunction":
  29016. return printFunction(path, print, options);
  29017. case "TSExportAssignment":
  29018. return ["export = ", print("expression"), semi];
  29019. case "TSModuleBlock":
  29020. return printBlock(path, options, print);
  29021. case "TSInterfaceBody":
  29022. case "TSTypeLiteral":
  29023. return printObject(path, options, print);
  29024. case "TSTypeAliasDeclaration":
  29025. return printTypeAlias(path, options, print);
  29026. case "TSQualifiedName":
  29027. return join(".", [print("left"), print("right")]);
  29028. case "TSAbstractMethodDefinition":
  29029. case "TSDeclareMethod":
  29030. return printClassMethod(path, options, print);
  29031. case "TSAbstractAccessorProperty":
  29032. case "TSAbstractPropertyDefinition":
  29033. return printClassProperty(path, options, print);
  29034. case "TSInterfaceHeritage":
  29035. case "TSExpressionWithTypeArguments":
  29036. parts.push(print("expression"));
  29037. if (node.typeParameters) {
  29038. parts.push(print("typeParameters"));
  29039. }
  29040. return parts;
  29041. case "TSTemplateLiteralType":
  29042. return printTemplateLiteral(path, print, options);
  29043. case "TSNamedTupleMember":
  29044. return [print("label"), node.optional ? "?" : "", ": ", print("elementType")];
  29045. case "TSRestType":
  29046. return ["...", print("typeAnnotation")];
  29047. case "TSOptionalType":
  29048. return [print("typeAnnotation"), "?"];
  29049. case "TSInterfaceDeclaration":
  29050. return printInterface(path, options, print);
  29051. case "TSClassImplements":
  29052. return [print("expression"), print("typeParameters")];
  29053. case "TSTypeParameterDeclaration":
  29054. case "TSTypeParameterInstantiation":
  29055. return printTypeParameters(path, options, print, "params");
  29056. case "TSTypeParameter":
  29057. return printTypeParameter(path, options, print);
  29058. case "TSSatisfiesExpression":
  29059. case "TSAsExpression": {
  29060. const operator = node.type === "TSAsExpression" ? "as" : "satisfies";
  29061. parts.push(print("expression"), ` ${operator} `, print("typeAnnotation"));
  29062. const parent = path.getParentNode();
  29063. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  29064. return group([indent([softline, ...parts]), softline]);
  29065. }
  29066. return parts;
  29067. }
  29068. case "TSArrayType":
  29069. return [print("elementType"), "[]"];
  29070. case "TSPropertySignature": {
  29071. if (node.readonly) {
  29072. parts.push("readonly ");
  29073. }
  29074. parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
  29075. if (node.typeAnnotation) {
  29076. parts.push(": ", print("typeAnnotation"));
  29077. }
  29078. if (node.initializer) {
  29079. parts.push(" = ", print("initializer"));
  29080. }
  29081. return parts;
  29082. }
  29083. case "TSParameterProperty":
  29084. if (node.accessibility) {
  29085. parts.push(node.accessibility + " ");
  29086. }
  29087. if (node.export) {
  29088. parts.push("export ");
  29089. }
  29090. if (node.static) {
  29091. parts.push("static ");
  29092. }
  29093. if (node.override) {
  29094. parts.push("override ");
  29095. }
  29096. if (node.readonly) {
  29097. parts.push("readonly ");
  29098. }
  29099. parts.push(print("parameter"));
  29100. return parts;
  29101. case "TSTypeQuery":
  29102. return ["typeof ", print("exprName"), print("typeParameters")];
  29103. case "TSIndexSignature": {
  29104. const parent = path.getParentNode();
  29105. const trailingComma = node.parameters.length > 1 ? ifBreak(shouldPrintComma(options) ? "," : "") : "";
  29106. const parametersGroup = group([indent([softline, join([", ", softline], path.map(print, "parameters"))]), trailingComma, softline]);
  29107. 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 : ""];
  29108. }
  29109. case "TSTypePredicate":
  29110. return [node.asserts ? "asserts " : "", print("parameterName"), node.typeAnnotation ? [" is ", print("typeAnnotation")] : ""];
  29111. case "TSNonNullExpression":
  29112. return [print("expression"), "!"];
  29113. case "TSImportType":
  29114. return [!node.isTypeOf ? "" : "typeof ", "import(", print(node.parameter ? "parameter" : "argument"), ")", !node.qualifier ? "" : [".", print("qualifier")], printTypeParameters(path, options, print, "typeParameters")];
  29115. case "TSLiteralType":
  29116. return print("literal");
  29117. case "TSIndexedAccessType":
  29118. return printIndexedAccessType(path, options, print);
  29119. case "TSConstructSignatureDeclaration":
  29120. case "TSCallSignatureDeclaration":
  29121. case "TSConstructorType": {
  29122. if (node.type === "TSConstructorType" && node.abstract) {
  29123. parts.push("abstract ");
  29124. }
  29125. if (node.type !== "TSCallSignatureDeclaration") {
  29126. parts.push("new ");
  29127. }
  29128. parts.push(group(printFunctionParameters(path, print, options, false, true)));
  29129. if (node.returnType || node.typeAnnotation) {
  29130. const isType = node.type === "TSConstructorType";
  29131. parts.push(isType ? " => " : ": ", print("returnType"), print("typeAnnotation"));
  29132. }
  29133. return parts;
  29134. }
  29135. case "TSTypeOperator":
  29136. return [node.operator, " ", print("typeAnnotation")];
  29137. case "TSMappedType": {
  29138. const shouldBreak = hasNewlineInRange(options.originalText, locStart(node), locEnd(node));
  29139. return group(["{", indent([options.bracketSpacing ? line : softline, print("typeParameter"), node.optional ? getTypeScriptMappedTypeModifier(node.optional, "?") : "", node.typeAnnotation ? ": " : "", print("typeAnnotation"), ifBreak(semi)]), printDanglingComments(path, options, true), options.bracketSpacing ? line : softline, "}"], {
  29140. shouldBreak
  29141. });
  29142. }
  29143. case "TSMethodSignature": {
  29144. const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
  29145. 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));
  29146. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  29147. const returnTypePropertyName = node.returnType ? "returnType" : "typeAnnotation";
  29148. const returnTypeNode = node[returnTypePropertyName];
  29149. const returnTypeDoc = returnTypeNode ? print(returnTypePropertyName) : "";
  29150. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  29151. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  29152. if (returnTypeNode) {
  29153. parts.push(": ", group(returnTypeDoc));
  29154. }
  29155. return group(parts);
  29156. }
  29157. case "TSNamespaceExportDeclaration":
  29158. parts.push("export as namespace ", print("id"));
  29159. if (options.semi) {
  29160. parts.push(";");
  29161. }
  29162. return group(parts);
  29163. case "TSEnumDeclaration":
  29164. if (node.declare) {
  29165. parts.push("declare ");
  29166. }
  29167. if (node.modifiers) {
  29168. parts.push(printTypeScriptModifiers(path, options, print));
  29169. }
  29170. if (node.const) {
  29171. parts.push("const ");
  29172. }
  29173. parts.push("enum ", print("id"), " ");
  29174. if (node.members.length === 0) {
  29175. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  29176. } else {
  29177. parts.push(group(["{", indent([hardline, printArrayItems(path, options, "members", print), shouldPrintComma(options, "es5") ? "," : ""]), printDanglingComments(path, options, true), hardline, "}"]));
  29178. }
  29179. return parts;
  29180. case "TSEnumMember":
  29181. if (node.computed) {
  29182. parts.push("[", print("id"), "]");
  29183. } else {
  29184. parts.push(print("id"));
  29185. }
  29186. if (node.initializer) {
  29187. parts.push(" = ", print("initializer"));
  29188. }
  29189. return parts;
  29190. case "TSImportEqualsDeclaration":
  29191. if (node.isExport) {
  29192. parts.push("export ");
  29193. }
  29194. parts.push("import ");
  29195. if (node.importKind && node.importKind !== "value") {
  29196. parts.push(node.importKind, " ");
  29197. }
  29198. parts.push(print("id"), " = ", print("moduleReference"));
  29199. if (options.semi) {
  29200. parts.push(";");
  29201. }
  29202. return group(parts);
  29203. case "TSExternalModuleReference":
  29204. return ["require(", print("expression"), ")"];
  29205. case "TSModuleDeclaration": {
  29206. const parent = path.getParentNode();
  29207. const isExternalModule = isStringLiteral(node.id);
  29208. const parentIsDeclaration = parent.type === "TSModuleDeclaration";
  29209. const bodyIsDeclaration = node.body && node.body.type === "TSModuleDeclaration";
  29210. if (parentIsDeclaration) {
  29211. parts.push(".");
  29212. } else {
  29213. if (node.declare) {
  29214. parts.push("declare ");
  29215. }
  29216. parts.push(printTypeScriptModifiers(path, options, print));
  29217. const textBetweenNodeAndItsId = options.originalText.slice(locStart(node), locStart(node.id));
  29218. const isGlobalDeclaration = node.id.type === "Identifier" && node.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
  29219. if (!isGlobalDeclaration) {
  29220. parts.push(isExternalModule || /(?:^|\s)module(?:\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
  29221. }
  29222. }
  29223. parts.push(print("id"));
  29224. if (bodyIsDeclaration) {
  29225. parts.push(print("body"));
  29226. } else if (node.body) {
  29227. parts.push(" ", group(print("body")));
  29228. } else {
  29229. parts.push(semi);
  29230. }
  29231. return parts;
  29232. }
  29233. case "TSConditionalType":
  29234. return printTernary(path, options, print);
  29235. case "TSInferType":
  29236. return ["infer", " ", print("typeParameter")];
  29237. case "TSIntersectionType":
  29238. return printIntersectionType(path, options, print);
  29239. case "TSUnionType":
  29240. return printUnionType(path, options, print);
  29241. case "TSFunctionType":
  29242. return printFunctionType(path, options, print);
  29243. case "TSTupleType":
  29244. return printTupleType(path, options, print);
  29245. case "TSTypeReference":
  29246. return [print("typeName"), printTypeParameters(path, options, print, "typeParameters")];
  29247. case "TSTypeAnnotation":
  29248. return print("typeAnnotation");
  29249. case "TSEmptyBodyFunctionExpression":
  29250. return printMethodInternal(path, options, print);
  29251. case "TSJSDocAllType":
  29252. return "*";
  29253. case "TSJSDocUnknownType":
  29254. return "?";
  29255. case "TSJSDocNullableType":
  29256. return printJSDocType(path, print, "?");
  29257. case "TSJSDocNonNullableType":
  29258. return printJSDocType(path, print, "!");
  29259. case "TSInstantiationExpression":
  29260. return [print("expression"), print("typeParameters")];
  29261. default:
  29262. throw new Error(`Unknown TypeScript node type: ${JSON.stringify(node.type)}.`);
  29263. }
  29264. }
  29265. module2.exports = {
  29266. printTypescript
  29267. };
  29268. }
  29269. });
  29270. var require_comment = __commonJS2({
  29271. "src/language-js/print/comment.js"(exports2, module2) {
  29272. "use strict";
  29273. var {
  29274. hasNewline
  29275. } = require_util();
  29276. var {
  29277. builders: {
  29278. join,
  29279. hardline
  29280. },
  29281. utils: {
  29282. replaceTextEndOfLine
  29283. }
  29284. } = require("./doc.js");
  29285. var {
  29286. isLineComment
  29287. } = require_utils7();
  29288. var {
  29289. locStart,
  29290. locEnd
  29291. } = require_loc();
  29292. var isBlockComment = require_is_block_comment();
  29293. function printComment(commentPath, options) {
  29294. const comment = commentPath.getValue();
  29295. if (isLineComment(comment)) {
  29296. return options.originalText.slice(locStart(comment), locEnd(comment)).trimEnd();
  29297. }
  29298. if (isBlockComment(comment)) {
  29299. if (isIndentableBlockComment(comment)) {
  29300. const printed = printIndentableBlockComment(comment);
  29301. if (comment.trailing && !hasNewline(options.originalText, locStart(comment), {
  29302. backwards: true
  29303. })) {
  29304. return [hardline, printed];
  29305. }
  29306. return printed;
  29307. }
  29308. const commentEnd = locEnd(comment);
  29309. const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
  29310. return ["/*", replaceTextEndOfLine(comment.value), isInsideFlowComment ? "*-/" : "*/"];
  29311. }
  29312. throw new Error("Not a comment: " + JSON.stringify(comment));
  29313. }
  29314. function isIndentableBlockComment(comment) {
  29315. const lines = `*${comment.value}*`.split("\n");
  29316. return lines.length > 1 && lines.every((line) => line.trim()[0] === "*");
  29317. }
  29318. function printIndentableBlockComment(comment) {
  29319. const lines = comment.value.split("\n");
  29320. return ["/*", join(hardline, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"];
  29321. }
  29322. module2.exports = {
  29323. printComment
  29324. };
  29325. }
  29326. });
  29327. var require_literal = __commonJS2({
  29328. "src/language-js/print/literal.js"(exports2, module2) {
  29329. "use strict";
  29330. var {
  29331. printString,
  29332. printNumber
  29333. } = require_util();
  29334. var {
  29335. replaceTextEndOfLine
  29336. } = require_doc_utils();
  29337. var {
  29338. printDirective
  29339. } = require_misc();
  29340. function printLiteral(path, options) {
  29341. const node = path.getNode();
  29342. switch (node.type) {
  29343. case "RegExpLiteral":
  29344. return printRegex(node);
  29345. case "BigIntLiteral":
  29346. return printBigInt(node.bigint || node.extra.raw);
  29347. case "NumericLiteral":
  29348. return printNumber(node.extra.raw);
  29349. case "StringLiteral":
  29350. return replaceTextEndOfLine(printString(node.extra.raw, options));
  29351. case "NullLiteral":
  29352. return "null";
  29353. case "BooleanLiteral":
  29354. return String(node.value);
  29355. case "DecimalLiteral":
  29356. return printNumber(node.value) + "m";
  29357. case "Literal": {
  29358. if (node.regex) {
  29359. return printRegex(node.regex);
  29360. }
  29361. if (node.bigint) {
  29362. return printBigInt(node.raw);
  29363. }
  29364. if (node.decimal) {
  29365. return printNumber(node.decimal) + "m";
  29366. }
  29367. const {
  29368. value
  29369. } = node;
  29370. if (typeof value === "number") {
  29371. return printNumber(node.raw);
  29372. }
  29373. if (typeof value === "string") {
  29374. return isDirective(path) ? printDirective(node.raw, options) : replaceTextEndOfLine(printString(node.raw, options));
  29375. }
  29376. return String(value);
  29377. }
  29378. }
  29379. }
  29380. function isDirective(path) {
  29381. if (path.getName() !== "expression") {
  29382. return;
  29383. }
  29384. const parent = path.getParentNode();
  29385. return parent.type === "ExpressionStatement" && parent.directive;
  29386. }
  29387. function printBigInt(raw) {
  29388. return raw.toLowerCase();
  29389. }
  29390. function printRegex({
  29391. pattern,
  29392. flags
  29393. }) {
  29394. flags = [...flags].sort().join("");
  29395. return `/${pattern}/${flags}`;
  29396. }
  29397. module2.exports = {
  29398. printLiteral
  29399. };
  29400. }
  29401. });
  29402. var require_printer_estree = __commonJS2({
  29403. "src/language-js/printer-estree.js"(exports2, module2) {
  29404. "use strict";
  29405. var {
  29406. printDanglingComments
  29407. } = require_comments();
  29408. var {
  29409. hasNewline
  29410. } = require_util();
  29411. var {
  29412. builders: {
  29413. join,
  29414. line,
  29415. hardline,
  29416. softline,
  29417. group,
  29418. indent
  29419. },
  29420. utils: {
  29421. replaceTextEndOfLine
  29422. }
  29423. } = require("./doc.js");
  29424. var embed = require_embed();
  29425. var clean = require_clean();
  29426. var {
  29427. insertPragma
  29428. } = require_pragma();
  29429. var handleComments = require_comments2();
  29430. var pathNeedsParens = require_needs_parens();
  29431. var preprocess = require_print_preprocess();
  29432. var {
  29433. hasFlowShorthandAnnotationComment,
  29434. hasComment,
  29435. CommentCheckFlags,
  29436. isTheOnlyJsxElementInMarkdown,
  29437. isLineComment,
  29438. isNextLineEmpty,
  29439. needsHardlineAfterDanglingComment,
  29440. hasIgnoreComment,
  29441. isCallExpression,
  29442. isMemberExpression,
  29443. markerForIfWithoutBlockAndSameLineComment
  29444. } = require_utils7();
  29445. var {
  29446. locStart,
  29447. locEnd
  29448. } = require_loc();
  29449. var isBlockComment = require_is_block_comment();
  29450. var {
  29451. printHtmlBinding,
  29452. isVueEventBindingExpression
  29453. } = require_html_binding();
  29454. var {
  29455. printAngular
  29456. } = require_angular();
  29457. var {
  29458. printJsx,
  29459. hasJsxIgnoreComment
  29460. } = require_jsx();
  29461. var {
  29462. printFlow
  29463. } = require_flow();
  29464. var {
  29465. printTypescript
  29466. } = require_typescript();
  29467. var {
  29468. printOptionalToken,
  29469. printBindExpressionCallee,
  29470. printTypeAnnotation,
  29471. adjustClause,
  29472. printRestSpread,
  29473. printDefiniteToken,
  29474. printDirective
  29475. } = require_misc();
  29476. var {
  29477. printImportDeclaration,
  29478. printExportDeclaration,
  29479. printExportAllDeclaration,
  29480. printModuleSpecifier
  29481. } = require_module();
  29482. var {
  29483. printTernary
  29484. } = require_ternary();
  29485. var {
  29486. printTemplateLiteral
  29487. } = require_template_literal();
  29488. var {
  29489. printArray
  29490. } = require_array4();
  29491. var {
  29492. printObject
  29493. } = require_object();
  29494. var {
  29495. printClass,
  29496. printClassMethod,
  29497. printClassProperty
  29498. } = require_class();
  29499. var {
  29500. printProperty
  29501. } = require_property();
  29502. var {
  29503. printFunction,
  29504. printArrowFunction,
  29505. printMethod,
  29506. printReturnStatement,
  29507. printThrowStatement
  29508. } = require_function();
  29509. var {
  29510. printCallExpression
  29511. } = require_call_expression();
  29512. var {
  29513. printVariableDeclarator,
  29514. printAssignmentExpression
  29515. } = require_assignment();
  29516. var {
  29517. printBinaryishExpression
  29518. } = require_binaryish();
  29519. var {
  29520. printSwitchCaseConsequent
  29521. } = require_statement();
  29522. var {
  29523. printMemberExpression
  29524. } = require_member();
  29525. var {
  29526. printBlock,
  29527. printBlockBody
  29528. } = require_block();
  29529. var {
  29530. printComment
  29531. } = require_comment();
  29532. var {
  29533. printLiteral
  29534. } = require_literal();
  29535. var {
  29536. printDecorators
  29537. } = require_decorators();
  29538. function genericPrint(path, options, print, args) {
  29539. const printed = printPathNoParens(path, options, print, args);
  29540. if (!printed) {
  29541. return "";
  29542. }
  29543. const node = path.getValue();
  29544. const {
  29545. type
  29546. } = node;
  29547. 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") {
  29548. return printed;
  29549. }
  29550. let parts = [printed];
  29551. const printedDecorators = printDecorators(path, options, print);
  29552. const isClassExpressionWithDecorators = node.type === "ClassExpression" && printedDecorators;
  29553. if (printedDecorators) {
  29554. parts = [...printedDecorators, printed];
  29555. if (!isClassExpressionWithDecorators) {
  29556. return group(parts);
  29557. }
  29558. }
  29559. const needsParens = pathNeedsParens(path, options);
  29560. if (!needsParens) {
  29561. if (args && args.needsSemi) {
  29562. parts.unshift(";");
  29563. }
  29564. if (parts.length === 1 && parts[0] === printed) {
  29565. return printed;
  29566. }
  29567. return parts;
  29568. }
  29569. if (isClassExpressionWithDecorators) {
  29570. parts = [indent([line, ...parts])];
  29571. }
  29572. parts.unshift("(");
  29573. if (args && args.needsSemi) {
  29574. parts.unshift(";");
  29575. }
  29576. if (hasFlowShorthandAnnotationComment(node)) {
  29577. const [comment] = node.trailingComments;
  29578. parts.push(" /*", comment.value.trimStart(), "*/");
  29579. comment.printed = true;
  29580. }
  29581. if (isClassExpressionWithDecorators) {
  29582. parts.push(line);
  29583. }
  29584. parts.push(")");
  29585. return parts;
  29586. }
  29587. function printPathNoParens(path, options, print, args) {
  29588. const node = path.getValue();
  29589. const semi = options.semi ? ";" : "";
  29590. if (!node) {
  29591. return "";
  29592. }
  29593. if (typeof node === "string") {
  29594. return node;
  29595. }
  29596. for (const printer of [printLiteral, printHtmlBinding, printAngular, printJsx, printFlow, printTypescript]) {
  29597. const printed = printer(path, options, print);
  29598. if (typeof printed !== "undefined") {
  29599. return printed;
  29600. }
  29601. }
  29602. let parts = [];
  29603. switch (node.type) {
  29604. case "JsExpressionRoot":
  29605. return print("node");
  29606. case "JsonRoot":
  29607. return [print("node"), hardline];
  29608. case "File":
  29609. if (node.program && node.program.interpreter) {
  29610. parts.push(print(["program", "interpreter"]));
  29611. }
  29612. parts.push(print("program"));
  29613. return parts;
  29614. case "Program":
  29615. return printBlockBody(path, options, print);
  29616. case "EmptyStatement":
  29617. return "";
  29618. case "ExpressionStatement": {
  29619. if (options.parser === "__vue_event_binding" || options.parser === "__vue_ts_event_binding") {
  29620. const parent = path.getParentNode();
  29621. if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === node) {
  29622. return [print("expression"), isVueEventBindingExpression(node.expression) ? ";" : ""];
  29623. }
  29624. }
  29625. const danglingComment = printDanglingComments(path, options, true, ({
  29626. marker
  29627. }) => marker === markerForIfWithoutBlockAndSameLineComment);
  29628. return [print("expression"), isTheOnlyJsxElementInMarkdown(options, path) ? "" : semi, danglingComment ? [" ", danglingComment] : ""];
  29629. }
  29630. case "ParenthesizedExpression": {
  29631. const shouldHug = !hasComment(node.expression) && (node.expression.type === "ObjectExpression" || node.expression.type === "ArrayExpression");
  29632. if (shouldHug) {
  29633. return ["(", print("expression"), ")"];
  29634. }
  29635. return group(["(", indent([softline, print("expression")]), softline, ")"]);
  29636. }
  29637. case "AssignmentExpression":
  29638. return printAssignmentExpression(path, options, print);
  29639. case "VariableDeclarator":
  29640. return printVariableDeclarator(path, options, print);
  29641. case "BinaryExpression":
  29642. case "LogicalExpression":
  29643. return printBinaryishExpression(path, options, print);
  29644. case "AssignmentPattern":
  29645. return [print("left"), " = ", print("right")];
  29646. case "OptionalMemberExpression":
  29647. case "MemberExpression": {
  29648. return printMemberExpression(path, options, print);
  29649. }
  29650. case "MetaProperty":
  29651. return [print("meta"), ".", print("property")];
  29652. case "BindExpression":
  29653. if (node.object) {
  29654. parts.push(print("object"));
  29655. }
  29656. parts.push(group(indent([softline, printBindExpressionCallee(path, options, print)])));
  29657. return parts;
  29658. case "Identifier": {
  29659. return [node.name, printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print)];
  29660. }
  29661. case "V8IntrinsicIdentifier":
  29662. return ["%", node.name];
  29663. case "SpreadElement":
  29664. case "SpreadElementPattern":
  29665. case "SpreadProperty":
  29666. case "SpreadPropertyPattern":
  29667. case "RestElement":
  29668. return printRestSpread(path, options, print);
  29669. case "FunctionDeclaration":
  29670. case "FunctionExpression":
  29671. return printFunction(path, print, options, args);
  29672. case "ArrowFunctionExpression":
  29673. return printArrowFunction(path, options, print, args);
  29674. case "YieldExpression":
  29675. parts.push("yield");
  29676. if (node.delegate) {
  29677. parts.push("*");
  29678. }
  29679. if (node.argument) {
  29680. parts.push(" ", print("argument"));
  29681. }
  29682. return parts;
  29683. case "AwaitExpression": {
  29684. parts.push("await");
  29685. if (node.argument) {
  29686. parts.push(" ", print("argument"));
  29687. const parent = path.getParentNode();
  29688. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  29689. parts = [indent([softline, ...parts]), softline];
  29690. const parentAwaitOrBlock = path.findAncestor((node2) => node2.type === "AwaitExpression" || node2.type === "BlockStatement");
  29691. if (!parentAwaitOrBlock || parentAwaitOrBlock.type !== "AwaitExpression") {
  29692. return group(parts);
  29693. }
  29694. }
  29695. }
  29696. return parts;
  29697. }
  29698. case "ExportDefaultDeclaration":
  29699. case "ExportNamedDeclaration":
  29700. return printExportDeclaration(path, options, print);
  29701. case "ExportAllDeclaration":
  29702. return printExportAllDeclaration(path, options, print);
  29703. case "ImportDeclaration":
  29704. return printImportDeclaration(path, options, print);
  29705. case "ImportSpecifier":
  29706. case "ExportSpecifier":
  29707. case "ImportNamespaceSpecifier":
  29708. case "ExportNamespaceSpecifier":
  29709. case "ImportDefaultSpecifier":
  29710. case "ExportDefaultSpecifier":
  29711. return printModuleSpecifier(path, options, print);
  29712. case "ImportAttribute":
  29713. return [print("key"), ": ", print("value")];
  29714. case "Import":
  29715. return "import";
  29716. case "BlockStatement":
  29717. case "StaticBlock":
  29718. case "ClassBody":
  29719. return printBlock(path, options, print);
  29720. case "ThrowStatement":
  29721. return printThrowStatement(path, options, print);
  29722. case "ReturnStatement":
  29723. return printReturnStatement(path, options, print);
  29724. case "NewExpression":
  29725. case "ImportExpression":
  29726. case "OptionalCallExpression":
  29727. case "CallExpression":
  29728. return printCallExpression(path, options, print);
  29729. case "ObjectExpression":
  29730. case "ObjectPattern":
  29731. case "RecordExpression":
  29732. return printObject(path, options, print);
  29733. case "ObjectProperty":
  29734. case "Property":
  29735. if (node.method || node.kind === "get" || node.kind === "set") {
  29736. return printMethod(path, options, print);
  29737. }
  29738. return printProperty(path, options, print);
  29739. case "ObjectMethod":
  29740. return printMethod(path, options, print);
  29741. case "Decorator":
  29742. return ["@", print("expression")];
  29743. case "ArrayExpression":
  29744. case "ArrayPattern":
  29745. case "TupleExpression":
  29746. return printArray(path, options, print);
  29747. case "SequenceExpression": {
  29748. const parent = path.getParentNode(0);
  29749. if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
  29750. const parts2 = [];
  29751. path.each((expressionPath, index) => {
  29752. if (index === 0) {
  29753. parts2.push(print());
  29754. } else {
  29755. parts2.push(",", indent([line, print()]));
  29756. }
  29757. }, "expressions");
  29758. return group(parts2);
  29759. }
  29760. return group(join([",", line], path.map(print, "expressions")));
  29761. }
  29762. case "ThisExpression":
  29763. return "this";
  29764. case "Super":
  29765. return "super";
  29766. case "Directive":
  29767. return [print("value"), semi];
  29768. case "DirectiveLiteral":
  29769. return printDirective(node.extra.raw, options);
  29770. case "UnaryExpression":
  29771. parts.push(node.operator);
  29772. if (/[a-z]$/.test(node.operator)) {
  29773. parts.push(" ");
  29774. }
  29775. if (hasComment(node.argument)) {
  29776. parts.push(group(["(", indent([softline, print("argument")]), softline, ")"]));
  29777. } else {
  29778. parts.push(print("argument"));
  29779. }
  29780. return parts;
  29781. case "UpdateExpression":
  29782. parts.push(print("argument"), node.operator);
  29783. if (node.prefix) {
  29784. parts.reverse();
  29785. }
  29786. return parts;
  29787. case "ConditionalExpression":
  29788. return printTernary(path, options, print);
  29789. case "VariableDeclaration": {
  29790. const printed = path.map(print, "declarations");
  29791. const parentNode = path.getParentNode();
  29792. const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
  29793. const hasValue = node.declarations.some((decl) => decl.init);
  29794. let firstVariable;
  29795. if (printed.length === 1 && !hasComment(node.declarations[0])) {
  29796. firstVariable = printed[0];
  29797. } else if (printed.length > 0) {
  29798. firstVariable = indent(printed[0]);
  29799. }
  29800. parts = [node.declare ? "declare " : "", node.kind, firstVariable ? [" ", firstVariable] : "", indent(printed.slice(1).map((p) => [",", hasValue && !isParentForLoop ? hardline : line, p]))];
  29801. if (!(isParentForLoop && parentNode.body !== node)) {
  29802. parts.push(semi);
  29803. }
  29804. return group(parts);
  29805. }
  29806. case "WithStatement":
  29807. return group(["with (", print("object"), ")", adjustClause(node.body, print("body"))]);
  29808. case "IfStatement": {
  29809. const con = adjustClause(node.consequent, print("consequent"));
  29810. const opening = group(["if (", group([indent([softline, print("test")]), softline]), ")", con]);
  29811. parts.push(opening);
  29812. if (node.alternate) {
  29813. const commentOnOwnLine = hasComment(node.consequent, CommentCheckFlags.Trailing | CommentCheckFlags.Line) || needsHardlineAfterDanglingComment(node);
  29814. const elseOnSameLine = node.consequent.type === "BlockStatement" && !commentOnOwnLine;
  29815. parts.push(elseOnSameLine ? " " : hardline);
  29816. if (hasComment(node, CommentCheckFlags.Dangling)) {
  29817. parts.push(printDanglingComments(path, options, true), commentOnOwnLine ? hardline : " ");
  29818. }
  29819. parts.push("else", group(adjustClause(node.alternate, print("alternate"), node.alternate.type === "IfStatement")));
  29820. }
  29821. return parts;
  29822. }
  29823. case "ForStatement": {
  29824. const body = adjustClause(node.body, print("body"));
  29825. const dangling = printDanglingComments(path, options, true);
  29826. const printedComments = dangling ? [dangling, softline] : "";
  29827. if (!node.init && !node.test && !node.update) {
  29828. return [printedComments, group(["for (;;)", body])];
  29829. }
  29830. return [printedComments, group(["for (", group([indent([softline, print("init"), ";", line, print("test"), ";", line, print("update")]), softline]), ")", body])];
  29831. }
  29832. case "WhileStatement":
  29833. return group(["while (", group([indent([softline, print("test")]), softline]), ")", adjustClause(node.body, print("body"))]);
  29834. case "ForInStatement":
  29835. return group(["for (", print("left"), " in ", print("right"), ")", adjustClause(node.body, print("body"))]);
  29836. case "ForOfStatement":
  29837. return group(["for", node.await ? " await" : "", " (", print("left"), " of ", print("right"), ")", adjustClause(node.body, print("body"))]);
  29838. case "DoWhileStatement": {
  29839. const clause = adjustClause(node.body, print("body"));
  29840. const doBody = group(["do", clause]);
  29841. parts = [doBody];
  29842. if (node.body.type === "BlockStatement") {
  29843. parts.push(" ");
  29844. } else {
  29845. parts.push(hardline);
  29846. }
  29847. parts.push("while (", group([indent([softline, print("test")]), softline]), ")", semi);
  29848. return parts;
  29849. }
  29850. case "DoExpression":
  29851. return [node.async ? "async " : "", "do ", print("body")];
  29852. case "BreakStatement":
  29853. parts.push("break");
  29854. if (node.label) {
  29855. parts.push(" ", print("label"));
  29856. }
  29857. parts.push(semi);
  29858. return parts;
  29859. case "ContinueStatement":
  29860. parts.push("continue");
  29861. if (node.label) {
  29862. parts.push(" ", print("label"));
  29863. }
  29864. parts.push(semi);
  29865. return parts;
  29866. case "LabeledStatement":
  29867. if (node.body.type === "EmptyStatement") {
  29868. return [print("label"), ":;"];
  29869. }
  29870. return [print("label"), ": ", print("body")];
  29871. case "TryStatement":
  29872. return ["try ", print("block"), node.handler ? [" ", print("handler")] : "", node.finalizer ? [" finally ", print("finalizer")] : ""];
  29873. case "CatchClause":
  29874. if (node.param) {
  29875. const parameterHasComments = hasComment(node.param, (comment) => !isBlockComment(comment) || comment.leading && hasNewline(options.originalText, locEnd(comment)) || comment.trailing && hasNewline(options.originalText, locStart(comment), {
  29876. backwards: true
  29877. }));
  29878. const param = print("param");
  29879. return ["catch ", parameterHasComments ? ["(", indent([softline, param]), softline, ") "] : ["(", param, ") "], print("body")];
  29880. }
  29881. return ["catch ", print("body")];
  29882. case "SwitchStatement":
  29883. return [group(["switch (", indent([softline, print("discriminant")]), softline, ")"]), " {", node.cases.length > 0 ? indent([hardline, join(hardline, path.map((casePath, index, cases) => {
  29884. const caseNode = casePath.getValue();
  29885. return [print(), index !== cases.length - 1 && isNextLineEmpty(caseNode, options) ? hardline : ""];
  29886. }, "cases"))]) : "", hardline, "}"];
  29887. case "SwitchCase": {
  29888. if (node.test) {
  29889. parts.push("case ", print("test"), ":");
  29890. } else {
  29891. parts.push("default:");
  29892. }
  29893. if (hasComment(node, CommentCheckFlags.Dangling)) {
  29894. parts.push(" ", printDanglingComments(path, options, true));
  29895. }
  29896. const consequent = node.consequent.filter((node2) => node2.type !== "EmptyStatement");
  29897. if (consequent.length > 0) {
  29898. const cons = printSwitchCaseConsequent(path, options, print);
  29899. parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? [" ", cons] : indent([hardline, cons]));
  29900. }
  29901. return parts;
  29902. }
  29903. case "DebuggerStatement":
  29904. return ["debugger", semi];
  29905. case "ClassDeclaration":
  29906. case "ClassExpression":
  29907. return printClass(path, options, print);
  29908. case "ClassMethod":
  29909. case "ClassPrivateMethod":
  29910. case "MethodDefinition":
  29911. return printClassMethod(path, options, print);
  29912. case "ClassProperty":
  29913. case "PropertyDefinition":
  29914. case "ClassPrivateProperty":
  29915. case "ClassAccessorProperty":
  29916. case "AccessorProperty":
  29917. return printClassProperty(path, options, print);
  29918. case "TemplateElement":
  29919. return replaceTextEndOfLine(node.value.raw);
  29920. case "TemplateLiteral":
  29921. return printTemplateLiteral(path, print, options);
  29922. case "TaggedTemplateExpression":
  29923. return [print("tag"), print("typeParameters"), print("quasi")];
  29924. case "PrivateIdentifier":
  29925. return ["#", print("name")];
  29926. case "PrivateName":
  29927. return ["#", print("id")];
  29928. case "InterpreterDirective":
  29929. parts.push("#!", node.value, hardline);
  29930. if (isNextLineEmpty(node, options)) {
  29931. parts.push(hardline);
  29932. }
  29933. return parts;
  29934. case "TopicReference":
  29935. return "%";
  29936. case "ArgumentPlaceholder":
  29937. return "?";
  29938. case "ModuleExpression": {
  29939. parts.push("module {");
  29940. const printed = print("body");
  29941. if (printed) {
  29942. parts.push(indent([hardline, printed]), hardline);
  29943. }
  29944. parts.push("}");
  29945. return parts;
  29946. }
  29947. default:
  29948. throw new Error("unknown type: " + JSON.stringify(node.type));
  29949. }
  29950. }
  29951. function canAttachComment(node) {
  29952. return node.type && !isBlockComment(node) && !isLineComment(node) && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && node.type !== "TSEmptyBodyFunctionExpression";
  29953. }
  29954. module2.exports = {
  29955. preprocess,
  29956. print: genericPrint,
  29957. embed,
  29958. insertPragma,
  29959. massageAstNode: clean,
  29960. hasPrettierIgnore(path) {
  29961. return hasIgnoreComment(path) || hasJsxIgnoreComment(path);
  29962. },
  29963. willPrintOwnComments: handleComments.willPrintOwnComments,
  29964. canAttachComment,
  29965. printComment,
  29966. isBlockComment,
  29967. handleComments: {
  29968. avoidAstMutation: true,
  29969. ownLine: handleComments.handleOwnLineComment,
  29970. endOfLine: handleComments.handleEndOfLineComment,
  29971. remaining: handleComments.handleRemainingComment
  29972. },
  29973. getCommentChildNodes: handleComments.getCommentChildNodes
  29974. };
  29975. }
  29976. });
  29977. var require_printer_estree_json = __commonJS2({
  29978. "src/language-js/printer-estree-json.js"(exports2, module2) {
  29979. "use strict";
  29980. var {
  29981. builders: {
  29982. hardline,
  29983. indent,
  29984. join
  29985. }
  29986. } = require("./doc.js");
  29987. var preprocess = require_print_preprocess();
  29988. function genericPrint(path, options, print) {
  29989. const node = path.getValue();
  29990. switch (node.type) {
  29991. case "JsonRoot":
  29992. return [print("node"), hardline];
  29993. case "ArrayExpression": {
  29994. if (node.elements.length === 0) {
  29995. return "[]";
  29996. }
  29997. const printed = path.map(() => path.getValue() === null ? "null" : print(), "elements");
  29998. return ["[", indent([hardline, join([",", hardline], printed)]), hardline, "]"];
  29999. }
  30000. case "ObjectExpression":
  30001. return node.properties.length === 0 ? "{}" : ["{", indent([hardline, join([",", hardline], path.map(print, "properties"))]), hardline, "}"];
  30002. case "ObjectProperty":
  30003. return [print("key"), ": ", print("value")];
  30004. case "UnaryExpression":
  30005. return [node.operator === "+" ? "" : node.operator, print("argument")];
  30006. case "NullLiteral":
  30007. return "null";
  30008. case "BooleanLiteral":
  30009. return node.value ? "true" : "false";
  30010. case "StringLiteral":
  30011. return JSON.stringify(node.value);
  30012. case "NumericLiteral":
  30013. return isObjectKey(path) ? JSON.stringify(String(node.value)) : JSON.stringify(node.value);
  30014. case "Identifier":
  30015. return isObjectKey(path) ? JSON.stringify(node.name) : node.name;
  30016. case "TemplateLiteral":
  30017. return print(["quasis", 0]);
  30018. case "TemplateElement":
  30019. return JSON.stringify(node.value.cooked);
  30020. default:
  30021. throw new Error("unknown type: " + JSON.stringify(node.type));
  30022. }
  30023. }
  30024. function isObjectKey(path) {
  30025. return path.getName() === "key" && path.getParentNode().type === "ObjectProperty";
  30026. }
  30027. var ignoredProperties = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
  30028. function clean(node, newNode) {
  30029. const {
  30030. type
  30031. } = node;
  30032. if (type === "ObjectProperty") {
  30033. const {
  30034. key
  30035. } = node;
  30036. if (key.type === "Identifier") {
  30037. newNode.key = {
  30038. type: "StringLiteral",
  30039. value: key.name
  30040. };
  30041. } else if (key.type === "NumericLiteral") {
  30042. newNode.key = {
  30043. type: "StringLiteral",
  30044. value: String(key.value)
  30045. };
  30046. }
  30047. return;
  30048. }
  30049. if (type === "UnaryExpression" && node.operator === "+") {
  30050. return newNode.argument;
  30051. }
  30052. if (type === "ArrayExpression") {
  30053. for (const [index, element] of node.elements.entries()) {
  30054. if (element === null) {
  30055. newNode.elements.splice(index, 0, {
  30056. type: "NullLiteral"
  30057. });
  30058. }
  30059. }
  30060. return;
  30061. }
  30062. if (type === "TemplateLiteral") {
  30063. return {
  30064. type: "StringLiteral",
  30065. value: node.quasis[0].value.cooked
  30066. };
  30067. }
  30068. }
  30069. clean.ignoredProperties = ignoredProperties;
  30070. module2.exports = {
  30071. preprocess,
  30072. print: genericPrint,
  30073. massageAstNode: clean
  30074. };
  30075. }
  30076. });
  30077. var require_common_options = __commonJS2({
  30078. "src/common/common-options.js"(exports2, module2) {
  30079. "use strict";
  30080. var CATEGORY_COMMON = "Common";
  30081. module2.exports = {
  30082. bracketSpacing: {
  30083. since: "0.0.0",
  30084. category: CATEGORY_COMMON,
  30085. type: "boolean",
  30086. default: true,
  30087. description: "Print spaces between brackets.",
  30088. oppositeDescription: "Do not print spaces between brackets."
  30089. },
  30090. singleQuote: {
  30091. since: "0.0.0",
  30092. category: CATEGORY_COMMON,
  30093. type: "boolean",
  30094. default: false,
  30095. description: "Use single quotes instead of double quotes."
  30096. },
  30097. proseWrap: {
  30098. since: "1.8.2",
  30099. category: CATEGORY_COMMON,
  30100. type: "choice",
  30101. default: [{
  30102. since: "1.8.2",
  30103. value: true
  30104. }, {
  30105. since: "1.9.0",
  30106. value: "preserve"
  30107. }],
  30108. description: "How to wrap prose.",
  30109. choices: [{
  30110. since: "1.9.0",
  30111. value: "always",
  30112. description: "Wrap prose if it exceeds the print width."
  30113. }, {
  30114. since: "1.9.0",
  30115. value: "never",
  30116. description: "Do not wrap prose."
  30117. }, {
  30118. since: "1.9.0",
  30119. value: "preserve",
  30120. description: "Wrap prose as-is."
  30121. }]
  30122. },
  30123. bracketSameLine: {
  30124. since: "2.4.0",
  30125. category: CATEGORY_COMMON,
  30126. type: "boolean",
  30127. default: false,
  30128. description: "Put > of opening tags on the last line instead of on a new line."
  30129. },
  30130. singleAttributePerLine: {
  30131. since: "2.6.0",
  30132. category: CATEGORY_COMMON,
  30133. type: "boolean",
  30134. default: false,
  30135. description: "Enforce single attribute per line in HTML, Vue and JSX."
  30136. }
  30137. };
  30138. }
  30139. });
  30140. var require_options2 = __commonJS2({
  30141. "src/language-js/options.js"(exports2, module2) {
  30142. "use strict";
  30143. var commonOptions = require_common_options();
  30144. var CATEGORY_JAVASCRIPT = "JavaScript";
  30145. module2.exports = {
  30146. arrowParens: {
  30147. since: "1.9.0",
  30148. category: CATEGORY_JAVASCRIPT,
  30149. type: "choice",
  30150. default: [{
  30151. since: "1.9.0",
  30152. value: "avoid"
  30153. }, {
  30154. since: "2.0.0",
  30155. value: "always"
  30156. }],
  30157. description: "Include parentheses around a sole arrow function parameter.",
  30158. choices: [{
  30159. value: "always",
  30160. description: "Always include parens. Example: `(x) => x`"
  30161. }, {
  30162. value: "avoid",
  30163. description: "Omit parens when possible. Example: `x => x`"
  30164. }]
  30165. },
  30166. bracketSameLine: commonOptions.bracketSameLine,
  30167. bracketSpacing: commonOptions.bracketSpacing,
  30168. jsxBracketSameLine: {
  30169. since: "0.17.0",
  30170. category: CATEGORY_JAVASCRIPT,
  30171. type: "boolean",
  30172. description: "Put > on the last line instead of at a new line.",
  30173. deprecated: "2.4.0"
  30174. },
  30175. semi: {
  30176. since: "1.0.0",
  30177. category: CATEGORY_JAVASCRIPT,
  30178. type: "boolean",
  30179. default: true,
  30180. description: "Print semicolons.",
  30181. oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
  30182. },
  30183. singleQuote: commonOptions.singleQuote,
  30184. jsxSingleQuote: {
  30185. since: "1.15.0",
  30186. category: CATEGORY_JAVASCRIPT,
  30187. type: "boolean",
  30188. default: false,
  30189. description: "Use single quotes in JSX."
  30190. },
  30191. quoteProps: {
  30192. since: "1.17.0",
  30193. category: CATEGORY_JAVASCRIPT,
  30194. type: "choice",
  30195. default: "as-needed",
  30196. description: "Change when properties in objects are quoted.",
  30197. choices: [{
  30198. value: "as-needed",
  30199. description: "Only add quotes around object properties where required."
  30200. }, {
  30201. value: "consistent",
  30202. description: "If at least one property in an object requires quotes, quote all properties."
  30203. }, {
  30204. value: "preserve",
  30205. description: "Respect the input use of quotes in object properties."
  30206. }]
  30207. },
  30208. trailingComma: {
  30209. since: "0.0.0",
  30210. category: CATEGORY_JAVASCRIPT,
  30211. type: "choice",
  30212. default: [{
  30213. since: "0.0.0",
  30214. value: false
  30215. }, {
  30216. since: "0.19.0",
  30217. value: "none"
  30218. }, {
  30219. since: "2.0.0",
  30220. value: "es5"
  30221. }],
  30222. description: "Print trailing commas wherever possible when multi-line.",
  30223. choices: [{
  30224. value: "es5",
  30225. description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
  30226. }, {
  30227. value: "none",
  30228. description: "No trailing commas."
  30229. }, {
  30230. value: "all",
  30231. description: "Trailing commas wherever possible (including function arguments)."
  30232. }]
  30233. },
  30234. singleAttributePerLine: commonOptions.singleAttributePerLine
  30235. };
  30236. }
  30237. });
  30238. var require_parsers = __commonJS2({
  30239. "src/language-js/parse/parsers.js"(exports2, module2) {
  30240. "use strict";
  30241. module2.exports = {
  30242. get babel() {
  30243. return require("./parser-babel.js").parsers.babel;
  30244. },
  30245. get "babel-flow"() {
  30246. return require("./parser-babel.js").parsers["babel-flow"];
  30247. },
  30248. get "babel-ts"() {
  30249. return require("./parser-babel.js").parsers["babel-ts"];
  30250. },
  30251. get json() {
  30252. return require("./parser-babel.js").parsers.json;
  30253. },
  30254. get json5() {
  30255. return require("./parser-babel.js").parsers.json5;
  30256. },
  30257. get "json-stringify"() {
  30258. return require("./parser-babel.js").parsers["json-stringify"];
  30259. },
  30260. get __js_expression() {
  30261. return require("./parser-babel.js").parsers.__js_expression;
  30262. },
  30263. get __vue_expression() {
  30264. return require("./parser-babel.js").parsers.__vue_expression;
  30265. },
  30266. get __vue_ts_expression() {
  30267. return require("./parser-babel.js").parsers.__vue_ts_expression;
  30268. },
  30269. get __vue_event_binding() {
  30270. return require("./parser-babel.js").parsers.__vue_event_binding;
  30271. },
  30272. get __vue_ts_event_binding() {
  30273. return require("./parser-babel.js").parsers.__vue_ts_event_binding;
  30274. },
  30275. get flow() {
  30276. return require("./parser-flow.js").parsers.flow;
  30277. },
  30278. get typescript() {
  30279. return require("./parser-typescript.js").parsers.typescript;
  30280. },
  30281. get __ng_action() {
  30282. return require("./parser-angular.js").parsers.__ng_action;
  30283. },
  30284. get __ng_binding() {
  30285. return require("./parser-angular.js").parsers.__ng_binding;
  30286. },
  30287. get __ng_interpolation() {
  30288. return require("./parser-angular.js").parsers.__ng_interpolation;
  30289. },
  30290. get __ng_directive() {
  30291. return require("./parser-angular.js").parsers.__ng_directive;
  30292. },
  30293. get acorn() {
  30294. return require("./parser-espree.js").parsers.acorn;
  30295. },
  30296. get espree() {
  30297. return require("./parser-espree.js").parsers.espree;
  30298. },
  30299. get meriyah() {
  30300. return require("./parser-meriyah.js").parsers.meriyah;
  30301. },
  30302. get __babel_estree() {
  30303. return require("./parser-babel.js").parsers.__babel_estree;
  30304. }
  30305. };
  30306. }
  30307. });
  30308. var require_JavaScript = __commonJS2({
  30309. "node_modules/linguist-languages/data/JavaScript.json"(exports2, module2) {
  30310. module2.exports = {
  30311. name: "JavaScript",
  30312. type: "programming",
  30313. tmScope: "source.js",
  30314. aceMode: "javascript",
  30315. codemirrorMode: "javascript",
  30316. codemirrorMimeType: "text/javascript",
  30317. color: "#f1e05a",
  30318. aliases: ["js", "node"],
  30319. 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"],
  30320. filenames: ["Jakefile"],
  30321. interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"],
  30322. languageId: 183
  30323. };
  30324. }
  30325. });
  30326. var require_TypeScript = __commonJS2({
  30327. "node_modules/linguist-languages/data/TypeScript.json"(exports2, module2) {
  30328. module2.exports = {
  30329. name: "TypeScript",
  30330. type: "programming",
  30331. color: "#3178c6",
  30332. aliases: ["ts"],
  30333. interpreters: ["deno", "ts-node"],
  30334. extensions: [".ts", ".cts", ".mts"],
  30335. tmScope: "source.ts",
  30336. aceMode: "typescript",
  30337. codemirrorMode: "javascript",
  30338. codemirrorMimeType: "application/typescript",
  30339. languageId: 378
  30340. };
  30341. }
  30342. });
  30343. var require_TSX = __commonJS2({
  30344. "node_modules/linguist-languages/data/TSX.json"(exports2, module2) {
  30345. module2.exports = {
  30346. name: "TSX",
  30347. type: "programming",
  30348. color: "#3178c6",
  30349. group: "TypeScript",
  30350. extensions: [".tsx"],
  30351. tmScope: "source.tsx",
  30352. aceMode: "javascript",
  30353. codemirrorMode: "jsx",
  30354. codemirrorMimeType: "text/jsx",
  30355. languageId: 94901924
  30356. };
  30357. }
  30358. });
  30359. var require_JSON = __commonJS2({
  30360. "node_modules/linguist-languages/data/JSON.json"(exports2, module2) {
  30361. module2.exports = {
  30362. name: "JSON",
  30363. type: "data",
  30364. color: "#292929",
  30365. tmScope: "source.json",
  30366. aceMode: "json",
  30367. codemirrorMode: "javascript",
  30368. codemirrorMimeType: "application/json",
  30369. aliases: ["geojson", "jsonl", "topojson"],
  30370. extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"],
  30371. filenames: [".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", "Pipfile.lock", "composer.lock", "mcmod.info"],
  30372. languageId: 174
  30373. };
  30374. }
  30375. });
  30376. var require_JSON_with_Comments = __commonJS2({
  30377. "node_modules/linguist-languages/data/JSON with Comments.json"(exports2, module2) {
  30378. module2.exports = {
  30379. name: "JSON with Comments",
  30380. type: "data",
  30381. color: "#292929",
  30382. group: "JSON",
  30383. tmScope: "source.js",
  30384. aceMode: "javascript",
  30385. codemirrorMode: "javascript",
  30386. codemirrorMimeType: "text/javascript",
  30387. aliases: ["jsonc"],
  30388. 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"],
  30389. filenames: [".babelrc", ".devcontainer.json", ".eslintrc.json", ".jscsrc", ".jshintrc", ".jslintrc", "api-extractor.json", "devcontainer.json", "jsconfig.json", "language-configuration.json", "tsconfig.json", "tslint.json"],
  30390. languageId: 423
  30391. };
  30392. }
  30393. });
  30394. var require_JSON5 = __commonJS2({
  30395. "node_modules/linguist-languages/data/JSON5.json"(exports2, module2) {
  30396. module2.exports = {
  30397. name: "JSON5",
  30398. type: "data",
  30399. color: "#267CB9",
  30400. extensions: [".json5"],
  30401. tmScope: "source.js",
  30402. aceMode: "javascript",
  30403. codemirrorMode: "javascript",
  30404. codemirrorMimeType: "application/json",
  30405. languageId: 175
  30406. };
  30407. }
  30408. });
  30409. var require_language_js = __commonJS2({
  30410. "src/language-js/index.js"(exports2, module2) {
  30411. "use strict";
  30412. var createLanguage = require_create_language();
  30413. var estreePrinter = require_printer_estree();
  30414. var estreeJsonPrinter = require_printer_estree_json();
  30415. var options = require_options2();
  30416. var parsers = require_parsers();
  30417. var languages = [createLanguage(require_JavaScript(), (data) => ({
  30418. since: "0.0.0",
  30419. parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"],
  30420. vscodeLanguageIds: ["javascript", "mongo"],
  30421. interpreters: [...data.interpreters, "zx"],
  30422. extensions: [...data.extensions.filter((extension) => extension !== ".jsx"), ".wxs"]
  30423. })), createLanguage(require_JavaScript(), () => ({
  30424. name: "Flow",
  30425. since: "0.0.0",
  30426. parsers: ["flow", "babel-flow"],
  30427. vscodeLanguageIds: ["javascript"],
  30428. aliases: [],
  30429. filenames: [],
  30430. extensions: [".js.flow"]
  30431. })), createLanguage(require_JavaScript(), () => ({
  30432. name: "JSX",
  30433. since: "0.0.0",
  30434. parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"],
  30435. vscodeLanguageIds: ["javascriptreact"],
  30436. aliases: void 0,
  30437. filenames: void 0,
  30438. extensions: [".jsx"],
  30439. group: "JavaScript",
  30440. interpreters: void 0,
  30441. tmScope: "source.js.jsx",
  30442. aceMode: "javascript",
  30443. codemirrorMode: "jsx",
  30444. codemirrorMimeType: "text/jsx",
  30445. color: void 0
  30446. })), createLanguage(require_TypeScript(), () => ({
  30447. since: "1.4.0",
  30448. parsers: ["typescript", "babel-ts"],
  30449. vscodeLanguageIds: ["typescript"]
  30450. })), createLanguage(require_TSX(), () => ({
  30451. since: "1.4.0",
  30452. parsers: ["typescript", "babel-ts"],
  30453. vscodeLanguageIds: ["typescriptreact"]
  30454. })), createLanguage(require_JSON(), () => ({
  30455. name: "JSON.stringify",
  30456. since: "1.13.0",
  30457. parsers: ["json-stringify"],
  30458. vscodeLanguageIds: ["json"],
  30459. extensions: [".importmap"],
  30460. filenames: ["package.json", "package-lock.json", "composer.json"]
  30461. })), createLanguage(require_JSON(), (data) => ({
  30462. since: "1.5.0",
  30463. parsers: ["json"],
  30464. vscodeLanguageIds: ["json"],
  30465. extensions: data.extensions.filter((extension) => extension !== ".jsonl")
  30466. })), createLanguage(require_JSON_with_Comments(), (data) => ({
  30467. since: "1.5.0",
  30468. parsers: ["json"],
  30469. vscodeLanguageIds: ["jsonc"],
  30470. filenames: [...data.filenames, ".eslintrc", ".swcrc"]
  30471. })), createLanguage(require_JSON5(), () => ({
  30472. since: "1.13.0",
  30473. parsers: ["json5"],
  30474. vscodeLanguageIds: ["json5"]
  30475. }))];
  30476. var printers = {
  30477. estree: estreePrinter,
  30478. "estree-json": estreeJsonPrinter
  30479. };
  30480. module2.exports = {
  30481. languages,
  30482. options,
  30483. printers,
  30484. parsers
  30485. };
  30486. }
  30487. });
  30488. var require_clean2 = __commonJS2({
  30489. "src/language-css/clean.js"(exports2, module2) {
  30490. "use strict";
  30491. var {
  30492. isFrontMatterNode
  30493. } = require_util();
  30494. var getLast = require_get_last();
  30495. var ignoredProperties = /* @__PURE__ */ new Set(["raw", "raws", "sourceIndex", "source", "before", "after", "trailingComma"]);
  30496. function clean(ast, newObj, parent) {
  30497. if (isFrontMatterNode(ast) && ast.lang === "yaml") {
  30498. delete newObj.value;
  30499. }
  30500. if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length > 0) {
  30501. if (parent.nodes[0] === ast || isFrontMatterNode(parent.nodes[0]) && parent.nodes[1] === ast) {
  30502. delete newObj.text;
  30503. if (/^\*\s*@(?:format|prettier)\s*$/.test(ast.text)) {
  30504. return null;
  30505. }
  30506. }
  30507. if (parent.type === "css-root" && getLast(parent.nodes) === ast) {
  30508. return null;
  30509. }
  30510. }
  30511. if (ast.type === "value-root") {
  30512. delete newObj.text;
  30513. }
  30514. if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
  30515. delete newObj.value;
  30516. }
  30517. if (ast.type === "css-rule") {
  30518. delete newObj.params;
  30519. }
  30520. if (ast.type === "selector-combinator") {
  30521. newObj.value = newObj.value.replace(/\s+/g, " ");
  30522. }
  30523. if (ast.type === "media-feature") {
  30524. newObj.value = newObj.value.replace(/ /g, "");
  30525. }
  30526. 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") {
  30527. newObj.value = newObj.value.toLowerCase();
  30528. }
  30529. if (ast.type === "css-decl") {
  30530. newObj.prop = newObj.prop.toLowerCase();
  30531. }
  30532. if (ast.type === "css-atrule" || ast.type === "css-import") {
  30533. newObj.name = newObj.name.toLowerCase();
  30534. }
  30535. if (ast.type === "value-number") {
  30536. newObj.unit = newObj.unit.toLowerCase();
  30537. }
  30538. 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) {
  30539. newObj.value = cleanCSSStrings(newObj.value);
  30540. }
  30541. if (ast.type === "selector-attribute") {
  30542. newObj.attribute = newObj.attribute.trim();
  30543. if (newObj.namespace) {
  30544. if (typeof newObj.namespace === "string") {
  30545. newObj.namespace = newObj.namespace.trim();
  30546. if (newObj.namespace.length === 0) {
  30547. newObj.namespace = true;
  30548. }
  30549. }
  30550. }
  30551. if (newObj.value) {
  30552. newObj.value = newObj.value.trim().replace(/^["']|["']$/g, "");
  30553. delete newObj.quoted;
  30554. }
  30555. }
  30556. 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) {
  30557. newObj.value = newObj.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g, (match, numStr, unit) => {
  30558. const num = Number(numStr);
  30559. return Number.isNaN(num) ? match : num + unit.toLowerCase();
  30560. });
  30561. }
  30562. if (ast.type === "selector-tag") {
  30563. const lowercasedValue = ast.value.toLowerCase();
  30564. if (["from", "to"].includes(lowercasedValue)) {
  30565. newObj.value = lowercasedValue;
  30566. }
  30567. }
  30568. if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
  30569. delete newObj.value;
  30570. }
  30571. if (ast.type === "selector-unknown") {
  30572. delete newObj.value;
  30573. }
  30574. if (ast.type === "value-comma_group") {
  30575. const index = ast.groups.findIndex((node) => node.type === "value-number" && node.unit === "...");
  30576. if (index !== -1) {
  30577. newObj.groups[index].unit = "";
  30578. newObj.groups.splice(index + 1, 0, {
  30579. type: "value-word",
  30580. value: "...",
  30581. isColor: false,
  30582. isHex: false
  30583. });
  30584. }
  30585. }
  30586. if (ast.type === "value-comma_group" && ast.groups.some((node) => node.type === "value-atword" && node.value.endsWith("[") || node.type === "value-word" && node.value.startsWith("]"))) {
  30587. return {
  30588. type: "value-atword",
  30589. value: ast.groups.map((node) => node.value).join(""),
  30590. group: {
  30591. open: null,
  30592. close: null,
  30593. groups: [],
  30594. type: "value-paren_group"
  30595. }
  30596. };
  30597. }
  30598. }
  30599. clean.ignoredProperties = ignoredProperties;
  30600. function cleanCSSStrings(value) {
  30601. return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1");
  30602. }
  30603. module2.exports = clean;
  30604. }
  30605. });
  30606. var require_print = __commonJS2({
  30607. "src/utils/front-matter/print.js"(exports2, module2) {
  30608. "use strict";
  30609. var {
  30610. builders: {
  30611. hardline,
  30612. markAsRoot
  30613. }
  30614. } = require("./doc.js");
  30615. function print(node, textToDoc) {
  30616. if (node.lang === "yaml") {
  30617. const value = node.value.trim();
  30618. const doc2 = value ? textToDoc(value, {
  30619. parser: "yaml"
  30620. }, {
  30621. stripTrailingHardline: true
  30622. }) : "";
  30623. return markAsRoot([node.startDelimiter, hardline, doc2, doc2 ? hardline : "", node.endDelimiter]);
  30624. }
  30625. }
  30626. module2.exports = print;
  30627. }
  30628. });
  30629. var require_embed2 = __commonJS2({
  30630. "src/language-css/embed.js"(exports2, module2) {
  30631. "use strict";
  30632. var {
  30633. builders: {
  30634. hardline
  30635. }
  30636. } = require("./doc.js");
  30637. var printFrontMatter = require_print();
  30638. function embed(path, print, textToDoc) {
  30639. const node = path.getValue();
  30640. if (node.type === "front-matter") {
  30641. const doc2 = printFrontMatter(node, textToDoc);
  30642. return doc2 ? [doc2, hardline] : "";
  30643. }
  30644. }
  30645. module2.exports = embed;
  30646. }
  30647. });
  30648. var require_parse4 = __commonJS2({
  30649. "src/utils/front-matter/parse.js"(exports2, module2) {
  30650. "use strict";
  30651. var frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})(?<language>[^\\n]*)\\n(?:|(?<value>.*?)\\n)(?<endDelimiter>\\k<startDelimiter>|\\.{3})[^\\S\\n]*(?:\\n|$)", "s");
  30652. function parse(text) {
  30653. const match = text.match(frontMatterRegex);
  30654. if (!match) {
  30655. return {
  30656. content: text
  30657. };
  30658. }
  30659. const {
  30660. startDelimiter,
  30661. language,
  30662. value = "",
  30663. endDelimiter
  30664. } = match.groups;
  30665. let lang = language.trim() || "yaml";
  30666. if (startDelimiter === "+++") {
  30667. lang = "toml";
  30668. }
  30669. if (lang !== "yaml" && startDelimiter !== endDelimiter) {
  30670. return {
  30671. content: text
  30672. };
  30673. }
  30674. const [raw] = match;
  30675. const frontMatter = {
  30676. type: "front-matter",
  30677. lang,
  30678. value,
  30679. startDelimiter,
  30680. endDelimiter,
  30681. raw: raw.replace(/\n$/, "")
  30682. };
  30683. return {
  30684. frontMatter,
  30685. content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
  30686. };
  30687. }
  30688. module2.exports = parse;
  30689. }
  30690. });
  30691. var require_pragma2 = __commonJS2({
  30692. "src/language-css/pragma.js"(exports2, module2) {
  30693. "use strict";
  30694. var jsPragma = require_pragma();
  30695. var parseFrontMatter = require_parse4();
  30696. function hasPragma(text) {
  30697. return jsPragma.hasPragma(parseFrontMatter(text).content);
  30698. }
  30699. function insertPragma(text) {
  30700. const {
  30701. frontMatter,
  30702. content
  30703. } = parseFrontMatter(text);
  30704. return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
  30705. }
  30706. module2.exports = {
  30707. hasPragma,
  30708. insertPragma
  30709. };
  30710. }
  30711. });
  30712. var require_utils8 = __commonJS2({
  30713. "src/language-css/utils/index.js"(exports2, module2) {
  30714. "use strict";
  30715. 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"]);
  30716. function getAncestorCounter(path, typeOrTypes) {
  30717. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  30718. let counter = -1;
  30719. let ancestorNode;
  30720. while (ancestorNode = path.getParentNode(++counter)) {
  30721. if (types.includes(ancestorNode.type)) {
  30722. return counter;
  30723. }
  30724. }
  30725. return -1;
  30726. }
  30727. function getAncestorNode(path, typeOrTypes) {
  30728. const counter = getAncestorCounter(path, typeOrTypes);
  30729. return counter === -1 ? null : path.getParentNode(counter);
  30730. }
  30731. function getPropOfDeclNode(path) {
  30732. var _declAncestorNode$pro;
  30733. const declAncestorNode = getAncestorNode(path, "css-decl");
  30734. return declAncestorNode === null || declAncestorNode === void 0 ? void 0 : (_declAncestorNode$pro = declAncestorNode.prop) === null || _declAncestorNode$pro === void 0 ? void 0 : _declAncestorNode$pro.toLowerCase();
  30735. }
  30736. var wideKeywords = /* @__PURE__ */ new Set(["initial", "inherit", "unset", "revert"]);
  30737. function isWideKeywords(value) {
  30738. return wideKeywords.has(value.toLowerCase());
  30739. }
  30740. function isKeyframeAtRuleKeywords(path, value) {
  30741. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30742. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
  30743. }
  30744. function maybeToLowerCase(value) {
  30745. return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
  30746. }
  30747. function insideValueFunctionNode(path, functionName) {
  30748. var _funcAncestorNode$val;
  30749. const funcAncestorNode = getAncestorNode(path, "value-func");
  30750. return (funcAncestorNode === null || funcAncestorNode === void 0 ? void 0 : (_funcAncestorNode$val = funcAncestorNode.value) === null || _funcAncestorNode$val === void 0 ? void 0 : _funcAncestorNode$val.toLowerCase()) === functionName;
  30751. }
  30752. function insideICSSRuleNode(path) {
  30753. var _ruleAncestorNode$raw;
  30754. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  30755. const selector = ruleAncestorNode === null || ruleAncestorNode === void 0 ? void 0 : (_ruleAncestorNode$raw = ruleAncestorNode.raws) === null || _ruleAncestorNode$raw === void 0 ? void 0 : _ruleAncestorNode$raw.selector;
  30756. return selector && (selector.startsWith(":import") || selector.startsWith(":export"));
  30757. }
  30758. function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
  30759. const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames) ? atRuleNameOrAtRuleNames : [atRuleNameOrAtRuleNames];
  30760. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30761. return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
  30762. }
  30763. function insideURLFunctionInImportAtRuleNode(path) {
  30764. const node = path.getValue();
  30765. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30766. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) === "import" && node.groups[0].value === "url" && node.groups.length === 2;
  30767. }
  30768. function isURLFunctionNode(node) {
  30769. return node.type === "value-func" && node.value.toLowerCase() === "url";
  30770. }
  30771. function isLastNode(path, node) {
  30772. var _path$getParentNode;
  30773. const nodes = (_path$getParentNode = path.getParentNode()) === null || _path$getParentNode === void 0 ? void 0 : _path$getParentNode.nodes;
  30774. return nodes && nodes.indexOf(node) === nodes.length - 1;
  30775. }
  30776. function isDetachedRulesetDeclarationNode(node) {
  30777. const {
  30778. selector
  30779. } = node;
  30780. if (!selector) {
  30781. return false;
  30782. }
  30783. return typeof selector === "string" && /^@.+:.*$/.test(selector) || selector.value && /^@.+:.*$/.test(selector.value);
  30784. }
  30785. function isForKeywordNode(node) {
  30786. return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
  30787. }
  30788. function isIfElseKeywordNode(node) {
  30789. return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
  30790. }
  30791. function isEachKeywordNode(node) {
  30792. return node.type === "value-word" && node.value === "in";
  30793. }
  30794. function isMultiplicationNode(node) {
  30795. return node.type === "value-operator" && node.value === "*";
  30796. }
  30797. function isDivisionNode(node) {
  30798. return node.type === "value-operator" && node.value === "/";
  30799. }
  30800. function isAdditionNode(node) {
  30801. return node.type === "value-operator" && node.value === "+";
  30802. }
  30803. function isSubtractionNode(node) {
  30804. return node.type === "value-operator" && node.value === "-";
  30805. }
  30806. function isModuloNode(node) {
  30807. return node.type === "value-operator" && node.value === "%";
  30808. }
  30809. function isMathOperatorNode(node) {
  30810. return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
  30811. }
  30812. function isEqualityOperatorNode(node) {
  30813. return node.type === "value-word" && ["==", "!="].includes(node.value);
  30814. }
  30815. function isRelationalOperatorNode(node) {
  30816. return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
  30817. }
  30818. function isSCSSControlDirectiveNode(node) {
  30819. return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
  30820. }
  30821. function isDetachedRulesetCallNode(node) {
  30822. var _node$raws;
  30823. return ((_node$raws = node.raws) === null || _node$raws === void 0 ? void 0 : _node$raws.params) && /^\(\s*\)$/.test(node.raws.params);
  30824. }
  30825. function isTemplatePlaceholderNode(node) {
  30826. return node.name.startsWith("prettier-placeholder");
  30827. }
  30828. function isTemplatePropNode(node) {
  30829. return node.prop.startsWith("@prettier-placeholder");
  30830. }
  30831. function isPostcssSimpleVarNode(currentNode, nextNode) {
  30832. return currentNode.value === "$$" && currentNode.type === "value-func" && (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "value-word" && !nextNode.raws.before;
  30833. }
  30834. function hasComposesNode(node) {
  30835. var _node$value, _node$value$group;
  30836. 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";
  30837. }
  30838. function hasParensAroundNode(node) {
  30839. var _node$value2, _node$value2$group, _node$value2$group$gr;
  30840. 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;
  30841. }
  30842. function hasEmptyRawBefore(node) {
  30843. var _node$raws2;
  30844. return ((_node$raws2 = node.raws) === null || _node$raws2 === void 0 ? void 0 : _node$raws2.before) === "";
  30845. }
  30846. function isKeyValuePairNode(node) {
  30847. var _node$groups, _node$groups$;
  30848. 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";
  30849. }
  30850. function isKeyValuePairInParenGroupNode(node) {
  30851. var _node$groups2;
  30852. return node.type === "value-paren_group" && ((_node$groups2 = node.groups) === null || _node$groups2 === void 0 ? void 0 : _node$groups2[0]) && isKeyValuePairNode(node.groups[0]);
  30853. }
  30854. function isSCSSMapItemNode(path) {
  30855. var _declNode$prop;
  30856. const node = path.getValue();
  30857. if (node.groups.length === 0) {
  30858. return false;
  30859. }
  30860. const parentParentNode = path.getParentNode(1);
  30861. if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
  30862. return false;
  30863. }
  30864. const declNode = getAncestorNode(path, "css-decl");
  30865. if (declNode !== null && declNode !== void 0 && (_declNode$prop = declNode.prop) !== null && _declNode$prop !== void 0 && _declNode$prop.startsWith("$")) {
  30866. return true;
  30867. }
  30868. if (isKeyValuePairInParenGroupNode(parentParentNode)) {
  30869. return true;
  30870. }
  30871. if (parentParentNode.type === "value-func") {
  30872. return true;
  30873. }
  30874. return false;
  30875. }
  30876. function isInlineValueCommentNode(node) {
  30877. return node.type === "value-comment" && node.inline;
  30878. }
  30879. function isHashNode(node) {
  30880. return node.type === "value-word" && node.value === "#";
  30881. }
  30882. function isLeftCurlyBraceNode(node) {
  30883. return node.type === "value-word" && node.value === "{";
  30884. }
  30885. function isRightCurlyBraceNode(node) {
  30886. return node.type === "value-word" && node.value === "}";
  30887. }
  30888. function isWordNode(node) {
  30889. return ["value-word", "value-atword"].includes(node.type);
  30890. }
  30891. function isColonNode(node) {
  30892. return (node === null || node === void 0 ? void 0 : node.type) === "value-colon";
  30893. }
  30894. function isKeyInValuePairNode(node, parentNode) {
  30895. if (!isKeyValuePairNode(parentNode)) {
  30896. return false;
  30897. }
  30898. const {
  30899. groups
  30900. } = parentNode;
  30901. const index = groups.indexOf(node);
  30902. if (index === -1) {
  30903. return false;
  30904. }
  30905. return isColonNode(groups[index + 1]);
  30906. }
  30907. function isMediaAndSupportsKeywords(node) {
  30908. return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
  30909. }
  30910. function isColorAdjusterFuncNode(node) {
  30911. if (node.type !== "value-func") {
  30912. return false;
  30913. }
  30914. return colorAdjusterFunctions.has(node.value.toLowerCase());
  30915. }
  30916. function lastLineHasInlineComment(text) {
  30917. return /\/\//.test(text.split(/[\n\r]/).pop());
  30918. }
  30919. function isAtWordPlaceholderNode(node) {
  30920. return (node === null || node === void 0 ? void 0 : node.type) === "value-atword" && node.value.startsWith("prettier-placeholder-");
  30921. }
  30922. function isConfigurationNode(node, parentNode) {
  30923. var _node$open, _node$close;
  30924. 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")) {
  30925. return false;
  30926. }
  30927. if (parentNode.type === "value-comma_group") {
  30928. const prevIdx = parentNode.groups.indexOf(node) - 1;
  30929. const maybeWithNode = parentNode.groups[prevIdx];
  30930. if ((maybeWithNode === null || maybeWithNode === void 0 ? void 0 : maybeWithNode.type) === "value-word" && maybeWithNode.value === "with") {
  30931. return true;
  30932. }
  30933. }
  30934. return false;
  30935. }
  30936. function isParenGroupNode(node) {
  30937. var _node$open2, _node$close2;
  30938. 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) === ")";
  30939. }
  30940. module2.exports = {
  30941. getAncestorCounter,
  30942. getAncestorNode,
  30943. getPropOfDeclNode,
  30944. maybeToLowerCase,
  30945. insideValueFunctionNode,
  30946. insideICSSRuleNode,
  30947. insideAtRuleNode,
  30948. insideURLFunctionInImportAtRuleNode,
  30949. isKeyframeAtRuleKeywords,
  30950. isWideKeywords,
  30951. isLastNode,
  30952. isSCSSControlDirectiveNode,
  30953. isDetachedRulesetDeclarationNode,
  30954. isRelationalOperatorNode,
  30955. isEqualityOperatorNode,
  30956. isMultiplicationNode,
  30957. isDivisionNode,
  30958. isAdditionNode,
  30959. isSubtractionNode,
  30960. isModuloNode,
  30961. isMathOperatorNode,
  30962. isEachKeywordNode,
  30963. isForKeywordNode,
  30964. isURLFunctionNode,
  30965. isIfElseKeywordNode,
  30966. hasComposesNode,
  30967. hasParensAroundNode,
  30968. hasEmptyRawBefore,
  30969. isDetachedRulesetCallNode,
  30970. isTemplatePlaceholderNode,
  30971. isTemplatePropNode,
  30972. isPostcssSimpleVarNode,
  30973. isKeyValuePairNode,
  30974. isKeyValuePairInParenGroupNode,
  30975. isKeyInValuePairNode,
  30976. isSCSSMapItemNode,
  30977. isInlineValueCommentNode,
  30978. isHashNode,
  30979. isLeftCurlyBraceNode,
  30980. isRightCurlyBraceNode,
  30981. isWordNode,
  30982. isColonNode,
  30983. isMediaAndSupportsKeywords,
  30984. isColorAdjusterFuncNode,
  30985. lastLineHasInlineComment,
  30986. isAtWordPlaceholderNode,
  30987. isConfigurationNode,
  30988. isParenGroupNode
  30989. };
  30990. }
  30991. });
  30992. var require_line_column_to_index = __commonJS2({
  30993. "src/utils/line-column-to-index.js"(exports2, module2) {
  30994. "use strict";
  30995. module2.exports = function(lineColumn, text) {
  30996. let index = 0;
  30997. for (let i = 0; i < lineColumn.line - 1; ++i) {
  30998. index = text.indexOf("\n", index) + 1;
  30999. }
  31000. return index + lineColumn.column;
  31001. };
  31002. }
  31003. });
  31004. var require_loc2 = __commonJS2({
  31005. "src/language-css/loc.js"(exports2, module2) {
  31006. "use strict";
  31007. var {
  31008. skipEverythingButNewLine
  31009. } = require_skip();
  31010. var getLast = require_get_last();
  31011. var lineColumnToIndex = require_line_column_to_index();
  31012. function calculateLocStart(node, text) {
  31013. if (typeof node.sourceIndex === "number") {
  31014. return node.sourceIndex;
  31015. }
  31016. return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
  31017. }
  31018. function calculateLocEnd(node, text) {
  31019. if (node.type === "css-comment" && node.inline) {
  31020. return skipEverythingButNewLine(text, node.source.startOffset);
  31021. }
  31022. const endNode = node.nodes && getLast(node.nodes);
  31023. if (endNode && node.source && !node.source.end) {
  31024. node = endNode;
  31025. }
  31026. if (node.source && node.source.end) {
  31027. return lineColumnToIndex(node.source.end, text);
  31028. }
  31029. return null;
  31030. }
  31031. function calculateLoc(node, text) {
  31032. if (node.source) {
  31033. node.source.startOffset = calculateLocStart(node, text);
  31034. node.source.endOffset = calculateLocEnd(node, text);
  31035. }
  31036. for (const key in node) {
  31037. const child = node[key];
  31038. if (key === "source" || !child || typeof child !== "object") {
  31039. continue;
  31040. }
  31041. if (child.type === "value-root" || child.type === "value-unknown") {
  31042. calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
  31043. } else {
  31044. calculateLoc(child, text);
  31045. }
  31046. }
  31047. }
  31048. function calculateValueNodeLoc(node, rootOffset, text) {
  31049. if (node.source) {
  31050. node.source.startOffset = calculateLocStart(node, text) + rootOffset;
  31051. node.source.endOffset = calculateLocEnd(node, text) + rootOffset;
  31052. }
  31053. for (const key in node) {
  31054. const child = node[key];
  31055. if (key === "source" || !child || typeof child !== "object") {
  31056. continue;
  31057. }
  31058. calculateValueNodeLoc(child, rootOffset, text);
  31059. }
  31060. }
  31061. function getValueRootOffset(node) {
  31062. let result = node.source.startOffset;
  31063. if (typeof node.prop === "string") {
  31064. result += node.prop.length;
  31065. }
  31066. if (node.type === "css-atrule" && typeof node.name === "string") {
  31067. result += 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
  31068. }
  31069. if (node.type !== "css-atrule" && node.raws && typeof node.raws.between === "string") {
  31070. result += node.raws.between.length;
  31071. }
  31072. return result;
  31073. }
  31074. function replaceQuotesInInlineComments(text) {
  31075. let state = "initial";
  31076. let stateToReturnFromQuotes = "initial";
  31077. let inlineCommentStartIndex;
  31078. let inlineCommentContainsQuotes = false;
  31079. const inlineCommentsToReplace = [];
  31080. for (let i = 0; i < text.length; i++) {
  31081. const c = text[i];
  31082. switch (state) {
  31083. case "initial":
  31084. if (c === "'") {
  31085. state = "single-quotes";
  31086. continue;
  31087. }
  31088. if (c === '"') {
  31089. state = "double-quotes";
  31090. continue;
  31091. }
  31092. if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
  31093. state = "url";
  31094. i += 3;
  31095. continue;
  31096. }
  31097. if (c === "*" && text[i - 1] === "/") {
  31098. state = "comment-block";
  31099. continue;
  31100. }
  31101. if (c === "/" && text[i - 1] === "/") {
  31102. state = "comment-inline";
  31103. inlineCommentStartIndex = i - 1;
  31104. continue;
  31105. }
  31106. continue;
  31107. case "single-quotes":
  31108. if (c === "'" && text[i - 1] !== "\\") {
  31109. state = stateToReturnFromQuotes;
  31110. stateToReturnFromQuotes = "initial";
  31111. }
  31112. if (c === "\n" || c === "\r") {
  31113. return text;
  31114. }
  31115. continue;
  31116. case "double-quotes":
  31117. if (c === '"' && text[i - 1] !== "\\") {
  31118. state = stateToReturnFromQuotes;
  31119. stateToReturnFromQuotes = "initial";
  31120. }
  31121. if (c === "\n" || c === "\r") {
  31122. return text;
  31123. }
  31124. continue;
  31125. case "url":
  31126. if (c === ")") {
  31127. state = "initial";
  31128. }
  31129. if (c === "\n" || c === "\r") {
  31130. return text;
  31131. }
  31132. if (c === "'") {
  31133. state = "single-quotes";
  31134. stateToReturnFromQuotes = "url";
  31135. continue;
  31136. }
  31137. if (c === '"') {
  31138. state = "double-quotes";
  31139. stateToReturnFromQuotes = "url";
  31140. continue;
  31141. }
  31142. continue;
  31143. case "comment-block":
  31144. if (c === "/" && text[i - 1] === "*") {
  31145. state = "initial";
  31146. }
  31147. continue;
  31148. case "comment-inline":
  31149. if (c === '"' || c === "'" || c === "*") {
  31150. inlineCommentContainsQuotes = true;
  31151. }
  31152. if (c === "\n" || c === "\r") {
  31153. if (inlineCommentContainsQuotes) {
  31154. inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
  31155. }
  31156. state = "initial";
  31157. inlineCommentContainsQuotes = false;
  31158. }
  31159. continue;
  31160. }
  31161. }
  31162. for (const [start, end] of inlineCommentsToReplace) {
  31163. text = text.slice(0, start) + text.slice(start, end).replace(/["'*]/g, " ") + text.slice(end);
  31164. }
  31165. return text;
  31166. }
  31167. function locStart(node) {
  31168. return node.source.startOffset;
  31169. }
  31170. function locEnd(node) {
  31171. return node.source.endOffset;
  31172. }
  31173. module2.exports = {
  31174. locStart,
  31175. locEnd,
  31176. calculateLoc,
  31177. replaceQuotesInInlineComments
  31178. };
  31179. }
  31180. });
  31181. var require_is_less_parser = __commonJS2({
  31182. "src/language-css/utils/is-less-parser.js"(exports2, module2) {
  31183. "use strict";
  31184. function isLessParser(options) {
  31185. return options.parser === "css" || options.parser === "less";
  31186. }
  31187. module2.exports = isLessParser;
  31188. }
  31189. });
  31190. var require_is_scss = __commonJS2({
  31191. "src/language-css/utils/is-scss.js"(exports2, module2) {
  31192. "use strict";
  31193. function isSCSS(parser, text) {
  31194. const hasExplicitParserChoice = parser === "less" || parser === "scss";
  31195. const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
  31196. return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
  31197. }
  31198. module2.exports = isSCSS;
  31199. }
  31200. });
  31201. var require_css_units_evaluate = __commonJS2({
  31202. "src/language-css/utils/css-units.evaluate.js"(exports2, module2) {
  31203. module2.exports = {
  31204. em: "em",
  31205. rem: "rem",
  31206. ex: "ex",
  31207. rex: "rex",
  31208. cap: "cap",
  31209. rcap: "rcap",
  31210. ch: "ch",
  31211. rch: "rch",
  31212. ic: "ic",
  31213. ric: "ric",
  31214. lh: "lh",
  31215. rlh: "rlh",
  31216. vw: "vw",
  31217. svw: "svw",
  31218. lvw: "lvw",
  31219. dvw: "dvw",
  31220. vh: "vh",
  31221. svh: "svh",
  31222. lvh: "lvh",
  31223. dvh: "dvh",
  31224. vi: "vi",
  31225. svi: "svi",
  31226. lvi: "lvi",
  31227. dvi: "dvi",
  31228. vb: "vb",
  31229. svb: "svb",
  31230. lvb: "lvb",
  31231. dvb: "dvb",
  31232. vmin: "vmin",
  31233. svmin: "svmin",
  31234. lvmin: "lvmin",
  31235. dvmin: "dvmin",
  31236. vmax: "vmax",
  31237. svmax: "svmax",
  31238. lvmax: "lvmax",
  31239. dvmax: "dvmax",
  31240. cm: "cm",
  31241. mm: "mm",
  31242. q: "Q",
  31243. in: "in",
  31244. pt: "pt",
  31245. pc: "pc",
  31246. px: "px",
  31247. deg: "deg",
  31248. grad: "grad",
  31249. rad: "rad",
  31250. turn: "turn",
  31251. s: "s",
  31252. ms: "ms",
  31253. hz: "Hz",
  31254. khz: "kHz",
  31255. dpi: "dpi",
  31256. dpcm: "dpcm",
  31257. dppx: "dppx",
  31258. x: "x"
  31259. };
  31260. }
  31261. });
  31262. var require_print_unit = __commonJS2({
  31263. "src/language-css/utils/print-unit.js"(exports2, module2) {
  31264. "use strict";
  31265. var CSS_UNITS = require_css_units_evaluate();
  31266. function printUnit(unit) {
  31267. const lowercased = unit.toLowerCase();
  31268. return Object.prototype.hasOwnProperty.call(CSS_UNITS, lowercased) ? CSS_UNITS[lowercased] : unit;
  31269. }
  31270. module2.exports = printUnit;
  31271. }
  31272. });
  31273. var require_printer_postcss = __commonJS2({
  31274. "src/language-css/printer-postcss.js"(exports2, module2) {
  31275. "use strict";
  31276. var getLast = require_get_last();
  31277. var {
  31278. printNumber,
  31279. printString,
  31280. hasNewline,
  31281. isFrontMatterNode,
  31282. isNextLineEmpty,
  31283. isNonEmptyArray
  31284. } = require_util();
  31285. var {
  31286. builders: {
  31287. join,
  31288. line,
  31289. hardline,
  31290. softline,
  31291. group,
  31292. fill,
  31293. indent,
  31294. dedent,
  31295. ifBreak,
  31296. breakParent
  31297. },
  31298. utils: {
  31299. removeLines,
  31300. getDocParts
  31301. }
  31302. } = require("./doc.js");
  31303. var clean = require_clean2();
  31304. var embed = require_embed2();
  31305. var {
  31306. insertPragma
  31307. } = require_pragma2();
  31308. var {
  31309. getAncestorNode,
  31310. getPropOfDeclNode,
  31311. maybeToLowerCase,
  31312. insideValueFunctionNode,
  31313. insideICSSRuleNode,
  31314. insideAtRuleNode,
  31315. insideURLFunctionInImportAtRuleNode,
  31316. isKeyframeAtRuleKeywords,
  31317. isWideKeywords,
  31318. isLastNode,
  31319. isSCSSControlDirectiveNode,
  31320. isDetachedRulesetDeclarationNode,
  31321. isRelationalOperatorNode,
  31322. isEqualityOperatorNode,
  31323. isMultiplicationNode,
  31324. isDivisionNode,
  31325. isAdditionNode,
  31326. isSubtractionNode,
  31327. isMathOperatorNode,
  31328. isEachKeywordNode,
  31329. isForKeywordNode,
  31330. isURLFunctionNode,
  31331. isIfElseKeywordNode,
  31332. hasComposesNode,
  31333. hasParensAroundNode,
  31334. hasEmptyRawBefore,
  31335. isKeyValuePairNode,
  31336. isKeyInValuePairNode,
  31337. isDetachedRulesetCallNode,
  31338. isTemplatePlaceholderNode,
  31339. isTemplatePropNode,
  31340. isPostcssSimpleVarNode,
  31341. isSCSSMapItemNode,
  31342. isInlineValueCommentNode,
  31343. isHashNode,
  31344. isLeftCurlyBraceNode,
  31345. isRightCurlyBraceNode,
  31346. isWordNode,
  31347. isColonNode,
  31348. isMediaAndSupportsKeywords,
  31349. isColorAdjusterFuncNode,
  31350. lastLineHasInlineComment,
  31351. isAtWordPlaceholderNode,
  31352. isConfigurationNode,
  31353. isParenGroupNode
  31354. } = require_utils8();
  31355. var {
  31356. locStart,
  31357. locEnd
  31358. } = require_loc2();
  31359. var isLessParser = require_is_less_parser();
  31360. var isSCSS = require_is_scss();
  31361. var printUnit = require_print_unit();
  31362. function shouldPrintComma(options) {
  31363. return options.trailingComma === "es5" || options.trailingComma === "all";
  31364. }
  31365. function genericPrint(path, options, print) {
  31366. const node = path.getValue();
  31367. if (!node) {
  31368. return "";
  31369. }
  31370. if (typeof node === "string") {
  31371. return node;
  31372. }
  31373. switch (node.type) {
  31374. case "front-matter":
  31375. return [node.raw, hardline];
  31376. case "css-root": {
  31377. const nodes = printNodeSequence(path, options, print);
  31378. let after = node.raws.after.trim();
  31379. if (after.startsWith(";")) {
  31380. after = after.slice(1).trim();
  31381. }
  31382. return [nodes, after ? ` ${after}` : "", getDocParts(nodes).length > 0 ? hardline : ""];
  31383. }
  31384. case "css-comment": {
  31385. const isInlineComment = node.inline || node.raws.inline;
  31386. const text = options.originalText.slice(locStart(node), locEnd(node));
  31387. return isInlineComment ? text.trimEnd() : text;
  31388. }
  31389. case "css-rule": {
  31390. 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) ? ";" : ""] : ";"];
  31391. }
  31392. case "css-decl": {
  31393. const parentNode = path.getParentNode();
  31394. const {
  31395. between: rawBetween
  31396. } = node.raws;
  31397. const trimmedBetween = rawBetween.trim();
  31398. const isColon = trimmedBetween === ":";
  31399. let value = hasComposesNode(node) ? removeLines(print("value")) : print("value");
  31400. if (!isColon && lastLineHasInlineComment(trimmedBetween)) {
  31401. value = indent([hardline, dedent(value)]);
  31402. }
  31403. return [node.raws.before.replace(/[\s;]/g, ""), parentNode.type === "css-atrule" && parentNode.variable || 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(";") : ";"];
  31404. }
  31405. case "css-atrule": {
  31406. const parentNode = path.getParentNode();
  31407. const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";";
  31408. if (isLessParser(options)) {
  31409. if (node.mixin) {
  31410. return [print("selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31411. }
  31412. if (node.function) {
  31413. return [node.name, print("params"), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  31414. }
  31415. if (node.variable) {
  31416. 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 ? "" : ";"];
  31417. }
  31418. }
  31419. 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 ? "" : ";"];
  31420. }
  31421. case "media-query-list": {
  31422. const parts = [];
  31423. path.each((childPath) => {
  31424. const node2 = childPath.getValue();
  31425. if (node2.type === "media-query" && node2.value === "") {
  31426. return;
  31427. }
  31428. parts.push(print());
  31429. }, "nodes");
  31430. return group(indent(join(line, parts)));
  31431. }
  31432. case "media-query": {
  31433. return [join(" ", path.map(print, "nodes")), isLastNode(path, node) ? "" : ","];
  31434. }
  31435. case "media-type": {
  31436. return adjustNumbers(adjustStrings(node.value, options));
  31437. }
  31438. case "media-feature-expression": {
  31439. if (!node.nodes) {
  31440. return node.value;
  31441. }
  31442. return ["(", ...path.map(print, "nodes"), ")"];
  31443. }
  31444. case "media-feature": {
  31445. return maybeToLowerCase(adjustStrings(node.value.replace(/ +/g, " "), options));
  31446. }
  31447. case "media-colon": {
  31448. return [node.value, " "];
  31449. }
  31450. case "media-value": {
  31451. return adjustNumbers(adjustStrings(node.value, options));
  31452. }
  31453. case "media-keyword": {
  31454. return adjustStrings(node.value, options);
  31455. }
  31456. case "media-url": {
  31457. return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/g, ")"), options);
  31458. }
  31459. case "media-unknown": {
  31460. return node.value;
  31461. }
  31462. case "selector-root": {
  31463. 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"))]);
  31464. }
  31465. case "selector-selector": {
  31466. return group(indent(path.map(print, "nodes")));
  31467. }
  31468. case "selector-comment": {
  31469. return node.value;
  31470. }
  31471. case "selector-string": {
  31472. return adjustStrings(node.value, options);
  31473. }
  31474. case "selector-tag": {
  31475. const parentNode = path.getParentNode();
  31476. const index = parentNode && parentNode.nodes.indexOf(node);
  31477. const prevNode = index && parentNode.nodes[index - 1];
  31478. 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)];
  31479. }
  31480. case "selector-id": {
  31481. return ["#", node.value];
  31482. }
  31483. case "selector-class": {
  31484. return [".", adjustNumbers(adjustStrings(node.value, options))];
  31485. }
  31486. case "selector-attribute": {
  31487. var _node$operator;
  31488. 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" : "", "]"];
  31489. }
  31490. case "selector-combinator": {
  31491. if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
  31492. const parentNode = path.getParentNode();
  31493. const leading2 = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line;
  31494. return [leading2, node.value, isLastNode(path, node) ? "" : " "];
  31495. }
  31496. const leading = node.value.trim().startsWith("(") ? line : "";
  31497. const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line;
  31498. return [leading, value];
  31499. }
  31500. case "selector-universal": {
  31501. return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.value];
  31502. }
  31503. case "selector-pseudo": {
  31504. return [maybeToLowerCase(node.value), isNonEmptyArray(node.nodes) ? group(["(", indent([softline, join([",", line], path.map(print, "nodes"))]), softline, ")"]) : ""];
  31505. }
  31506. case "selector-nesting": {
  31507. return node.value;
  31508. }
  31509. case "selector-unknown": {
  31510. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  31511. if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
  31512. return adjustNumbers(adjustStrings(maybeToLowerCase(node.value), options));
  31513. }
  31514. const parentNode = path.getParentNode();
  31515. if (parentNode.raws && parentNode.raws.selector) {
  31516. const start = locStart(parentNode);
  31517. const end = start + parentNode.raws.selector.length;
  31518. return options.originalText.slice(start, end).trim();
  31519. }
  31520. const grandParent = path.getParentNode(1);
  31521. if (parentNode.type === "value-paren_group" && grandParent && grandParent.type === "value-func" && grandParent.value === "selector") {
  31522. const start = locEnd(parentNode.open) + 1;
  31523. const end = locStart(parentNode.close);
  31524. const selector = options.originalText.slice(start, end).trim();
  31525. return lastLineHasInlineComment(selector) ? [breakParent, selector] : selector;
  31526. }
  31527. return node.value;
  31528. }
  31529. case "value-value":
  31530. case "value-root": {
  31531. return print("group");
  31532. }
  31533. case "value-comment": {
  31534. return options.originalText.slice(locStart(node), locEnd(node));
  31535. }
  31536. case "value-comma_group": {
  31537. const parentNode = path.getParentNode();
  31538. const parentParentNode = path.getParentNode(1);
  31539. const declAncestorProp = getPropOfDeclNode(path);
  31540. const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
  31541. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  31542. const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
  31543. const hasInlineComment = node.groups.some((node2) => isInlineValueCommentNode(node2));
  31544. const printed = path.map(print, "groups");
  31545. const parts = [];
  31546. const insideURLFunction = insideValueFunctionNode(path, "url");
  31547. let insideSCSSInterpolationInString = false;
  31548. let didBreak = false;
  31549. for (let i = 0; i < node.groups.length; ++i) {
  31550. var _iNode$value;
  31551. parts.push(printed[i]);
  31552. const iPrevNode = node.groups[i - 1];
  31553. const iNode = node.groups[i];
  31554. const iNextNode = node.groups[i + 1];
  31555. const iNextNextNode = node.groups[i + 2];
  31556. if (insideURLFunction) {
  31557. if (iNextNode && isAdditionNode(iNextNode) || isAdditionNode(iNode)) {
  31558. parts.push(" ");
  31559. }
  31560. continue;
  31561. }
  31562. 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 === "*") {
  31563. continue;
  31564. }
  31565. if (!iNextNode) {
  31566. continue;
  31567. }
  31568. if (iNode.type === "value-word" && iNode.value.endsWith("-") && isAtWordPlaceholderNode(iNextNode)) {
  31569. continue;
  31570. }
  31571. if (iNode.type === "value-string" && iNode.quoted) {
  31572. const positionOfOpeningInterpolation = iNode.value.lastIndexOf("#{");
  31573. const positionOfClosingInterpolation = iNode.value.lastIndexOf("}");
  31574. if (positionOfOpeningInterpolation !== -1 && positionOfClosingInterpolation !== -1) {
  31575. insideSCSSInterpolationInString = positionOfOpeningInterpolation > positionOfClosingInterpolation;
  31576. } else if (positionOfOpeningInterpolation !== -1) {
  31577. insideSCSSInterpolationInString = true;
  31578. } else if (positionOfClosingInterpolation !== -1) {
  31579. insideSCSSInterpolationInString = false;
  31580. }
  31581. }
  31582. if (insideSCSSInterpolationInString) {
  31583. continue;
  31584. }
  31585. if (isColonNode(iNode) || isColonNode(iNextNode)) {
  31586. continue;
  31587. }
  31588. if (iNode.type === "value-atword" && (iNode.value === "" || iNode.value.endsWith("["))) {
  31589. continue;
  31590. }
  31591. if (iNextNode.type === "value-word" && iNextNode.value.startsWith("]")) {
  31592. continue;
  31593. }
  31594. if (iNode.value === "~") {
  31595. continue;
  31596. }
  31597. if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
  31598. continue;
  31599. }
  31600. if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
  31601. continue;
  31602. }
  31603. if (iNode.value === "\\") {
  31604. continue;
  31605. }
  31606. if (isPostcssSimpleVarNode(iNode, iNextNode)) {
  31607. continue;
  31608. }
  31609. if (isHashNode(iNode) || isLeftCurlyBraceNode(iNode) || isRightCurlyBraceNode(iNextNode) || isLeftCurlyBraceNode(iNextNode) && hasEmptyRawBefore(iNextNode) || isRightCurlyBraceNode(iNode) && hasEmptyRawBefore(iNextNode)) {
  31610. continue;
  31611. }
  31612. if (iNode.value === "--" && isHashNode(iNextNode)) {
  31613. continue;
  31614. }
  31615. const isMathOperator = isMathOperatorNode(iNode);
  31616. const isNextMathOperator = isMathOperatorNode(iNextNode);
  31617. if ((isMathOperator && isHashNode(iNextNode) || isNextMathOperator && isRightCurlyBraceNode(iNode)) && hasEmptyRawBefore(iNextNode)) {
  31618. continue;
  31619. }
  31620. if (!iPrevNode && isDivisionNode(iNode)) {
  31621. continue;
  31622. }
  31623. if (insideValueFunctionNode(path, "calc") && (isAdditionNode(iNode) || isAdditionNode(iNextNode) || isSubtractionNode(iNode) || isSubtractionNode(iNextNode)) && hasEmptyRawBefore(iNextNode)) {
  31624. continue;
  31625. }
  31626. const isColorAdjusterNode = (isAdditionNode(iNode) || isSubtractionNode(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode(parentParentNode) && !hasEmptyRawBefore(iNextNode);
  31627. const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode(iNextNextNode) || iNode.type === "value-func" || isWordNode(iNode);
  31628. const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode(iPrevNode);
  31629. 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)))) {
  31630. continue;
  31631. }
  31632. if ((options.parser === "scss" || options.parser === "less") && isMathOperator && iNode.value === "-" && isParenGroupNode(iNextNode) && locEnd(iNode) === locStart(iNextNode.open) && iNextNode.open.value === "(") {
  31633. continue;
  31634. }
  31635. if (isInlineValueCommentNode(iNode)) {
  31636. if (parentNode.type === "value-paren_group") {
  31637. parts.push(dedent(hardline));
  31638. continue;
  31639. }
  31640. parts.push(hardline);
  31641. continue;
  31642. }
  31643. if (isControlDirective && (isEqualityOperatorNode(iNextNode) || isRelationalOperatorNode(iNextNode) || isIfElseKeywordNode(iNextNode) || isEachKeywordNode(iNode) || isForKeywordNode(iNode))) {
  31644. parts.push(" ");
  31645. continue;
  31646. }
  31647. if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
  31648. parts.push(" ");
  31649. continue;
  31650. }
  31651. if (isGridValue) {
  31652. if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
  31653. parts.push(hardline);
  31654. didBreak = true;
  31655. } else {
  31656. parts.push(" ");
  31657. }
  31658. continue;
  31659. }
  31660. if (isNextMathOperator) {
  31661. parts.push(" ");
  31662. continue;
  31663. }
  31664. if (iNextNode && iNextNode.value === "...") {
  31665. continue;
  31666. }
  31667. if (isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && locEnd(iNode) === locStart(iNextNode)) {
  31668. continue;
  31669. }
  31670. if (isAtWordPlaceholderNode(iNode) && isParenGroupNode(iNextNode) && locEnd(iNode) === locStart(iNextNode.open)) {
  31671. parts.push(softline);
  31672. continue;
  31673. }
  31674. if (iNode.value === "with" && isParenGroupNode(iNextNode)) {
  31675. parts.push(" ");
  31676. continue;
  31677. }
  31678. if ((_iNode$value = iNode.value) !== null && _iNode$value !== void 0 && _iNode$value.endsWith("#") && iNextNode.value === "{" && isParenGroupNode(iNextNode.group)) {
  31679. continue;
  31680. }
  31681. parts.push(line);
  31682. }
  31683. if (hasInlineComment) {
  31684. parts.push(breakParent);
  31685. }
  31686. if (didBreak) {
  31687. parts.unshift(hardline);
  31688. }
  31689. if (isControlDirective) {
  31690. return group(indent(parts));
  31691. }
  31692. if (insideURLFunctionInImportAtRuleNode(path)) {
  31693. return group(fill(parts));
  31694. }
  31695. return group(indent(fill(parts)));
  31696. }
  31697. case "value-paren_group": {
  31698. const parentNode = path.getParentNode();
  31699. 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:"))) {
  31700. return [node.open ? print("open") : "", join(",", path.map(print, "groups")), node.close ? print("close") : ""];
  31701. }
  31702. if (!node.open) {
  31703. const printed2 = path.map(print, "groups");
  31704. const res = [];
  31705. for (let i = 0; i < printed2.length; i++) {
  31706. if (i !== 0) {
  31707. res.push([",", line]);
  31708. }
  31709. res.push(printed2[i]);
  31710. }
  31711. return group(indent(fill(res)));
  31712. }
  31713. const isSCSSMapItem = isSCSSMapItemNode(path);
  31714. const lastItem = getLast(node.groups);
  31715. const isLastItemComment = lastItem && lastItem.type === "value-comment";
  31716. const isKey = isKeyInValuePairNode(node, parentNode);
  31717. const isConfiguration = isConfigurationNode(node, parentNode);
  31718. const shouldBreak = isConfiguration || isSCSSMapItem && !isKey;
  31719. const shouldDedent = isConfiguration || isKey;
  31720. const printed = group([node.open ? print("open") : "", indent([softline, join([line], path.map((childPath, index) => {
  31721. const child = childPath.getValue();
  31722. const isLast = index === node.groups.length - 1;
  31723. let printed2 = [print(), isLast ? "" : ","];
  31724. 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") {
  31725. const parts = getDocParts(printed2[0].contents.contents);
  31726. parts[1] = group(parts[1]);
  31727. printed2 = [group(dedent(printed2))];
  31728. }
  31729. if (!isLast && child.type === "value-comma_group" && isNonEmptyArray(child.groups)) {
  31730. let last = getLast(child.groups);
  31731. if (!last.source && last.close) {
  31732. last = last.close;
  31733. }
  31734. if (last.source && isNextLineEmpty(options.originalText, last, locEnd)) {
  31735. printed2.push(hardline);
  31736. }
  31737. }
  31738. return printed2;
  31739. }, "groups"))]), ifBreak(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline, node.close ? print("close") : ""], {
  31740. shouldBreak
  31741. });
  31742. return shouldDedent ? dedent(printed) : printed;
  31743. }
  31744. case "value-func": {
  31745. return [node.value, insideAtRuleNode(path, "supports") && isMediaAndSupportsKeywords(node) ? " " : "", print("group")];
  31746. }
  31747. case "value-paren": {
  31748. return node.value;
  31749. }
  31750. case "value-number": {
  31751. return [printCssNumber(node.value), printUnit(node.unit)];
  31752. }
  31753. case "value-operator": {
  31754. return node.value;
  31755. }
  31756. case "value-word": {
  31757. if (node.isColor && node.isHex || isWideKeywords(node.value)) {
  31758. return node.value.toLowerCase();
  31759. }
  31760. return node.value;
  31761. }
  31762. case "value-colon": {
  31763. const parentNode = path.getParentNode();
  31764. const index = parentNode && parentNode.groups.indexOf(node);
  31765. const prevNode = index && parentNode.groups[index - 1];
  31766. return [node.value, prevNode && typeof prevNode.value === "string" && getLast(prevNode.value) === "\\" || insideValueFunctionNode(path, "url") ? "" : line];
  31767. }
  31768. case "value-comma": {
  31769. return [node.value, " "];
  31770. }
  31771. case "value-string": {
  31772. return printString(node.raws.quote + node.value + node.raws.quote, options);
  31773. }
  31774. case "value-atword": {
  31775. return ["@", node.value];
  31776. }
  31777. case "value-unicode-range": {
  31778. return node.value;
  31779. }
  31780. case "value-unknown": {
  31781. return node.value;
  31782. }
  31783. default:
  31784. throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`);
  31785. }
  31786. }
  31787. function printNodeSequence(path, options, print) {
  31788. const parts = [];
  31789. path.each((pathChild, i, nodes) => {
  31790. const prevNode = nodes[i - 1];
  31791. if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
  31792. const childNode = pathChild.getValue();
  31793. parts.push(options.originalText.slice(locStart(childNode), locEnd(childNode)));
  31794. } else {
  31795. parts.push(print());
  31796. }
  31797. if (i !== nodes.length - 1) {
  31798. if (nodes[i + 1].type === "css-comment" && !hasNewline(options.originalText, locStart(nodes[i + 1]), {
  31799. backwards: true
  31800. }) && !isFrontMatterNode(nodes[i]) || nodes[i + 1].type === "css-atrule" && nodes[i + 1].name === "else" && nodes[i].type !== "css-comment") {
  31801. parts.push(" ");
  31802. } else {
  31803. parts.push(options.__isHTMLStyleAttribute ? line : hardline);
  31804. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd) && !isFrontMatterNode(nodes[i])) {
  31805. parts.push(hardline);
  31806. }
  31807. }
  31808. }
  31809. }, "nodes");
  31810. return parts;
  31811. }
  31812. var STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
  31813. var NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
  31814. var STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
  31815. var WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
  31816. var ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX.source + `|(${WORD_PART_REGEX.source})?(${NUMBER_REGEX.source})(${STANDARD_UNIT_REGEX.source})?`, "g");
  31817. function adjustStrings(value, options) {
  31818. return value.replace(STRING_REGEX, (match) => printString(match, options));
  31819. }
  31820. function quoteAttributeValue(value, options) {
  31821. const quote = options.singleQuote ? "'" : '"';
  31822. return value.includes('"') || value.includes("'") ? value : quote + value + quote;
  31823. }
  31824. function adjustNumbers(value) {
  31825. return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase(unit || "") : match);
  31826. }
  31827. function printCssNumber(rawNumber) {
  31828. return printNumber(rawNumber).replace(/\.0(?=$|e)/, "");
  31829. }
  31830. module2.exports = {
  31831. print: genericPrint,
  31832. embed,
  31833. insertPragma,
  31834. massageAstNode: clean
  31835. };
  31836. }
  31837. });
  31838. var require_options3 = __commonJS2({
  31839. "src/language-css/options.js"(exports2, module2) {
  31840. "use strict";
  31841. var commonOptions = require_common_options();
  31842. module2.exports = {
  31843. singleQuote: commonOptions.singleQuote
  31844. };
  31845. }
  31846. });
  31847. var require_parsers2 = __commonJS2({
  31848. "src/language-css/parsers.js"(exports2, module2) {
  31849. "use strict";
  31850. module2.exports = {
  31851. get css() {
  31852. return require("./parser-postcss.js").parsers.css;
  31853. },
  31854. get less() {
  31855. return require("./parser-postcss.js").parsers.less;
  31856. },
  31857. get scss() {
  31858. return require("./parser-postcss.js").parsers.scss;
  31859. }
  31860. };
  31861. }
  31862. });
  31863. var require_CSS = __commonJS2({
  31864. "node_modules/linguist-languages/data/CSS.json"(exports2, module2) {
  31865. module2.exports = {
  31866. name: "CSS",
  31867. type: "markup",
  31868. tmScope: "source.css",
  31869. aceMode: "css",
  31870. codemirrorMode: "css",
  31871. codemirrorMimeType: "text/css",
  31872. color: "#563d7c",
  31873. extensions: [".css"],
  31874. languageId: 50
  31875. };
  31876. }
  31877. });
  31878. var require_PostCSS = __commonJS2({
  31879. "node_modules/linguist-languages/data/PostCSS.json"(exports2, module2) {
  31880. module2.exports = {
  31881. name: "PostCSS",
  31882. type: "markup",
  31883. color: "#dc3a0c",
  31884. tmScope: "source.postcss",
  31885. group: "CSS",
  31886. extensions: [".pcss", ".postcss"],
  31887. aceMode: "text",
  31888. languageId: 262764437
  31889. };
  31890. }
  31891. });
  31892. var require_Less = __commonJS2({
  31893. "node_modules/linguist-languages/data/Less.json"(exports2, module2) {
  31894. module2.exports = {
  31895. name: "Less",
  31896. type: "markup",
  31897. color: "#1d365d",
  31898. aliases: ["less-css"],
  31899. extensions: [".less"],
  31900. tmScope: "source.css.less",
  31901. aceMode: "less",
  31902. codemirrorMode: "css",
  31903. codemirrorMimeType: "text/css",
  31904. languageId: 198
  31905. };
  31906. }
  31907. });
  31908. var require_SCSS = __commonJS2({
  31909. "node_modules/linguist-languages/data/SCSS.json"(exports2, module2) {
  31910. module2.exports = {
  31911. name: "SCSS",
  31912. type: "markup",
  31913. color: "#c6538c",
  31914. tmScope: "source.css.scss",
  31915. aceMode: "scss",
  31916. codemirrorMode: "css",
  31917. codemirrorMimeType: "text/x-scss",
  31918. extensions: [".scss"],
  31919. languageId: 329
  31920. };
  31921. }
  31922. });
  31923. var require_language_css = __commonJS2({
  31924. "src/language-css/index.js"(exports2, module2) {
  31925. "use strict";
  31926. var createLanguage = require_create_language();
  31927. var printer = require_printer_postcss();
  31928. var options = require_options3();
  31929. var parsers = require_parsers2();
  31930. var languages = [createLanguage(require_CSS(), (data) => ({
  31931. since: "1.4.0",
  31932. parsers: ["css"],
  31933. vscodeLanguageIds: ["css"],
  31934. extensions: [...data.extensions, ".wxss"]
  31935. })), createLanguage(require_PostCSS(), () => ({
  31936. since: "1.4.0",
  31937. parsers: ["css"],
  31938. vscodeLanguageIds: ["postcss"]
  31939. })), createLanguage(require_Less(), () => ({
  31940. since: "1.4.0",
  31941. parsers: ["less"],
  31942. vscodeLanguageIds: ["less"]
  31943. })), createLanguage(require_SCSS(), () => ({
  31944. since: "1.4.0",
  31945. parsers: ["scss"],
  31946. vscodeLanguageIds: ["scss"]
  31947. }))];
  31948. var printers = {
  31949. postcss: printer
  31950. };
  31951. module2.exports = {
  31952. languages,
  31953. options,
  31954. printers,
  31955. parsers
  31956. };
  31957. }
  31958. });
  31959. var require_loc3 = __commonJS2({
  31960. "src/language-handlebars/loc.js"(exports2, module2) {
  31961. "use strict";
  31962. function locStart(node) {
  31963. return node.loc.start.offset;
  31964. }
  31965. function locEnd(node) {
  31966. return node.loc.end.offset;
  31967. }
  31968. module2.exports = {
  31969. locStart,
  31970. locEnd
  31971. };
  31972. }
  31973. });
  31974. var require_clean3 = __commonJS2({
  31975. "src/language-handlebars/clean.js"(exports2, module2) {
  31976. "use strict";
  31977. function clean(ast, newNode) {
  31978. if (ast.type === "TextNode") {
  31979. const trimmed = ast.chars.trim();
  31980. if (!trimmed) {
  31981. return null;
  31982. }
  31983. newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
  31984. }
  31985. if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
  31986. delete newNode.value;
  31987. }
  31988. }
  31989. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "selfClosing"]);
  31990. module2.exports = clean;
  31991. }
  31992. });
  31993. var require_html_void_elements_evaluate = __commonJS2({
  31994. "src/language-handlebars/html-void-elements.evaluate.js"(exports2, module2) {
  31995. module2.exports = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
  31996. }
  31997. });
  31998. var require_utils9 = __commonJS2({
  31999. "src/language-handlebars/utils.js"(exports2, module2) {
  32000. "use strict";
  32001. var getLast = require_get_last();
  32002. var htmlVoidElements = require_html_void_elements_evaluate();
  32003. function isLastNodeOfSiblings(path) {
  32004. const node = path.getValue();
  32005. const parentNode = path.getParentNode(0);
  32006. if (isParentOfSomeType(path, ["ElementNode"]) && getLast(parentNode.children) === node) {
  32007. return true;
  32008. }
  32009. if (isParentOfSomeType(path, ["Block"]) && getLast(parentNode.body) === node) {
  32010. return true;
  32011. }
  32012. return false;
  32013. }
  32014. function isUppercase(string) {
  32015. return string.toUpperCase() === string;
  32016. }
  32017. function isGlimmerComponent(node) {
  32018. return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && !node.tag.startsWith(":") && (isUppercase(node.tag[0]) || node.tag.includes("."));
  32019. }
  32020. var voidTags = new Set(htmlVoidElements);
  32021. function isVoidTag(tag) {
  32022. return voidTags.has(tag.toLowerCase()) && !isUppercase(tag[0]);
  32023. }
  32024. function isVoid(node) {
  32025. return node.selfClosing === true || isVoidTag(node.tag) || isGlimmerComponent(node) && node.children.every((node2) => isWhitespaceNode(node2));
  32026. }
  32027. function isWhitespaceNode(node) {
  32028. return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
  32029. }
  32030. function isNodeOfSomeType(node, types) {
  32031. return node && types.includes(node.type);
  32032. }
  32033. function isParentOfSomeType(path, types) {
  32034. const parentNode = path.getParentNode(0);
  32035. return isNodeOfSomeType(parentNode, types);
  32036. }
  32037. function isPreviousNodeOfSomeType(path, types) {
  32038. const previousNode = getPreviousNode(path);
  32039. return isNodeOfSomeType(previousNode, types);
  32040. }
  32041. function isNextNodeOfSomeType(path, types) {
  32042. const nextNode = getNextNode(path);
  32043. return isNodeOfSomeType(nextNode, types);
  32044. }
  32045. function getSiblingNode(path, offset) {
  32046. var _path$getParentNode2, _ref7, _ref8, _parentNode$children;
  32047. const node = path.getValue();
  32048. const parentNode = (_path$getParentNode2 = path.getParentNode(0)) !== null && _path$getParentNode2 !== void 0 ? _path$getParentNode2 : {};
  32049. 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 : [];
  32050. const index = children.indexOf(node);
  32051. return index !== -1 && children[index + offset];
  32052. }
  32053. function getPreviousNode(path, lookBack = 1) {
  32054. return getSiblingNode(path, -lookBack);
  32055. }
  32056. function getNextNode(path) {
  32057. return getSiblingNode(path, 1);
  32058. }
  32059. function isPrettierIgnoreNode(node) {
  32060. return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
  32061. }
  32062. function hasPrettierIgnore(path) {
  32063. const node = path.getValue();
  32064. const previousPreviousNode = getPreviousNode(path, 2);
  32065. return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
  32066. }
  32067. module2.exports = {
  32068. getNextNode,
  32069. getPreviousNode,
  32070. hasPrettierIgnore,
  32071. isLastNodeOfSiblings,
  32072. isNextNodeOfSomeType,
  32073. isNodeOfSomeType,
  32074. isParentOfSomeType,
  32075. isPreviousNodeOfSomeType,
  32076. isVoid,
  32077. isWhitespaceNode
  32078. };
  32079. }
  32080. });
  32081. var require_printer_glimmer = __commonJS2({
  32082. "src/language-handlebars/printer-glimmer.js"(exports2, module2) {
  32083. "use strict";
  32084. var {
  32085. builders: {
  32086. dedent,
  32087. fill,
  32088. group,
  32089. hardline,
  32090. ifBreak,
  32091. indent,
  32092. join,
  32093. line,
  32094. softline
  32095. },
  32096. utils: {
  32097. getDocParts,
  32098. replaceTextEndOfLine
  32099. }
  32100. } = require("./doc.js");
  32101. var {
  32102. getPreferredQuote,
  32103. isNonEmptyArray
  32104. } = require_util();
  32105. var {
  32106. locStart,
  32107. locEnd
  32108. } = require_loc3();
  32109. var clean = require_clean3();
  32110. var {
  32111. getNextNode,
  32112. getPreviousNode,
  32113. hasPrettierIgnore,
  32114. isLastNodeOfSiblings,
  32115. isNextNodeOfSomeType,
  32116. isNodeOfSomeType,
  32117. isParentOfSomeType,
  32118. isPreviousNodeOfSomeType,
  32119. isVoid,
  32120. isWhitespaceNode
  32121. } = require_utils9();
  32122. var NEWLINES_TO_PRESERVE_MAX = 2;
  32123. function print(path, options, print2) {
  32124. const node = path.getValue();
  32125. if (!node) {
  32126. return "";
  32127. }
  32128. if (hasPrettierIgnore(path)) {
  32129. return options.originalText.slice(locStart(node), locEnd(node));
  32130. }
  32131. const favoriteQuote = options.singleQuote ? "'" : '"';
  32132. switch (node.type) {
  32133. case "Block":
  32134. case "Program":
  32135. case "Template": {
  32136. return group(path.map(print2, "body"));
  32137. }
  32138. case "ElementNode": {
  32139. const startingTag = group(printStartingTag(path, print2));
  32140. const escapeNextElementNode = options.htmlWhitespaceSensitivity === "ignore" && isNextNodeOfSomeType(path, ["ElementNode"]) ? softline : "";
  32141. if (isVoid(node)) {
  32142. return [startingTag, escapeNextElementNode];
  32143. }
  32144. const endingTag = ["</", node.tag, ">"];
  32145. if (node.children.length === 0) {
  32146. return [startingTag, indent(endingTag), escapeNextElementNode];
  32147. }
  32148. if (options.htmlWhitespaceSensitivity === "ignore") {
  32149. return [startingTag, indent(printChildren(path, options, print2)), hardline, indent(endingTag), escapeNextElementNode];
  32150. }
  32151. return [startingTag, indent(group(printChildren(path, options, print2))), indent(endingTag), escapeNextElementNode];
  32152. }
  32153. case "BlockStatement": {
  32154. const pp = path.getParentNode(1);
  32155. 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];
  32156. if (isElseIfLike) {
  32157. return [printElseIfLikeBlock(path, print2, pp.inverse.body[0].path.parts[0]), printProgram(path, print2, options), printInverse(path, print2, options)];
  32158. }
  32159. return [printOpenBlock(path, print2), group([printProgram(path, print2, options), printInverse(path, print2, options), printCloseBlock(path, print2, options)])];
  32160. }
  32161. case "ElementModifierStatement": {
  32162. return group(["{{", printPathAndParams(path, print2), "}}"]);
  32163. }
  32164. case "MustacheStatement": {
  32165. return group([printOpeningMustache(node), printPathAndParams(path, print2), printClosingMustache(node)]);
  32166. }
  32167. case "SubExpression": {
  32168. return group(["(", printSubExpressionPathAndParams(path, print2), softline, ")"]);
  32169. }
  32170. case "AttrNode": {
  32171. const isText = node.value.type === "TextNode";
  32172. const isEmptyText = isText && node.value.chars === "";
  32173. if (isEmptyText && locStart(node.value) === locEnd(node.value)) {
  32174. return node.name;
  32175. }
  32176. 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 : "";
  32177. const valueDoc = print2("value");
  32178. return [node.name, "=", quote, node.name === "class" && quote ? group(indent(valueDoc)) : valueDoc, quote];
  32179. }
  32180. case "ConcatStatement": {
  32181. return path.map(print2, "parts");
  32182. }
  32183. case "Hash": {
  32184. return join(line, path.map(print2, "pairs"));
  32185. }
  32186. case "HashPair": {
  32187. return [node.key, "=", print2("value")];
  32188. }
  32189. case "TextNode": {
  32190. let text = node.chars.replace(/{{/g, "\\{{");
  32191. const attrName = getCurrentAttributeName(path);
  32192. if (attrName) {
  32193. if (attrName === "class") {
  32194. const formattedClasses = text.trim().split(/\s+/).join(" ");
  32195. let leadingSpace2 = false;
  32196. let trailingSpace2 = false;
  32197. if (isParentOfSomeType(path, ["ConcatStatement"])) {
  32198. if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text)) {
  32199. leadingSpace2 = true;
  32200. }
  32201. if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text) && formattedClasses !== "") {
  32202. trailingSpace2 = true;
  32203. }
  32204. }
  32205. return [leadingSpace2 ? line : "", formattedClasses, trailingSpace2 ? line : ""];
  32206. }
  32207. return replaceTextEndOfLine(text);
  32208. }
  32209. const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
  32210. const isWhitespaceOnly = whitespacesOnlyRE.test(text);
  32211. const isFirstElement = !getPreviousNode(path);
  32212. const isLastElement = !getNextNode(path);
  32213. if (options.htmlWhitespaceSensitivity !== "ignore") {
  32214. const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
  32215. const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
  32216. const shouldTrimTrailingNewlines = isLastElement && isParentOfSomeType(path, ["Template"]);
  32217. const shouldTrimLeadingNewlines = isFirstElement && isParentOfSomeType(path, ["Template"]);
  32218. if (isWhitespaceOnly) {
  32219. if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
  32220. return "";
  32221. }
  32222. let breaks = [line];
  32223. const newlines = countNewLines(text);
  32224. if (newlines) {
  32225. breaks = generateHardlines(newlines);
  32226. }
  32227. if (isLastNodeOfSiblings(path)) {
  32228. breaks = breaks.map((newline) => dedent(newline));
  32229. }
  32230. return breaks;
  32231. }
  32232. const [lead] = text.match(leadingWhitespacesRE);
  32233. const [tail] = text.match(trailingWhitespacesRE);
  32234. let leadBreaks = [];
  32235. if (lead) {
  32236. leadBreaks = [line];
  32237. const leadingNewlines = countNewLines(lead);
  32238. if (leadingNewlines) {
  32239. leadBreaks = generateHardlines(leadingNewlines);
  32240. }
  32241. text = text.replace(leadingWhitespacesRE, "");
  32242. }
  32243. let trailBreaks = [];
  32244. if (tail) {
  32245. if (!shouldTrimTrailingNewlines) {
  32246. trailBreaks = [line];
  32247. const trailingNewlines = countNewLines(tail);
  32248. if (trailingNewlines) {
  32249. trailBreaks = generateHardlines(trailingNewlines);
  32250. }
  32251. if (isLastNodeOfSiblings(path)) {
  32252. trailBreaks = trailBreaks.map((hardline2) => dedent(hardline2));
  32253. }
  32254. }
  32255. text = text.replace(trailingWhitespacesRE, "");
  32256. }
  32257. return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
  32258. }
  32259. const lineBreaksCount = countNewLines(text);
  32260. let leadingLineBreaksCount = countLeadingNewLines(text);
  32261. let trailingLineBreaksCount = countTrailingNewLines(text);
  32262. if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
  32263. return "";
  32264. }
  32265. if (isWhitespaceOnly && lineBreaksCount) {
  32266. leadingLineBreaksCount = Math.min(lineBreaksCount, NEWLINES_TO_PRESERVE_MAX);
  32267. trailingLineBreaksCount = 0;
  32268. } else {
  32269. if (isNextNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  32270. trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
  32271. }
  32272. if (isPreviousNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  32273. leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
  32274. }
  32275. }
  32276. let leadingSpace = "";
  32277. let trailingSpace = "";
  32278. if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType(path, ["MustacheStatement"])) {
  32279. trailingSpace = " ";
  32280. }
  32281. if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
  32282. leadingSpace = " ";
  32283. }
  32284. if (isFirstElement) {
  32285. leadingLineBreaksCount = 0;
  32286. leadingSpace = "";
  32287. }
  32288. if (isLastElement) {
  32289. trailingLineBreaksCount = 0;
  32290. trailingSpace = "";
  32291. }
  32292. text = text.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
  32293. return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(text)), ...generateHardlines(trailingLineBreaksCount)];
  32294. }
  32295. case "MustacheCommentStatement": {
  32296. const start = locStart(node);
  32297. const end = locEnd(node);
  32298. const isLeftWhiteSpaceSensitive = options.originalText.charAt(start + 2) === "~";
  32299. const isRightWhitespaceSensitive = options.originalText.charAt(end - 3) === "~";
  32300. const dashes = node.value.includes("}}") ? "--" : "";
  32301. return ["{{", isLeftWhiteSpaceSensitive ? "~" : "", "!", dashes, node.value, dashes, isRightWhitespaceSensitive ? "~" : "", "}}"];
  32302. }
  32303. case "PathExpression": {
  32304. return node.original;
  32305. }
  32306. case "BooleanLiteral": {
  32307. return String(node.value);
  32308. }
  32309. case "CommentStatement": {
  32310. return ["<!--", node.value, "-->"];
  32311. }
  32312. case "StringLiteral": {
  32313. if (needsOppositeQuote(path)) {
  32314. const printFavoriteQuote = !options.singleQuote ? "'" : '"';
  32315. return printStringLiteral(node.value, printFavoriteQuote);
  32316. }
  32317. return printStringLiteral(node.value, favoriteQuote);
  32318. }
  32319. case "NumberLiteral": {
  32320. return String(node.value);
  32321. }
  32322. case "UndefinedLiteral": {
  32323. return "undefined";
  32324. }
  32325. case "NullLiteral": {
  32326. return "null";
  32327. }
  32328. default:
  32329. throw new Error("unknown glimmer type: " + JSON.stringify(node.type));
  32330. }
  32331. }
  32332. function sortByLoc(a, b) {
  32333. return locStart(a) - locStart(b);
  32334. }
  32335. function printStartingTag(path, print2) {
  32336. const node = path.getValue();
  32337. const types = ["attributes", "modifiers", "comments"].filter((property) => isNonEmptyArray(node[property]));
  32338. const attributes = types.flatMap((type) => node[type]).sort(sortByLoc);
  32339. for (const attributeType of types) {
  32340. path.each((attributePath) => {
  32341. const index = attributes.indexOf(attributePath.getValue());
  32342. attributes.splice(index, 1, [line, print2()]);
  32343. }, attributeType);
  32344. }
  32345. if (isNonEmptyArray(node.blockParams)) {
  32346. attributes.push(line, printBlockParams(node));
  32347. }
  32348. return ["<", node.tag, indent(attributes), printStartingTagEndMarker(node)];
  32349. }
  32350. function printChildren(path, options, print2) {
  32351. const node = path.getValue();
  32352. const isEmpty = node.children.every((node2) => isWhitespaceNode(node2));
  32353. if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
  32354. return "";
  32355. }
  32356. return path.map((childPath, childIndex) => {
  32357. const printedChild = print2();
  32358. if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
  32359. return [softline, printedChild];
  32360. }
  32361. return printedChild;
  32362. }, "children");
  32363. }
  32364. function printStartingTagEndMarker(node) {
  32365. if (isVoid(node)) {
  32366. return ifBreak([softline, "/>"], [" />", softline]);
  32367. }
  32368. return ifBreak([softline, ">"], ">");
  32369. }
  32370. function printOpeningMustache(node) {
  32371. const mustache = node.escaped === false ? "{{{" : "{{";
  32372. const strip = node.strip && node.strip.open ? "~" : "";
  32373. return [mustache, strip];
  32374. }
  32375. function printClosingMustache(node) {
  32376. const mustache = node.escaped === false ? "}}}" : "}}";
  32377. const strip = node.strip && node.strip.close ? "~" : "";
  32378. return [strip, mustache];
  32379. }
  32380. function printOpeningBlockOpeningMustache(node) {
  32381. const opening = printOpeningMustache(node);
  32382. const strip = node.openStrip.open ? "~" : "";
  32383. return [opening, strip, "#"];
  32384. }
  32385. function printOpeningBlockClosingMustache(node) {
  32386. const closing = printClosingMustache(node);
  32387. const strip = node.openStrip.close ? "~" : "";
  32388. return [strip, closing];
  32389. }
  32390. function printClosingBlockOpeningMustache(node) {
  32391. const opening = printOpeningMustache(node);
  32392. const strip = node.closeStrip.open ? "~" : "";
  32393. return [opening, strip, "/"];
  32394. }
  32395. function printClosingBlockClosingMustache(node) {
  32396. const closing = printClosingMustache(node);
  32397. const strip = node.closeStrip.close ? "~" : "";
  32398. return [strip, closing];
  32399. }
  32400. function printInverseBlockOpeningMustache(node) {
  32401. const opening = printOpeningMustache(node);
  32402. const strip = node.inverseStrip.open ? "~" : "";
  32403. return [opening, strip];
  32404. }
  32405. function printInverseBlockClosingMustache(node) {
  32406. const closing = printClosingMustache(node);
  32407. const strip = node.inverseStrip.close ? "~" : "";
  32408. return [strip, closing];
  32409. }
  32410. function printOpenBlock(path, print2) {
  32411. const node = path.getValue();
  32412. const parts = [];
  32413. const paramsDoc = printParams(path, print2);
  32414. if (paramsDoc) {
  32415. parts.push(group(paramsDoc));
  32416. }
  32417. if (isNonEmptyArray(node.program.blockParams)) {
  32418. parts.push(printBlockParams(node.program));
  32419. }
  32420. return group([printOpeningBlockOpeningMustache(node), printPath(path, print2), parts.length > 0 ? indent([line, join(line, parts)]) : "", softline, printOpeningBlockClosingMustache(node)]);
  32421. }
  32422. function printElseBlock(node, options) {
  32423. return [options.htmlWhitespaceSensitivity === "ignore" ? hardline : "", printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)];
  32424. }
  32425. function printElseIfLikeBlock(path, print2, ifLikeKeyword) {
  32426. const node = path.getValue();
  32427. const parentNode = path.getParentNode(1);
  32428. return group([printInverseBlockOpeningMustache(parentNode), ["else", " ", ifLikeKeyword], indent([line, group(printParams(path, print2)), ...isNonEmptyArray(node.program.blockParams) ? [line, printBlockParams(node.program)] : []]), softline, printInverseBlockClosingMustache(parentNode)]);
  32429. }
  32430. function printCloseBlock(path, print2, options) {
  32431. const node = path.getValue();
  32432. if (options.htmlWhitespaceSensitivity === "ignore") {
  32433. const escape = blockStatementHasOnlyWhitespaceInProgram(node) ? softline : hardline;
  32434. return [escape, printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  32435. }
  32436. return [printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  32437. }
  32438. function blockStatementHasOnlyWhitespaceInProgram(node) {
  32439. return isNodeOfSomeType(node, ["BlockStatement"]) && node.program.body.every((node2) => isWhitespaceNode(node2));
  32440. }
  32441. function blockStatementHasElseIfLike(node) {
  32442. 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];
  32443. }
  32444. function blockStatementHasElse(node) {
  32445. return isNodeOfSomeType(node, ["BlockStatement"]) && node.inverse;
  32446. }
  32447. function printProgram(path, print2, options) {
  32448. const node = path.getValue();
  32449. if (blockStatementHasOnlyWhitespaceInProgram(node)) {
  32450. return "";
  32451. }
  32452. const program = print2("program");
  32453. if (options.htmlWhitespaceSensitivity === "ignore") {
  32454. return indent([hardline, program]);
  32455. }
  32456. return indent(program);
  32457. }
  32458. function printInverse(path, print2, options) {
  32459. const node = path.getValue();
  32460. const inverse = print2("inverse");
  32461. const printed = options.htmlWhitespaceSensitivity === "ignore" ? [hardline, inverse] : inverse;
  32462. if (blockStatementHasElseIfLike(node)) {
  32463. return printed;
  32464. }
  32465. if (blockStatementHasElse(node)) {
  32466. return [printElseBlock(node, options), indent(printed)];
  32467. }
  32468. return "";
  32469. }
  32470. function getTextValueParts(value) {
  32471. return getDocParts(join(line, splitByHtmlWhitespace(value)));
  32472. }
  32473. function splitByHtmlWhitespace(string) {
  32474. return string.split(/[\t\n\f\r ]+/);
  32475. }
  32476. function getCurrentAttributeName(path) {
  32477. for (let depth = 0; depth < 2; depth++) {
  32478. const parentNode = path.getParentNode(depth);
  32479. if (parentNode && parentNode.type === "AttrNode") {
  32480. return parentNode.name.toLowerCase();
  32481. }
  32482. }
  32483. }
  32484. function countNewLines(string) {
  32485. string = typeof string === "string" ? string : "";
  32486. return string.split("\n").length - 1;
  32487. }
  32488. function countLeadingNewLines(string) {
  32489. string = typeof string === "string" ? string : "";
  32490. const newLines = (string.match(/^([^\S\n\r]*[\n\r])+/g) || [])[0] || "";
  32491. return countNewLines(newLines);
  32492. }
  32493. function countTrailingNewLines(string) {
  32494. string = typeof string === "string" ? string : "";
  32495. const newLines = (string.match(/([\n\r][^\S\n\r]*)+$/g) || [])[0] || "";
  32496. return countNewLines(newLines);
  32497. }
  32498. function generateHardlines(number = 0) {
  32499. return Array.from({
  32500. length: Math.min(number, NEWLINES_TO_PRESERVE_MAX)
  32501. }).fill(hardline);
  32502. }
  32503. function printStringLiteral(stringLiteral, favoriteQuote) {
  32504. const {
  32505. quote,
  32506. regex
  32507. } = getPreferredQuote(stringLiteral, favoriteQuote);
  32508. return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
  32509. }
  32510. function needsOppositeQuote(path) {
  32511. let index = 0;
  32512. let parentNode = path.getParentNode(index);
  32513. while (parentNode && isNodeOfSomeType(parentNode, ["SubExpression"])) {
  32514. index++;
  32515. parentNode = path.getParentNode(index);
  32516. }
  32517. if (parentNode && isNodeOfSomeType(path.getParentNode(index + 1), ["ConcatStatement"]) && isNodeOfSomeType(path.getParentNode(index + 2), ["AttrNode"])) {
  32518. return true;
  32519. }
  32520. return false;
  32521. }
  32522. function printSubExpressionPathAndParams(path, print2) {
  32523. const printed = printPath(path, print2);
  32524. const params = printParams(path, print2);
  32525. if (!params) {
  32526. return printed;
  32527. }
  32528. return indent([printed, line, group(params)]);
  32529. }
  32530. function printPathAndParams(path, print2) {
  32531. const p = printPath(path, print2);
  32532. const params = printParams(path, print2);
  32533. if (!params) {
  32534. return p;
  32535. }
  32536. return [indent([p, line, params]), softline];
  32537. }
  32538. function printPath(path, print2) {
  32539. return print2("path");
  32540. }
  32541. function printParams(path, print2) {
  32542. const node = path.getValue();
  32543. const parts = [];
  32544. if (node.params.length > 0) {
  32545. const params = path.map(print2, "params");
  32546. parts.push(...params);
  32547. }
  32548. if (node.hash && node.hash.pairs.length > 0) {
  32549. const hash = print2("hash");
  32550. parts.push(hash);
  32551. }
  32552. if (parts.length === 0) {
  32553. return "";
  32554. }
  32555. return join(line, parts);
  32556. }
  32557. function printBlockParams(node) {
  32558. return ["as |", node.blockParams.join(" "), "|"];
  32559. }
  32560. module2.exports = {
  32561. print,
  32562. massageAstNode: clean
  32563. };
  32564. }
  32565. });
  32566. var require_parsers3 = __commonJS2({
  32567. "src/language-handlebars/parsers.js"(exports2, module2) {
  32568. "use strict";
  32569. module2.exports = {
  32570. get glimmer() {
  32571. return require("./parser-glimmer.js").parsers.glimmer;
  32572. }
  32573. };
  32574. }
  32575. });
  32576. var require_Handlebars = __commonJS2({
  32577. "node_modules/linguist-languages/data/Handlebars.json"(exports2, module2) {
  32578. module2.exports = {
  32579. name: "Handlebars",
  32580. type: "markup",
  32581. color: "#f7931e",
  32582. aliases: ["hbs", "htmlbars"],
  32583. extensions: [".handlebars", ".hbs"],
  32584. tmScope: "text.html.handlebars",
  32585. aceMode: "handlebars",
  32586. languageId: 155
  32587. };
  32588. }
  32589. });
  32590. var require_language_handlebars = __commonJS2({
  32591. "src/language-handlebars/index.js"(exports2, module2) {
  32592. "use strict";
  32593. var createLanguage = require_create_language();
  32594. var printer = require_printer_glimmer();
  32595. var parsers = require_parsers3();
  32596. var languages = [createLanguage(require_Handlebars(), () => ({
  32597. since: "2.3.0",
  32598. parsers: ["glimmer"],
  32599. vscodeLanguageIds: ["handlebars"]
  32600. }))];
  32601. var printers = {
  32602. glimmer: printer
  32603. };
  32604. module2.exports = {
  32605. languages,
  32606. printers,
  32607. parsers
  32608. };
  32609. }
  32610. });
  32611. var require_pragma3 = __commonJS2({
  32612. "src/language-graphql/pragma.js"(exports2, module2) {
  32613. "use strict";
  32614. function hasPragma(text) {
  32615. return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text);
  32616. }
  32617. function insertPragma(text) {
  32618. return "# @format\n\n" + text;
  32619. }
  32620. module2.exports = {
  32621. hasPragma,
  32622. insertPragma
  32623. };
  32624. }
  32625. });
  32626. var require_loc4 = __commonJS2({
  32627. "src/language-graphql/loc.js"(exports2, module2) {
  32628. "use strict";
  32629. function locStart(node) {
  32630. if (typeof node.start === "number") {
  32631. return node.start;
  32632. }
  32633. return node.loc && node.loc.start;
  32634. }
  32635. function locEnd(node) {
  32636. if (typeof node.end === "number") {
  32637. return node.end;
  32638. }
  32639. return node.loc && node.loc.end;
  32640. }
  32641. module2.exports = {
  32642. locStart,
  32643. locEnd
  32644. };
  32645. }
  32646. });
  32647. var require_printer_graphql = __commonJS2({
  32648. "src/language-graphql/printer-graphql.js"(exports2, module2) {
  32649. "use strict";
  32650. var {
  32651. builders: {
  32652. join,
  32653. hardline,
  32654. line,
  32655. softline,
  32656. group,
  32657. indent,
  32658. ifBreak
  32659. }
  32660. } = require("./doc.js");
  32661. var {
  32662. isNextLineEmpty,
  32663. isNonEmptyArray
  32664. } = require_util();
  32665. var {
  32666. insertPragma
  32667. } = require_pragma3();
  32668. var {
  32669. locStart,
  32670. locEnd
  32671. } = require_loc4();
  32672. function genericPrint(path, options, print) {
  32673. const node = path.getValue();
  32674. if (!node) {
  32675. return "";
  32676. }
  32677. if (typeof node === "string") {
  32678. return node;
  32679. }
  32680. switch (node.kind) {
  32681. case "Document": {
  32682. const parts = [];
  32683. path.each((pathChild, index, definitions) => {
  32684. parts.push(print());
  32685. if (index !== definitions.length - 1) {
  32686. parts.push(hardline);
  32687. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd)) {
  32688. parts.push(hardline);
  32689. }
  32690. }
  32691. }, "definitions");
  32692. return [...parts, hardline];
  32693. }
  32694. case "OperationDefinition": {
  32695. const hasOperation = options.originalText[locStart(node)] !== "{";
  32696. const hasName = Boolean(node.name);
  32697. 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")];
  32698. }
  32699. case "FragmentDefinition": {
  32700. 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")];
  32701. }
  32702. case "SelectionSet": {
  32703. return ["{", indent([hardline, join(hardline, printSequence(path, options, print, "selections"))]), hardline, "}"];
  32704. }
  32705. case "Field": {
  32706. 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")]);
  32707. }
  32708. case "Name": {
  32709. return node.value;
  32710. }
  32711. case "StringValue": {
  32712. if (node.block) {
  32713. const lines = node.value.replace(/"""/g, "\\$&").split("\n");
  32714. if (lines.length === 1) {
  32715. lines[0] = lines[0].trim();
  32716. }
  32717. if (lines.every((line2) => line2 === "")) {
  32718. lines.length = 0;
  32719. }
  32720. return join(hardline, ['"""', ...lines, '"""']);
  32721. }
  32722. return ['"', node.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"'];
  32723. }
  32724. case "IntValue":
  32725. case "FloatValue":
  32726. case "EnumValue": {
  32727. return node.value;
  32728. }
  32729. case "BooleanValue": {
  32730. return node.value ? "true" : "false";
  32731. }
  32732. case "NullValue": {
  32733. return "null";
  32734. }
  32735. case "Variable": {
  32736. return ["$", print("name")];
  32737. }
  32738. case "ListValue": {
  32739. return group(["[", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "values"))]), softline, "]"]);
  32740. }
  32741. case "ObjectValue": {
  32742. 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 ? " " : ""), "}"]);
  32743. }
  32744. case "ObjectField":
  32745. case "Argument": {
  32746. return [print("name"), ": ", print("value")];
  32747. }
  32748. case "Directive": {
  32749. return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : ""];
  32750. }
  32751. case "NamedType": {
  32752. return print("name");
  32753. }
  32754. case "VariableDefinition": {
  32755. return [print("variable"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  32756. }
  32757. case "ObjectTypeExtension":
  32758. case "ObjectTypeDefinition": {
  32759. 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, "}"] : ""];
  32760. }
  32761. case "FieldDefinition": {
  32762. 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)];
  32763. }
  32764. case "DirectiveDefinition": {
  32765. 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"))];
  32766. }
  32767. case "EnumTypeExtension":
  32768. case "EnumTypeDefinition": {
  32769. 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, "}"] : ""];
  32770. }
  32771. case "EnumValueDefinition": {
  32772. return [print("description"), node.description ? hardline : "", print("name"), printDirectives(path, print, node)];
  32773. }
  32774. case "InputValueDefinition": {
  32775. return [print("description"), node.description ? node.description.block ? hardline : line : "", print("name"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  32776. }
  32777. case "InputObjectTypeExtension":
  32778. case "InputObjectTypeDefinition": {
  32779. 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, "}"] : ""];
  32780. }
  32781. case "SchemaExtension": {
  32782. return ["extend schema", printDirectives(path, print, node), ...node.operationTypes.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]), hardline, "}"] : []];
  32783. }
  32784. case "SchemaDefinition": {
  32785. 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, "}"];
  32786. }
  32787. case "OperationTypeDefinition": {
  32788. return [print("operation"), ": ", print("type")];
  32789. }
  32790. case "InterfaceTypeExtension":
  32791. case "InterfaceTypeDefinition": {
  32792. 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, "}"] : ""];
  32793. }
  32794. case "FragmentSpread": {
  32795. return ["...", print("name"), printDirectives(path, print, node)];
  32796. }
  32797. case "InlineFragment": {
  32798. return ["...", node.typeCondition ? [" on ", print("typeCondition")] : "", printDirectives(path, print, node), " ", print("selectionSet")];
  32799. }
  32800. case "UnionTypeExtension":
  32801. case "UnionTypeDefinition": {
  32802. 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"))])] : ""])]);
  32803. }
  32804. case "ScalarTypeExtension":
  32805. case "ScalarTypeDefinition": {
  32806. return [print("description"), node.description ? hardline : "", node.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", print("name"), printDirectives(path, print, node)];
  32807. }
  32808. case "NonNullType": {
  32809. return [print("type"), "!"];
  32810. }
  32811. case "ListType": {
  32812. return ["[", print("type"), "]"];
  32813. }
  32814. default:
  32815. throw new Error("unknown graphql type: " + JSON.stringify(node.kind));
  32816. }
  32817. }
  32818. function printDirectives(path, print, node) {
  32819. if (node.directives.length === 0) {
  32820. return "";
  32821. }
  32822. const printed = join(line, path.map(print, "directives"));
  32823. if (node.kind === "FragmentDefinition" || node.kind === "OperationDefinition") {
  32824. return group([line, printed]);
  32825. }
  32826. return [" ", group(indent([softline, printed]))];
  32827. }
  32828. function printSequence(path, options, print, property) {
  32829. return path.map((path2, index, sequence) => {
  32830. const printed = print();
  32831. if (index < sequence.length - 1 && isNextLineEmpty(options.originalText, path2.getValue(), locEnd)) {
  32832. return [printed, hardline];
  32833. }
  32834. return printed;
  32835. }, property);
  32836. }
  32837. function canAttachComment(node) {
  32838. return node.kind && node.kind !== "Comment";
  32839. }
  32840. function printComment(commentPath) {
  32841. const comment = commentPath.getValue();
  32842. if (comment.kind === "Comment") {
  32843. return "#" + comment.value.trimEnd();
  32844. }
  32845. throw new Error("Not a comment: " + JSON.stringify(comment));
  32846. }
  32847. function printInterfaces(path, options, print) {
  32848. const node = path.getNode();
  32849. const parts = [];
  32850. const {
  32851. interfaces
  32852. } = node;
  32853. const printed = path.map((node2) => print(node2), "interfaces");
  32854. for (let index = 0; index < interfaces.length; index++) {
  32855. const interfaceNode = interfaces[index];
  32856. parts.push(printed[index]);
  32857. const nextInterfaceNode = interfaces[index + 1];
  32858. if (nextInterfaceNode) {
  32859. const textBetween = options.originalText.slice(interfaceNode.loc.end, nextInterfaceNode.loc.start);
  32860. const hasComment = textBetween.includes("#");
  32861. const separator = textBetween.replace(/#.*/g, "").trim();
  32862. parts.push(separator === "," ? "," : " &", hasComment ? line : " ");
  32863. }
  32864. }
  32865. return parts;
  32866. }
  32867. function clean(node, newNode) {
  32868. if (node.kind === "StringValue" && node.block && !node.value.includes("\n")) {
  32869. newNode.value = newNode.value.trim();
  32870. }
  32871. }
  32872. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
  32873. function hasPrettierIgnore(path) {
  32874. var _node$comments;
  32875. const node = path.getValue();
  32876. 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");
  32877. }
  32878. module2.exports = {
  32879. print: genericPrint,
  32880. massageAstNode: clean,
  32881. hasPrettierIgnore,
  32882. insertPragma,
  32883. printComment,
  32884. canAttachComment
  32885. };
  32886. }
  32887. });
  32888. var require_options4 = __commonJS2({
  32889. "src/language-graphql/options.js"(exports2, module2) {
  32890. "use strict";
  32891. var commonOptions = require_common_options();
  32892. module2.exports = {
  32893. bracketSpacing: commonOptions.bracketSpacing
  32894. };
  32895. }
  32896. });
  32897. var require_parsers4 = __commonJS2({
  32898. "src/language-graphql/parsers.js"(exports2, module2) {
  32899. "use strict";
  32900. module2.exports = {
  32901. get graphql() {
  32902. return require("./parser-graphql.js").parsers.graphql;
  32903. }
  32904. };
  32905. }
  32906. });
  32907. var require_GraphQL = __commonJS2({
  32908. "node_modules/linguist-languages/data/GraphQL.json"(exports2, module2) {
  32909. module2.exports = {
  32910. name: "GraphQL",
  32911. type: "data",
  32912. color: "#e10098",
  32913. extensions: [".graphql", ".gql", ".graphqls"],
  32914. tmScope: "source.graphql",
  32915. aceMode: "text",
  32916. languageId: 139
  32917. };
  32918. }
  32919. });
  32920. var require_language_graphql = __commonJS2({
  32921. "src/language-graphql/index.js"(exports2, module2) {
  32922. "use strict";
  32923. var createLanguage = require_create_language();
  32924. var printer = require_printer_graphql();
  32925. var options = require_options4();
  32926. var parsers = require_parsers4();
  32927. var languages = [createLanguage(require_GraphQL(), () => ({
  32928. since: "1.5.0",
  32929. parsers: ["graphql"],
  32930. vscodeLanguageIds: ["graphql"]
  32931. }))];
  32932. var printers = {
  32933. graphql: printer
  32934. };
  32935. module2.exports = {
  32936. languages,
  32937. options,
  32938. printers,
  32939. parsers
  32940. };
  32941. }
  32942. });
  32943. var require_collapse_white_space = __commonJS2({
  32944. "node_modules/collapse-white-space/index.js"(exports2, module2) {
  32945. "use strict";
  32946. module2.exports = collapse;
  32947. function collapse(value) {
  32948. return String(value).replace(/\s+/g, " ");
  32949. }
  32950. }
  32951. });
  32952. var require_loc5 = __commonJS2({
  32953. "src/language-markdown/loc.js"(exports2, module2) {
  32954. "use strict";
  32955. function locStart(node) {
  32956. return node.position.start.offset;
  32957. }
  32958. function locEnd(node) {
  32959. return node.position.end.offset;
  32960. }
  32961. module2.exports = {
  32962. locStart,
  32963. locEnd
  32964. };
  32965. }
  32966. });
  32967. var require_constants_evaluate = __commonJS2({
  32968. "src/language-markdown/constants.evaluate.js"(exports2, module2) {
  32969. module2.exports = {
  32970. 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])?",
  32971. 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]",
  32972. 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]"
  32973. };
  32974. }
  32975. });
  32976. var require_utils10 = __commonJS2({
  32977. "src/language-markdown/utils.js"(exports2, module2) {
  32978. "use strict";
  32979. var {
  32980. getLast
  32981. } = require_util();
  32982. var {
  32983. locStart,
  32984. locEnd
  32985. } = require_loc5();
  32986. var {
  32987. cjkPattern,
  32988. kPattern,
  32989. punctuationPattern
  32990. } = require_constants_evaluate();
  32991. var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
  32992. var INLINE_NODE_WRAPPER_TYPES = [...INLINE_NODE_TYPES, "tableCell", "paragraph", "heading"];
  32993. var kRegex = new RegExp(kPattern);
  32994. var punctuationRegex = new RegExp(punctuationPattern);
  32995. function splitText(text, options) {
  32996. const KIND_NON_CJK = "non-cjk";
  32997. const KIND_CJ_LETTER = "cj-letter";
  32998. const KIND_K_LETTER = "k-letter";
  32999. const KIND_CJK_PUNCTUATION = "cjk-punctuation";
  33000. const nodes = [];
  33001. const tokens = (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})
  33002. (${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
  33003. for (const [index, token] of tokens.entries()) {
  33004. if (index % 2 === 1) {
  33005. nodes.push({
  33006. type: "whitespace",
  33007. value: /\n/.test(token) ? "\n" : " "
  33008. });
  33009. continue;
  33010. }
  33011. if ((index === 0 || index === tokens.length - 1) && token === "") {
  33012. continue;
  33013. }
  33014. const innerTokens = token.split(new RegExp(`(${cjkPattern})`));
  33015. for (const [innerIndex, innerToken] of innerTokens.entries()) {
  33016. if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
  33017. continue;
  33018. }
  33019. if (innerIndex % 2 === 0) {
  33020. if (innerToken !== "") {
  33021. appendNode({
  33022. type: "word",
  33023. value: innerToken,
  33024. kind: KIND_NON_CJK,
  33025. hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
  33026. hasTrailingPunctuation: punctuationRegex.test(getLast(innerToken))
  33027. });
  33028. }
  33029. continue;
  33030. }
  33031. appendNode(punctuationRegex.test(innerToken) ? {
  33032. type: "word",
  33033. value: innerToken,
  33034. kind: KIND_CJK_PUNCTUATION,
  33035. hasLeadingPunctuation: true,
  33036. hasTrailingPunctuation: true
  33037. } : {
  33038. type: "word",
  33039. value: innerToken,
  33040. kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
  33041. hasLeadingPunctuation: false,
  33042. hasTrailingPunctuation: false
  33043. });
  33044. }
  33045. }
  33046. return nodes;
  33047. function appendNode(node) {
  33048. const lastNode = getLast(nodes);
  33049. if (lastNode && lastNode.type === "word") {
  33050. 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) {
  33051. nodes.push({
  33052. type: "whitespace",
  33053. value: " "
  33054. });
  33055. } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && ![lastNode.value, node.value].some((value) => /\u3000/.test(value))) {
  33056. nodes.push({
  33057. type: "whitespace",
  33058. value: ""
  33059. });
  33060. }
  33061. }
  33062. nodes.push(node);
  33063. function isBetween(kind1, kind2) {
  33064. return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
  33065. }
  33066. }
  33067. }
  33068. function getOrderedListItemInfo(orderListItem, originalText) {
  33069. const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
  33070. return {
  33071. numberText,
  33072. marker,
  33073. leadingSpaces
  33074. };
  33075. }
  33076. function hasGitDiffFriendlyOrderedList(node, options) {
  33077. if (!node.ordered) {
  33078. return false;
  33079. }
  33080. if (node.children.length < 2) {
  33081. return false;
  33082. }
  33083. const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
  33084. const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
  33085. if (firstNumber === 0 && node.children.length > 2) {
  33086. const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
  33087. return secondNumber === 1 && thirdNumber === 1;
  33088. }
  33089. return secondNumber === 1;
  33090. }
  33091. function getFencedCodeBlockValue(node, originalText) {
  33092. const {
  33093. value
  33094. } = node;
  33095. if (node.position.end.offset === originalText.length && value.endsWith("\n") && originalText.endsWith("\n")) {
  33096. return value.slice(0, -1);
  33097. }
  33098. return value;
  33099. }
  33100. function mapAst(ast, handler) {
  33101. return function preorder(node, index, parentStack) {
  33102. const newNode = Object.assign({}, handler(node, index, parentStack));
  33103. if (newNode.children) {
  33104. newNode.children = newNode.children.map((child, index2) => preorder(child, index2, [newNode, ...parentStack]));
  33105. }
  33106. return newNode;
  33107. }(ast, null, []);
  33108. }
  33109. function isAutolink(node) {
  33110. if ((node === null || node === void 0 ? void 0 : node.type) !== "link" || node.children.length !== 1) {
  33111. return false;
  33112. }
  33113. const [child] = node.children;
  33114. return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
  33115. }
  33116. module2.exports = {
  33117. mapAst,
  33118. splitText,
  33119. punctuationPattern,
  33120. getFencedCodeBlockValue,
  33121. getOrderedListItemInfo,
  33122. hasGitDiffFriendlyOrderedList,
  33123. INLINE_NODE_TYPES,
  33124. INLINE_NODE_WRAPPER_TYPES,
  33125. isAutolink
  33126. };
  33127. }
  33128. });
  33129. var require_embed3 = __commonJS2({
  33130. "src/language-markdown/embed.js"(exports2, module2) {
  33131. "use strict";
  33132. var {
  33133. inferParserByLanguage,
  33134. getMaxContinuousCount
  33135. } = require_util();
  33136. var {
  33137. builders: {
  33138. hardline,
  33139. markAsRoot
  33140. },
  33141. utils: {
  33142. replaceEndOfLine
  33143. }
  33144. } = require("./doc.js");
  33145. var printFrontMatter = require_print();
  33146. var {
  33147. getFencedCodeBlockValue
  33148. } = require_utils10();
  33149. function embed(path, print, textToDoc, options) {
  33150. const node = path.getValue();
  33151. if (node.type === "code" && node.lang !== null) {
  33152. const parser = inferParserByLanguage(node.lang, options);
  33153. if (parser) {
  33154. const styleUnit = options.__inJsTemplate ? "~" : "`";
  33155. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  33156. const newOptions = {
  33157. parser
  33158. };
  33159. if (node.lang === "tsx") {
  33160. newOptions.filepath = "dummy.tsx";
  33161. }
  33162. const doc2 = textToDoc(getFencedCodeBlockValue(node, options.originalText), newOptions, {
  33163. stripTrailingHardline: true
  33164. });
  33165. return markAsRoot([style, node.lang, node.meta ? " " + node.meta : "", hardline, replaceEndOfLine(doc2), hardline, style]);
  33166. }
  33167. }
  33168. switch (node.type) {
  33169. case "front-matter":
  33170. return printFrontMatter(node, textToDoc);
  33171. case "importExport":
  33172. return [textToDoc(node.value, {
  33173. parser: "babel"
  33174. }, {
  33175. stripTrailingHardline: true
  33176. }), hardline];
  33177. case "jsx":
  33178. return textToDoc(`<$>${node.value}</$>`, {
  33179. parser: "__js_expression",
  33180. rootMarker: "mdx"
  33181. }, {
  33182. stripTrailingHardline: true
  33183. });
  33184. }
  33185. return null;
  33186. }
  33187. module2.exports = embed;
  33188. }
  33189. });
  33190. var require_pragma4 = __commonJS2({
  33191. "src/language-markdown/pragma.js"(exports2, module2) {
  33192. "use strict";
  33193. var parseFrontMatter = require_parse4();
  33194. var pragmas = ["format", "prettier"];
  33195. function startWithPragma(text) {
  33196. const pragma = `@(${pragmas.join("|")})`;
  33197. const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?
  33198. [\\s\\S]*(^|
  33199. )[^\\S
  33200. ]*${pragma}[^\\S
  33201. ]*($|
  33202. )[\\s\\S]*
  33203. .*-->`].join("|"), "m");
  33204. const matched = text.match(regex);
  33205. return (matched === null || matched === void 0 ? void 0 : matched.index) === 0;
  33206. }
  33207. module2.exports = {
  33208. startWithPragma,
  33209. hasPragma: (text) => startWithPragma(parseFrontMatter(text).content.trimStart()),
  33210. insertPragma: (text) => {
  33211. const extracted = parseFrontMatter(text);
  33212. const pragma = `<!-- @${pragmas[0]} -->`;
  33213. return extracted.frontMatter ? `${extracted.frontMatter.raw}
  33214. ${pragma}
  33215. ${extracted.content}` : `${pragma}
  33216. ${extracted.content}`;
  33217. }
  33218. };
  33219. }
  33220. });
  33221. var require_print_preprocess2 = __commonJS2({
  33222. "src/language-markdown/print-preprocess.js"(exports2, module2) {
  33223. "use strict";
  33224. var getLast = require_get_last();
  33225. var {
  33226. getOrderedListItemInfo,
  33227. mapAst,
  33228. splitText
  33229. } = require_utils10();
  33230. var isSingleCharRegex = /^.$/su;
  33231. function preprocess(ast, options) {
  33232. ast = restoreUnescapedCharacter(ast, options);
  33233. ast = mergeContinuousTexts(ast);
  33234. ast = transformInlineCode(ast, options);
  33235. ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
  33236. ast = markAlignedList(ast, options);
  33237. ast = splitTextIntoSentences(ast, options);
  33238. ast = transformImportExport(ast);
  33239. ast = mergeContinuousImportExport(ast);
  33240. return ast;
  33241. }
  33242. function transformImportExport(ast) {
  33243. return mapAst(ast, (node) => {
  33244. if (node.type !== "import" && node.type !== "export") {
  33245. return node;
  33246. }
  33247. return Object.assign(Object.assign({}, node), {}, {
  33248. type: "importExport"
  33249. });
  33250. });
  33251. }
  33252. function transformInlineCode(ast, options) {
  33253. return mapAst(ast, (node) => {
  33254. if (node.type !== "inlineCode" || options.proseWrap === "preserve") {
  33255. return node;
  33256. }
  33257. return Object.assign(Object.assign({}, node), {}, {
  33258. value: node.value.replace(/\s+/g, " ")
  33259. });
  33260. });
  33261. }
  33262. function restoreUnescapedCharacter(ast, options) {
  33263. 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), {}, {
  33264. value: options.originalText.slice(node.position.start.offset, node.position.end.offset)
  33265. }));
  33266. }
  33267. function mergeContinuousImportExport(ast) {
  33268. return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
  33269. type: "importExport",
  33270. value: prevNode.value + "\n\n" + node.value,
  33271. position: {
  33272. start: prevNode.position.start,
  33273. end: node.position.end
  33274. }
  33275. }));
  33276. }
  33277. function mergeChildren(ast, shouldMerge, mergeNode) {
  33278. return mapAst(ast, (node) => {
  33279. if (!node.children) {
  33280. return node;
  33281. }
  33282. const children = node.children.reduce((current, child) => {
  33283. const lastChild = getLast(current);
  33284. if (lastChild && shouldMerge(lastChild, child)) {
  33285. current.splice(-1, 1, mergeNode(lastChild, child));
  33286. } else {
  33287. current.push(child);
  33288. }
  33289. return current;
  33290. }, []);
  33291. return Object.assign(Object.assign({}, node), {}, {
  33292. children
  33293. });
  33294. });
  33295. }
  33296. function mergeContinuousTexts(ast) {
  33297. return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
  33298. type: "text",
  33299. value: prevNode.value + node.value,
  33300. position: {
  33301. start: prevNode.position.start,
  33302. end: node.position.end
  33303. }
  33304. }));
  33305. }
  33306. function splitTextIntoSentences(ast, options) {
  33307. return mapAst(ast, (node, index, [parentNode]) => {
  33308. if (node.type !== "text") {
  33309. return node;
  33310. }
  33311. let {
  33312. value
  33313. } = node;
  33314. if (parentNode.type === "paragraph") {
  33315. if (index === 0) {
  33316. value = value.trimStart();
  33317. }
  33318. if (index === parentNode.children.length - 1) {
  33319. value = value.trimEnd();
  33320. }
  33321. }
  33322. return {
  33323. type: "sentence",
  33324. position: node.position,
  33325. children: splitText(value, options)
  33326. };
  33327. });
  33328. }
  33329. function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
  33330. return mapAst(ast, (node, index, parentStack) => {
  33331. if (node.type === "code") {
  33332. const isIndented = /^\n?(?: {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
  33333. node.isIndented = isIndented;
  33334. if (isIndented) {
  33335. for (let i = 0; i < parentStack.length; i++) {
  33336. const parent = parentStack[i];
  33337. if (parent.hasIndentedCodeblock) {
  33338. break;
  33339. }
  33340. if (parent.type === "list") {
  33341. parent.hasIndentedCodeblock = true;
  33342. }
  33343. }
  33344. }
  33345. }
  33346. return node;
  33347. });
  33348. }
  33349. function markAlignedList(ast, options) {
  33350. return mapAst(ast, (node, index, parentStack) => {
  33351. if (node.type === "list" && node.children.length > 0) {
  33352. for (let i = 0; i < parentStack.length; i++) {
  33353. const parent = parentStack[i];
  33354. if (parent.type === "list" && !parent.isAligned) {
  33355. node.isAligned = false;
  33356. return node;
  33357. }
  33358. }
  33359. node.isAligned = isAligned(node);
  33360. }
  33361. return node;
  33362. });
  33363. function getListItemStart(listItem) {
  33364. return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
  33365. }
  33366. function isAligned(list) {
  33367. if (!list.ordered) {
  33368. return true;
  33369. }
  33370. const [firstItem, secondItem] = list.children;
  33371. const firstInfo = getOrderedListItemInfo(firstItem, options.originalText);
  33372. if (firstInfo.leadingSpaces.length > 1) {
  33373. return true;
  33374. }
  33375. const firstStart = getListItemStart(firstItem);
  33376. if (firstStart === -1) {
  33377. return false;
  33378. }
  33379. if (list.children.length === 1) {
  33380. return firstStart % options.tabWidth === 0;
  33381. }
  33382. const secondStart = getListItemStart(secondItem);
  33383. if (firstStart !== secondStart) {
  33384. return false;
  33385. }
  33386. if (firstStart % options.tabWidth === 0) {
  33387. return true;
  33388. }
  33389. const secondInfo = getOrderedListItemInfo(secondItem, options.originalText);
  33390. return secondInfo.leadingSpaces.length > 1;
  33391. }
  33392. }
  33393. module2.exports = preprocess;
  33394. }
  33395. });
  33396. var require_clean4 = __commonJS2({
  33397. "src/language-markdown/clean.js"(exports2, module2) {
  33398. "use strict";
  33399. var collapseWhiteSpace = require_collapse_white_space();
  33400. var {
  33401. isFrontMatterNode
  33402. } = require_util();
  33403. var {
  33404. startWithPragma
  33405. } = require_pragma4();
  33406. var ignoredProperties = /* @__PURE__ */ new Set(["position", "raw"]);
  33407. function clean(ast, newObj, parent) {
  33408. if (ast.type === "front-matter" || ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
  33409. delete newObj.value;
  33410. }
  33411. if (ast.type === "list") {
  33412. delete newObj.isAligned;
  33413. }
  33414. if (ast.type === "list" || ast.type === "listItem") {
  33415. delete newObj.spread;
  33416. delete newObj.loose;
  33417. }
  33418. if (ast.type === "text") {
  33419. return null;
  33420. }
  33421. if (ast.type === "inlineCode") {
  33422. newObj.value = ast.value.replace(/[\t\n ]+/g, " ");
  33423. }
  33424. if (ast.type === "wikiLink") {
  33425. newObj.value = ast.value.trim().replace(/[\t\n]+/g, " ");
  33426. }
  33427. if (ast.type === "definition" || ast.type === "linkReference" || ast.type === "imageReference") {
  33428. newObj.label = collapseWhiteSpace(ast.label);
  33429. }
  33430. if ((ast.type === "definition" || ast.type === "link" || ast.type === "image") && ast.title) {
  33431. newObj.title = ast.title.replace(/\\(["')])/g, "$1");
  33432. }
  33433. 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)) {
  33434. return null;
  33435. }
  33436. }
  33437. clean.ignoredProperties = ignoredProperties;
  33438. module2.exports = clean;
  33439. }
  33440. });
  33441. var require_printer_markdown = __commonJS2({
  33442. "src/language-markdown/printer-markdown.js"(exports2, module2) {
  33443. "use strict";
  33444. var collapseWhiteSpace = require_collapse_white_space();
  33445. var {
  33446. getLast,
  33447. getMinNotPresentContinuousCount,
  33448. getMaxContinuousCount,
  33449. getStringWidth,
  33450. isNonEmptyArray
  33451. } = require_util();
  33452. var {
  33453. builders: {
  33454. breakParent,
  33455. join,
  33456. line,
  33457. literalline,
  33458. markAsRoot,
  33459. hardline,
  33460. softline,
  33461. ifBreak,
  33462. fill,
  33463. align,
  33464. indent,
  33465. group,
  33466. hardlineWithoutBreakParent
  33467. },
  33468. utils: {
  33469. normalizeDoc,
  33470. replaceTextEndOfLine
  33471. },
  33472. printer: {
  33473. printDocToString
  33474. }
  33475. } = require("./doc.js");
  33476. var embed = require_embed3();
  33477. var {
  33478. insertPragma
  33479. } = require_pragma4();
  33480. var {
  33481. locStart,
  33482. locEnd
  33483. } = require_loc5();
  33484. var preprocess = require_print_preprocess2();
  33485. var clean = require_clean4();
  33486. var {
  33487. getFencedCodeBlockValue,
  33488. hasGitDiffFriendlyOrderedList,
  33489. splitText,
  33490. punctuationPattern,
  33491. INLINE_NODE_TYPES,
  33492. INLINE_NODE_WRAPPER_TYPES,
  33493. isAutolink
  33494. } = require_utils10();
  33495. var TRAILING_HARDLINE_NODES = /* @__PURE__ */ new Set(["importExport"]);
  33496. var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link", "wikiLink"];
  33497. var SIBLING_NODE_TYPES = /* @__PURE__ */ new Set(["listItem", "definition", "footnoteDefinition"]);
  33498. function genericPrint(path, options, print) {
  33499. const node = path.getValue();
  33500. if (shouldRemainTheSameContent(path)) {
  33501. 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));
  33502. }
  33503. switch (node.type) {
  33504. case "front-matter":
  33505. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  33506. case "root":
  33507. if (node.children.length === 0) {
  33508. return "";
  33509. }
  33510. return [normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode(node).type) ? hardline : ""];
  33511. case "paragraph":
  33512. return printChildren(path, options, print, {
  33513. postprocessor: fill
  33514. });
  33515. case "sentence":
  33516. return printChildren(path, options, print);
  33517. case "word": {
  33518. let escapedValue = node.value.replace(/\*/g, "\\$&").replace(new RegExp([`(^|${punctuationPattern})(_+)`, `(_+)(${punctuationPattern}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_"));
  33519. const isFirstSentence = (node2, name, index) => node2.type === "sentence" && index === 0;
  33520. const isLastChildAutolink = (node2, name, index) => isAutolink(node2.children[index - 1]);
  33521. if (escapedValue !== node.value && (path.match(void 0, isFirstSentence, isLastChildAutolink) || path.match(void 0, isFirstSentence, (node2, name, index) => node2.type === "emphasis" && index === 0, isLastChildAutolink))) {
  33522. escapedValue = escapedValue.replace(/^(\\?[*_])+/, (prefix) => prefix.replace(/\\/g, ""));
  33523. }
  33524. return escapedValue;
  33525. }
  33526. case "whitespace": {
  33527. const parentNode = path.getParentNode();
  33528. const index = parentNode.children.indexOf(node);
  33529. const nextNode = parentNode.children[index + 1];
  33530. const proseWrap = nextNode && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(nextNode.value) ? "never" : options.proseWrap;
  33531. return printLine(path, node.value, {
  33532. proseWrap
  33533. });
  33534. }
  33535. case "emphasis": {
  33536. let style;
  33537. if (isAutolink(node.children[0])) {
  33538. style = options.originalText[node.position.start.offset];
  33539. } else {
  33540. const parentNode = path.getParentNode();
  33541. const index = parentNode.children.indexOf(node);
  33542. const prevNode = parentNode.children[index - 1];
  33543. const nextNode = parentNode.children[index + 1];
  33544. 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;
  33545. style = hasPrevOrNextWord || getAncestorNode(path, "emphasis") ? "*" : "_";
  33546. }
  33547. return [style, printChildren(path, options, print), style];
  33548. }
  33549. case "strong":
  33550. return ["**", printChildren(path, options, print), "**"];
  33551. case "delete":
  33552. return ["~~", printChildren(path, options, print), "~~"];
  33553. case "inlineCode": {
  33554. const backtickCount = getMinNotPresentContinuousCount(node.value, "`");
  33555. const style = "`".repeat(backtickCount || 1);
  33556. const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
  33557. return [style, gap, node.value, gap, style];
  33558. }
  33559. case "wikiLink": {
  33560. let contents = "";
  33561. if (options.proseWrap === "preserve") {
  33562. contents = node.value;
  33563. } else {
  33564. contents = node.value.replace(/[\t\n]+/g, " ");
  33565. }
  33566. return ["[[", contents, "]]"];
  33567. }
  33568. case "link":
  33569. switch (options.originalText[node.position.start.offset]) {
  33570. case "<": {
  33571. const mailto = "mailto:";
  33572. 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;
  33573. return ["<", url, ">"];
  33574. }
  33575. case "[":
  33576. return ["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  33577. default:
  33578. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  33579. }
  33580. case "image":
  33581. return ["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  33582. case "blockquote":
  33583. return ["> ", align("> ", printChildren(path, options, print))];
  33584. case "heading":
  33585. return ["#".repeat(node.depth) + " ", printChildren(path, options, print)];
  33586. case "code": {
  33587. if (node.isIndented) {
  33588. const alignment = " ".repeat(4);
  33589. return align(alignment, [alignment, ...replaceTextEndOfLine(node.value, hardline)]);
  33590. }
  33591. const styleUnit = options.__inJsTemplate ? "~" : "`";
  33592. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  33593. return [style, node.lang || "", node.meta ? " " + node.meta : "", hardline, ...replaceTextEndOfLine(getFencedCodeBlockValue(node, options.originalText), hardline), hardline, style];
  33594. }
  33595. case "html": {
  33596. const parentNode = path.getParentNode();
  33597. const value = parentNode.type === "root" && getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
  33598. const isHtmlComment = /^<!--.*-->$/s.test(value);
  33599. return replaceTextEndOfLine(value, isHtmlComment ? hardline : markAsRoot(literalline));
  33600. }
  33601. case "list": {
  33602. const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
  33603. const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(node, options);
  33604. return printChildren(path, options, print, {
  33605. processor: (childPath, index) => {
  33606. const prefix = getPrefix();
  33607. const childNode = childPath.getValue();
  33608. if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
  33609. return [prefix, printListItem(childPath, options, print, prefix)];
  33610. }
  33611. return [prefix, align(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))];
  33612. function getPrefix() {
  33613. const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
  33614. return node.isAligned || node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
  33615. }
  33616. }
  33617. });
  33618. }
  33619. case "thematicBreak": {
  33620. const counter = getAncestorCounter(path, "list");
  33621. if (counter === -1) {
  33622. return "---";
  33623. }
  33624. const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
  33625. return nthSiblingIndex % 2 === 0 ? "***" : "---";
  33626. }
  33627. case "linkReference":
  33628. return ["[", printChildren(path, options, print), "]", node.referenceType === "full" ? printLinkReference(node) : node.referenceType === "collapsed" ? "[]" : ""];
  33629. case "imageReference":
  33630. switch (node.referenceType) {
  33631. case "full":
  33632. return ["![", node.alt || "", "]", printLinkReference(node)];
  33633. default:
  33634. return ["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""];
  33635. }
  33636. case "definition": {
  33637. const lineOrSpace = options.proseWrap === "always" ? line : " ";
  33638. return group([printLinkReference(node), ":", indent([lineOrSpace, printUrl(node.url), node.title === null ? "" : [lineOrSpace, printTitle(node.title, options, false)]])]);
  33639. }
  33640. case "footnote":
  33641. return ["[^", printChildren(path, options, print), "]"];
  33642. case "footnoteReference":
  33643. return printFootnoteReference(node);
  33644. case "footnoteDefinition": {
  33645. const nextNode = path.getParentNode().children[path.getName() + 1];
  33646. 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);
  33647. return [printFootnoteReference(node), ": ", shouldInlineFootnote ? printChildren(path, options, print) : group([align(" ".repeat(4), printChildren(path, options, print, {
  33648. processor: (childPath, index) => index === 0 ? group([softline, print()]) : print()
  33649. })), nextNode && nextNode.type === "footnoteDefinition" ? softline : ""])];
  33650. }
  33651. case "table":
  33652. return printTable(path, options, print);
  33653. case "tableCell":
  33654. return printChildren(path, options, print);
  33655. case "break":
  33656. return /\s/.test(options.originalText[node.position.start.offset]) ? [" ", markAsRoot(literalline)] : ["\\", hardline];
  33657. case "liquidNode":
  33658. return replaceTextEndOfLine(node.value, hardline);
  33659. case "importExport":
  33660. return [node.value, hardline];
  33661. case "esComment":
  33662. return ["{/* ", node.value, " */}"];
  33663. case "jsx":
  33664. return node.value;
  33665. case "math":
  33666. return ["$$", hardline, node.value ? [...replaceTextEndOfLine(node.value, hardline), hardline] : "", "$$"];
  33667. case "inlineMath": {
  33668. return options.originalText.slice(locStart(node), locEnd(node));
  33669. }
  33670. case "tableRow":
  33671. case "listItem":
  33672. default:
  33673. throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`);
  33674. }
  33675. }
  33676. function printListItem(path, options, print, listPrefix) {
  33677. const node = path.getValue();
  33678. const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
  33679. return [prefix, printChildren(path, options, print, {
  33680. processor: (childPath, index) => {
  33681. if (index === 0 && childPath.getValue().type !== "list") {
  33682. return align(" ".repeat(prefix.length), print());
  33683. }
  33684. const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3));
  33685. return [alignment, align(alignment, print())];
  33686. }
  33687. })];
  33688. }
  33689. function alignListPrefix(prefix, options) {
  33690. const additionalSpaces = getAdditionalSpaces();
  33691. return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces);
  33692. function getAdditionalSpaces() {
  33693. const restSpaces = prefix.length % options.tabWidth;
  33694. return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
  33695. }
  33696. }
  33697. function getNthListSiblingIndex(node, parentNode) {
  33698. return getNthSiblingIndex(node, parentNode, (siblingNode) => siblingNode.ordered === node.ordered);
  33699. }
  33700. function getNthSiblingIndex(node, parentNode, condition) {
  33701. let index = -1;
  33702. for (const childNode of parentNode.children) {
  33703. if (childNode.type === node.type && condition(childNode)) {
  33704. index++;
  33705. } else {
  33706. index = -1;
  33707. }
  33708. if (childNode === node) {
  33709. return index;
  33710. }
  33711. }
  33712. }
  33713. function getAncestorCounter(path, typeOrTypes) {
  33714. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  33715. let counter = -1;
  33716. let ancestorNode;
  33717. while (ancestorNode = path.getParentNode(++counter)) {
  33718. if (types.includes(ancestorNode.type)) {
  33719. return counter;
  33720. }
  33721. }
  33722. return -1;
  33723. }
  33724. function getAncestorNode(path, typeOrTypes) {
  33725. const counter = getAncestorCounter(path, typeOrTypes);
  33726. return counter === -1 ? null : path.getParentNode(counter);
  33727. }
  33728. function printLine(path, value, options) {
  33729. if (options.proseWrap === "preserve" && value === "\n") {
  33730. return hardline;
  33731. }
  33732. const isBreakable = options.proseWrap === "always" && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
  33733. return value !== "" ? isBreakable ? line : " " : isBreakable ? softline : "";
  33734. }
  33735. function printTable(path, options, print) {
  33736. const node = path.getValue();
  33737. const columnMaxWidths = [];
  33738. const contents = path.map((rowPath) => rowPath.map((cellPath, columnIndex) => {
  33739. const text = printDocToString(print(), options).formatted;
  33740. const width = getStringWidth(text);
  33741. columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, width);
  33742. return {
  33743. text,
  33744. width
  33745. };
  33746. }, "children"), "children");
  33747. const alignedTable = printTableContents(false);
  33748. if (options.proseWrap !== "never") {
  33749. return [breakParent, alignedTable];
  33750. }
  33751. const compactTable = printTableContents(true);
  33752. return [breakParent, group(ifBreak(compactTable, alignedTable))];
  33753. function printTableContents(isCompact) {
  33754. const parts = [printRow(contents[0], isCompact), printAlign(isCompact)];
  33755. if (contents.length > 1) {
  33756. parts.push(join(hardlineWithoutBreakParent, contents.slice(1).map((rowContents) => printRow(rowContents, isCompact))));
  33757. }
  33758. return join(hardlineWithoutBreakParent, parts);
  33759. }
  33760. function printAlign(isCompact) {
  33761. const align2 = columnMaxWidths.map((width, index) => {
  33762. const align3 = node.align[index];
  33763. const first = align3 === "center" || align3 === "left" ? ":" : "-";
  33764. const last = align3 === "center" || align3 === "right" ? ":" : "-";
  33765. const middle = isCompact ? "-" : "-".repeat(width - 2);
  33766. return `${first}${middle}${last}`;
  33767. });
  33768. return `| ${align2.join(" | ")} |`;
  33769. }
  33770. function printRow(rowContents, isCompact) {
  33771. const columns = rowContents.map(({
  33772. text,
  33773. width
  33774. }, columnIndex) => {
  33775. if (isCompact) {
  33776. return text;
  33777. }
  33778. const spaces = columnMaxWidths[columnIndex] - width;
  33779. const align2 = node.align[columnIndex];
  33780. let before = 0;
  33781. if (align2 === "right") {
  33782. before = spaces;
  33783. } else if (align2 === "center") {
  33784. before = Math.floor(spaces / 2);
  33785. }
  33786. const after = spaces - before;
  33787. return `${" ".repeat(before)}${text}${" ".repeat(after)}`;
  33788. });
  33789. return `| ${columns.join(" | ")} |`;
  33790. }
  33791. }
  33792. function printRoot(path, options, print) {
  33793. const ignoreRanges = [];
  33794. let ignoreStart = null;
  33795. const {
  33796. children
  33797. } = path.getValue();
  33798. for (const [index, childNode] of children.entries()) {
  33799. switch (isPrettierIgnore(childNode)) {
  33800. case "start":
  33801. if (ignoreStart === null) {
  33802. ignoreStart = {
  33803. index,
  33804. offset: childNode.position.end.offset
  33805. };
  33806. }
  33807. break;
  33808. case "end":
  33809. if (ignoreStart !== null) {
  33810. ignoreRanges.push({
  33811. start: ignoreStart,
  33812. end: {
  33813. index,
  33814. offset: childNode.position.start.offset
  33815. }
  33816. });
  33817. ignoreStart = null;
  33818. }
  33819. break;
  33820. default:
  33821. break;
  33822. }
  33823. }
  33824. return printChildren(path, options, print, {
  33825. processor: (childPath, index) => {
  33826. if (ignoreRanges.length > 0) {
  33827. const ignoreRange = ignoreRanges[0];
  33828. if (index === ignoreRange.start.index) {
  33829. return [printIgnoreComment(children[ignoreRange.start.index]), options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), printIgnoreComment(children[ignoreRange.end.index])];
  33830. }
  33831. if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
  33832. return false;
  33833. }
  33834. if (index === ignoreRange.end.index) {
  33835. ignoreRanges.shift();
  33836. return false;
  33837. }
  33838. }
  33839. return print();
  33840. }
  33841. });
  33842. }
  33843. function printChildren(path, options, print, events = {}) {
  33844. const {
  33845. postprocessor
  33846. } = events;
  33847. const processor = events.processor || (() => print());
  33848. const node = path.getValue();
  33849. const parts = [];
  33850. let lastChildNode;
  33851. path.each((childPath, index) => {
  33852. const childNode = childPath.getValue();
  33853. const result = processor(childPath, index);
  33854. if (result !== false) {
  33855. const data = {
  33856. parts,
  33857. prevNode: lastChildNode,
  33858. parentNode: node,
  33859. options
  33860. };
  33861. if (shouldPrePrintHardline(childNode, data)) {
  33862. parts.push(hardline);
  33863. if (lastChildNode && TRAILING_HARDLINE_NODES.has(lastChildNode.type)) {
  33864. if (shouldPrePrintTripleHardline(childNode, data)) {
  33865. parts.push(hardline);
  33866. }
  33867. } else {
  33868. if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
  33869. parts.push(hardline);
  33870. }
  33871. if (shouldPrePrintTripleHardline(childNode, data)) {
  33872. parts.push(hardline);
  33873. }
  33874. }
  33875. }
  33876. parts.push(result);
  33877. lastChildNode = childNode;
  33878. }
  33879. }, "children");
  33880. return postprocessor ? postprocessor(parts) : parts;
  33881. }
  33882. function printIgnoreComment(node) {
  33883. if (node.type === "html") {
  33884. return node.value;
  33885. }
  33886. if (node.type === "paragraph" && Array.isArray(node.children) && node.children.length === 1 && node.children[0].type === "esComment") {
  33887. return ["{/* ", node.children[0].value, " */}"];
  33888. }
  33889. }
  33890. function getLastDescendantNode(node) {
  33891. let current = node;
  33892. while (isNonEmptyArray(current.children)) {
  33893. current = getLast(current.children);
  33894. }
  33895. return current;
  33896. }
  33897. function isPrettierIgnore(node) {
  33898. let match;
  33899. if (node.type === "html") {
  33900. match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
  33901. } else {
  33902. let comment;
  33903. if (node.type === "esComment") {
  33904. comment = node;
  33905. } else if (node.type === "paragraph" && node.children.length === 1 && node.children[0].type === "esComment") {
  33906. comment = node.children[0];
  33907. }
  33908. if (comment) {
  33909. match = comment.value.match(/^prettier-ignore(?:-(start|end))?$/);
  33910. }
  33911. }
  33912. return match ? match[1] || "next" : false;
  33913. }
  33914. function shouldPrePrintHardline(node, data) {
  33915. const isFirstNode = data.parts.length === 0;
  33916. const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
  33917. const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
  33918. return !isFirstNode && !isInlineNode && !isInlineHTML;
  33919. }
  33920. function shouldPrePrintDoubleHardline(node, data) {
  33921. var _data$prevNode, _data$prevNode2, _data$prevNode3;
  33922. const isSequence = (data.prevNode && data.prevNode.type) === node.type;
  33923. const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
  33924. const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
  33925. const isPrevNodeLooseListItem = ((_data$prevNode = data.prevNode) === null || _data$prevNode === void 0 ? void 0 : _data$prevNode.type) === "listItem" && data.prevNode.loose;
  33926. const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
  33927. 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;
  33928. 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;
  33929. return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
  33930. }
  33931. function shouldPrePrintTripleHardline(node, data) {
  33932. const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
  33933. const isIndentedCode = node.type === "code" && node.isIndented;
  33934. return isPrevNodeList && isIndentedCode;
  33935. }
  33936. function shouldRemainTheSameContent(path) {
  33937. const ancestorNode = getAncestorNode(path, ["linkReference", "imageReference"]);
  33938. return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
  33939. }
  33940. function printUrl(url, dangerousCharOrChars = []) {
  33941. const dangerousChars = [" ", ...Array.isArray(dangerousCharOrChars) ? dangerousCharOrChars : [dangerousCharOrChars]];
  33942. return new RegExp(dangerousChars.map((x) => `\\${x}`).join("|")).test(url) ? `<${url}>` : url;
  33943. }
  33944. function printTitle(title, options, printSpace = true) {
  33945. if (!title) {
  33946. return "";
  33947. }
  33948. if (printSpace) {
  33949. return " " + printTitle(title, options, false);
  33950. }
  33951. title = title.replace(/\\(["')])/g, "$1");
  33952. if (title.includes('"') && title.includes("'") && !title.includes(")")) {
  33953. return `(${title})`;
  33954. }
  33955. const singleCount = title.split("'").length - 1;
  33956. const doubleCount = title.split('"').length - 1;
  33957. const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
  33958. title = title.replace(/\\/, "\\\\");
  33959. title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
  33960. return `${quote}${title}${quote}`;
  33961. }
  33962. function clamp(value, min, max) {
  33963. return value < min ? min : value > max ? max : value;
  33964. }
  33965. function hasPrettierIgnore(path) {
  33966. const index = Number(path.getName());
  33967. if (index === 0) {
  33968. return false;
  33969. }
  33970. const prevNode = path.getParentNode().children[index - 1];
  33971. return isPrettierIgnore(prevNode) === "next";
  33972. }
  33973. function printLinkReference(node) {
  33974. return `[${collapseWhiteSpace(node.label)}]`;
  33975. }
  33976. function printFootnoteReference(node) {
  33977. return `[^${node.label}]`;
  33978. }
  33979. module2.exports = {
  33980. preprocess,
  33981. print: genericPrint,
  33982. embed,
  33983. massageAstNode: clean,
  33984. hasPrettierIgnore,
  33985. insertPragma
  33986. };
  33987. }
  33988. });
  33989. var require_options5 = __commonJS2({
  33990. "src/language-markdown/options.js"(exports2, module2) {
  33991. "use strict";
  33992. var commonOptions = require_common_options();
  33993. module2.exports = {
  33994. proseWrap: commonOptions.proseWrap,
  33995. singleQuote: commonOptions.singleQuote
  33996. };
  33997. }
  33998. });
  33999. var require_parsers5 = __commonJS2({
  34000. "src/language-markdown/parsers.js"(exports2, module2) {
  34001. "use strict";
  34002. module2.exports = {
  34003. get remark() {
  34004. return require("./parser-markdown.js").parsers.remark;
  34005. },
  34006. get markdown() {
  34007. return require("./parser-markdown.js").parsers.remark;
  34008. },
  34009. get mdx() {
  34010. return require("./parser-markdown.js").parsers.mdx;
  34011. }
  34012. };
  34013. }
  34014. });
  34015. var require_Markdown = __commonJS2({
  34016. "node_modules/linguist-languages/data/Markdown.json"(exports2, module2) {
  34017. module2.exports = {
  34018. name: "Markdown",
  34019. type: "prose",
  34020. color: "#083fa1",
  34021. aliases: ["pandoc"],
  34022. aceMode: "markdown",
  34023. codemirrorMode: "gfm",
  34024. codemirrorMimeType: "text/x-gfm",
  34025. wrap: true,
  34026. extensions: [".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"],
  34027. filenames: ["contents.lr"],
  34028. tmScope: "source.gfm",
  34029. languageId: 222
  34030. };
  34031. }
  34032. });
  34033. var require_language_markdown = __commonJS2({
  34034. "src/language-markdown/index.js"(exports2, module2) {
  34035. "use strict";
  34036. var createLanguage = require_create_language();
  34037. var printer = require_printer_markdown();
  34038. var options = require_options5();
  34039. var parsers = require_parsers5();
  34040. var languages = [createLanguage(require_Markdown(), (data) => ({
  34041. since: "1.8.0",
  34042. parsers: ["markdown"],
  34043. vscodeLanguageIds: ["markdown"],
  34044. filenames: [...data.filenames, "README"],
  34045. extensions: data.extensions.filter((extension) => extension !== ".mdx")
  34046. })), createLanguage(require_Markdown(), () => ({
  34047. name: "MDX",
  34048. since: "1.15.0",
  34049. parsers: ["mdx"],
  34050. vscodeLanguageIds: ["mdx"],
  34051. filenames: [],
  34052. extensions: [".mdx"]
  34053. }))];
  34054. var printers = {
  34055. mdast: printer
  34056. };
  34057. module2.exports = {
  34058. languages,
  34059. options,
  34060. printers,
  34061. parsers
  34062. };
  34063. }
  34064. });
  34065. var require_clean5 = __commonJS2({
  34066. "src/language-html/clean.js"(exports2, module2) {
  34067. "use strict";
  34068. var {
  34069. isFrontMatterNode
  34070. } = require_util();
  34071. var ignoredProperties = /* @__PURE__ */ new Set(["sourceSpan", "startSourceSpan", "endSourceSpan", "nameSpan", "valueSpan"]);
  34072. function clean(ast, newNode) {
  34073. if (ast.type === "text" || ast.type === "comment") {
  34074. return null;
  34075. }
  34076. if (isFrontMatterNode(ast) || ast.type === "yaml" || ast.type === "toml") {
  34077. return null;
  34078. }
  34079. if (ast.type === "attribute") {
  34080. delete newNode.value;
  34081. }
  34082. if (ast.type === "docType") {
  34083. delete newNode.value;
  34084. }
  34085. }
  34086. clean.ignoredProperties = ignoredProperties;
  34087. module2.exports = clean;
  34088. }
  34089. });
  34090. var require_constants_evaluate2 = __commonJS2({
  34091. "src/language-html/constants.evaluate.js"(exports2, module2) {
  34092. module2.exports = {
  34093. CSS_DISPLAY_TAGS: {
  34094. area: "none",
  34095. base: "none",
  34096. basefont: "none",
  34097. datalist: "none",
  34098. head: "none",
  34099. link: "none",
  34100. meta: "none",
  34101. noembed: "none",
  34102. noframes: "none",
  34103. param: "block",
  34104. rp: "none",
  34105. script: "block",
  34106. source: "block",
  34107. style: "none",
  34108. template: "inline",
  34109. track: "block",
  34110. title: "none",
  34111. html: "block",
  34112. body: "block",
  34113. address: "block",
  34114. blockquote: "block",
  34115. center: "block",
  34116. div: "block",
  34117. figure: "block",
  34118. figcaption: "block",
  34119. footer: "block",
  34120. form: "block",
  34121. header: "block",
  34122. hr: "block",
  34123. legend: "block",
  34124. listing: "block",
  34125. main: "block",
  34126. p: "block",
  34127. plaintext: "block",
  34128. pre: "block",
  34129. xmp: "block",
  34130. slot: "contents",
  34131. ruby: "ruby",
  34132. rt: "ruby-text",
  34133. article: "block",
  34134. aside: "block",
  34135. h1: "block",
  34136. h2: "block",
  34137. h3: "block",
  34138. h4: "block",
  34139. h5: "block",
  34140. h6: "block",
  34141. hgroup: "block",
  34142. nav: "block",
  34143. section: "block",
  34144. dir: "block",
  34145. dd: "block",
  34146. dl: "block",
  34147. dt: "block",
  34148. ol: "block",
  34149. ul: "block",
  34150. li: "list-item",
  34151. table: "table",
  34152. caption: "table-caption",
  34153. colgroup: "table-column-group",
  34154. col: "table-column",
  34155. thead: "table-header-group",
  34156. tbody: "table-row-group",
  34157. tfoot: "table-footer-group",
  34158. tr: "table-row",
  34159. td: "table-cell",
  34160. th: "table-cell",
  34161. fieldset: "block",
  34162. button: "inline-block",
  34163. details: "block",
  34164. summary: "block",
  34165. dialog: "block",
  34166. meter: "inline-block",
  34167. progress: "inline-block",
  34168. object: "inline-block",
  34169. video: "inline-block",
  34170. audio: "inline-block",
  34171. select: "inline-block",
  34172. option: "block",
  34173. optgroup: "block"
  34174. },
  34175. CSS_DISPLAY_DEFAULT: "inline",
  34176. CSS_WHITE_SPACE_TAGS: {
  34177. listing: "pre",
  34178. plaintext: "pre",
  34179. pre: "pre",
  34180. xmp: "pre",
  34181. nobr: "nowrap",
  34182. table: "initial",
  34183. textarea: "pre-wrap"
  34184. },
  34185. CSS_WHITE_SPACE_DEFAULT: "normal"
  34186. };
  34187. }
  34188. });
  34189. var require_is_unknown_namespace = __commonJS2({
  34190. "src/language-html/utils/is-unknown-namespace.js"(exports2, module2) {
  34191. "use strict";
  34192. function isUnknownNamespace(node) {
  34193. return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
  34194. }
  34195. module2.exports = isUnknownNamespace;
  34196. }
  34197. });
  34198. var require_utils11 = __commonJS2({
  34199. "src/language-html/utils/index.js"(exports2, module2) {
  34200. "use strict";
  34201. var {
  34202. inferParserByLanguage,
  34203. isFrontMatterNode
  34204. } = require_util();
  34205. var {
  34206. builders: {
  34207. line,
  34208. hardline,
  34209. join
  34210. },
  34211. utils: {
  34212. getDocParts,
  34213. replaceTextEndOfLine
  34214. }
  34215. } = require("./doc.js");
  34216. var {
  34217. CSS_DISPLAY_TAGS,
  34218. CSS_DISPLAY_DEFAULT,
  34219. CSS_WHITE_SPACE_TAGS,
  34220. CSS_WHITE_SPACE_DEFAULT
  34221. } = require_constants_evaluate2();
  34222. var isUnknownNamespace = require_is_unknown_namespace();
  34223. var HTML_WHITESPACE = /* @__PURE__ */ new Set([" ", "\n", "\f", "\r", " "]);
  34224. var htmlTrimStart = (string) => string.replace(/^[\t\n\f\r ]+/, "");
  34225. var htmlTrimEnd = (string) => string.replace(/[\t\n\f\r ]+$/, "");
  34226. var htmlTrim = (string) => htmlTrimStart(htmlTrimEnd(string));
  34227. var htmlTrimLeadingBlankLines = (string) => string.replace(/^[\t\f\r ]*\n/g, "");
  34228. var htmlTrimPreserveIndentation = (string) => htmlTrimLeadingBlankLines(htmlTrimEnd(string));
  34229. var splitByHtmlWhitespace = (string) => string.split(/[\t\n\f\r ]+/);
  34230. var getLeadingHtmlWhitespace = (string) => string.match(/^[\t\n\f\r ]*/)[0];
  34231. var getLeadingAndTrailingHtmlWhitespace = (string) => {
  34232. const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
  34233. return {
  34234. leadingWhitespace,
  34235. trailingWhitespace,
  34236. text
  34237. };
  34238. };
  34239. var hasHtmlWhitespace = (string) => /[\t\n\f\r ]/.test(string);
  34240. function shouldPreserveContent(node, options) {
  34241. if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
  34242. return true;
  34243. }
  34244. if (node.type === "ieConditionalComment" && !node.complete) {
  34245. return true;
  34246. }
  34247. if (isPreLikeNode(node) && node.children.some((child) => child.type !== "text" && child.type !== "interpolation")) {
  34248. return true;
  34249. }
  34250. if (isVueNonHtmlBlock(node, options) && !isScriptLikeTag(node) && node.type !== "interpolation") {
  34251. return true;
  34252. }
  34253. return false;
  34254. }
  34255. function hasPrettierIgnore(node) {
  34256. if (node.type === "attribute") {
  34257. return false;
  34258. }
  34259. if (!node.parent) {
  34260. return false;
  34261. }
  34262. if (!node.prev) {
  34263. return false;
  34264. }
  34265. return isPrettierIgnore(node.prev);
  34266. }
  34267. function isPrettierIgnore(node) {
  34268. return node.type === "comment" && node.value.trim() === "prettier-ignore";
  34269. }
  34270. function isTextLikeNode(node) {
  34271. return node.type === "text" || node.type === "comment";
  34272. }
  34273. function isScriptLikeTag(node) {
  34274. return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
  34275. }
  34276. function canHaveInterpolation(node) {
  34277. return node.children && !isScriptLikeTag(node);
  34278. }
  34279. function isWhitespaceSensitiveNode(node) {
  34280. return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
  34281. }
  34282. function isIndentationSensitiveNode(node) {
  34283. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  34284. }
  34285. function isLeadingSpaceSensitiveNode(node, options) {
  34286. const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
  34287. if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
  34288. return node.type === "interpolation";
  34289. }
  34290. return isLeadingSpaceSensitive;
  34291. function _isLeadingSpaceSensitiveNode() {
  34292. if (isFrontMatterNode(node)) {
  34293. return false;
  34294. }
  34295. if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
  34296. return true;
  34297. }
  34298. if (!node.parent || node.parent.cssDisplay === "none") {
  34299. return false;
  34300. }
  34301. if (isPreLikeNode(node.parent)) {
  34302. return true;
  34303. }
  34304. if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  34305. return false;
  34306. }
  34307. if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
  34308. return false;
  34309. }
  34310. return true;
  34311. }
  34312. }
  34313. function isTrailingSpaceSensitiveNode(node, options) {
  34314. if (isFrontMatterNode(node)) {
  34315. return false;
  34316. }
  34317. if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
  34318. return true;
  34319. }
  34320. if (!node.parent || node.parent.cssDisplay === "none") {
  34321. return false;
  34322. }
  34323. if (isPreLikeNode(node.parent)) {
  34324. return true;
  34325. }
  34326. if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  34327. return false;
  34328. }
  34329. if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
  34330. return false;
  34331. }
  34332. return true;
  34333. }
  34334. function isDanglingSpaceSensitiveNode(node) {
  34335. return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
  34336. }
  34337. function forceNextEmptyLine(node) {
  34338. return isFrontMatterNode(node) || node.next && node.sourceSpan.end && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
  34339. }
  34340. function forceBreakContent(node) {
  34341. 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));
  34342. }
  34343. function forceBreakChildren(node) {
  34344. return node.type === "element" && node.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
  34345. }
  34346. function preferHardlineAsLeadingSpaces(node) {
  34347. return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
  34348. }
  34349. function preferHardlineAsTrailingSpaces(node) {
  34350. return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
  34351. }
  34352. function hasSurroundingLineBreak(node) {
  34353. return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
  34354. }
  34355. function hasLeadingLineBreak(node) {
  34356. 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);
  34357. }
  34358. function hasTrailingLineBreak(node) {
  34359. 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);
  34360. }
  34361. function preferHardlineAsSurroundingSpaces(node) {
  34362. switch (node.type) {
  34363. case "ieConditionalComment":
  34364. case "comment":
  34365. case "directive":
  34366. return true;
  34367. case "element":
  34368. return ["script", "select"].includes(node.name);
  34369. }
  34370. return false;
  34371. }
  34372. function getLastDescendant(node) {
  34373. return node.lastChild ? getLastDescendant(node.lastChild) : node;
  34374. }
  34375. function hasNonTextChild(node) {
  34376. return node.children && node.children.some((child) => child.type !== "text");
  34377. }
  34378. function _inferScriptParser(node) {
  34379. const {
  34380. type,
  34381. lang
  34382. } = node.attrMap;
  34383. if (type === "module" || type === "text/javascript" || type === "text/babel" || type === "application/javascript" || lang === "jsx") {
  34384. return "babel";
  34385. }
  34386. if (type === "application/x-typescript" || lang === "ts" || lang === "tsx") {
  34387. return "typescript";
  34388. }
  34389. if (type === "text/markdown") {
  34390. return "markdown";
  34391. }
  34392. if (type === "text/html") {
  34393. return "html";
  34394. }
  34395. if (type && (type.endsWith("json") || type.endsWith("importmap")) || type === "speculationrules") {
  34396. return "json";
  34397. }
  34398. if (type === "text/x-handlebars-template") {
  34399. return "glimmer";
  34400. }
  34401. }
  34402. function inferStyleParser(node, options) {
  34403. const {
  34404. lang
  34405. } = node.attrMap;
  34406. if (!lang || lang === "postcss" || lang === "css") {
  34407. return "css";
  34408. }
  34409. if (lang === "scss") {
  34410. return "scss";
  34411. }
  34412. if (lang === "less") {
  34413. return "less";
  34414. }
  34415. if (lang === "stylus") {
  34416. return inferParserByLanguage("stylus", options);
  34417. }
  34418. }
  34419. function inferScriptParser(node, options) {
  34420. if (node.name === "script" && !node.attrMap.src) {
  34421. if (!node.attrMap.lang && !node.attrMap.type) {
  34422. return "babel";
  34423. }
  34424. return _inferScriptParser(node);
  34425. }
  34426. if (node.name === "style") {
  34427. return inferStyleParser(node, options);
  34428. }
  34429. if (options && isVueNonHtmlBlock(node, options)) {
  34430. return _inferScriptParser(node) || !("src" in node.attrMap) && inferParserByLanguage(node.attrMap.lang, options);
  34431. }
  34432. }
  34433. function isBlockLikeCssDisplay(cssDisplay) {
  34434. return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
  34435. }
  34436. function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  34437. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34438. }
  34439. function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  34440. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34441. }
  34442. function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  34443. return !isBlockLikeCssDisplay(cssDisplay);
  34444. }
  34445. function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  34446. return !isBlockLikeCssDisplay(cssDisplay);
  34447. }
  34448. function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
  34449. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  34450. }
  34451. function isPreLikeNode(node) {
  34452. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  34453. }
  34454. function countParents(path, predicate) {
  34455. let counter = 0;
  34456. for (let i = path.stack.length - 1; i >= 0; i--) {
  34457. const value = path.stack[i];
  34458. if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
  34459. counter++;
  34460. }
  34461. }
  34462. return counter;
  34463. }
  34464. function hasParent(node, fn) {
  34465. let current = node;
  34466. while (current) {
  34467. if (fn(current)) {
  34468. return true;
  34469. }
  34470. current = current.parent;
  34471. }
  34472. return false;
  34473. }
  34474. function getNodeCssStyleDisplay(node, options) {
  34475. if (node.prev && node.prev.type === "comment") {
  34476. const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
  34477. if (match) {
  34478. return match[1];
  34479. }
  34480. }
  34481. let isInSvgForeignObject = false;
  34482. if (node.type === "element" && node.namespace === "svg") {
  34483. if (hasParent(node, (parent) => parent.fullName === "svg:foreignObject")) {
  34484. isInSvgForeignObject = true;
  34485. } else {
  34486. return node.name === "svg" ? "inline-block" : "block";
  34487. }
  34488. }
  34489. switch (options.htmlWhitespaceSensitivity) {
  34490. case "strict":
  34491. return "inline";
  34492. case "ignore":
  34493. return "block";
  34494. default: {
  34495. if (options.parser === "vue" && node.parent && node.parent.type === "root") {
  34496. return "block";
  34497. }
  34498. return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
  34499. }
  34500. }
  34501. }
  34502. function getNodeCssStyleWhiteSpace(node) {
  34503. return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
  34504. }
  34505. function getMinIndentation(text) {
  34506. let minIndentation = Number.POSITIVE_INFINITY;
  34507. for (const lineText of text.split("\n")) {
  34508. if (lineText.length === 0) {
  34509. continue;
  34510. }
  34511. if (!HTML_WHITESPACE.has(lineText[0])) {
  34512. return 0;
  34513. }
  34514. const indentation = getLeadingHtmlWhitespace(lineText).length;
  34515. if (lineText.length === indentation) {
  34516. continue;
  34517. }
  34518. if (indentation < minIndentation) {
  34519. minIndentation = indentation;
  34520. }
  34521. }
  34522. return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
  34523. }
  34524. function dedentString(text, minIndent = getMinIndentation(text)) {
  34525. return minIndent === 0 ? text : text.split("\n").map((lineText) => lineText.slice(minIndent)).join("\n");
  34526. }
  34527. function countChars(text, char) {
  34528. let counter = 0;
  34529. for (let i = 0; i < text.length; i++) {
  34530. if (text[i] === char) {
  34531. counter++;
  34532. }
  34533. }
  34534. return counter;
  34535. }
  34536. function unescapeQuoteEntities(text) {
  34537. return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  34538. }
  34539. var vueRootElementsSet = /* @__PURE__ */ new Set(["template", "style", "script"]);
  34540. function isVueCustomBlock(node, options) {
  34541. return isVueSfcBlock(node, options) && !vueRootElementsSet.has(node.fullName);
  34542. }
  34543. function isVueSfcBlock(node, options) {
  34544. return options.parser === "vue" && node.type === "element" && node.parent.type === "root" && node.fullName.toLowerCase() !== "html";
  34545. }
  34546. function isVueNonHtmlBlock(node, options) {
  34547. return isVueSfcBlock(node, options) && (isVueCustomBlock(node, options) || node.attrMap.lang && node.attrMap.lang !== "html");
  34548. }
  34549. function isVueSlotAttribute(attribute) {
  34550. const attributeName = attribute.fullName;
  34551. return attributeName.charAt(0) === "#" || attributeName === "slot-scope" || attributeName === "v-slot" || attributeName.startsWith("v-slot:");
  34552. }
  34553. function isVueSfcBindingsAttribute(attribute, options) {
  34554. const element = attribute.parent;
  34555. if (!isVueSfcBlock(element, options)) {
  34556. return false;
  34557. }
  34558. const tagName = element.fullName;
  34559. const attributeName = attribute.fullName;
  34560. return tagName === "script" && attributeName === "setup" || tagName === "style" && attributeName === "vars";
  34561. }
  34562. function getTextValueParts(node, value = node.value) {
  34563. return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceTextEndOfLine(value) : replaceTextEndOfLine(dedentString(htmlTrimPreserveIndentation(value)), hardline) : getDocParts(join(line, splitByHtmlWhitespace(value)));
  34564. }
  34565. function isVueScriptTag(node, options) {
  34566. return isVueSfcBlock(node, options) && node.name === "script";
  34567. }
  34568. module2.exports = {
  34569. htmlTrim,
  34570. htmlTrimPreserveIndentation,
  34571. hasHtmlWhitespace,
  34572. getLeadingAndTrailingHtmlWhitespace,
  34573. canHaveInterpolation,
  34574. countChars,
  34575. countParents,
  34576. dedentString,
  34577. forceBreakChildren,
  34578. forceBreakContent,
  34579. forceNextEmptyLine,
  34580. getLastDescendant,
  34581. getNodeCssStyleDisplay,
  34582. getNodeCssStyleWhiteSpace,
  34583. hasPrettierIgnore,
  34584. inferScriptParser,
  34585. isVueCustomBlock,
  34586. isVueNonHtmlBlock,
  34587. isVueScriptTag,
  34588. isVueSlotAttribute,
  34589. isVueSfcBindingsAttribute,
  34590. isVueSfcBlock,
  34591. isDanglingSpaceSensitiveNode,
  34592. isIndentationSensitiveNode,
  34593. isLeadingSpaceSensitiveNode,
  34594. isPreLikeNode,
  34595. isScriptLikeTag,
  34596. isTextLikeNode,
  34597. isTrailingSpaceSensitiveNode,
  34598. isWhitespaceSensitiveNode,
  34599. isUnknownNamespace,
  34600. preferHardlineAsLeadingSpaces,
  34601. preferHardlineAsTrailingSpaces,
  34602. shouldPreserveContent,
  34603. unescapeQuoteEntities,
  34604. getTextValueParts
  34605. };
  34606. }
  34607. });
  34608. var require_chars = __commonJS2({
  34609. "node_modules/angular-html-parser/lib/compiler/src/chars.js"(exports2) {
  34610. "use strict";
  34611. Object.defineProperty(exports2, "__esModule", {
  34612. value: true
  34613. });
  34614. exports2.$EOF = 0;
  34615. exports2.$BSPACE = 8;
  34616. exports2.$TAB = 9;
  34617. exports2.$LF = 10;
  34618. exports2.$VTAB = 11;
  34619. exports2.$FF = 12;
  34620. exports2.$CR = 13;
  34621. exports2.$SPACE = 32;
  34622. exports2.$BANG = 33;
  34623. exports2.$DQ = 34;
  34624. exports2.$HASH = 35;
  34625. exports2.$$ = 36;
  34626. exports2.$PERCENT = 37;
  34627. exports2.$AMPERSAND = 38;
  34628. exports2.$SQ = 39;
  34629. exports2.$LPAREN = 40;
  34630. exports2.$RPAREN = 41;
  34631. exports2.$STAR = 42;
  34632. exports2.$PLUS = 43;
  34633. exports2.$COMMA = 44;
  34634. exports2.$MINUS = 45;
  34635. exports2.$PERIOD = 46;
  34636. exports2.$SLASH = 47;
  34637. exports2.$COLON = 58;
  34638. exports2.$SEMICOLON = 59;
  34639. exports2.$LT = 60;
  34640. exports2.$EQ = 61;
  34641. exports2.$GT = 62;
  34642. exports2.$QUESTION = 63;
  34643. exports2.$0 = 48;
  34644. exports2.$7 = 55;
  34645. exports2.$9 = 57;
  34646. exports2.$A = 65;
  34647. exports2.$E = 69;
  34648. exports2.$F = 70;
  34649. exports2.$X = 88;
  34650. exports2.$Z = 90;
  34651. exports2.$LBRACKET = 91;
  34652. exports2.$BACKSLASH = 92;
  34653. exports2.$RBRACKET = 93;
  34654. exports2.$CARET = 94;
  34655. exports2.$_ = 95;
  34656. exports2.$a = 97;
  34657. exports2.$b = 98;
  34658. exports2.$e = 101;
  34659. exports2.$f = 102;
  34660. exports2.$n = 110;
  34661. exports2.$r = 114;
  34662. exports2.$t = 116;
  34663. exports2.$u = 117;
  34664. exports2.$v = 118;
  34665. exports2.$x = 120;
  34666. exports2.$z = 122;
  34667. exports2.$LBRACE = 123;
  34668. exports2.$BAR = 124;
  34669. exports2.$RBRACE = 125;
  34670. exports2.$NBSP = 160;
  34671. exports2.$PIPE = 124;
  34672. exports2.$TILDA = 126;
  34673. exports2.$AT = 64;
  34674. exports2.$BT = 96;
  34675. function isWhitespace(code) {
  34676. return code >= exports2.$TAB && code <= exports2.$SPACE || code == exports2.$NBSP;
  34677. }
  34678. exports2.isWhitespace = isWhitespace;
  34679. function isDigit(code) {
  34680. return exports2.$0 <= code && code <= exports2.$9;
  34681. }
  34682. exports2.isDigit = isDigit;
  34683. function isAsciiLetter(code) {
  34684. return code >= exports2.$a && code <= exports2.$z || code >= exports2.$A && code <= exports2.$Z;
  34685. }
  34686. exports2.isAsciiLetter = isAsciiLetter;
  34687. function isAsciiHexDigit(code) {
  34688. return code >= exports2.$a && code <= exports2.$f || code >= exports2.$A && code <= exports2.$F || isDigit(code);
  34689. }
  34690. exports2.isAsciiHexDigit = isAsciiHexDigit;
  34691. function isNewLine(code) {
  34692. return code === exports2.$LF || code === exports2.$CR;
  34693. }
  34694. exports2.isNewLine = isNewLine;
  34695. function isOctalDigit(code) {
  34696. return exports2.$0 <= code && code <= exports2.$7;
  34697. }
  34698. exports2.isOctalDigit = isOctalDigit;
  34699. }
  34700. });
  34701. var require_static_symbol = __commonJS2({
  34702. "node_modules/angular-html-parser/lib/compiler/src/aot/static_symbol.js"(exports2) {
  34703. "use strict";
  34704. Object.defineProperty(exports2, "__esModule", {
  34705. value: true
  34706. });
  34707. var StaticSymbol = class {
  34708. constructor(filePath, name, members) {
  34709. this.filePath = filePath;
  34710. this.name = name;
  34711. this.members = members;
  34712. }
  34713. assertNoMembers() {
  34714. if (this.members.length) {
  34715. throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`);
  34716. }
  34717. }
  34718. };
  34719. exports2.StaticSymbol = StaticSymbol;
  34720. var StaticSymbolCache = class {
  34721. constructor() {
  34722. this.cache = /* @__PURE__ */ new Map();
  34723. }
  34724. get(declarationFile, name, members) {
  34725. members = members || [];
  34726. const memberSuffix = members.length ? `.${members.join(".")}` : "";
  34727. const key = `"${declarationFile}".${name}${memberSuffix}`;
  34728. let result = this.cache.get(key);
  34729. if (!result) {
  34730. result = new StaticSymbol(declarationFile, name, members);
  34731. this.cache.set(key, result);
  34732. }
  34733. return result;
  34734. }
  34735. };
  34736. exports2.StaticSymbolCache = StaticSymbolCache;
  34737. }
  34738. });
  34739. var require_util3 = __commonJS2({
  34740. "node_modules/angular-html-parser/lib/compiler/src/util.js"(exports2) {
  34741. "use strict";
  34742. Object.defineProperty(exports2, "__esModule", {
  34743. value: true
  34744. });
  34745. var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
  34746. function dashCaseToCamelCase(input) {
  34747. return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
  34748. }
  34749. exports2.dashCaseToCamelCase = dashCaseToCamelCase;
  34750. function splitAtColon(input, defaultValues) {
  34751. return _splitAt(input, ":", defaultValues);
  34752. }
  34753. exports2.splitAtColon = splitAtColon;
  34754. function splitAtPeriod(input, defaultValues) {
  34755. return _splitAt(input, ".", defaultValues);
  34756. }
  34757. exports2.splitAtPeriod = splitAtPeriod;
  34758. function _splitAt(input, character, defaultValues) {
  34759. const characterIndex = input.indexOf(character);
  34760. if (characterIndex == -1)
  34761. return defaultValues;
  34762. return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
  34763. }
  34764. function visitValue(value, visitor, context) {
  34765. if (Array.isArray(value)) {
  34766. return visitor.visitArray(value, context);
  34767. }
  34768. if (isStrictStringMap(value)) {
  34769. return visitor.visitStringMap(value, context);
  34770. }
  34771. if (value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean") {
  34772. return visitor.visitPrimitive(value, context);
  34773. }
  34774. return visitor.visitOther(value, context);
  34775. }
  34776. exports2.visitValue = visitValue;
  34777. function isDefined(val) {
  34778. return val !== null && val !== void 0;
  34779. }
  34780. exports2.isDefined = isDefined;
  34781. function noUndefined(val) {
  34782. return val === void 0 ? null : val;
  34783. }
  34784. exports2.noUndefined = noUndefined;
  34785. var ValueTransformer = class {
  34786. visitArray(arr, context) {
  34787. return arr.map((value) => visitValue(value, this, context));
  34788. }
  34789. visitStringMap(map, context) {
  34790. const result = {};
  34791. Object.keys(map).forEach((key) => {
  34792. result[key] = visitValue(map[key], this, context);
  34793. });
  34794. return result;
  34795. }
  34796. visitPrimitive(value, context) {
  34797. return value;
  34798. }
  34799. visitOther(value, context) {
  34800. return value;
  34801. }
  34802. };
  34803. exports2.ValueTransformer = ValueTransformer;
  34804. exports2.SyncAsync = {
  34805. assertSync: (value) => {
  34806. if (isPromise(value)) {
  34807. throw new Error(`Illegal state: value cannot be a promise`);
  34808. }
  34809. return value;
  34810. },
  34811. then: (value, cb) => {
  34812. return isPromise(value) ? value.then(cb) : cb(value);
  34813. },
  34814. all: (syncAsyncValues) => {
  34815. return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
  34816. }
  34817. };
  34818. function error(msg) {
  34819. throw new Error(`Internal Error: ${msg}`);
  34820. }
  34821. exports2.error = error;
  34822. function syntaxError(msg, parseErrors) {
  34823. const error2 = Error(msg);
  34824. error2[ERROR_SYNTAX_ERROR] = true;
  34825. if (parseErrors)
  34826. error2[ERROR_PARSE_ERRORS] = parseErrors;
  34827. return error2;
  34828. }
  34829. exports2.syntaxError = syntaxError;
  34830. var ERROR_SYNTAX_ERROR = "ngSyntaxError";
  34831. var ERROR_PARSE_ERRORS = "ngParseErrors";
  34832. function isSyntaxError(error2) {
  34833. return error2[ERROR_SYNTAX_ERROR];
  34834. }
  34835. exports2.isSyntaxError = isSyntaxError;
  34836. function getParseErrors(error2) {
  34837. return error2[ERROR_PARSE_ERRORS] || [];
  34838. }
  34839. exports2.getParseErrors = getParseErrors;
  34840. function escapeRegExp(s) {
  34841. return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
  34842. }
  34843. exports2.escapeRegExp = escapeRegExp;
  34844. var STRING_MAP_PROTO = Object.getPrototypeOf({});
  34845. function isStrictStringMap(obj) {
  34846. return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
  34847. }
  34848. function utf8Encode(str) {
  34849. let encoded = "";
  34850. for (let index = 0; index < str.length; index++) {
  34851. let codePoint = str.charCodeAt(index);
  34852. if (codePoint >= 55296 && codePoint <= 56319 && str.length > index + 1) {
  34853. const low = str.charCodeAt(index + 1);
  34854. if (low >= 56320 && low <= 57343) {
  34855. index++;
  34856. codePoint = (codePoint - 55296 << 10) + low - 56320 + 65536;
  34857. }
  34858. }
  34859. if (codePoint <= 127) {
  34860. encoded += String.fromCharCode(codePoint);
  34861. } else if (codePoint <= 2047) {
  34862. encoded += String.fromCharCode(codePoint >> 6 & 31 | 192, codePoint & 63 | 128);
  34863. } else if (codePoint <= 65535) {
  34864. encoded += String.fromCharCode(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  34865. } else if (codePoint <= 2097151) {
  34866. encoded += String.fromCharCode(codePoint >> 18 & 7 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  34867. }
  34868. }
  34869. return encoded;
  34870. }
  34871. exports2.utf8Encode = utf8Encode;
  34872. function stringify(token) {
  34873. if (typeof token === "string") {
  34874. return token;
  34875. }
  34876. if (token instanceof Array) {
  34877. return "[" + token.map(stringify).join(", ") + "]";
  34878. }
  34879. if (token == null) {
  34880. return "" + token;
  34881. }
  34882. if (token.overriddenName) {
  34883. return `${token.overriddenName}`;
  34884. }
  34885. if (token.name) {
  34886. return `${token.name}`;
  34887. }
  34888. if (!token.toString) {
  34889. return "object";
  34890. }
  34891. const res = token.toString();
  34892. if (res == null) {
  34893. return "" + res;
  34894. }
  34895. const newLineIndex = res.indexOf("\n");
  34896. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  34897. }
  34898. exports2.stringify = stringify;
  34899. function resolveForwardRef(type) {
  34900. if (typeof type === "function" && type.hasOwnProperty("__forward_ref__")) {
  34901. return type();
  34902. } else {
  34903. return type;
  34904. }
  34905. }
  34906. exports2.resolveForwardRef = resolveForwardRef;
  34907. function isPromise(obj) {
  34908. return !!obj && typeof obj.then === "function";
  34909. }
  34910. exports2.isPromise = isPromise;
  34911. var Version = class {
  34912. constructor(full) {
  34913. this.full = full;
  34914. const splits = full.split(".");
  34915. this.major = splits[0];
  34916. this.minor = splits[1];
  34917. this.patch = splits.slice(2).join(".");
  34918. }
  34919. };
  34920. exports2.Version = Version;
  34921. var __window = typeof window !== "undefined" && window;
  34922. var __self = typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self;
  34923. var __global = typeof global !== "undefined" && global;
  34924. var _global = __global || __window || __self;
  34925. exports2.global = _global;
  34926. }
  34927. });
  34928. var require_compile_metadata = __commonJS2({
  34929. "node_modules/angular-html-parser/lib/compiler/src/compile_metadata.js"(exports2) {
  34930. "use strict";
  34931. Object.defineProperty(exports2, "__esModule", {
  34932. value: true
  34933. });
  34934. var static_symbol_1 = require_static_symbol();
  34935. var util_1 = require_util3();
  34936. var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  34937. function sanitizeIdentifier(name) {
  34938. return name.replace(/\W/g, "_");
  34939. }
  34940. exports2.sanitizeIdentifier = sanitizeIdentifier;
  34941. var _anonymousTypeIndex = 0;
  34942. function identifierName(compileIdentifier) {
  34943. if (!compileIdentifier || !compileIdentifier.reference) {
  34944. return null;
  34945. }
  34946. const ref = compileIdentifier.reference;
  34947. if (ref instanceof static_symbol_1.StaticSymbol) {
  34948. return ref.name;
  34949. }
  34950. if (ref["__anonymousType"]) {
  34951. return ref["__anonymousType"];
  34952. }
  34953. let identifier = util_1.stringify(ref);
  34954. if (identifier.indexOf("(") >= 0) {
  34955. identifier = `anonymous_${_anonymousTypeIndex++}`;
  34956. ref["__anonymousType"] = identifier;
  34957. } else {
  34958. identifier = sanitizeIdentifier(identifier);
  34959. }
  34960. return identifier;
  34961. }
  34962. exports2.identifierName = identifierName;
  34963. function identifierModuleUrl(compileIdentifier) {
  34964. const ref = compileIdentifier.reference;
  34965. if (ref instanceof static_symbol_1.StaticSymbol) {
  34966. return ref.filePath;
  34967. }
  34968. return `./${util_1.stringify(ref)}`;
  34969. }
  34970. exports2.identifierModuleUrl = identifierModuleUrl;
  34971. function viewClassName(compType, embeddedTemplateIndex) {
  34972. return `View_${identifierName({
  34973. reference: compType
  34974. })}_${embeddedTemplateIndex}`;
  34975. }
  34976. exports2.viewClassName = viewClassName;
  34977. function rendererTypeName(compType) {
  34978. return `RenderType_${identifierName({
  34979. reference: compType
  34980. })}`;
  34981. }
  34982. exports2.rendererTypeName = rendererTypeName;
  34983. function hostViewClassName(compType) {
  34984. return `HostView_${identifierName({
  34985. reference: compType
  34986. })}`;
  34987. }
  34988. exports2.hostViewClassName = hostViewClassName;
  34989. function componentFactoryName(compType) {
  34990. return `${identifierName({
  34991. reference: compType
  34992. })}NgFactory`;
  34993. }
  34994. exports2.componentFactoryName = componentFactoryName;
  34995. var CompileSummaryKind;
  34996. (function(CompileSummaryKind2) {
  34997. CompileSummaryKind2[CompileSummaryKind2["Pipe"] = 0] = "Pipe";
  34998. CompileSummaryKind2[CompileSummaryKind2["Directive"] = 1] = "Directive";
  34999. CompileSummaryKind2[CompileSummaryKind2["NgModule"] = 2] = "NgModule";
  35000. CompileSummaryKind2[CompileSummaryKind2["Injectable"] = 3] = "Injectable";
  35001. })(CompileSummaryKind = exports2.CompileSummaryKind || (exports2.CompileSummaryKind = {}));
  35002. function tokenName(token) {
  35003. return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
  35004. }
  35005. exports2.tokenName = tokenName;
  35006. function tokenReference(token) {
  35007. if (token.identifier != null) {
  35008. return token.identifier.reference;
  35009. } else {
  35010. return token.value;
  35011. }
  35012. }
  35013. exports2.tokenReference = tokenReference;
  35014. var CompileStylesheetMetadata = class {
  35015. constructor({
  35016. moduleUrl,
  35017. styles,
  35018. styleUrls
  35019. } = {}) {
  35020. this.moduleUrl = moduleUrl || null;
  35021. this.styles = _normalizeArray(styles);
  35022. this.styleUrls = _normalizeArray(styleUrls);
  35023. }
  35024. };
  35025. exports2.CompileStylesheetMetadata = CompileStylesheetMetadata;
  35026. var CompileTemplateMetadata = class {
  35027. constructor({
  35028. encapsulation,
  35029. template,
  35030. templateUrl,
  35031. htmlAst,
  35032. styles,
  35033. styleUrls,
  35034. externalStylesheets,
  35035. animations,
  35036. ngContentSelectors,
  35037. interpolation,
  35038. isInline,
  35039. preserveWhitespaces
  35040. }) {
  35041. this.encapsulation = encapsulation;
  35042. this.template = template;
  35043. this.templateUrl = templateUrl;
  35044. this.htmlAst = htmlAst;
  35045. this.styles = _normalizeArray(styles);
  35046. this.styleUrls = _normalizeArray(styleUrls);
  35047. this.externalStylesheets = _normalizeArray(externalStylesheets);
  35048. this.animations = animations ? flatten(animations) : [];
  35049. this.ngContentSelectors = ngContentSelectors || [];
  35050. if (interpolation && interpolation.length != 2) {
  35051. throw new Error(`'interpolation' should have a start and an end symbol.`);
  35052. }
  35053. this.interpolation = interpolation;
  35054. this.isInline = isInline;
  35055. this.preserveWhitespaces = preserveWhitespaces;
  35056. }
  35057. toSummary() {
  35058. return {
  35059. ngContentSelectors: this.ngContentSelectors,
  35060. encapsulation: this.encapsulation,
  35061. styles: this.styles,
  35062. animations: this.animations
  35063. };
  35064. }
  35065. };
  35066. exports2.CompileTemplateMetadata = CompileTemplateMetadata;
  35067. var CompileDirectiveMetadata = class {
  35068. static create({
  35069. isHost,
  35070. type,
  35071. isComponent,
  35072. selector,
  35073. exportAs,
  35074. changeDetection,
  35075. inputs,
  35076. outputs,
  35077. host,
  35078. providers,
  35079. viewProviders,
  35080. queries,
  35081. guards,
  35082. viewQueries,
  35083. entryComponents,
  35084. template,
  35085. componentViewType,
  35086. rendererType,
  35087. componentFactory
  35088. }) {
  35089. const hostListeners = {};
  35090. const hostProperties = {};
  35091. const hostAttributes = {};
  35092. if (host != null) {
  35093. Object.keys(host).forEach((key) => {
  35094. const value = host[key];
  35095. const matches = key.match(HOST_REG_EXP);
  35096. if (matches === null) {
  35097. hostAttributes[key] = value;
  35098. } else if (matches[1] != null) {
  35099. hostProperties[matches[1]] = value;
  35100. } else if (matches[2] != null) {
  35101. hostListeners[matches[2]] = value;
  35102. }
  35103. });
  35104. }
  35105. const inputsMap = {};
  35106. if (inputs != null) {
  35107. inputs.forEach((bindConfig) => {
  35108. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  35109. inputsMap[parts[0]] = parts[1];
  35110. });
  35111. }
  35112. const outputsMap = {};
  35113. if (outputs != null) {
  35114. outputs.forEach((bindConfig) => {
  35115. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  35116. outputsMap[parts[0]] = parts[1];
  35117. });
  35118. }
  35119. return new CompileDirectiveMetadata({
  35120. isHost,
  35121. type,
  35122. isComponent: !!isComponent,
  35123. selector,
  35124. exportAs,
  35125. changeDetection,
  35126. inputs: inputsMap,
  35127. outputs: outputsMap,
  35128. hostListeners,
  35129. hostProperties,
  35130. hostAttributes,
  35131. providers,
  35132. viewProviders,
  35133. queries,
  35134. guards,
  35135. viewQueries,
  35136. entryComponents,
  35137. template,
  35138. componentViewType,
  35139. rendererType,
  35140. componentFactory
  35141. });
  35142. }
  35143. constructor({
  35144. isHost,
  35145. type,
  35146. isComponent,
  35147. selector,
  35148. exportAs,
  35149. changeDetection,
  35150. inputs,
  35151. outputs,
  35152. hostListeners,
  35153. hostProperties,
  35154. hostAttributes,
  35155. providers,
  35156. viewProviders,
  35157. queries,
  35158. guards,
  35159. viewQueries,
  35160. entryComponents,
  35161. template,
  35162. componentViewType,
  35163. rendererType,
  35164. componentFactory
  35165. }) {
  35166. this.isHost = !!isHost;
  35167. this.type = type;
  35168. this.isComponent = isComponent;
  35169. this.selector = selector;
  35170. this.exportAs = exportAs;
  35171. this.changeDetection = changeDetection;
  35172. this.inputs = inputs;
  35173. this.outputs = outputs;
  35174. this.hostListeners = hostListeners;
  35175. this.hostProperties = hostProperties;
  35176. this.hostAttributes = hostAttributes;
  35177. this.providers = _normalizeArray(providers);
  35178. this.viewProviders = _normalizeArray(viewProviders);
  35179. this.queries = _normalizeArray(queries);
  35180. this.guards = guards;
  35181. this.viewQueries = _normalizeArray(viewQueries);
  35182. this.entryComponents = _normalizeArray(entryComponents);
  35183. this.template = template;
  35184. this.componentViewType = componentViewType;
  35185. this.rendererType = rendererType;
  35186. this.componentFactory = componentFactory;
  35187. }
  35188. toSummary() {
  35189. return {
  35190. summaryKind: CompileSummaryKind.Directive,
  35191. type: this.type,
  35192. isComponent: this.isComponent,
  35193. selector: this.selector,
  35194. exportAs: this.exportAs,
  35195. inputs: this.inputs,
  35196. outputs: this.outputs,
  35197. hostListeners: this.hostListeners,
  35198. hostProperties: this.hostProperties,
  35199. hostAttributes: this.hostAttributes,
  35200. providers: this.providers,
  35201. viewProviders: this.viewProviders,
  35202. queries: this.queries,
  35203. guards: this.guards,
  35204. viewQueries: this.viewQueries,
  35205. entryComponents: this.entryComponents,
  35206. changeDetection: this.changeDetection,
  35207. template: this.template && this.template.toSummary(),
  35208. componentViewType: this.componentViewType,
  35209. rendererType: this.rendererType,
  35210. componentFactory: this.componentFactory
  35211. };
  35212. }
  35213. };
  35214. exports2.CompileDirectiveMetadata = CompileDirectiveMetadata;
  35215. var CompilePipeMetadata = class {
  35216. constructor({
  35217. type,
  35218. name,
  35219. pure
  35220. }) {
  35221. this.type = type;
  35222. this.name = name;
  35223. this.pure = !!pure;
  35224. }
  35225. toSummary() {
  35226. return {
  35227. summaryKind: CompileSummaryKind.Pipe,
  35228. type: this.type,
  35229. name: this.name,
  35230. pure: this.pure
  35231. };
  35232. }
  35233. };
  35234. exports2.CompilePipeMetadata = CompilePipeMetadata;
  35235. var CompileShallowModuleMetadata = class {
  35236. };
  35237. exports2.CompileShallowModuleMetadata = CompileShallowModuleMetadata;
  35238. var CompileNgModuleMetadata = class {
  35239. constructor({
  35240. type,
  35241. providers,
  35242. declaredDirectives,
  35243. exportedDirectives,
  35244. declaredPipes,
  35245. exportedPipes,
  35246. entryComponents,
  35247. bootstrapComponents,
  35248. importedModules,
  35249. exportedModules,
  35250. schemas,
  35251. transitiveModule,
  35252. id
  35253. }) {
  35254. this.type = type || null;
  35255. this.declaredDirectives = _normalizeArray(declaredDirectives);
  35256. this.exportedDirectives = _normalizeArray(exportedDirectives);
  35257. this.declaredPipes = _normalizeArray(declaredPipes);
  35258. this.exportedPipes = _normalizeArray(exportedPipes);
  35259. this.providers = _normalizeArray(providers);
  35260. this.entryComponents = _normalizeArray(entryComponents);
  35261. this.bootstrapComponents = _normalizeArray(bootstrapComponents);
  35262. this.importedModules = _normalizeArray(importedModules);
  35263. this.exportedModules = _normalizeArray(exportedModules);
  35264. this.schemas = _normalizeArray(schemas);
  35265. this.id = id || null;
  35266. this.transitiveModule = transitiveModule || null;
  35267. }
  35268. toSummary() {
  35269. const module3 = this.transitiveModule;
  35270. return {
  35271. summaryKind: CompileSummaryKind.NgModule,
  35272. type: this.type,
  35273. entryComponents: module3.entryComponents,
  35274. providers: module3.providers,
  35275. modules: module3.modules,
  35276. exportedDirectives: module3.exportedDirectives,
  35277. exportedPipes: module3.exportedPipes
  35278. };
  35279. }
  35280. };
  35281. exports2.CompileNgModuleMetadata = CompileNgModuleMetadata;
  35282. var TransitiveCompileNgModuleMetadata = class {
  35283. constructor() {
  35284. this.directivesSet = /* @__PURE__ */ new Set();
  35285. this.directives = [];
  35286. this.exportedDirectivesSet = /* @__PURE__ */ new Set();
  35287. this.exportedDirectives = [];
  35288. this.pipesSet = /* @__PURE__ */ new Set();
  35289. this.pipes = [];
  35290. this.exportedPipesSet = /* @__PURE__ */ new Set();
  35291. this.exportedPipes = [];
  35292. this.modulesSet = /* @__PURE__ */ new Set();
  35293. this.modules = [];
  35294. this.entryComponentsSet = /* @__PURE__ */ new Set();
  35295. this.entryComponents = [];
  35296. this.providers = [];
  35297. }
  35298. addProvider(provider, module3) {
  35299. this.providers.push({
  35300. provider,
  35301. module: module3
  35302. });
  35303. }
  35304. addDirective(id) {
  35305. if (!this.directivesSet.has(id.reference)) {
  35306. this.directivesSet.add(id.reference);
  35307. this.directives.push(id);
  35308. }
  35309. }
  35310. addExportedDirective(id) {
  35311. if (!this.exportedDirectivesSet.has(id.reference)) {
  35312. this.exportedDirectivesSet.add(id.reference);
  35313. this.exportedDirectives.push(id);
  35314. }
  35315. }
  35316. addPipe(id) {
  35317. if (!this.pipesSet.has(id.reference)) {
  35318. this.pipesSet.add(id.reference);
  35319. this.pipes.push(id);
  35320. }
  35321. }
  35322. addExportedPipe(id) {
  35323. if (!this.exportedPipesSet.has(id.reference)) {
  35324. this.exportedPipesSet.add(id.reference);
  35325. this.exportedPipes.push(id);
  35326. }
  35327. }
  35328. addModule(id) {
  35329. if (!this.modulesSet.has(id.reference)) {
  35330. this.modulesSet.add(id.reference);
  35331. this.modules.push(id);
  35332. }
  35333. }
  35334. addEntryComponent(ec) {
  35335. if (!this.entryComponentsSet.has(ec.componentType)) {
  35336. this.entryComponentsSet.add(ec.componentType);
  35337. this.entryComponents.push(ec);
  35338. }
  35339. }
  35340. };
  35341. exports2.TransitiveCompileNgModuleMetadata = TransitiveCompileNgModuleMetadata;
  35342. function _normalizeArray(obj) {
  35343. return obj || [];
  35344. }
  35345. var ProviderMeta = class {
  35346. constructor(token, {
  35347. useClass,
  35348. useValue,
  35349. useExisting,
  35350. useFactory,
  35351. deps,
  35352. multi
  35353. }) {
  35354. this.token = token;
  35355. this.useClass = useClass || null;
  35356. this.useValue = useValue;
  35357. this.useExisting = useExisting;
  35358. this.useFactory = useFactory || null;
  35359. this.dependencies = deps || null;
  35360. this.multi = !!multi;
  35361. }
  35362. };
  35363. exports2.ProviderMeta = ProviderMeta;
  35364. function flatten(list) {
  35365. return list.reduce((flat, item) => {
  35366. const flatItem = Array.isArray(item) ? flatten(item) : item;
  35367. return flat.concat(flatItem);
  35368. }, []);
  35369. }
  35370. exports2.flatten = flatten;
  35371. function jitSourceUrl(url) {
  35372. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, "ng:///");
  35373. }
  35374. function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
  35375. let url;
  35376. if (templateMeta.isInline) {
  35377. if (compMeta.type.reference instanceof static_symbol_1.StaticSymbol) {
  35378. url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
  35379. } else {
  35380. url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
  35381. }
  35382. } else {
  35383. url = templateMeta.templateUrl;
  35384. }
  35385. return compMeta.type.reference instanceof static_symbol_1.StaticSymbol ? url : jitSourceUrl(url);
  35386. }
  35387. exports2.templateSourceUrl = templateSourceUrl;
  35388. function sharedStylesheetJitUrl(meta, id) {
  35389. const pathParts = meta.moduleUrl.split(/\/\\/g);
  35390. const baseName = pathParts[pathParts.length - 1];
  35391. return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`);
  35392. }
  35393. exports2.sharedStylesheetJitUrl = sharedStylesheetJitUrl;
  35394. function ngModuleJitUrl(moduleMeta) {
  35395. return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`);
  35396. }
  35397. exports2.ngModuleJitUrl = ngModuleJitUrl;
  35398. function templateJitUrl(ngModuleType, compMeta) {
  35399. return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`);
  35400. }
  35401. exports2.templateJitUrl = templateJitUrl;
  35402. }
  35403. });
  35404. var require_parse_util = __commonJS2({
  35405. "node_modules/angular-html-parser/lib/compiler/src/parse_util.js"(exports2) {
  35406. "use strict";
  35407. Object.defineProperty(exports2, "__esModule", {
  35408. value: true
  35409. });
  35410. var chars = require_chars();
  35411. var compile_metadata_1 = require_compile_metadata();
  35412. var ParseLocation = class {
  35413. constructor(file, offset, line, col) {
  35414. this.file = file;
  35415. this.offset = offset;
  35416. this.line = line;
  35417. this.col = col;
  35418. }
  35419. toString() {
  35420. return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
  35421. }
  35422. moveBy(delta) {
  35423. const source = this.file.content;
  35424. const len = source.length;
  35425. let offset = this.offset;
  35426. let line = this.line;
  35427. let col = this.col;
  35428. while (offset > 0 && delta < 0) {
  35429. offset--;
  35430. delta++;
  35431. const ch = source.charCodeAt(offset);
  35432. if (ch == chars.$LF) {
  35433. line--;
  35434. const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode(chars.$LF));
  35435. col = priorLine > 0 ? offset - priorLine : offset;
  35436. } else {
  35437. col--;
  35438. }
  35439. }
  35440. while (offset < len && delta > 0) {
  35441. const ch = source.charCodeAt(offset);
  35442. offset++;
  35443. delta--;
  35444. if (ch == chars.$LF) {
  35445. line++;
  35446. col = 0;
  35447. } else {
  35448. col++;
  35449. }
  35450. }
  35451. return new ParseLocation(this.file, offset, line, col);
  35452. }
  35453. getContext(maxChars, maxLines) {
  35454. const content = this.file.content;
  35455. let startOffset = this.offset;
  35456. if (startOffset != null) {
  35457. if (startOffset > content.length - 1) {
  35458. startOffset = content.length - 1;
  35459. }
  35460. let endOffset = startOffset;
  35461. let ctxChars = 0;
  35462. let ctxLines = 0;
  35463. while (ctxChars < maxChars && startOffset > 0) {
  35464. startOffset--;
  35465. ctxChars++;
  35466. if (content[startOffset] == "\n") {
  35467. if (++ctxLines == maxLines) {
  35468. break;
  35469. }
  35470. }
  35471. }
  35472. ctxChars = 0;
  35473. ctxLines = 0;
  35474. while (ctxChars < maxChars && endOffset < content.length - 1) {
  35475. endOffset++;
  35476. ctxChars++;
  35477. if (content[endOffset] == "\n") {
  35478. if (++ctxLines == maxLines) {
  35479. break;
  35480. }
  35481. }
  35482. }
  35483. return {
  35484. before: content.substring(startOffset, this.offset),
  35485. after: content.substring(this.offset, endOffset + 1)
  35486. };
  35487. }
  35488. return null;
  35489. }
  35490. };
  35491. exports2.ParseLocation = ParseLocation;
  35492. var ParseSourceFile = class {
  35493. constructor(content, url) {
  35494. this.content = content;
  35495. this.url = url;
  35496. }
  35497. };
  35498. exports2.ParseSourceFile = ParseSourceFile;
  35499. var ParseSourceSpan = class {
  35500. constructor(start, end, details = null) {
  35501. this.start = start;
  35502. this.end = end;
  35503. this.details = details;
  35504. }
  35505. toString() {
  35506. return this.start.file.content.substring(this.start.offset, this.end.offset);
  35507. }
  35508. };
  35509. exports2.ParseSourceSpan = ParseSourceSpan;
  35510. exports2.EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile("", ""), 0, 0, 0);
  35511. exports2.EMPTY_SOURCE_SPAN = new ParseSourceSpan(exports2.EMPTY_PARSE_LOCATION, exports2.EMPTY_PARSE_LOCATION);
  35512. var ParseErrorLevel;
  35513. (function(ParseErrorLevel2) {
  35514. ParseErrorLevel2[ParseErrorLevel2["WARNING"] = 0] = "WARNING";
  35515. ParseErrorLevel2[ParseErrorLevel2["ERROR"] = 1] = "ERROR";
  35516. })(ParseErrorLevel = exports2.ParseErrorLevel || (exports2.ParseErrorLevel = {}));
  35517. var ParseError = class {
  35518. constructor(span, msg, level = ParseErrorLevel.ERROR) {
  35519. this.span = span;
  35520. this.msg = msg;
  35521. this.level = level;
  35522. }
  35523. contextualMessage() {
  35524. const ctx = this.span.start.getContext(100, 3);
  35525. return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
  35526. }
  35527. toString() {
  35528. const details = this.span.details ? `, ${this.span.details}` : "";
  35529. return `${this.contextualMessage()}: ${this.span.start}${details}`;
  35530. }
  35531. };
  35532. exports2.ParseError = ParseError;
  35533. function typeSourceSpan(kind, type) {
  35534. const moduleUrl = compile_metadata_1.identifierModuleUrl(type);
  35535. const sourceFileName = moduleUrl != null ? `in ${kind} ${compile_metadata_1.identifierName(type)} in ${moduleUrl}` : `in ${kind} ${compile_metadata_1.identifierName(type)}`;
  35536. const sourceFile = new ParseSourceFile("", sourceFileName);
  35537. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  35538. }
  35539. exports2.typeSourceSpan = typeSourceSpan;
  35540. function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
  35541. const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
  35542. const sourceFile = new ParseSourceFile("", sourceFileName);
  35543. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  35544. }
  35545. exports2.r3JitTypeSourceSpan = r3JitTypeSourceSpan;
  35546. }
  35547. });
  35548. var require_print_preprocess3 = __commonJS2({
  35549. "src/language-html/print-preprocess.js"(exports2, module2) {
  35550. "use strict";
  35551. var {
  35552. ParseSourceSpan
  35553. } = require_parse_util();
  35554. var {
  35555. htmlTrim,
  35556. getLeadingAndTrailingHtmlWhitespace,
  35557. hasHtmlWhitespace,
  35558. canHaveInterpolation,
  35559. getNodeCssStyleDisplay,
  35560. isDanglingSpaceSensitiveNode,
  35561. isIndentationSensitiveNode,
  35562. isLeadingSpaceSensitiveNode,
  35563. isTrailingSpaceSensitiveNode,
  35564. isWhitespaceSensitiveNode,
  35565. isVueScriptTag
  35566. } = require_utils11();
  35567. var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIfConditionalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText, markTsScript];
  35568. function preprocess(ast, options) {
  35569. for (const fn of PREPROCESS_PIPELINE) {
  35570. fn(ast, options);
  35571. }
  35572. return ast;
  35573. }
  35574. function removeIgnorableFirstLf(ast) {
  35575. ast.walk((node) => {
  35576. if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
  35577. const text = node.children[0];
  35578. if (text.value.length === 1) {
  35579. node.removeChild(text);
  35580. } else {
  35581. text.value = text.value.slice(1);
  35582. }
  35583. }
  35584. });
  35585. }
  35586. function mergeIfConditionalStartEndCommentIntoElementOpeningTag(ast) {
  35587. 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;
  35588. ast.walk((node) => {
  35589. if (node.children) {
  35590. for (let i = 0; i < node.children.length; i++) {
  35591. const child = node.children[i];
  35592. if (!isTarget(child)) {
  35593. continue;
  35594. }
  35595. const ieConditionalStartComment = child.prev;
  35596. const ieConditionalEndComment = child.firstChild;
  35597. node.removeChild(ieConditionalStartComment);
  35598. i--;
  35599. const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
  35600. const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
  35601. child.condition = ieConditionalStartComment.condition;
  35602. child.sourceSpan = sourceSpan;
  35603. child.startSourceSpan = startSourceSpan;
  35604. child.removeChild(ieConditionalEndComment);
  35605. }
  35606. }
  35607. });
  35608. }
  35609. function mergeNodeIntoText(ast, shouldMerge, getValue) {
  35610. ast.walk((node) => {
  35611. if (node.children) {
  35612. for (let i = 0; i < node.children.length; i++) {
  35613. const child = node.children[i];
  35614. if (child.type !== "text" && !shouldMerge(child)) {
  35615. continue;
  35616. }
  35617. if (child.type !== "text") {
  35618. child.type = "text";
  35619. child.value = getValue(child);
  35620. }
  35621. const prevChild = child.prev;
  35622. if (!prevChild || prevChild.type !== "text") {
  35623. continue;
  35624. }
  35625. prevChild.value += child.value;
  35626. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, child.sourceSpan.end);
  35627. node.removeChild(child);
  35628. i--;
  35629. }
  35630. }
  35631. });
  35632. }
  35633. function mergeCdataIntoText(ast) {
  35634. return mergeNodeIntoText(ast, (node) => node.type === "cdata", (node) => `<![CDATA[${node.value}]]>`);
  35635. }
  35636. function mergeSimpleElementIntoText(ast) {
  35637. 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";
  35638. ast.walk((node) => {
  35639. if (node.children) {
  35640. for (let i = 0; i < node.children.length; i++) {
  35641. const child = node.children[i];
  35642. if (!isSimpleElement(child)) {
  35643. continue;
  35644. }
  35645. const prevChild = child.prev;
  35646. const nextChild = child.next;
  35647. prevChild.value += `<${child.rawName}>` + child.firstChild.value + `</${child.rawName}>` + nextChild.value;
  35648. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, nextChild.sourceSpan.end);
  35649. prevChild.isTrailingSpaceSensitive = nextChild.isTrailingSpaceSensitive;
  35650. prevChild.hasTrailingSpaces = nextChild.hasTrailingSpaces;
  35651. node.removeChild(child);
  35652. i--;
  35653. node.removeChild(nextChild);
  35654. }
  35655. }
  35656. });
  35657. }
  35658. function extractInterpolation(ast, options) {
  35659. if (options.parser === "html") {
  35660. return;
  35661. }
  35662. const interpolationRegex = /{{(.+?)}}/s;
  35663. ast.walk((node) => {
  35664. if (!canHaveInterpolation(node)) {
  35665. return;
  35666. }
  35667. for (const child of node.children) {
  35668. if (child.type !== "text") {
  35669. continue;
  35670. }
  35671. let startSourceSpan = child.sourceSpan.start;
  35672. let endSourceSpan = null;
  35673. const components = child.value.split(interpolationRegex);
  35674. for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
  35675. const value = components[i];
  35676. if (i % 2 === 0) {
  35677. endSourceSpan = startSourceSpan.moveBy(value.length);
  35678. if (value.length > 0) {
  35679. node.insertChildBefore(child, {
  35680. type: "text",
  35681. value,
  35682. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
  35683. });
  35684. }
  35685. continue;
  35686. }
  35687. endSourceSpan = startSourceSpan.moveBy(value.length + 4);
  35688. node.insertChildBefore(child, {
  35689. type: "interpolation",
  35690. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
  35691. children: value.length === 0 ? [] : [{
  35692. type: "text",
  35693. value,
  35694. sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
  35695. }]
  35696. });
  35697. }
  35698. node.removeChild(child);
  35699. }
  35700. });
  35701. }
  35702. function extractWhitespaces(ast) {
  35703. ast.walk((node) => {
  35704. if (!node.children) {
  35705. return;
  35706. }
  35707. if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim(node.children[0].value).length === 0) {
  35708. node.hasDanglingSpaces = node.children.length > 0;
  35709. node.children = [];
  35710. return;
  35711. }
  35712. const isWhitespaceSensitive = isWhitespaceSensitiveNode(node);
  35713. const isIndentationSensitive = isIndentationSensitiveNode(node);
  35714. if (!isWhitespaceSensitive) {
  35715. for (let i = 0; i < node.children.length; i++) {
  35716. const child = node.children[i];
  35717. if (child.type !== "text") {
  35718. continue;
  35719. }
  35720. const {
  35721. leadingWhitespace,
  35722. text,
  35723. trailingWhitespace
  35724. } = getLeadingAndTrailingHtmlWhitespace(child.value);
  35725. const prevChild = child.prev;
  35726. const nextChild = child.next;
  35727. if (!text) {
  35728. node.removeChild(child);
  35729. i--;
  35730. if (leadingWhitespace || trailingWhitespace) {
  35731. if (prevChild) {
  35732. prevChild.hasTrailingSpaces = true;
  35733. }
  35734. if (nextChild) {
  35735. nextChild.hasLeadingSpaces = true;
  35736. }
  35737. }
  35738. } else {
  35739. child.value = text;
  35740. child.sourceSpan = new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length));
  35741. if (leadingWhitespace) {
  35742. if (prevChild) {
  35743. prevChild.hasTrailingSpaces = true;
  35744. }
  35745. child.hasLeadingSpaces = true;
  35746. }
  35747. if (trailingWhitespace) {
  35748. child.hasTrailingSpaces = true;
  35749. if (nextChild) {
  35750. nextChild.hasLeadingSpaces = true;
  35751. }
  35752. }
  35753. }
  35754. }
  35755. }
  35756. node.isWhitespaceSensitive = isWhitespaceSensitive;
  35757. node.isIndentationSensitive = isIndentationSensitive;
  35758. });
  35759. }
  35760. function addIsSelfClosing(ast) {
  35761. ast.walk((node) => {
  35762. node.isSelfClosing = !node.children || node.type === "element" && (node.tagDefinition.isVoid || node.startSourceSpan === node.endSourceSpan);
  35763. });
  35764. }
  35765. function addHasHtmComponentClosingTag(ast, options) {
  35766. ast.walk((node) => {
  35767. if (node.type !== "element") {
  35768. return;
  35769. }
  35770. node.hasHtmComponentClosingTag = node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset));
  35771. });
  35772. }
  35773. function addCssDisplay(ast, options) {
  35774. ast.walk((node) => {
  35775. node.cssDisplay = getNodeCssStyleDisplay(node, options);
  35776. });
  35777. }
  35778. function addIsSpaceSensitive(ast, options) {
  35779. ast.walk((node) => {
  35780. const {
  35781. children
  35782. } = node;
  35783. if (!children) {
  35784. return;
  35785. }
  35786. if (children.length === 0) {
  35787. node.isDanglingSpaceSensitive = isDanglingSpaceSensitiveNode(node);
  35788. return;
  35789. }
  35790. for (const child of children) {
  35791. child.isLeadingSpaceSensitive = isLeadingSpaceSensitiveNode(child, options);
  35792. child.isTrailingSpaceSensitive = isTrailingSpaceSensitiveNode(child, options);
  35793. }
  35794. for (let index = 0; index < children.length; index++) {
  35795. const child = children[index];
  35796. child.isLeadingSpaceSensitive = index === 0 ? child.isLeadingSpaceSensitive : child.prev.isTrailingSpaceSensitive && child.isLeadingSpaceSensitive;
  35797. child.isTrailingSpaceSensitive = index === children.length - 1 ? child.isTrailingSpaceSensitive : child.next.isLeadingSpaceSensitive && child.isTrailingSpaceSensitive;
  35798. }
  35799. });
  35800. }
  35801. function markTsScript(ast, options) {
  35802. if (options.parser === "vue") {
  35803. const vueScriptTag = ast.children.find((child) => isVueScriptTag(child, options));
  35804. if (!vueScriptTag) {
  35805. return;
  35806. }
  35807. const {
  35808. lang
  35809. } = vueScriptTag.attrMap;
  35810. if (lang === "ts" || lang === "typescript") {
  35811. options.__should_parse_vue_template_with_ts = true;
  35812. }
  35813. }
  35814. }
  35815. module2.exports = preprocess;
  35816. }
  35817. });
  35818. var require_pragma5 = __commonJS2({
  35819. "src/language-html/pragma.js"(exports2, module2) {
  35820. "use strict";
  35821. function hasPragma(text) {
  35822. return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text);
  35823. }
  35824. function insertPragma(text) {
  35825. return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
  35826. }
  35827. module2.exports = {
  35828. hasPragma,
  35829. insertPragma
  35830. };
  35831. }
  35832. });
  35833. var require_loc6 = __commonJS2({
  35834. "src/language-html/loc.js"(exports2, module2) {
  35835. "use strict";
  35836. function locStart(node) {
  35837. return node.sourceSpan.start.offset;
  35838. }
  35839. function locEnd(node) {
  35840. return node.sourceSpan.end.offset;
  35841. }
  35842. module2.exports = {
  35843. locStart,
  35844. locEnd
  35845. };
  35846. }
  35847. });
  35848. var require_tag = __commonJS2({
  35849. "src/language-html/print/tag.js"(exports2, module2) {
  35850. "use strict";
  35851. var assert = require("assert");
  35852. var {
  35853. isNonEmptyArray
  35854. } = require_util();
  35855. var {
  35856. builders: {
  35857. indent,
  35858. join,
  35859. line,
  35860. softline,
  35861. hardline
  35862. },
  35863. utils: {
  35864. replaceTextEndOfLine
  35865. }
  35866. } = require("./doc.js");
  35867. var {
  35868. locStart,
  35869. locEnd
  35870. } = require_loc6();
  35871. var {
  35872. isTextLikeNode,
  35873. getLastDescendant,
  35874. isPreLikeNode,
  35875. hasPrettierIgnore,
  35876. shouldPreserveContent,
  35877. isVueSfcBlock
  35878. } = require_utils11();
  35879. function printClosingTag(node, options) {
  35880. return [node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)];
  35881. }
  35882. function printClosingTagStart(node, options) {
  35883. return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : [printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)];
  35884. }
  35885. function printClosingTagEnd(node, options) {
  35886. return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : [printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)];
  35887. }
  35888. function printClosingTagPrefix(node, options) {
  35889. return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
  35890. }
  35891. function printClosingTagSuffix(node, options) {
  35892. return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
  35893. }
  35894. function printClosingTagStartMarker(node, options) {
  35895. assert(!node.isSelfClosing);
  35896. if (shouldNotPrintClosingTag(node, options)) {
  35897. return "";
  35898. }
  35899. switch (node.type) {
  35900. case "ieConditionalComment":
  35901. return "<!";
  35902. case "element":
  35903. if (node.hasHtmComponentClosingTag) {
  35904. return "<//";
  35905. }
  35906. default:
  35907. return `</${node.rawName}`;
  35908. }
  35909. }
  35910. function printClosingTagEndMarker(node, options) {
  35911. if (shouldNotPrintClosingTag(node, options)) {
  35912. return "";
  35913. }
  35914. switch (node.type) {
  35915. case "ieConditionalComment":
  35916. case "ieConditionalEndComment":
  35917. return "[endif]-->";
  35918. case "ieConditionalStartComment":
  35919. return "]><!-->";
  35920. case "interpolation":
  35921. return "}}";
  35922. case "element":
  35923. if (node.isSelfClosing) {
  35924. return "/>";
  35925. }
  35926. default:
  35927. return ">";
  35928. }
  35929. }
  35930. function shouldNotPrintClosingTag(node, options) {
  35931. return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore(node) || shouldPreserveContent(node.parent, options));
  35932. }
  35933. function needsToBorrowPrevClosingTagEndMarker(node) {
  35934. return node.prev && node.prev.type !== "docType" && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  35935. }
  35936. function needsToBorrowLastChildClosingTagEndMarker(node) {
  35937. return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild)) && !isPreLikeNode(node);
  35938. }
  35939. function needsToBorrowParentClosingTagStartMarker(node) {
  35940. return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
  35941. }
  35942. function needsToBorrowNextOpeningTagStartMarker(node) {
  35943. return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
  35944. }
  35945. function getPrettierIgnoreAttributeCommentData(value) {
  35946. const match = value.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);
  35947. if (!match) {
  35948. return false;
  35949. }
  35950. if (!match[1]) {
  35951. return true;
  35952. }
  35953. return match[1].split(/\s+/);
  35954. }
  35955. function needsToBorrowParentOpeningTagEndMarker(node) {
  35956. return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  35957. }
  35958. function printAttributes(path, options, print) {
  35959. const node = path.getValue();
  35960. if (!isNonEmptyArray(node.attrs)) {
  35961. return node.isSelfClosing ? " " : "";
  35962. }
  35963. const ignoreAttributeData = node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData(node.prev.value);
  35964. const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? (attribute) => ignoreAttributeData.includes(attribute.rawName) : () => false;
  35965. const printedAttributes = path.map((attributePath) => {
  35966. const attribute = attributePath.getValue();
  35967. return hasPrettierIgnoreAttribute(attribute) ? replaceTextEndOfLine(options.originalText.slice(locStart(attribute), locEnd(attribute))) : print();
  35968. }, "attrs");
  35969. const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
  35970. const shouldPrintAttributePerLine = options.singleAttributePerLine && node.attrs.length > 1 && !isVueSfcBlock(node, options);
  35971. const attributeLine = shouldPrintAttributePerLine ? hardline : line;
  35972. const parts = [indent([forceNotToBreakAttrContent ? " " : line, join(attributeLine, printedAttributes)])];
  35973. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) || node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) || forceNotToBreakAttrContent) {
  35974. parts.push(node.isSelfClosing ? " " : "");
  35975. } else {
  35976. parts.push(options.bracketSameLine ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? line : softline);
  35977. }
  35978. return parts;
  35979. }
  35980. function printOpeningTagEnd(node) {
  35981. return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
  35982. }
  35983. function printOpeningTag(path, options, print) {
  35984. const node = path.getValue();
  35985. return [printOpeningTagStart(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)];
  35986. }
  35987. function printOpeningTagStart(node, options) {
  35988. return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : [printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)];
  35989. }
  35990. function printOpeningTagPrefix(node, options) {
  35991. return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
  35992. }
  35993. function printOpeningTagStartMarker(node) {
  35994. switch (node.type) {
  35995. case "ieConditionalComment":
  35996. case "ieConditionalStartComment":
  35997. return `<!--[if ${node.condition}`;
  35998. case "ieConditionalEndComment":
  35999. return "<!--<!";
  36000. case "interpolation":
  36001. return "{{";
  36002. case "docType":
  36003. return "<!DOCTYPE";
  36004. case "element":
  36005. if (node.condition) {
  36006. return `<!--[if ${node.condition}]><!--><${node.rawName}`;
  36007. }
  36008. default:
  36009. return `<${node.rawName}`;
  36010. }
  36011. }
  36012. function printOpeningTagEndMarker(node) {
  36013. assert(!node.isSelfClosing);
  36014. switch (node.type) {
  36015. case "ieConditionalComment":
  36016. return "]>";
  36017. case "element":
  36018. if (node.condition) {
  36019. return "><!--<![endif]-->";
  36020. }
  36021. default:
  36022. return ">";
  36023. }
  36024. }
  36025. module2.exports = {
  36026. printClosingTag,
  36027. printClosingTagStart,
  36028. printClosingTagStartMarker,
  36029. printClosingTagEndMarker,
  36030. printClosingTagSuffix,
  36031. printClosingTagEnd,
  36032. needsToBorrowLastChildClosingTagEndMarker,
  36033. needsToBorrowParentClosingTagStartMarker,
  36034. needsToBorrowPrevClosingTagEndMarker,
  36035. printOpeningTag,
  36036. printOpeningTagStart,
  36037. printOpeningTagPrefix,
  36038. printOpeningTagStartMarker,
  36039. printOpeningTagEndMarker,
  36040. needsToBorrowNextOpeningTagStartMarker,
  36041. needsToBorrowParentOpeningTagEndMarker
  36042. };
  36043. }
  36044. });
  36045. var require_parse_srcset = __commonJS2({
  36046. "node_modules/parse-srcset/src/parse-srcset.js"(exports2, module2) {
  36047. (function(root, factory) {
  36048. if (typeof define === "function" && define.amd) {
  36049. define([], factory);
  36050. } else if (typeof module2 === "object" && module2.exports) {
  36051. module2.exports = factory();
  36052. } else {
  36053. root.parseSrcset = factory();
  36054. }
  36055. })(exports2, function() {
  36056. return function(input, options) {
  36057. var logger = options && options.logger || console;
  36058. function isSpace(c2) {
  36059. return c2 === " " || c2 === " " || c2 === "\n" || c2 === "\f" || c2 === "\r";
  36060. }
  36061. function collectCharacters(regEx) {
  36062. var chars, match = regEx.exec(input.substring(pos));
  36063. if (match) {
  36064. chars = match[0];
  36065. pos += chars.length;
  36066. return chars;
  36067. }
  36068. }
  36069. 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 = [];
  36070. while (true) {
  36071. collectCharacters(regexLeadingCommasOrSpaces);
  36072. if (pos >= inputLength) {
  36073. return candidates;
  36074. }
  36075. url = collectCharacters(regexLeadingNotSpaces);
  36076. descriptors = [];
  36077. if (url.slice(-1) === ",") {
  36078. url = url.replace(regexTrailingCommas, "");
  36079. parseDescriptors();
  36080. } else {
  36081. tokenize();
  36082. }
  36083. }
  36084. function tokenize() {
  36085. collectCharacters(regexLeadingSpaces);
  36086. currentDescriptor = "";
  36087. state = "in descriptor";
  36088. while (true) {
  36089. c = input.charAt(pos);
  36090. if (state === "in descriptor") {
  36091. if (isSpace(c)) {
  36092. if (currentDescriptor) {
  36093. descriptors.push(currentDescriptor);
  36094. currentDescriptor = "";
  36095. state = "after descriptor";
  36096. }
  36097. } else if (c === ",") {
  36098. pos += 1;
  36099. if (currentDescriptor) {
  36100. descriptors.push(currentDescriptor);
  36101. }
  36102. parseDescriptors();
  36103. return;
  36104. } else if (c === "(") {
  36105. currentDescriptor = currentDescriptor + c;
  36106. state = "in parens";
  36107. } else if (c === "") {
  36108. if (currentDescriptor) {
  36109. descriptors.push(currentDescriptor);
  36110. }
  36111. parseDescriptors();
  36112. return;
  36113. } else {
  36114. currentDescriptor = currentDescriptor + c;
  36115. }
  36116. } else if (state === "in parens") {
  36117. if (c === ")") {
  36118. currentDescriptor = currentDescriptor + c;
  36119. state = "in descriptor";
  36120. } else if (c === "") {
  36121. descriptors.push(currentDescriptor);
  36122. parseDescriptors();
  36123. return;
  36124. } else {
  36125. currentDescriptor = currentDescriptor + c;
  36126. }
  36127. } else if (state === "after descriptor") {
  36128. if (isSpace(c)) {
  36129. } else if (c === "") {
  36130. parseDescriptors();
  36131. return;
  36132. } else {
  36133. state = "in descriptor";
  36134. pos -= 1;
  36135. }
  36136. }
  36137. pos += 1;
  36138. }
  36139. }
  36140. function parseDescriptors() {
  36141. var pError = false, w, d, h, i, candidate = {}, desc, lastChar, value, intVal, floatVal;
  36142. for (i = 0; i < descriptors.length; i++) {
  36143. desc = descriptors[i];
  36144. lastChar = desc[desc.length - 1];
  36145. value = desc.substring(0, desc.length - 1);
  36146. intVal = parseInt(value, 10);
  36147. floatVal = parseFloat(value);
  36148. if (regexNonNegativeInteger.test(value) && lastChar === "w") {
  36149. if (w || d) {
  36150. pError = true;
  36151. }
  36152. if (intVal === 0) {
  36153. pError = true;
  36154. } else {
  36155. w = intVal;
  36156. }
  36157. } else if (regexFloatingPoint.test(value) && lastChar === "x") {
  36158. if (w || d || h) {
  36159. pError = true;
  36160. }
  36161. if (floatVal < 0) {
  36162. pError = true;
  36163. } else {
  36164. d = floatVal;
  36165. }
  36166. } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
  36167. if (h || d) {
  36168. pError = true;
  36169. }
  36170. if (intVal === 0) {
  36171. pError = true;
  36172. } else {
  36173. h = intVal;
  36174. }
  36175. } else {
  36176. pError = true;
  36177. }
  36178. }
  36179. if (!pError) {
  36180. candidate.url = url;
  36181. if (w) {
  36182. candidate.w = w;
  36183. }
  36184. if (d) {
  36185. candidate.d = d;
  36186. }
  36187. if (h) {
  36188. candidate.h = h;
  36189. }
  36190. candidates.push(candidate);
  36191. } else if (logger && logger.error) {
  36192. logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
  36193. }
  36194. }
  36195. };
  36196. });
  36197. }
  36198. });
  36199. var require_syntax_attribute = __commonJS2({
  36200. "src/language-html/syntax-attribute.js"(exports2, module2) {
  36201. "use strict";
  36202. var parseSrcset = require_parse_srcset();
  36203. var {
  36204. builders: {
  36205. ifBreak,
  36206. join,
  36207. line
  36208. }
  36209. } = require("./doc.js");
  36210. function printImgSrcset(value) {
  36211. const srcset = parseSrcset(value, {
  36212. logger: {
  36213. error(message) {
  36214. throw new Error(message);
  36215. }
  36216. }
  36217. });
  36218. const hasW = srcset.some(({
  36219. w
  36220. }) => w);
  36221. const hasH = srcset.some(({
  36222. h
  36223. }) => h);
  36224. const hasX = srcset.some(({
  36225. d
  36226. }) => d);
  36227. if (hasW + hasH + hasX > 1) {
  36228. throw new Error("Mixed descriptor in srcset is not supported");
  36229. }
  36230. const key = hasW ? "w" : hasH ? "h" : "d";
  36231. const unit = hasW ? "w" : hasH ? "h" : "x";
  36232. const getMax = (values) => Math.max(...values);
  36233. const urls = srcset.map((src) => src.url);
  36234. const maxUrlLength = getMax(urls.map((url) => url.length));
  36235. const descriptors = srcset.map((src) => src[key]).map((descriptor) => descriptor ? descriptor.toString() : "");
  36236. const descriptorLeftLengths = descriptors.map((descriptor) => {
  36237. const index = descriptor.indexOf(".");
  36238. return index === -1 ? descriptor.length : index;
  36239. });
  36240. const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
  36241. return join([",", line], urls.map((url, index) => {
  36242. const parts = [url];
  36243. const descriptor = descriptors[index];
  36244. if (descriptor) {
  36245. const urlPadding = maxUrlLength - url.length + 1;
  36246. const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
  36247. const alignment = " ".repeat(urlPadding + descriptorPadding);
  36248. parts.push(ifBreak(alignment, " "), descriptor + unit);
  36249. }
  36250. return parts;
  36251. }));
  36252. }
  36253. function printClassNames(value) {
  36254. return value.trim().split(/\s+/).join(" ");
  36255. }
  36256. module2.exports = {
  36257. printImgSrcset,
  36258. printClassNames
  36259. };
  36260. }
  36261. });
  36262. var require_syntax_vue = __commonJS2({
  36263. "src/language-html/syntax-vue.js"(exports2, module2) {
  36264. "use strict";
  36265. var {
  36266. builders: {
  36267. group
  36268. }
  36269. } = require("./doc.js");
  36270. function printVueFor(value, textToDoc) {
  36271. const {
  36272. left,
  36273. operator,
  36274. right
  36275. } = parseVueFor(value);
  36276. return [group(textToDoc(`function _(${left}) {}`, {
  36277. parser: "babel",
  36278. __isVueForBindingLeft: true
  36279. })), " ", operator, " ", textToDoc(right, {
  36280. parser: "__js_expression"
  36281. }, {
  36282. stripTrailingHardline: true
  36283. })];
  36284. }
  36285. function parseVueFor(value) {
  36286. const forAliasRE = /(.*?)\s+(in|of)\s+(.*)/s;
  36287. const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/;
  36288. const stripParensRE = /^\(|\)$/g;
  36289. const inMatch = value.match(forAliasRE);
  36290. if (!inMatch) {
  36291. return;
  36292. }
  36293. const res = {};
  36294. res.for = inMatch[3].trim();
  36295. if (!res.for) {
  36296. return;
  36297. }
  36298. const alias = inMatch[1].trim().replace(stripParensRE, "");
  36299. const iteratorMatch = alias.match(forIteratorRE);
  36300. if (iteratorMatch) {
  36301. res.alias = alias.replace(forIteratorRE, "");
  36302. res.iterator1 = iteratorMatch[1].trim();
  36303. if (iteratorMatch[2]) {
  36304. res.iterator2 = iteratorMatch[2].trim();
  36305. }
  36306. } else {
  36307. res.alias = alias;
  36308. }
  36309. const left = [res.alias, res.iterator1, res.iterator2];
  36310. if (left.some((part, index) => !part && (index === 0 || left.slice(index + 1).some(Boolean)))) {
  36311. return;
  36312. }
  36313. return {
  36314. left: left.filter(Boolean).join(","),
  36315. operator: inMatch[2],
  36316. right: res.for
  36317. };
  36318. }
  36319. function printVueBindings(value, textToDoc) {
  36320. return textToDoc(`function _(${value}) {}`, {
  36321. parser: "babel",
  36322. __isVueBindings: true
  36323. });
  36324. }
  36325. function isVueEventBindingExpression(eventBindingValue) {
  36326. const fnExpRE = /^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/;
  36327. const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
  36328. const value = eventBindingValue.trim();
  36329. return fnExpRE.test(value) || simplePathRE.test(value);
  36330. }
  36331. module2.exports = {
  36332. isVueEventBindingExpression,
  36333. printVueFor,
  36334. printVueBindings
  36335. };
  36336. }
  36337. });
  36338. var require_get_node_content = __commonJS2({
  36339. "src/language-html/get-node-content.js"(exports2, module2) {
  36340. "use strict";
  36341. var {
  36342. needsToBorrowParentClosingTagStartMarker,
  36343. printClosingTagStartMarker,
  36344. needsToBorrowLastChildClosingTagEndMarker,
  36345. printClosingTagEndMarker,
  36346. needsToBorrowParentOpeningTagEndMarker,
  36347. printOpeningTagEndMarker
  36348. } = require_tag();
  36349. function getNodeContent(node, options) {
  36350. let start = node.startSourceSpan.end.offset;
  36351. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild)) {
  36352. start -= printOpeningTagEndMarker(node).length;
  36353. }
  36354. let end = node.endSourceSpan.start.offset;
  36355. if (node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild)) {
  36356. end += printClosingTagStartMarker(node, options).length;
  36357. } else if (needsToBorrowLastChildClosingTagEndMarker(node)) {
  36358. end -= printClosingTagEndMarker(node.lastChild, options).length;
  36359. }
  36360. return options.originalText.slice(start, end);
  36361. }
  36362. module2.exports = getNodeContent;
  36363. }
  36364. });
  36365. var require_embed4 = __commonJS2({
  36366. "src/language-html/embed.js"(exports2, module2) {
  36367. "use strict";
  36368. var {
  36369. builders: {
  36370. breakParent,
  36371. group,
  36372. hardline,
  36373. indent,
  36374. line,
  36375. fill,
  36376. softline
  36377. },
  36378. utils: {
  36379. mapDoc,
  36380. replaceTextEndOfLine
  36381. }
  36382. } = require("./doc.js");
  36383. var printFrontMatter = require_print();
  36384. var {
  36385. printClosingTag,
  36386. printClosingTagSuffix,
  36387. needsToBorrowPrevClosingTagEndMarker,
  36388. printOpeningTagPrefix,
  36389. printOpeningTag
  36390. } = require_tag();
  36391. var {
  36392. printImgSrcset,
  36393. printClassNames
  36394. } = require_syntax_attribute();
  36395. var {
  36396. printVueFor,
  36397. printVueBindings,
  36398. isVueEventBindingExpression
  36399. } = require_syntax_vue();
  36400. var {
  36401. isScriptLikeTag,
  36402. isVueNonHtmlBlock,
  36403. inferScriptParser,
  36404. htmlTrimPreserveIndentation,
  36405. dedentString,
  36406. unescapeQuoteEntities,
  36407. isVueSlotAttribute,
  36408. isVueSfcBindingsAttribute,
  36409. getTextValueParts
  36410. } = require_utils11();
  36411. var getNodeContent = require_get_node_content();
  36412. function printEmbeddedAttributeValue(node, htmlTextToDoc, options) {
  36413. const isKeyMatched = (patterns) => new RegExp(patterns.join("|")).test(node.fullName);
  36414. const getValue = () => unescapeQuoteEntities(node.value);
  36415. let shouldHug = false;
  36416. const __onHtmlBindingRoot = (root, options2) => {
  36417. 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;
  36418. if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options2.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
  36419. shouldHug = true;
  36420. }
  36421. };
  36422. const printHug = (doc2) => group(doc2);
  36423. const printExpand = (doc2, canHaveTrailingWhitespace = true) => group([indent([softline, doc2]), canHaveTrailingWhitespace ? softline : ""]);
  36424. const printMaybeHug = (doc2) => shouldHug ? printHug(doc2) : printExpand(doc2);
  36425. const attributeTextToDoc = (code, opts) => htmlTextToDoc(code, Object.assign({
  36426. __onHtmlBindingRoot,
  36427. __embeddedInHtml: true
  36428. }, opts));
  36429. if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
  36430. return printExpand(printImgSrcset(getValue()));
  36431. }
  36432. if (node.fullName === "class" && !options.parentParser) {
  36433. const value = getValue();
  36434. if (!value.includes("{{")) {
  36435. return printClassNames(value);
  36436. }
  36437. }
  36438. if (node.fullName === "style" && !options.parentParser) {
  36439. const value = getValue();
  36440. if (!value.includes("{{")) {
  36441. return printExpand(attributeTextToDoc(value, {
  36442. parser: "css",
  36443. __isHTMLStyleAttribute: true
  36444. }));
  36445. }
  36446. }
  36447. if (options.parser === "vue") {
  36448. if (node.fullName === "v-for") {
  36449. return printVueFor(getValue(), attributeTextToDoc);
  36450. }
  36451. if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
  36452. return printVueBindings(getValue(), attributeTextToDoc);
  36453. }
  36454. const vueEventBindingPatterns = ["^@", "^v-on:"];
  36455. const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
  36456. const jsExpressionBindingPatterns = ["^v-"];
  36457. if (isKeyMatched(vueEventBindingPatterns)) {
  36458. const value = getValue();
  36459. const parser = isVueEventBindingExpression(value) ? "__js_expression" : options.__should_parse_vue_template_with_ts ? "__vue_ts_event_binding" : "__vue_event_binding";
  36460. return printMaybeHug(attributeTextToDoc(value, {
  36461. parser
  36462. }));
  36463. }
  36464. if (isKeyMatched(vueExpressionBindingPatterns)) {
  36465. return printMaybeHug(attributeTextToDoc(getValue(), {
  36466. parser: "__vue_expression"
  36467. }));
  36468. }
  36469. if (isKeyMatched(jsExpressionBindingPatterns)) {
  36470. return printMaybeHug(attributeTextToDoc(getValue(), {
  36471. parser: "__js_expression"
  36472. }));
  36473. }
  36474. }
  36475. if (options.parser === "angular") {
  36476. const ngTextToDoc = (code, opts) => attributeTextToDoc(code, Object.assign(Object.assign({}, opts), {}, {
  36477. trailingComma: "none"
  36478. }));
  36479. const ngDirectiveBindingPatterns = ["^\\*"];
  36480. const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
  36481. const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", "^ng-(if|show|hide|class|style)$"];
  36482. const ngI18nPatterns = ["^i18n(-.+)?$"];
  36483. if (isKeyMatched(ngStatementBindingPatterns)) {
  36484. return printMaybeHug(ngTextToDoc(getValue(), {
  36485. parser: "__ng_action"
  36486. }));
  36487. }
  36488. if (isKeyMatched(ngExpressionBindingPatterns)) {
  36489. return printMaybeHug(ngTextToDoc(getValue(), {
  36490. parser: "__ng_binding"
  36491. }));
  36492. }
  36493. if (isKeyMatched(ngI18nPatterns)) {
  36494. const value2 = getValue().trim();
  36495. return printExpand(fill(getTextValueParts(node, value2)), !value2.includes("@@"));
  36496. }
  36497. if (isKeyMatched(ngDirectiveBindingPatterns)) {
  36498. return printMaybeHug(ngTextToDoc(getValue(), {
  36499. parser: "__ng_directive"
  36500. }));
  36501. }
  36502. const interpolationRegex = /{{(.+?)}}/s;
  36503. const value = getValue();
  36504. if (interpolationRegex.test(value)) {
  36505. const parts = [];
  36506. for (const [index, part] of value.split(interpolationRegex).entries()) {
  36507. if (index % 2 === 0) {
  36508. parts.push(replaceTextEndOfLine(part));
  36509. } else {
  36510. try {
  36511. parts.push(group(["{{", indent([line, ngTextToDoc(part, {
  36512. parser: "__ng_interpolation",
  36513. __isInHtmlInterpolation: true
  36514. })]), line, "}}"]));
  36515. } catch {
  36516. parts.push("{{", replaceTextEndOfLine(part), "}}");
  36517. }
  36518. }
  36519. }
  36520. return group(parts);
  36521. }
  36522. }
  36523. return null;
  36524. }
  36525. function embed(path, print, textToDoc, options) {
  36526. const node = path.getValue();
  36527. switch (node.type) {
  36528. case "element": {
  36529. if (isScriptLikeTag(node) || node.type === "interpolation") {
  36530. return;
  36531. }
  36532. if (!node.isSelfClosing && isVueNonHtmlBlock(node, options)) {
  36533. const parser = inferScriptParser(node, options);
  36534. if (!parser) {
  36535. return;
  36536. }
  36537. const content = getNodeContent(node, options);
  36538. let isEmpty = /^\s*$/.test(content);
  36539. let doc2 = "";
  36540. if (!isEmpty) {
  36541. doc2 = textToDoc(htmlTrimPreserveIndentation(content), {
  36542. parser,
  36543. __embeddedInHtml: true
  36544. }, {
  36545. stripTrailingHardline: true
  36546. });
  36547. isEmpty = doc2 === "";
  36548. }
  36549. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), isEmpty ? "" : hardline, doc2, isEmpty ? "" : hardline, printClosingTag(node, options), printClosingTagSuffix(node, options)];
  36550. }
  36551. break;
  36552. }
  36553. case "text": {
  36554. if (isScriptLikeTag(node.parent)) {
  36555. const parser = inferScriptParser(node.parent, options);
  36556. if (parser) {
  36557. const value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*\n/, "")) : node.value;
  36558. const textToDocOptions = {
  36559. parser,
  36560. __embeddedInHtml: true
  36561. };
  36562. if (options.parser === "html" && parser === "babel") {
  36563. let sourceType = "script";
  36564. const {
  36565. attrMap
  36566. } = node.parent;
  36567. if (attrMap && (attrMap.type === "module" || attrMap.type === "text/babel" && attrMap["data-type"] === "module")) {
  36568. sourceType = "module";
  36569. }
  36570. textToDocOptions.__babelSourceType = sourceType;
  36571. }
  36572. return [breakParent, printOpeningTagPrefix(node, options), textToDoc(value, textToDocOptions, {
  36573. stripTrailingHardline: true
  36574. }), printClosingTagSuffix(node, options)];
  36575. }
  36576. } else if (node.parent.type === "interpolation") {
  36577. const textToDocOptions = {
  36578. __isInHtmlInterpolation: true,
  36579. __embeddedInHtml: true
  36580. };
  36581. if (options.parser === "angular") {
  36582. textToDocOptions.parser = "__ng_interpolation";
  36583. textToDocOptions.trailingComma = "none";
  36584. } else if (options.parser === "vue") {
  36585. textToDocOptions.parser = options.__should_parse_vue_template_with_ts ? "__vue_ts_expression" : "__vue_expression";
  36586. } else {
  36587. textToDocOptions.parser = "__js_expression";
  36588. }
  36589. return [indent([line, textToDoc(node.value, textToDocOptions, {
  36590. stripTrailingHardline: true
  36591. })]), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line];
  36592. }
  36593. break;
  36594. }
  36595. case "attribute": {
  36596. if (!node.value) {
  36597. break;
  36598. }
  36599. if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  36600. return [node.rawName, "=", node.value];
  36601. }
  36602. if (options.parser === "lwc") {
  36603. const interpolationRegex = /^{.*}$/s;
  36604. if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  36605. return [node.rawName, "=", node.value];
  36606. }
  36607. }
  36608. const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => textToDoc(code, Object.assign({
  36609. __isInHtmlAttribute: true,
  36610. __embeddedInHtml: true
  36611. }, opts), {
  36612. stripTrailingHardline: true
  36613. }), options);
  36614. if (embeddedAttributeValueDoc) {
  36615. return [node.rawName, '="', group(mapDoc(embeddedAttributeValueDoc, (doc2) => typeof doc2 === "string" ? doc2.replace(/"/g, "&quot;") : doc2)), '"'];
  36616. }
  36617. break;
  36618. }
  36619. case "front-matter":
  36620. return printFrontMatter(node, textToDoc);
  36621. }
  36622. }
  36623. module2.exports = embed;
  36624. }
  36625. });
  36626. var require_children = __commonJS2({
  36627. "src/language-html/print/children.js"(exports2, module2) {
  36628. "use strict";
  36629. var {
  36630. builders: {
  36631. breakParent,
  36632. group,
  36633. ifBreak,
  36634. line,
  36635. softline,
  36636. hardline
  36637. },
  36638. utils: {
  36639. replaceTextEndOfLine
  36640. }
  36641. } = require("./doc.js");
  36642. var {
  36643. locStart,
  36644. locEnd
  36645. } = require_loc6();
  36646. var {
  36647. forceBreakChildren,
  36648. forceNextEmptyLine,
  36649. isTextLikeNode,
  36650. hasPrettierIgnore,
  36651. preferHardlineAsLeadingSpaces
  36652. } = require_utils11();
  36653. var {
  36654. printOpeningTagPrefix,
  36655. needsToBorrowNextOpeningTagStartMarker,
  36656. printOpeningTagStartMarker,
  36657. needsToBorrowPrevClosingTagEndMarker,
  36658. printClosingTagEndMarker,
  36659. printClosingTagSuffix,
  36660. needsToBorrowParentClosingTagStartMarker
  36661. } = require_tag();
  36662. function printChild(childPath, options, print) {
  36663. const child = childPath.getValue();
  36664. if (hasPrettierIgnore(child)) {
  36665. 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)];
  36666. }
  36667. return print();
  36668. }
  36669. function printBetweenLine(prevNode, nextNode) {
  36670. 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;
  36671. }
  36672. function printChildren(path, options, print) {
  36673. const node = path.getValue();
  36674. if (forceBreakChildren(node)) {
  36675. return [breakParent, ...path.map((childPath) => {
  36676. const childNode = childPath.getValue();
  36677. const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
  36678. return [!prevBetweenLine ? "" : [prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline : ""], printChild(childPath, options, print)];
  36679. }, "children")];
  36680. }
  36681. const groupIds = node.children.map(() => Symbol(""));
  36682. return path.map((childPath, childIndex) => {
  36683. const childNode = childPath.getValue();
  36684. if (isTextLikeNode(childNode)) {
  36685. if (childNode.prev && isTextLikeNode(childNode.prev)) {
  36686. const prevBetweenLine2 = printBetweenLine(childNode.prev, childNode);
  36687. if (prevBetweenLine2) {
  36688. if (forceNextEmptyLine(childNode.prev)) {
  36689. return [hardline, hardline, printChild(childPath, options, print)];
  36690. }
  36691. return [prevBetweenLine2, printChild(childPath, options, print)];
  36692. }
  36693. }
  36694. return printChild(childPath, options, print);
  36695. }
  36696. const prevParts = [];
  36697. const leadingParts = [];
  36698. const trailingParts = [];
  36699. const nextParts = [];
  36700. const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
  36701. const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
  36702. if (prevBetweenLine) {
  36703. if (forceNextEmptyLine(childNode.prev)) {
  36704. prevParts.push(hardline, hardline);
  36705. } else if (prevBetweenLine === hardline) {
  36706. prevParts.push(hardline);
  36707. } else {
  36708. if (isTextLikeNode(childNode.prev)) {
  36709. leadingParts.push(prevBetweenLine);
  36710. } else {
  36711. leadingParts.push(ifBreak("", softline, {
  36712. groupId: groupIds[childIndex - 1]
  36713. }));
  36714. }
  36715. }
  36716. }
  36717. if (nextBetweenLine) {
  36718. if (forceNextEmptyLine(childNode)) {
  36719. if (isTextLikeNode(childNode.next)) {
  36720. nextParts.push(hardline, hardline);
  36721. }
  36722. } else if (nextBetweenLine === hardline) {
  36723. if (isTextLikeNode(childNode.next)) {
  36724. nextParts.push(hardline);
  36725. }
  36726. } else {
  36727. trailingParts.push(nextBetweenLine);
  36728. }
  36729. }
  36730. return [...prevParts, group([...leadingParts, group([printChild(childPath, options, print), ...trailingParts], {
  36731. id: groupIds[childIndex]
  36732. })]), ...nextParts];
  36733. }, "children");
  36734. }
  36735. module2.exports = {
  36736. printChildren
  36737. };
  36738. }
  36739. });
  36740. var require_element = __commonJS2({
  36741. "src/language-html/print/element.js"(exports2, module2) {
  36742. "use strict";
  36743. var {
  36744. builders: {
  36745. breakParent,
  36746. dedentToRoot,
  36747. group,
  36748. ifBreak,
  36749. indentIfBreak,
  36750. indent,
  36751. line,
  36752. softline
  36753. },
  36754. utils: {
  36755. replaceTextEndOfLine
  36756. }
  36757. } = require("./doc.js");
  36758. var getNodeContent = require_get_node_content();
  36759. var {
  36760. shouldPreserveContent,
  36761. isScriptLikeTag,
  36762. isVueCustomBlock,
  36763. countParents,
  36764. forceBreakContent
  36765. } = require_utils11();
  36766. var {
  36767. printOpeningTagPrefix,
  36768. printOpeningTag,
  36769. printClosingTagSuffix,
  36770. printClosingTag,
  36771. needsToBorrowPrevClosingTagEndMarker,
  36772. needsToBorrowLastChildClosingTagEndMarker
  36773. } = require_tag();
  36774. var {
  36775. printChildren
  36776. } = require_children();
  36777. function printElement(path, options, print) {
  36778. const node = path.getValue();
  36779. if (shouldPreserveContent(node, options)) {
  36780. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), ...replaceTextEndOfLine(getNodeContent(node, options)), ...printClosingTag(node, options), printClosingTagSuffix(node, options)];
  36781. }
  36782. const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
  36783. const attrGroupId = Symbol("element-attr-group-id");
  36784. const printTag = (doc2) => group([group(printOpeningTag(path, options, print), {
  36785. id: attrGroupId
  36786. }), doc2, printClosingTag(node, options)]);
  36787. const printChildrenDoc = (childrenDoc) => {
  36788. if (shouldHugContent) {
  36789. return indentIfBreak(childrenDoc, {
  36790. groupId: attrGroupId
  36791. });
  36792. }
  36793. if ((isScriptLikeTag(node) || isVueCustomBlock(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle) {
  36794. return childrenDoc;
  36795. }
  36796. return indent(childrenDoc);
  36797. };
  36798. const printLineBeforeChildren = () => {
  36799. if (shouldHugContent) {
  36800. return ifBreak(softline, "", {
  36801. groupId: attrGroupId
  36802. });
  36803. }
  36804. if (node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive) {
  36805. return line;
  36806. }
  36807. if (node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) {
  36808. return dedentToRoot(softline);
  36809. }
  36810. return softline;
  36811. };
  36812. const printLineAfterChildren = () => {
  36813. const needsToBorrow = node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent);
  36814. if (needsToBorrow) {
  36815. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  36816. return " ";
  36817. }
  36818. return "";
  36819. }
  36820. if (shouldHugContent) {
  36821. return ifBreak(softline, "", {
  36822. groupId: attrGroupId
  36823. });
  36824. }
  36825. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  36826. return line;
  36827. }
  36828. 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)) {
  36829. return "";
  36830. }
  36831. return softline;
  36832. };
  36833. if (node.children.length === 0) {
  36834. return printTag(node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line : "");
  36835. }
  36836. return printTag([forceBreakContent(node) ? breakParent : "", printChildrenDoc([printLineBeforeChildren(), printChildren(path, options, print)]), printLineAfterChildren()]);
  36837. }
  36838. module2.exports = {
  36839. printElement
  36840. };
  36841. }
  36842. });
  36843. var require_printer_html = __commonJS2({
  36844. "src/language-html/printer-html.js"(exports2, module2) {
  36845. "use strict";
  36846. var {
  36847. builders: {
  36848. fill,
  36849. group,
  36850. hardline,
  36851. literalline
  36852. },
  36853. utils: {
  36854. cleanDoc,
  36855. getDocParts,
  36856. isConcat,
  36857. replaceTextEndOfLine
  36858. }
  36859. } = require("./doc.js");
  36860. var clean = require_clean5();
  36861. var {
  36862. countChars,
  36863. unescapeQuoteEntities,
  36864. getTextValueParts
  36865. } = require_utils11();
  36866. var preprocess = require_print_preprocess3();
  36867. var {
  36868. insertPragma
  36869. } = require_pragma5();
  36870. var {
  36871. locStart,
  36872. locEnd
  36873. } = require_loc6();
  36874. var embed = require_embed4();
  36875. var {
  36876. printClosingTagSuffix,
  36877. printClosingTagEnd,
  36878. printOpeningTagPrefix,
  36879. printOpeningTagStart
  36880. } = require_tag();
  36881. var {
  36882. printElement
  36883. } = require_element();
  36884. var {
  36885. printChildren
  36886. } = require_children();
  36887. function genericPrint(path, options, print) {
  36888. const node = path.getValue();
  36889. switch (node.type) {
  36890. case "front-matter":
  36891. return replaceTextEndOfLine(node.raw);
  36892. case "root":
  36893. if (options.__onHtmlRoot) {
  36894. options.__onHtmlRoot(node);
  36895. }
  36896. return [group(printChildren(path, options, print)), hardline];
  36897. case "element":
  36898. case "ieConditionalComment": {
  36899. return printElement(path, options, print);
  36900. }
  36901. case "ieConditionalStartComment":
  36902. case "ieConditionalEndComment":
  36903. return [printOpeningTagStart(node), printClosingTagEnd(node)];
  36904. case "interpolation":
  36905. return [printOpeningTagStart(node, options), ...path.map(print, "children"), printClosingTagEnd(node, options)];
  36906. case "text": {
  36907. if (node.parent.type === "interpolation") {
  36908. const trailingNewlineRegex = /\n[^\S\n]*$/;
  36909. const hasTrailingNewline = trailingNewlineRegex.test(node.value);
  36910. const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
  36911. return [...replaceTextEndOfLine(value), hasTrailingNewline ? hardline : ""];
  36912. }
  36913. const printed = cleanDoc([printOpeningTagPrefix(node, options), ...getTextValueParts(node), printClosingTagSuffix(node, options)]);
  36914. if (isConcat(printed) || printed.type === "fill") {
  36915. return fill(getDocParts(printed));
  36916. }
  36917. return printed;
  36918. }
  36919. case "docType":
  36920. return [group([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")]), printClosingTagEnd(node, options)];
  36921. case "comment": {
  36922. return [printOpeningTagPrefix(node, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(node), locEnd(node)), literalline), printClosingTagSuffix(node, options)];
  36923. }
  36924. case "attribute": {
  36925. if (node.value === null) {
  36926. return node.rawName;
  36927. }
  36928. const value = unescapeQuoteEntities(node.value);
  36929. const singleQuoteCount = countChars(value, "'");
  36930. const doubleQuoteCount = countChars(value, '"');
  36931. const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
  36932. return [node.rawName, "=", quote, ...replaceTextEndOfLine(quote === '"' ? value.replace(/"/g, "&quot;") : value.replace(/'/g, "&apos;")), quote];
  36933. }
  36934. default:
  36935. throw new Error(`Unexpected node type ${node.type}`);
  36936. }
  36937. }
  36938. module2.exports = {
  36939. preprocess,
  36940. print: genericPrint,
  36941. insertPragma,
  36942. massageAstNode: clean,
  36943. embed
  36944. };
  36945. }
  36946. });
  36947. var require_options6 = __commonJS2({
  36948. "src/language-html/options.js"(exports2, module2) {
  36949. "use strict";
  36950. var commonOptions = require_common_options();
  36951. var CATEGORY_HTML = "HTML";
  36952. module2.exports = {
  36953. bracketSameLine: commonOptions.bracketSameLine,
  36954. htmlWhitespaceSensitivity: {
  36955. since: "1.15.0",
  36956. category: CATEGORY_HTML,
  36957. type: "choice",
  36958. default: "css",
  36959. description: "How to handle whitespaces in HTML.",
  36960. choices: [{
  36961. value: "css",
  36962. description: "Respect the default value of CSS display property."
  36963. }, {
  36964. value: "strict",
  36965. description: "Whitespaces are considered sensitive."
  36966. }, {
  36967. value: "ignore",
  36968. description: "Whitespaces are considered insensitive."
  36969. }]
  36970. },
  36971. singleAttributePerLine: commonOptions.singleAttributePerLine,
  36972. vueIndentScriptAndStyle: {
  36973. since: "1.19.0",
  36974. category: CATEGORY_HTML,
  36975. type: "boolean",
  36976. default: false,
  36977. description: "Indent script and style tags in Vue files."
  36978. }
  36979. };
  36980. }
  36981. });
  36982. var require_parsers6 = __commonJS2({
  36983. "src/language-html/parsers.js"(exports2, module2) {
  36984. "use strict";
  36985. module2.exports = {
  36986. get html() {
  36987. return require("./parser-html.js").parsers.html;
  36988. },
  36989. get vue() {
  36990. return require("./parser-html.js").parsers.vue;
  36991. },
  36992. get angular() {
  36993. return require("./parser-html.js").parsers.angular;
  36994. },
  36995. get lwc() {
  36996. return require("./parser-html.js").parsers.lwc;
  36997. }
  36998. };
  36999. }
  37000. });
  37001. var require_HTML = __commonJS2({
  37002. "node_modules/linguist-languages/data/HTML.json"(exports2, module2) {
  37003. module2.exports = {
  37004. name: "HTML",
  37005. type: "markup",
  37006. tmScope: "text.html.basic",
  37007. aceMode: "html",
  37008. codemirrorMode: "htmlmixed",
  37009. codemirrorMimeType: "text/html",
  37010. color: "#e34c26",
  37011. aliases: ["xhtml"],
  37012. extensions: [".html", ".hta", ".htm", ".html.hl", ".inc", ".xht", ".xhtml"],
  37013. languageId: 146
  37014. };
  37015. }
  37016. });
  37017. var require_Vue = __commonJS2({
  37018. "node_modules/linguist-languages/data/Vue.json"(exports2, module2) {
  37019. module2.exports = {
  37020. name: "Vue",
  37021. type: "markup",
  37022. color: "#41b883",
  37023. extensions: [".vue"],
  37024. tmScope: "text.html.vue",
  37025. aceMode: "html",
  37026. languageId: 391
  37027. };
  37028. }
  37029. });
  37030. var require_language_html = __commonJS2({
  37031. "src/language-html/index.js"(exports2, module2) {
  37032. "use strict";
  37033. var createLanguage = require_create_language();
  37034. var printer = require_printer_html();
  37035. var options = require_options6();
  37036. var parsers = require_parsers6();
  37037. var languages = [createLanguage(require_HTML(), () => ({
  37038. name: "Angular",
  37039. since: "1.15.0",
  37040. parsers: ["angular"],
  37041. vscodeLanguageIds: ["html"],
  37042. extensions: [".component.html"],
  37043. filenames: []
  37044. })), createLanguage(require_HTML(), (data) => ({
  37045. since: "1.15.0",
  37046. parsers: ["html"],
  37047. vscodeLanguageIds: ["html"],
  37048. extensions: [...data.extensions, ".mjml"]
  37049. })), createLanguage(require_HTML(), () => ({
  37050. name: "Lightning Web Components",
  37051. since: "1.17.0",
  37052. parsers: ["lwc"],
  37053. vscodeLanguageIds: ["html"],
  37054. extensions: [],
  37055. filenames: []
  37056. })), createLanguage(require_Vue(), () => ({
  37057. since: "1.10.0",
  37058. parsers: ["vue"],
  37059. vscodeLanguageIds: ["vue"]
  37060. }))];
  37061. var printers = {
  37062. html: printer
  37063. };
  37064. module2.exports = {
  37065. languages,
  37066. printers,
  37067. options,
  37068. parsers
  37069. };
  37070. }
  37071. });
  37072. var require_pragma6 = __commonJS2({
  37073. "src/language-yaml/pragma.js"(exports2, module2) {
  37074. "use strict";
  37075. function isPragma(text) {
  37076. return /^\s*@(?:prettier|format)\s*$/.test(text);
  37077. }
  37078. function hasPragma(text) {
  37079. return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text);
  37080. }
  37081. function insertPragma(text) {
  37082. return `# @format
  37083. ${text}`;
  37084. }
  37085. module2.exports = {
  37086. isPragma,
  37087. hasPragma,
  37088. insertPragma
  37089. };
  37090. }
  37091. });
  37092. var require_loc7 = __commonJS2({
  37093. "src/language-yaml/loc.js"(exports2, module2) {
  37094. "use strict";
  37095. function locStart(node) {
  37096. return node.position.start.offset;
  37097. }
  37098. function locEnd(node) {
  37099. return node.position.end.offset;
  37100. }
  37101. module2.exports = {
  37102. locStart,
  37103. locEnd
  37104. };
  37105. }
  37106. });
  37107. var require_embed5 = __commonJS2({
  37108. "src/language-yaml/embed.js"(exports2, module2) {
  37109. "use strict";
  37110. function embed(path, print, textToDoc, options) {
  37111. const node = path.getValue();
  37112. if (node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(options.filepath)) {
  37113. return textToDoc(options.originalText, Object.assign(Object.assign({}, options), {}, {
  37114. parser: "json"
  37115. }));
  37116. }
  37117. }
  37118. module2.exports = embed;
  37119. }
  37120. });
  37121. var require_utils12 = __commonJS2({
  37122. "src/language-yaml/utils.js"(exports2, module2) {
  37123. "use strict";
  37124. var {
  37125. getLast,
  37126. isNonEmptyArray
  37127. } = require_util();
  37128. function getAncestorCount(path, filter) {
  37129. let counter = 0;
  37130. const pathStackLength = path.stack.length - 1;
  37131. for (let i = 0; i < pathStackLength; i++) {
  37132. const value = path.stack[i];
  37133. if (isNode(value) && filter(value)) {
  37134. counter++;
  37135. }
  37136. }
  37137. return counter;
  37138. }
  37139. function isNode(value, types) {
  37140. return value && typeof value.type === "string" && (!types || types.includes(value.type));
  37141. }
  37142. function mapNode(node, callback, parent) {
  37143. return callback("children" in node ? Object.assign(Object.assign({}, node), {}, {
  37144. children: node.children.map((childNode) => mapNode(childNode, callback, node))
  37145. }) : node, parent);
  37146. }
  37147. function defineShortcut(x, key, getter) {
  37148. Object.defineProperty(x, key, {
  37149. get: getter,
  37150. enumerable: false
  37151. });
  37152. }
  37153. function isNextLineEmpty(node, text) {
  37154. let newlineCount = 0;
  37155. const textLength = text.length;
  37156. for (let i = node.position.end.offset - 1; i < textLength; i++) {
  37157. const char = text[i];
  37158. if (char === "\n") {
  37159. newlineCount++;
  37160. }
  37161. if (newlineCount === 1 && /\S/.test(char)) {
  37162. return false;
  37163. }
  37164. if (newlineCount === 2) {
  37165. return true;
  37166. }
  37167. }
  37168. return false;
  37169. }
  37170. function isLastDescendantNode(path) {
  37171. const node = path.getValue();
  37172. switch (node.type) {
  37173. case "tag":
  37174. case "anchor":
  37175. case "comment":
  37176. return false;
  37177. }
  37178. const pathStackLength = path.stack.length;
  37179. for (let i = 1; i < pathStackLength; i++) {
  37180. const item = path.stack[i];
  37181. const parentItem = path.stack[i - 1];
  37182. if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
  37183. return false;
  37184. }
  37185. }
  37186. return true;
  37187. }
  37188. function getLastDescendantNode(node) {
  37189. return isNonEmptyArray(node.children) ? getLastDescendantNode(getLast(node.children)) : node;
  37190. }
  37191. function isPrettierIgnore(comment) {
  37192. return comment.value.trim() === "prettier-ignore";
  37193. }
  37194. function hasPrettierIgnore(path) {
  37195. const node = path.getValue();
  37196. if (node.type === "documentBody") {
  37197. const document2 = path.getParentNode();
  37198. return hasEndComments(document2.head) && isPrettierIgnore(getLast(document2.head.endComments));
  37199. }
  37200. return hasLeadingComments(node) && isPrettierIgnore(getLast(node.leadingComments));
  37201. }
  37202. function isEmptyNode(node) {
  37203. return !isNonEmptyArray(node.children) && !hasComments(node);
  37204. }
  37205. function hasComments(node) {
  37206. return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment(node) || hasEndComments(node);
  37207. }
  37208. function hasLeadingComments(node) {
  37209. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.leadingComments);
  37210. }
  37211. function hasMiddleComments(node) {
  37212. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.middleComments);
  37213. }
  37214. function hasIndicatorComment(node) {
  37215. return node === null || node === void 0 ? void 0 : node.indicatorComment;
  37216. }
  37217. function hasTrailingComment(node) {
  37218. return node === null || node === void 0 ? void 0 : node.trailingComment;
  37219. }
  37220. function hasEndComments(node) {
  37221. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.endComments);
  37222. }
  37223. function splitWithSingleSpace(text) {
  37224. const parts = [];
  37225. let lastPart;
  37226. for (const part of text.split(/( +)/)) {
  37227. if (part !== " ") {
  37228. if (lastPart === " ") {
  37229. parts.push(part);
  37230. } else {
  37231. parts.push((parts.pop() || "") + part);
  37232. }
  37233. } else if (lastPart === void 0) {
  37234. parts.unshift("");
  37235. }
  37236. lastPart = part;
  37237. }
  37238. if (lastPart === " ") {
  37239. parts.push((parts.pop() || "") + " ");
  37240. }
  37241. if (parts[0] === "") {
  37242. parts.shift();
  37243. parts.unshift(" " + (parts.shift() || ""));
  37244. }
  37245. return parts;
  37246. }
  37247. function getFlowScalarLineContents(nodeType, content, options) {
  37248. 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());
  37249. if (options.proseWrap === "preserve") {
  37250. return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]);
  37251. }
  37252. 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);
  37253. }
  37254. function getBlockValueLineContents(node, {
  37255. parentIndent,
  37256. isLastDescendant,
  37257. options
  37258. }) {
  37259. 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];
  37260. let leadingSpaceCount;
  37261. if (node.indent === null) {
  37262. const matches = content.match(/^(?<leadingSpace> *)[^\n\r ]/m);
  37263. leadingSpaceCount = matches ? matches.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
  37264. } else {
  37265. leadingSpaceCount = node.indent - 1 + parentIndent;
  37266. }
  37267. const rawLineContents = content.split("\n").map((lineContent) => lineContent.slice(leadingSpaceCount));
  37268. if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
  37269. return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]));
  37270. }
  37271. 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));
  37272. function removeUnnecessaryTrailingNewlines(lineContents) {
  37273. if (node.chomping === "keep") {
  37274. return getLast(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
  37275. }
  37276. let trailingNewlineCount = 0;
  37277. for (let i = lineContents.length - 1; i >= 0; i--) {
  37278. if (lineContents[i].length === 0) {
  37279. trailingNewlineCount++;
  37280. } else {
  37281. break;
  37282. }
  37283. }
  37284. return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
  37285. }
  37286. }
  37287. function isInlineNode(node) {
  37288. if (!node) {
  37289. return true;
  37290. }
  37291. switch (node.type) {
  37292. case "plain":
  37293. case "quoteDouble":
  37294. case "quoteSingle":
  37295. case "alias":
  37296. case "flowMapping":
  37297. case "flowSequence":
  37298. return true;
  37299. default:
  37300. return false;
  37301. }
  37302. }
  37303. module2.exports = {
  37304. getLast,
  37305. getAncestorCount,
  37306. isNode,
  37307. isEmptyNode,
  37308. isInlineNode,
  37309. mapNode,
  37310. defineShortcut,
  37311. isNextLineEmpty,
  37312. isLastDescendantNode,
  37313. getBlockValueLineContents,
  37314. getFlowScalarLineContents,
  37315. getLastDescendantNode,
  37316. hasPrettierIgnore,
  37317. hasLeadingComments,
  37318. hasMiddleComments,
  37319. hasIndicatorComment,
  37320. hasTrailingComment,
  37321. hasEndComments
  37322. };
  37323. }
  37324. });
  37325. var require_print_preprocess4 = __commonJS2({
  37326. "src/language-yaml/print-preprocess.js"(exports2, module2) {
  37327. "use strict";
  37328. var {
  37329. defineShortcut,
  37330. mapNode
  37331. } = require_utils12();
  37332. function preprocess(ast) {
  37333. return mapNode(ast, defineShortcuts);
  37334. }
  37335. function defineShortcuts(node) {
  37336. switch (node.type) {
  37337. case "document":
  37338. defineShortcut(node, "head", () => node.children[0]);
  37339. defineShortcut(node, "body", () => node.children[1]);
  37340. break;
  37341. case "documentBody":
  37342. case "sequenceItem":
  37343. case "flowSequenceItem":
  37344. case "mappingKey":
  37345. case "mappingValue":
  37346. defineShortcut(node, "content", () => node.children[0]);
  37347. break;
  37348. case "mappingItem":
  37349. case "flowMappingItem":
  37350. defineShortcut(node, "key", () => node.children[0]);
  37351. defineShortcut(node, "value", () => node.children[1]);
  37352. break;
  37353. }
  37354. return node;
  37355. }
  37356. module2.exports = preprocess;
  37357. }
  37358. });
  37359. var require_misc2 = __commonJS2({
  37360. "src/language-yaml/print/misc.js"(exports2, module2) {
  37361. "use strict";
  37362. var {
  37363. builders: {
  37364. softline,
  37365. align
  37366. }
  37367. } = require("./doc.js");
  37368. var {
  37369. hasEndComments,
  37370. isNextLineEmpty,
  37371. isNode
  37372. } = require_utils12();
  37373. var printedEmptyLineCache = /* @__PURE__ */ new WeakMap();
  37374. function printNextEmptyLine(path, originalText) {
  37375. const node = path.getValue();
  37376. const root = path.stack[0];
  37377. let isNextEmptyLinePrintedSet;
  37378. if (printedEmptyLineCache.has(root)) {
  37379. isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root);
  37380. } else {
  37381. isNextEmptyLinePrintedSet = /* @__PURE__ */ new Set();
  37382. printedEmptyLineCache.set(root, isNextEmptyLinePrintedSet);
  37383. }
  37384. if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
  37385. isNextEmptyLinePrintedSet.add(node.position.end.line);
  37386. if (isNextLineEmpty(node, originalText) && !shouldPrintEndComments(path.getParentNode())) {
  37387. return softline;
  37388. }
  37389. }
  37390. return "";
  37391. }
  37392. function shouldPrintEndComments(node) {
  37393. return hasEndComments(node) && !isNode(node, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
  37394. }
  37395. function alignWithSpaces(width, doc2) {
  37396. return align(" ".repeat(width), doc2);
  37397. }
  37398. module2.exports = {
  37399. alignWithSpaces,
  37400. shouldPrintEndComments,
  37401. printNextEmptyLine
  37402. };
  37403. }
  37404. });
  37405. var require_flow_mapping_sequence = __commonJS2({
  37406. "src/language-yaml/print/flow-mapping-sequence.js"(exports2, module2) {
  37407. "use strict";
  37408. var {
  37409. builders: {
  37410. ifBreak,
  37411. line,
  37412. softline,
  37413. hardline,
  37414. join
  37415. }
  37416. } = require("./doc.js");
  37417. var {
  37418. isEmptyNode,
  37419. getLast,
  37420. hasEndComments
  37421. } = require_utils12();
  37422. var {
  37423. printNextEmptyLine,
  37424. alignWithSpaces
  37425. } = require_misc2();
  37426. function printFlowMapping(path, print, options) {
  37427. const node = path.getValue();
  37428. const isMapping = node.type === "flowMapping";
  37429. const openMarker = isMapping ? "{" : "[";
  37430. const closeMarker = isMapping ? "}" : "]";
  37431. let bracketSpacing = softline;
  37432. if (isMapping && node.children.length > 0 && options.bracketSpacing) {
  37433. bracketSpacing = line;
  37434. }
  37435. const lastItem = getLast(node.children);
  37436. const isLastItemEmptyMappingItem = lastItem && lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
  37437. 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];
  37438. }
  37439. function printChildren(path, print, options) {
  37440. const node = path.getValue();
  37441. 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");
  37442. return parts;
  37443. }
  37444. module2.exports = {
  37445. printFlowMapping,
  37446. printFlowSequence: printFlowMapping
  37447. };
  37448. }
  37449. });
  37450. var require_mapping_item = __commonJS2({
  37451. "src/language-yaml/print/mapping-item.js"(exports2, module2) {
  37452. "use strict";
  37453. var {
  37454. builders: {
  37455. conditionalGroup,
  37456. group,
  37457. hardline,
  37458. ifBreak,
  37459. join,
  37460. line
  37461. }
  37462. } = require("./doc.js");
  37463. var {
  37464. hasLeadingComments,
  37465. hasMiddleComments,
  37466. hasTrailingComment,
  37467. hasEndComments,
  37468. isNode,
  37469. isEmptyNode,
  37470. isInlineNode
  37471. } = require_utils12();
  37472. var {
  37473. alignWithSpaces
  37474. } = require_misc2();
  37475. function printMappingItem(node, parentNode, path, print, options) {
  37476. const {
  37477. key,
  37478. value
  37479. } = node;
  37480. const isEmptyMappingKey = isEmptyNode(key);
  37481. const isEmptyMappingValue = isEmptyNode(value);
  37482. if (isEmptyMappingKey && isEmptyMappingValue) {
  37483. return ": ";
  37484. }
  37485. const printedKey = print("key");
  37486. const spaceBeforeColon = needsSpaceInFrontOfMappingValue(node) ? " " : "";
  37487. if (isEmptyMappingValue) {
  37488. if (node.type === "flowMappingItem" && parentNode.type === "flowMapping") {
  37489. return printedKey;
  37490. }
  37491. if (node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasTrailingComment(key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set")) {
  37492. return [printedKey, spaceBeforeColon, ":"];
  37493. }
  37494. return ["? ", alignWithSpaces(2, printedKey)];
  37495. }
  37496. const printedValue = print("value");
  37497. if (isEmptyMappingKey) {
  37498. return [": ", alignWithSpaces(2, printedValue)];
  37499. }
  37500. if (hasLeadingComments(value) || !isInlineNode(key.content)) {
  37501. return ["? ", alignWithSpaces(2, printedKey), hardline, join("", path.map(print, "value", "leadingComments").map((comment) => [comment, hardline])), ": ", alignWithSpaces(2, printedValue)];
  37502. }
  37503. 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)) {
  37504. return [printedKey, spaceBeforeColon, ": ", printedValue];
  37505. }
  37506. const groupId = Symbol("mappingKey");
  37507. const groupedKey = group([ifBreak("? "), group(alignWithSpaces(2, printedKey), {
  37508. id: groupId
  37509. })]);
  37510. const explicitMappingValue = [hardline, ": ", alignWithSpaces(2, printedValue)];
  37511. const implicitMappingValueParts = [spaceBeforeColon, ":"];
  37512. 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) {
  37513. implicitMappingValueParts.push(hardline);
  37514. } else if (value.content) {
  37515. implicitMappingValueParts.push(line);
  37516. }
  37517. implicitMappingValueParts.push(printedValue);
  37518. const implicitMappingValue = alignWithSpaces(options.tabWidth, implicitMappingValueParts);
  37519. if (isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasEndComments(key)) {
  37520. return conditionalGroup([[printedKey, implicitMappingValue]]);
  37521. }
  37522. return conditionalGroup([[groupedKey, ifBreak(explicitMappingValue, implicitMappingValue, {
  37523. groupId
  37524. })]]);
  37525. }
  37526. function isAbsolutelyPrintedAsSingleLineNode(node, options) {
  37527. if (!node) {
  37528. return true;
  37529. }
  37530. switch (node.type) {
  37531. case "plain":
  37532. case "quoteSingle":
  37533. case "quoteDouble":
  37534. break;
  37535. case "alias":
  37536. return true;
  37537. default:
  37538. return false;
  37539. }
  37540. if (options.proseWrap === "preserve") {
  37541. return node.position.start.line === node.position.end.line;
  37542. }
  37543. if (/\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
  37544. return false;
  37545. }
  37546. switch (options.proseWrap) {
  37547. case "never":
  37548. return !node.value.includes("\n");
  37549. case "always":
  37550. return !/[\n ]/.test(node.value);
  37551. default:
  37552. return false;
  37553. }
  37554. }
  37555. function needsSpaceInFrontOfMappingValue(node) {
  37556. return node.key.content && node.key.content.type === "alias";
  37557. }
  37558. function isSingleLineNode(node) {
  37559. if (!node) {
  37560. return true;
  37561. }
  37562. switch (node.type) {
  37563. case "plain":
  37564. case "quoteDouble":
  37565. case "quoteSingle":
  37566. return node.position.start.line === node.position.end.line;
  37567. case "alias":
  37568. return true;
  37569. default:
  37570. return false;
  37571. }
  37572. }
  37573. module2.exports = printMappingItem;
  37574. }
  37575. });
  37576. var require_block2 = __commonJS2({
  37577. "src/language-yaml/print/block.js"(exports2, module2) {
  37578. "use strict";
  37579. var {
  37580. builders: {
  37581. dedent,
  37582. dedentToRoot,
  37583. fill,
  37584. hardline,
  37585. join,
  37586. line,
  37587. literalline,
  37588. markAsRoot
  37589. },
  37590. utils: {
  37591. getDocParts
  37592. }
  37593. } = require("./doc.js");
  37594. var {
  37595. getAncestorCount,
  37596. getBlockValueLineContents,
  37597. hasIndicatorComment,
  37598. isLastDescendantNode,
  37599. isNode
  37600. } = require_utils12();
  37601. var {
  37602. alignWithSpaces
  37603. } = require_misc2();
  37604. function printBlock(path, print, options) {
  37605. const node = path.getValue();
  37606. const parentIndent = getAncestorCount(path, (ancestorNode) => isNode(ancestorNode, ["sequence", "mapping"]));
  37607. const isLastDescendant = isLastDescendantNode(path);
  37608. const parts = [node.type === "blockFolded" ? ">" : "|"];
  37609. if (node.indent !== null) {
  37610. parts.push(node.indent.toString());
  37611. }
  37612. if (node.chomping !== "clip") {
  37613. parts.push(node.chomping === "keep" ? "+" : "-");
  37614. }
  37615. if (hasIndicatorComment(node)) {
  37616. parts.push(" ", print("indicatorComment"));
  37617. }
  37618. const lineContents = getBlockValueLineContents(node, {
  37619. parentIndent,
  37620. isLastDescendant,
  37621. options
  37622. });
  37623. const contentsParts = [];
  37624. for (const [index, lineWords] of lineContents.entries()) {
  37625. if (index === 0) {
  37626. contentsParts.push(hardline);
  37627. }
  37628. contentsParts.push(fill(getDocParts(join(line, lineWords))));
  37629. if (index !== lineContents.length - 1) {
  37630. contentsParts.push(lineWords.length === 0 ? hardline : markAsRoot(literalline));
  37631. } else if (node.chomping === "keep" && isLastDescendant) {
  37632. contentsParts.push(dedentToRoot(lineWords.length === 0 ? hardline : literalline));
  37633. }
  37634. }
  37635. if (node.indent === null) {
  37636. parts.push(dedent(alignWithSpaces(options.tabWidth, contentsParts)));
  37637. } else {
  37638. parts.push(dedentToRoot(alignWithSpaces(node.indent - 1 + parentIndent, contentsParts)));
  37639. }
  37640. return parts;
  37641. }
  37642. module2.exports = printBlock;
  37643. }
  37644. });
  37645. var require_printer_yaml = __commonJS2({
  37646. "src/language-yaml/printer-yaml.js"(exports2, module2) {
  37647. "use strict";
  37648. var {
  37649. builders: {
  37650. breakParent,
  37651. fill,
  37652. group,
  37653. hardline,
  37654. join,
  37655. line,
  37656. lineSuffix,
  37657. literalline
  37658. },
  37659. utils: {
  37660. getDocParts,
  37661. replaceTextEndOfLine
  37662. }
  37663. } = require("./doc.js");
  37664. var {
  37665. isPreviousLineEmpty
  37666. } = require_util();
  37667. var {
  37668. insertPragma,
  37669. isPragma
  37670. } = require_pragma6();
  37671. var {
  37672. locStart
  37673. } = require_loc7();
  37674. var embed = require_embed5();
  37675. var {
  37676. getFlowScalarLineContents,
  37677. getLastDescendantNode,
  37678. hasLeadingComments,
  37679. hasMiddleComments,
  37680. hasTrailingComment,
  37681. hasEndComments,
  37682. hasPrettierIgnore,
  37683. isLastDescendantNode,
  37684. isNode,
  37685. isInlineNode
  37686. } = require_utils12();
  37687. var preprocess = require_print_preprocess4();
  37688. var {
  37689. alignWithSpaces,
  37690. printNextEmptyLine,
  37691. shouldPrintEndComments
  37692. } = require_misc2();
  37693. var {
  37694. printFlowMapping,
  37695. printFlowSequence
  37696. } = require_flow_mapping_sequence();
  37697. var printMappingItem = require_mapping_item();
  37698. var printBlock = require_block2();
  37699. function genericPrint(path, options, print) {
  37700. const node = path.getValue();
  37701. const parts = [];
  37702. if (node.type !== "mappingValue" && hasLeadingComments(node)) {
  37703. parts.push([join(hardline, path.map(print, "leadingComments")), hardline]);
  37704. }
  37705. const {
  37706. tag,
  37707. anchor
  37708. } = node;
  37709. if (tag) {
  37710. parts.push(print("tag"));
  37711. }
  37712. if (tag && anchor) {
  37713. parts.push(" ");
  37714. }
  37715. if (anchor) {
  37716. parts.push(print("anchor"));
  37717. }
  37718. let nextEmptyLine = "";
  37719. if (isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path)) {
  37720. nextEmptyLine = printNextEmptyLine(path, options.originalText);
  37721. }
  37722. if (tag || anchor) {
  37723. if (isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node)) {
  37724. parts.push(hardline);
  37725. } else {
  37726. parts.push(" ");
  37727. }
  37728. }
  37729. if (hasMiddleComments(node)) {
  37730. parts.push([node.middleComments.length === 1 ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline]);
  37731. }
  37732. const parentNode = path.getParentNode();
  37733. if (hasPrettierIgnore(path)) {
  37734. parts.push(replaceTextEndOfLine(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline));
  37735. } else {
  37736. parts.push(group(printNode(node, parentNode, path, options, print)));
  37737. }
  37738. if (hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])) {
  37739. parts.push(lineSuffix([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent, print("trailingComment")]));
  37740. }
  37741. if (shouldPrintEndComments(node)) {
  37742. parts.push(alignWithSpaces(node.type === "sequenceItem" ? 2 : 0, [hardline, join(hardline, path.map((path2) => [isPreviousLineEmpty(options.originalText, path2.getValue(), locStart) ? hardline : "", print()], "endComments"))]));
  37743. }
  37744. parts.push(nextEmptyLine);
  37745. return parts;
  37746. }
  37747. function printNode(node, parentNode, path, options, print) {
  37748. switch (node.type) {
  37749. case "root": {
  37750. const {
  37751. children
  37752. } = node;
  37753. const parts = [];
  37754. path.each((childPath, index) => {
  37755. const document2 = children[index];
  37756. const nextDocument = children[index + 1];
  37757. if (index !== 0) {
  37758. parts.push(hardline);
  37759. }
  37760. parts.push(print());
  37761. if (shouldPrintDocumentEndMarker(document2, nextDocument)) {
  37762. parts.push(hardline, "...");
  37763. if (hasTrailingComment(document2)) {
  37764. parts.push(" ", print("trailingComment"));
  37765. }
  37766. } else if (nextDocument && !hasTrailingComment(nextDocument.head)) {
  37767. parts.push(hardline, "---");
  37768. }
  37769. }, "children");
  37770. const lastDescendantNode = getLastDescendantNode(node);
  37771. if (!isNode(lastDescendantNode, ["blockLiteral", "blockFolded"]) || lastDescendantNode.chomping !== "keep") {
  37772. parts.push(hardline);
  37773. }
  37774. return parts;
  37775. }
  37776. case "document": {
  37777. const nextDocument = parentNode.children[path.getName() + 1];
  37778. const parts = [];
  37779. if (shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head") {
  37780. if (node.head.children.length > 0 || node.head.endComments.length > 0) {
  37781. parts.push(print("head"));
  37782. }
  37783. if (hasTrailingComment(node.head)) {
  37784. parts.push(["---", " ", print(["head", "trailingComment"])]);
  37785. } else {
  37786. parts.push("---");
  37787. }
  37788. }
  37789. if (shouldPrintDocumentBody(node)) {
  37790. parts.push(print("body"));
  37791. }
  37792. return join(hardline, parts);
  37793. }
  37794. case "documentHead":
  37795. return join(hardline, [...path.map(print, "children"), ...path.map(print, "endComments")]);
  37796. case "documentBody": {
  37797. const {
  37798. children,
  37799. endComments
  37800. } = node;
  37801. let separator = "";
  37802. if (children.length > 0 && endComments.length > 0) {
  37803. const lastDescendantNode = getLastDescendantNode(node);
  37804. if (isNode(lastDescendantNode, ["blockFolded", "blockLiteral"])) {
  37805. if (lastDescendantNode.chomping !== "keep") {
  37806. separator = [hardline, hardline];
  37807. }
  37808. } else {
  37809. separator = hardline;
  37810. }
  37811. }
  37812. return [join(hardline, path.map(print, "children")), separator, join(hardline, path.map(print, "endComments"))];
  37813. }
  37814. case "directive":
  37815. return ["%", join(" ", [node.name, ...node.parameters])];
  37816. case "comment":
  37817. return ["#", node.value];
  37818. case "alias":
  37819. return ["*", node.value];
  37820. case "tag":
  37821. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  37822. case "anchor":
  37823. return ["&", node.value];
  37824. case "plain":
  37825. return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
  37826. case "quoteDouble":
  37827. case "quoteSingle": {
  37828. const singleQuote = "'";
  37829. const doubleQuote = '"';
  37830. const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
  37831. if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
  37832. const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
  37833. return [originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote];
  37834. }
  37835. if (raw.includes(doubleQuote)) {
  37836. return [singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw.replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote];
  37837. }
  37838. if (raw.includes(singleQuote)) {
  37839. return [doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? raw.replace(/''/g, singleQuote) : raw, options), doubleQuote];
  37840. }
  37841. const quote = options.singleQuote ? singleQuote : doubleQuote;
  37842. return [quote, printFlowScalarContent(node.type, raw, options), quote];
  37843. }
  37844. case "blockFolded":
  37845. case "blockLiteral": {
  37846. return printBlock(path, print, options);
  37847. }
  37848. case "mapping":
  37849. case "sequence":
  37850. return join(hardline, path.map(print, "children"));
  37851. case "sequenceItem":
  37852. return ["- ", alignWithSpaces(2, node.content ? print("content") : "")];
  37853. case "mappingKey":
  37854. case "mappingValue":
  37855. return !node.content ? "" : print("content");
  37856. case "mappingItem":
  37857. case "flowMappingItem": {
  37858. return printMappingItem(node, parentNode, path, print, options);
  37859. }
  37860. case "flowMapping":
  37861. return printFlowMapping(path, print, options);
  37862. case "flowSequence":
  37863. return printFlowSequence(path, print, options);
  37864. case "flowSequenceItem":
  37865. return print("content");
  37866. default:
  37867. throw new Error(`Unexpected node type ${node.type}`);
  37868. }
  37869. }
  37870. function shouldPrintDocumentBody(document2) {
  37871. return document2.body.children.length > 0 || hasEndComments(document2.body);
  37872. }
  37873. function shouldPrintDocumentEndMarker(document2, nextDocument) {
  37874. return hasTrailingComment(document2) || nextDocument && (nextDocument.head.children.length > 0 || hasEndComments(nextDocument.head));
  37875. }
  37876. function shouldPrintDocumentHeadEndMarker(document2, nextDocument, root, options) {
  37877. if (root.children[0] === document2 && /---(?:\s|$)/.test(options.originalText.slice(locStart(document2), locStart(document2) + 4)) || document2.head.children.length > 0 || hasEndComments(document2.head) || hasTrailingComment(document2.head)) {
  37878. return "head";
  37879. }
  37880. if (shouldPrintDocumentEndMarker(document2, nextDocument)) {
  37881. return false;
  37882. }
  37883. return nextDocument ? "root" : false;
  37884. }
  37885. function printFlowScalarContent(nodeType, content, options) {
  37886. const lineContents = getFlowScalarLineContents(nodeType, content, options);
  37887. return join(hardline, lineContents.map((lineContentWords) => fill(getDocParts(join(line, lineContentWords)))));
  37888. }
  37889. function clean(node, newNode) {
  37890. if (isNode(newNode)) {
  37891. delete newNode.position;
  37892. switch (newNode.type) {
  37893. case "comment":
  37894. if (isPragma(newNode.value)) {
  37895. return null;
  37896. }
  37897. break;
  37898. case "quoteDouble":
  37899. case "quoteSingle":
  37900. newNode.type = "quote";
  37901. break;
  37902. }
  37903. }
  37904. }
  37905. module2.exports = {
  37906. preprocess,
  37907. embed,
  37908. print: genericPrint,
  37909. massageAstNode: clean,
  37910. insertPragma
  37911. };
  37912. }
  37913. });
  37914. var require_options7 = __commonJS2({
  37915. "src/language-yaml/options.js"(exports2, module2) {
  37916. "use strict";
  37917. var commonOptions = require_common_options();
  37918. module2.exports = {
  37919. bracketSpacing: commonOptions.bracketSpacing,
  37920. singleQuote: commonOptions.singleQuote,
  37921. proseWrap: commonOptions.proseWrap
  37922. };
  37923. }
  37924. });
  37925. var require_parsers7 = __commonJS2({
  37926. "src/language-yaml/parsers.js"(exports2, module2) {
  37927. "use strict";
  37928. module2.exports = {
  37929. get yaml() {
  37930. return require("./parser-yaml.js").parsers.yaml;
  37931. }
  37932. };
  37933. }
  37934. });
  37935. var require_YAML = __commonJS2({
  37936. "node_modules/linguist-languages/data/YAML.json"(exports2, module2) {
  37937. module2.exports = {
  37938. name: "YAML",
  37939. type: "data",
  37940. color: "#cb171e",
  37941. tmScope: "source.yaml",
  37942. aliases: ["yml"],
  37943. extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"],
  37944. filenames: [".clang-format", ".clang-tidy", ".gemrc", "CITATION.cff", "glide.lock", "yarn.lock"],
  37945. aceMode: "yaml",
  37946. codemirrorMode: "yaml",
  37947. codemirrorMimeType: "text/x-yaml",
  37948. languageId: 407
  37949. };
  37950. }
  37951. });
  37952. var require_language_yaml = __commonJS2({
  37953. "src/language-yaml/index.js"(exports2, module2) {
  37954. "use strict";
  37955. var createLanguage = require_create_language();
  37956. var printer = require_printer_yaml();
  37957. var options = require_options7();
  37958. var parsers = require_parsers7();
  37959. var languages = [createLanguage(require_YAML(), (data) => ({
  37960. since: "1.14.0",
  37961. parsers: ["yaml"],
  37962. vscodeLanguageIds: ["yaml", "ansible", "home-assistant"],
  37963. filenames: [...data.filenames.filter((filename) => filename !== "yarn.lock"), ".prettierrc", ".stylelintrc", ".lintstagedrc"]
  37964. }))];
  37965. module2.exports = {
  37966. languages,
  37967. printers: {
  37968. yaml: printer
  37969. },
  37970. options,
  37971. parsers
  37972. };
  37973. }
  37974. });
  37975. var require_languages = __commonJS2({
  37976. "src/languages.js"(exports2, module2) {
  37977. "use strict";
  37978. module2.exports = [require_language_js(), require_language_css(), require_language_handlebars(), require_language_graphql(), require_language_markdown(), require_language_html(), require_language_yaml()];
  37979. }
  37980. });
  37981. var require_load_plugins = __commonJS2({
  37982. "src/common/load-plugins.js"(exports2, module2) {
  37983. "use strict";
  37984. var fs = require("fs");
  37985. var path = require("path");
  37986. var fastGlob = require_out4();
  37987. var partition = require_partition();
  37988. var uniqByKey = require_uniq_by_key();
  37989. var internalPlugins = require_languages();
  37990. var {
  37991. default: mem2,
  37992. memClear: memClear2
  37993. } = (init_dist(), __toCommonJS(dist_exports));
  37994. var thirdParty = require("./third-party.js");
  37995. var resolve = require_resolve2();
  37996. var memoizedLoad = mem2(load, {
  37997. cacheKey: JSON.stringify
  37998. });
  37999. var memoizedSearch = mem2(findPluginsInNodeModules);
  38000. var clearCache = () => {
  38001. memClear2(memoizedLoad);
  38002. memClear2(memoizedSearch);
  38003. };
  38004. function load(plugins2, pluginSearchDirs) {
  38005. if (!plugins2) {
  38006. plugins2 = [];
  38007. }
  38008. if (pluginSearchDirs === false) {
  38009. pluginSearchDirs = [];
  38010. } else {
  38011. pluginSearchDirs = pluginSearchDirs || [];
  38012. if (pluginSearchDirs.length === 0) {
  38013. const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
  38014. if (autoLoadDir) {
  38015. pluginSearchDirs = [autoLoadDir];
  38016. }
  38017. }
  38018. }
  38019. const [externalPluginNames, externalPluginInstances] = partition(plugins2, (plugin) => typeof plugin === "string");
  38020. const externalManualLoadPluginInfos = externalPluginNames.map((pluginName) => {
  38021. let requirePath;
  38022. try {
  38023. requirePath = resolve(path.resolve(process.cwd(), pluginName));
  38024. } catch {
  38025. requirePath = resolve(pluginName, {
  38026. paths: [process.cwd()]
  38027. });
  38028. }
  38029. return {
  38030. name: pluginName,
  38031. requirePath
  38032. };
  38033. });
  38034. const externalAutoLoadPluginInfos = pluginSearchDirs.flatMap((pluginSearchDir) => {
  38035. const resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
  38036. const nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules");
  38037. if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
  38038. throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
  38039. }
  38040. return memoizedSearch(nodeModulesDir).map((pluginName) => ({
  38041. name: pluginName,
  38042. requirePath: resolve(pluginName, {
  38043. paths: [resolvedPluginSearchDir]
  38044. })
  38045. }));
  38046. });
  38047. const externalPlugins = [...uniqByKey([...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos], "requirePath").map((externalPluginInfo) => Object.assign({
  38048. name: externalPluginInfo.name
  38049. }, require(externalPluginInfo.requirePath))), ...externalPluginInstances];
  38050. return [...internalPlugins, ...externalPlugins];
  38051. }
  38052. function findPluginsInNodeModules(nodeModulesDir) {
  38053. const pluginPackageJsonPaths = fastGlob.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
  38054. cwd: nodeModulesDir
  38055. });
  38056. return pluginPackageJsonPaths.map(path.dirname);
  38057. }
  38058. function isDirectory(dir) {
  38059. try {
  38060. return fs.statSync(dir).isDirectory();
  38061. } catch {
  38062. return false;
  38063. }
  38064. }
  38065. module2.exports = {
  38066. loadPlugins: memoizedLoad,
  38067. clearCache
  38068. };
  38069. }
  38070. });
  38071. var {
  38072. version
  38073. } = require("./package.json");
  38074. var core = require_core();
  38075. var {
  38076. getSupportInfo
  38077. } = require_support();
  38078. var getFileInfo = require_get_file_info();
  38079. var sharedUtil = require_util_shared();
  38080. var plugins = require_load_plugins();
  38081. var config = require_resolve_config();
  38082. var doc = require("./doc.js");
  38083. function _withPlugins(fn, optsArgIdx = 1) {
  38084. return (...args) => {
  38085. const opts = args[optsArgIdx] || {};
  38086. args[optsArgIdx] = Object.assign(Object.assign({}, opts), {}, {
  38087. plugins: plugins.loadPlugins(opts.plugins, opts.pluginSearchDirs)
  38088. });
  38089. return fn(...args);
  38090. };
  38091. }
  38092. function withPlugins(fn, optsArgIdx) {
  38093. const resultingFn = _withPlugins(fn, optsArgIdx);
  38094. if (fn.sync) {
  38095. resultingFn.sync = _withPlugins(fn.sync, optsArgIdx);
  38096. }
  38097. return resultingFn;
  38098. }
  38099. var formatWithCursor = withPlugins(core.formatWithCursor);
  38100. module.exports = {
  38101. formatWithCursor,
  38102. format(text, opts) {
  38103. return formatWithCursor(text, opts).formatted;
  38104. },
  38105. check(text, opts) {
  38106. const {
  38107. formatted
  38108. } = formatWithCursor(text, opts);
  38109. return formatted === text;
  38110. },
  38111. doc,
  38112. resolveConfig: config.resolveConfig,
  38113. resolveConfigFile: config.resolveConfigFile,
  38114. clearConfigCache() {
  38115. config.clearCache();
  38116. plugins.clearCache();
  38117. },
  38118. getFileInfo: withPlugins(getFileInfo),
  38119. getSupportInfo: withPlugins(getSupportInfo, 0),
  38120. version,
  38121. util: sharedUtil,
  38122. __internal: {
  38123. errors: require_errors(),
  38124. coreOptions: require_core_options(),
  38125. createIgnorer: require_create_ignorer(),
  38126. optionsModule: require_options(),
  38127. optionsNormalizer: require_options_normalizer(),
  38128. utils: {
  38129. arrayify: require_arrayify(),
  38130. getLast: require_get_last(),
  38131. partition: require_partition(),
  38132. isNonEmptyArray: require_util().isNonEmptyArray
  38133. }
  38134. },
  38135. __debug: {
  38136. parse: withPlugins(core.parse),
  38137. formatAST: withPlugins(core.formatAST),
  38138. formatDoc: withPlugins(core.formatDoc),
  38139. printToDoc: withPlugins(core.printToDoc),
  38140. printDocToString: withPlugins(core.printDocToString)
  38141. }
  38142. };