index.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282
  1. "use strict";
  2. var __getOwnPropNames = Object.getOwnPropertyNames;
  3. var __commonJS = (cb, mod) => function __require() {
  4. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  5. };
  6. // node_modules/core-js/internals/global.js
  7. var require_global = __commonJS({
  8. "node_modules/core-js/internals/global.js"(exports2, module2) {
  9. var check = function(it) {
  10. return it && it.Math == Math && it;
  11. };
  12. module2.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || function() {
  13. return this;
  14. }() || Function("return this")();
  15. }
  16. });
  17. // node_modules/core-js/internals/fails.js
  18. var require_fails = __commonJS({
  19. "node_modules/core-js/internals/fails.js"(exports2, module2) {
  20. module2.exports = function(exec) {
  21. try {
  22. return !!exec();
  23. } catch (error) {
  24. return true;
  25. }
  26. };
  27. }
  28. });
  29. // node_modules/core-js/internals/descriptors.js
  30. var require_descriptors = __commonJS({
  31. "node_modules/core-js/internals/descriptors.js"(exports2, module2) {
  32. var fails = require_fails();
  33. module2.exports = !fails(function() {
  34. return Object.defineProperty({}, 1, { get: function() {
  35. return 7;
  36. } })[1] != 7;
  37. });
  38. }
  39. });
  40. // node_modules/core-js/internals/function-bind-native.js
  41. var require_function_bind_native = __commonJS({
  42. "node_modules/core-js/internals/function-bind-native.js"(exports2, module2) {
  43. var fails = require_fails();
  44. module2.exports = !fails(function() {
  45. var test = function() {
  46. }.bind();
  47. return typeof test != "function" || test.hasOwnProperty("prototype");
  48. });
  49. }
  50. });
  51. // node_modules/core-js/internals/function-call.js
  52. var require_function_call = __commonJS({
  53. "node_modules/core-js/internals/function-call.js"(exports2, module2) {
  54. var NATIVE_BIND = require_function_bind_native();
  55. var call = Function.prototype.call;
  56. module2.exports = NATIVE_BIND ? call.bind(call) : function() {
  57. return call.apply(call, arguments);
  58. };
  59. }
  60. });
  61. // node_modules/core-js/internals/object-property-is-enumerable.js
  62. var require_object_property_is_enumerable = __commonJS({
  63. "node_modules/core-js/internals/object-property-is-enumerable.js"(exports2) {
  64. "use strict";
  65. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  66. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  67. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  68. exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  69. var descriptor = getOwnPropertyDescriptor(this, V);
  70. return !!descriptor && descriptor.enumerable;
  71. } : $propertyIsEnumerable;
  72. }
  73. });
  74. // node_modules/core-js/internals/create-property-descriptor.js
  75. var require_create_property_descriptor = __commonJS({
  76. "node_modules/core-js/internals/create-property-descriptor.js"(exports2, module2) {
  77. module2.exports = function(bitmap, value) {
  78. return {
  79. enumerable: !(bitmap & 1),
  80. configurable: !(bitmap & 2),
  81. writable: !(bitmap & 4),
  82. value
  83. };
  84. };
  85. }
  86. });
  87. // node_modules/core-js/internals/function-uncurry-this.js
  88. var require_function_uncurry_this = __commonJS({
  89. "node_modules/core-js/internals/function-uncurry-this.js"(exports2, module2) {
  90. var NATIVE_BIND = require_function_bind_native();
  91. var FunctionPrototype = Function.prototype;
  92. var bind = FunctionPrototype.bind;
  93. var call = FunctionPrototype.call;
  94. var uncurryThis = NATIVE_BIND && bind.bind(call, call);
  95. module2.exports = NATIVE_BIND ? function(fn) {
  96. return fn && uncurryThis(fn);
  97. } : function(fn) {
  98. return fn && function() {
  99. return call.apply(fn, arguments);
  100. };
  101. };
  102. }
  103. });
  104. // node_modules/core-js/internals/classof-raw.js
  105. var require_classof_raw = __commonJS({
  106. "node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
  107. var uncurryThis = require_function_uncurry_this();
  108. var toString = uncurryThis({}.toString);
  109. var stringSlice = uncurryThis("".slice);
  110. module2.exports = function(it) {
  111. return stringSlice(toString(it), 8, -1);
  112. };
  113. }
  114. });
  115. // node_modules/core-js/internals/indexed-object.js
  116. var require_indexed_object = __commonJS({
  117. "node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
  118. var global2 = require_global();
  119. var uncurryThis = require_function_uncurry_this();
  120. var fails = require_fails();
  121. var classof = require_classof_raw();
  122. var Object2 = global2.Object;
  123. var split = uncurryThis("".split);
  124. module2.exports = fails(function() {
  125. return !Object2("z").propertyIsEnumerable(0);
  126. }) ? function(it) {
  127. return classof(it) == "String" ? split(it, "") : Object2(it);
  128. } : Object2;
  129. }
  130. });
  131. // node_modules/core-js/internals/require-object-coercible.js
  132. var require_require_object_coercible = __commonJS({
  133. "node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
  134. var global2 = require_global();
  135. var TypeError2 = global2.TypeError;
  136. module2.exports = function(it) {
  137. if (it == void 0)
  138. throw TypeError2("Can't call method on " + it);
  139. return it;
  140. };
  141. }
  142. });
  143. // node_modules/core-js/internals/to-indexed-object.js
  144. var require_to_indexed_object = __commonJS({
  145. "node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
  146. var IndexedObject = require_indexed_object();
  147. var requireObjectCoercible = require_require_object_coercible();
  148. module2.exports = function(it) {
  149. return IndexedObject(requireObjectCoercible(it));
  150. };
  151. }
  152. });
  153. // node_modules/core-js/internals/is-callable.js
  154. var require_is_callable = __commonJS({
  155. "node_modules/core-js/internals/is-callable.js"(exports2, module2) {
  156. module2.exports = function(argument) {
  157. return typeof argument == "function";
  158. };
  159. }
  160. });
  161. // node_modules/core-js/internals/is-object.js
  162. var require_is_object = __commonJS({
  163. "node_modules/core-js/internals/is-object.js"(exports2, module2) {
  164. var isCallable = require_is_callable();
  165. module2.exports = function(it) {
  166. return typeof it == "object" ? it !== null : isCallable(it);
  167. };
  168. }
  169. });
  170. // node_modules/core-js/internals/get-built-in.js
  171. var require_get_built_in = __commonJS({
  172. "node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
  173. var global2 = require_global();
  174. var isCallable = require_is_callable();
  175. var aFunction = function(argument) {
  176. return isCallable(argument) ? argument : void 0;
  177. };
  178. module2.exports = function(namespace, method) {
  179. return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
  180. };
  181. }
  182. });
  183. // node_modules/core-js/internals/object-is-prototype-of.js
  184. var require_object_is_prototype_of = __commonJS({
  185. "node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
  186. var uncurryThis = require_function_uncurry_this();
  187. module2.exports = uncurryThis({}.isPrototypeOf);
  188. }
  189. });
  190. // node_modules/core-js/internals/engine-user-agent.js
  191. var require_engine_user_agent = __commonJS({
  192. "node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
  193. var getBuiltIn = require_get_built_in();
  194. module2.exports = getBuiltIn("navigator", "userAgent") || "";
  195. }
  196. });
  197. // node_modules/core-js/internals/engine-v8-version.js
  198. var require_engine_v8_version = __commonJS({
  199. "node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
  200. var global2 = require_global();
  201. var userAgent = require_engine_user_agent();
  202. var process2 = global2.process;
  203. var Deno = global2.Deno;
  204. var versions = process2 && process2.versions || Deno && Deno.version;
  205. var v8 = versions && versions.v8;
  206. var match;
  207. var version2;
  208. if (v8) {
  209. match = v8.split(".");
  210. version2 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  211. }
  212. if (!version2 && userAgent) {
  213. match = userAgent.match(/Edge\/(\d+)/);
  214. if (!match || match[1] >= 74) {
  215. match = userAgent.match(/Chrome\/(\d+)/);
  216. if (match)
  217. version2 = +match[1];
  218. }
  219. }
  220. module2.exports = version2;
  221. }
  222. });
  223. // node_modules/core-js/internals/native-symbol.js
  224. var require_native_symbol = __commonJS({
  225. "node_modules/core-js/internals/native-symbol.js"(exports2, module2) {
  226. var V8_VERSION = require_engine_v8_version();
  227. var fails = require_fails();
  228. module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
  229. var symbol = Symbol();
  230. return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  231. });
  232. }
  233. });
  234. // node_modules/core-js/internals/use-symbol-as-uid.js
  235. var require_use_symbol_as_uid = __commonJS({
  236. "node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
  237. var NATIVE_SYMBOL = require_native_symbol();
  238. module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
  239. }
  240. });
  241. // node_modules/core-js/internals/is-symbol.js
  242. var require_is_symbol = __commonJS({
  243. "node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
  244. var global2 = require_global();
  245. var getBuiltIn = require_get_built_in();
  246. var isCallable = require_is_callable();
  247. var isPrototypeOf = require_object_is_prototype_of();
  248. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  249. var Object2 = global2.Object;
  250. module2.exports = USE_SYMBOL_AS_UID ? function(it) {
  251. return typeof it == "symbol";
  252. } : function(it) {
  253. var $Symbol = getBuiltIn("Symbol");
  254. return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object2(it));
  255. };
  256. }
  257. });
  258. // node_modules/core-js/internals/try-to-string.js
  259. var require_try_to_string = __commonJS({
  260. "node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
  261. var global2 = require_global();
  262. var String2 = global2.String;
  263. module2.exports = function(argument) {
  264. try {
  265. return String2(argument);
  266. } catch (error) {
  267. return "Object";
  268. }
  269. };
  270. }
  271. });
  272. // node_modules/core-js/internals/a-callable.js
  273. var require_a_callable = __commonJS({
  274. "node_modules/core-js/internals/a-callable.js"(exports2, module2) {
  275. var global2 = require_global();
  276. var isCallable = require_is_callable();
  277. var tryToString = require_try_to_string();
  278. var TypeError2 = global2.TypeError;
  279. module2.exports = function(argument) {
  280. if (isCallable(argument))
  281. return argument;
  282. throw TypeError2(tryToString(argument) + " is not a function");
  283. };
  284. }
  285. });
  286. // node_modules/core-js/internals/get-method.js
  287. var require_get_method = __commonJS({
  288. "node_modules/core-js/internals/get-method.js"(exports2, module2) {
  289. var aCallable = require_a_callable();
  290. module2.exports = function(V, P) {
  291. var func = V[P];
  292. return func == null ? void 0 : aCallable(func);
  293. };
  294. }
  295. });
  296. // node_modules/core-js/internals/ordinary-to-primitive.js
  297. var require_ordinary_to_primitive = __commonJS({
  298. "node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
  299. var global2 = require_global();
  300. var call = require_function_call();
  301. var isCallable = require_is_callable();
  302. var isObject = require_is_object();
  303. var TypeError2 = global2.TypeError;
  304. module2.exports = function(input, pref) {
  305. var fn, val;
  306. if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  307. return val;
  308. if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
  309. return val;
  310. if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
  311. return val;
  312. throw TypeError2("Can't convert object to primitive value");
  313. };
  314. }
  315. });
  316. // node_modules/core-js/internals/is-pure.js
  317. var require_is_pure = __commonJS({
  318. "node_modules/core-js/internals/is-pure.js"(exports2, module2) {
  319. module2.exports = false;
  320. }
  321. });
  322. // node_modules/core-js/internals/set-global.js
  323. var require_set_global = __commonJS({
  324. "node_modules/core-js/internals/set-global.js"(exports2, module2) {
  325. var global2 = require_global();
  326. var defineProperty = Object.defineProperty;
  327. module2.exports = function(key, value) {
  328. try {
  329. defineProperty(global2, key, { value, configurable: true, writable: true });
  330. } catch (error) {
  331. global2[key] = value;
  332. }
  333. return value;
  334. };
  335. }
  336. });
  337. // node_modules/core-js/internals/shared-store.js
  338. var require_shared_store = __commonJS({
  339. "node_modules/core-js/internals/shared-store.js"(exports2, module2) {
  340. var global2 = require_global();
  341. var setGlobal = require_set_global();
  342. var SHARED = "__core-js_shared__";
  343. var store = global2[SHARED] || setGlobal(SHARED, {});
  344. module2.exports = store;
  345. }
  346. });
  347. // node_modules/core-js/internals/shared.js
  348. var require_shared = __commonJS({
  349. "node_modules/core-js/internals/shared.js"(exports2, module2) {
  350. var IS_PURE = require_is_pure();
  351. var store = require_shared_store();
  352. (module2.exports = function(key, value) {
  353. return store[key] || (store[key] = value !== void 0 ? value : {});
  354. })("versions", []).push({
  355. version: "3.22.2",
  356. mode: IS_PURE ? "pure" : "global",
  357. copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
  358. license: "https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE",
  359. source: "https://github.com/zloirock/core-js"
  360. });
  361. }
  362. });
  363. // node_modules/core-js/internals/to-object.js
  364. var require_to_object = __commonJS({
  365. "node_modules/core-js/internals/to-object.js"(exports2, module2) {
  366. var global2 = require_global();
  367. var requireObjectCoercible = require_require_object_coercible();
  368. var Object2 = global2.Object;
  369. module2.exports = function(argument) {
  370. return Object2(requireObjectCoercible(argument));
  371. };
  372. }
  373. });
  374. // node_modules/core-js/internals/has-own-property.js
  375. var require_has_own_property = __commonJS({
  376. "node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
  377. var uncurryThis = require_function_uncurry_this();
  378. var toObject = require_to_object();
  379. var hasOwnProperty = uncurryThis({}.hasOwnProperty);
  380. module2.exports = Object.hasOwn || function hasOwn(it, key) {
  381. return hasOwnProperty(toObject(it), key);
  382. };
  383. }
  384. });
  385. // node_modules/core-js/internals/uid.js
  386. var require_uid = __commonJS({
  387. "node_modules/core-js/internals/uid.js"(exports2, module2) {
  388. var uncurryThis = require_function_uncurry_this();
  389. var id = 0;
  390. var postfix = Math.random();
  391. var toString = uncurryThis(1 .toString);
  392. module2.exports = function(key) {
  393. return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
  394. };
  395. }
  396. });
  397. // node_modules/core-js/internals/well-known-symbol.js
  398. var require_well_known_symbol = __commonJS({
  399. "node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
  400. var global2 = require_global();
  401. var shared = require_shared();
  402. var hasOwn = require_has_own_property();
  403. var uid = require_uid();
  404. var NATIVE_SYMBOL = require_native_symbol();
  405. var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
  406. var WellKnownSymbolsStore = shared("wks");
  407. var Symbol2 = global2.Symbol;
  408. var symbolFor = Symbol2 && Symbol2["for"];
  409. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
  410. module2.exports = function(name) {
  411. if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
  412. var description = "Symbol." + name;
  413. if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
  414. WellKnownSymbolsStore[name] = Symbol2[name];
  415. } else if (USE_SYMBOL_AS_UID && symbolFor) {
  416. WellKnownSymbolsStore[name] = symbolFor(description);
  417. } else {
  418. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  419. }
  420. }
  421. return WellKnownSymbolsStore[name];
  422. };
  423. }
  424. });
  425. // node_modules/core-js/internals/to-primitive.js
  426. var require_to_primitive = __commonJS({
  427. "node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
  428. var global2 = require_global();
  429. var call = require_function_call();
  430. var isObject = require_is_object();
  431. var isSymbol = require_is_symbol();
  432. var getMethod = require_get_method();
  433. var ordinaryToPrimitive = require_ordinary_to_primitive();
  434. var wellKnownSymbol = require_well_known_symbol();
  435. var TypeError2 = global2.TypeError;
  436. var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
  437. module2.exports = function(input, pref) {
  438. if (!isObject(input) || isSymbol(input))
  439. return input;
  440. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  441. var result;
  442. if (exoticToPrim) {
  443. if (pref === void 0)
  444. pref = "default";
  445. result = call(exoticToPrim, input, pref);
  446. if (!isObject(result) || isSymbol(result))
  447. return result;
  448. throw TypeError2("Can't convert object to primitive value");
  449. }
  450. if (pref === void 0)
  451. pref = "number";
  452. return ordinaryToPrimitive(input, pref);
  453. };
  454. }
  455. });
  456. // node_modules/core-js/internals/to-property-key.js
  457. var require_to_property_key = __commonJS({
  458. "node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
  459. var toPrimitive = require_to_primitive();
  460. var isSymbol = require_is_symbol();
  461. module2.exports = function(argument) {
  462. var key = toPrimitive(argument, "string");
  463. return isSymbol(key) ? key : key + "";
  464. };
  465. }
  466. });
  467. // node_modules/core-js/internals/document-create-element.js
  468. var require_document_create_element = __commonJS({
  469. "node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
  470. var global2 = require_global();
  471. var isObject = require_is_object();
  472. var document = global2.document;
  473. var EXISTS = isObject(document) && isObject(document.createElement);
  474. module2.exports = function(it) {
  475. return EXISTS ? document.createElement(it) : {};
  476. };
  477. }
  478. });
  479. // node_modules/core-js/internals/ie8-dom-define.js
  480. var require_ie8_dom_define = __commonJS({
  481. "node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
  482. var DESCRIPTORS = require_descriptors();
  483. var fails = require_fails();
  484. var createElement = require_document_create_element();
  485. module2.exports = !DESCRIPTORS && !fails(function() {
  486. return Object.defineProperty(createElement("div"), "a", {
  487. get: function() {
  488. return 7;
  489. }
  490. }).a != 7;
  491. });
  492. }
  493. });
  494. // node_modules/core-js/internals/object-get-own-property-descriptor.js
  495. var require_object_get_own_property_descriptor = __commonJS({
  496. "node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
  497. var DESCRIPTORS = require_descriptors();
  498. var call = require_function_call();
  499. var propertyIsEnumerableModule = require_object_property_is_enumerable();
  500. var createPropertyDescriptor = require_create_property_descriptor();
  501. var toIndexedObject = require_to_indexed_object();
  502. var toPropertyKey = require_to_property_key();
  503. var hasOwn = require_has_own_property();
  504. var IE8_DOM_DEFINE = require_ie8_dom_define();
  505. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  506. exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  507. O = toIndexedObject(O);
  508. P = toPropertyKey(P);
  509. if (IE8_DOM_DEFINE)
  510. try {
  511. return $getOwnPropertyDescriptor(O, P);
  512. } catch (error) {
  513. }
  514. if (hasOwn(O, P))
  515. return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
  516. };
  517. }
  518. });
  519. // node_modules/core-js/internals/v8-prototype-define-bug.js
  520. var require_v8_prototype_define_bug = __commonJS({
  521. "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
  522. var DESCRIPTORS = require_descriptors();
  523. var fails = require_fails();
  524. module2.exports = DESCRIPTORS && fails(function() {
  525. return Object.defineProperty(function() {
  526. }, "prototype", {
  527. value: 42,
  528. writable: false
  529. }).prototype != 42;
  530. });
  531. }
  532. });
  533. // node_modules/core-js/internals/an-object.js
  534. var require_an_object = __commonJS({
  535. "node_modules/core-js/internals/an-object.js"(exports2, module2) {
  536. var global2 = require_global();
  537. var isObject = require_is_object();
  538. var String2 = global2.String;
  539. var TypeError2 = global2.TypeError;
  540. module2.exports = function(argument) {
  541. if (isObject(argument))
  542. return argument;
  543. throw TypeError2(String2(argument) + " is not an object");
  544. };
  545. }
  546. });
  547. // node_modules/core-js/internals/object-define-property.js
  548. var require_object_define_property = __commonJS({
  549. "node_modules/core-js/internals/object-define-property.js"(exports2) {
  550. var global2 = require_global();
  551. var DESCRIPTORS = require_descriptors();
  552. var IE8_DOM_DEFINE = require_ie8_dom_define();
  553. var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
  554. var anObject = require_an_object();
  555. var toPropertyKey = require_to_property_key();
  556. var TypeError2 = global2.TypeError;
  557. var $defineProperty = Object.defineProperty;
  558. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  559. var ENUMERABLE = "enumerable";
  560. var CONFIGURABLE = "configurable";
  561. var WRITABLE = "writable";
  562. exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
  563. anObject(O);
  564. P = toPropertyKey(P);
  565. anObject(Attributes);
  566. if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  567. var current = $getOwnPropertyDescriptor(O, P);
  568. if (current && current[WRITABLE]) {
  569. O[P] = Attributes.value;
  570. Attributes = {
  571. configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
  572. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  573. writable: false
  574. };
  575. }
  576. }
  577. return $defineProperty(O, P, Attributes);
  578. } : $defineProperty : function defineProperty(O, P, Attributes) {
  579. anObject(O);
  580. P = toPropertyKey(P);
  581. anObject(Attributes);
  582. if (IE8_DOM_DEFINE)
  583. try {
  584. return $defineProperty(O, P, Attributes);
  585. } catch (error) {
  586. }
  587. if ("get" in Attributes || "set" in Attributes)
  588. throw TypeError2("Accessors not supported");
  589. if ("value" in Attributes)
  590. O[P] = Attributes.value;
  591. return O;
  592. };
  593. }
  594. });
  595. // node_modules/core-js/internals/create-non-enumerable-property.js
  596. var require_create_non_enumerable_property = __commonJS({
  597. "node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
  598. var DESCRIPTORS = require_descriptors();
  599. var definePropertyModule = require_object_define_property();
  600. var createPropertyDescriptor = require_create_property_descriptor();
  601. module2.exports = DESCRIPTORS ? function(object, key, value) {
  602. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  603. } : function(object, key, value) {
  604. object[key] = value;
  605. return object;
  606. };
  607. }
  608. });
  609. // node_modules/core-js/internals/inspect-source.js
  610. var require_inspect_source = __commonJS({
  611. "node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
  612. var uncurryThis = require_function_uncurry_this();
  613. var isCallable = require_is_callable();
  614. var store = require_shared_store();
  615. var functionToString = uncurryThis(Function.toString);
  616. if (!isCallable(store.inspectSource)) {
  617. store.inspectSource = function(it) {
  618. return functionToString(it);
  619. };
  620. }
  621. module2.exports = store.inspectSource;
  622. }
  623. });
  624. // node_modules/core-js/internals/native-weak-map.js
  625. var require_native_weak_map = __commonJS({
  626. "node_modules/core-js/internals/native-weak-map.js"(exports2, module2) {
  627. var global2 = require_global();
  628. var isCallable = require_is_callable();
  629. var inspectSource = require_inspect_source();
  630. var WeakMap2 = global2.WeakMap;
  631. module2.exports = isCallable(WeakMap2) && /native code/.test(inspectSource(WeakMap2));
  632. }
  633. });
  634. // node_modules/core-js/internals/shared-key.js
  635. var require_shared_key = __commonJS({
  636. "node_modules/core-js/internals/shared-key.js"(exports2, module2) {
  637. var shared = require_shared();
  638. var uid = require_uid();
  639. var keys = shared("keys");
  640. module2.exports = function(key) {
  641. return keys[key] || (keys[key] = uid(key));
  642. };
  643. }
  644. });
  645. // node_modules/core-js/internals/hidden-keys.js
  646. var require_hidden_keys = __commonJS({
  647. "node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
  648. module2.exports = {};
  649. }
  650. });
  651. // node_modules/core-js/internals/internal-state.js
  652. var require_internal_state = __commonJS({
  653. "node_modules/core-js/internals/internal-state.js"(exports2, module2) {
  654. var NATIVE_WEAK_MAP = require_native_weak_map();
  655. var global2 = require_global();
  656. var uncurryThis = require_function_uncurry_this();
  657. var isObject = require_is_object();
  658. var createNonEnumerableProperty = require_create_non_enumerable_property();
  659. var hasOwn = require_has_own_property();
  660. var shared = require_shared_store();
  661. var sharedKey = require_shared_key();
  662. var hiddenKeys = require_hidden_keys();
  663. var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
  664. var TypeError2 = global2.TypeError;
  665. var WeakMap2 = global2.WeakMap;
  666. var set;
  667. var get;
  668. var has;
  669. var enforce = function(it) {
  670. return has(it) ? get(it) : set(it, {});
  671. };
  672. var getterFor = function(TYPE) {
  673. return function(it) {
  674. var state;
  675. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  676. throw TypeError2("Incompatible receiver, " + TYPE + " required");
  677. }
  678. return state;
  679. };
  680. };
  681. if (NATIVE_WEAK_MAP || shared.state) {
  682. store = shared.state || (shared.state = new WeakMap2());
  683. wmget = uncurryThis(store.get);
  684. wmhas = uncurryThis(store.has);
  685. wmset = uncurryThis(store.set);
  686. set = function(it, metadata) {
  687. if (wmhas(store, it))
  688. throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
  689. metadata.facade = it;
  690. wmset(store, it, metadata);
  691. return metadata;
  692. };
  693. get = function(it) {
  694. return wmget(store, it) || {};
  695. };
  696. has = function(it) {
  697. return wmhas(store, it);
  698. };
  699. } else {
  700. STATE = sharedKey("state");
  701. hiddenKeys[STATE] = true;
  702. set = function(it, metadata) {
  703. if (hasOwn(it, STATE))
  704. throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
  705. metadata.facade = it;
  706. createNonEnumerableProperty(it, STATE, metadata);
  707. return metadata;
  708. };
  709. get = function(it) {
  710. return hasOwn(it, STATE) ? it[STATE] : {};
  711. };
  712. has = function(it) {
  713. return hasOwn(it, STATE);
  714. };
  715. }
  716. var store;
  717. var wmget;
  718. var wmhas;
  719. var wmset;
  720. var STATE;
  721. module2.exports = {
  722. set,
  723. get,
  724. has,
  725. enforce,
  726. getterFor
  727. };
  728. }
  729. });
  730. // node_modules/core-js/internals/function-name.js
  731. var require_function_name = __commonJS({
  732. "node_modules/core-js/internals/function-name.js"(exports2, module2) {
  733. var DESCRIPTORS = require_descriptors();
  734. var hasOwn = require_has_own_property();
  735. var FunctionPrototype = Function.prototype;
  736. var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
  737. var EXISTS = hasOwn(FunctionPrototype, "name");
  738. var PROPER = EXISTS && function something() {
  739. }.name === "something";
  740. var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
  741. module2.exports = {
  742. EXISTS,
  743. PROPER,
  744. CONFIGURABLE
  745. };
  746. }
  747. });
  748. // node_modules/core-js/internals/redefine.js
  749. var require_redefine = __commonJS({
  750. "node_modules/core-js/internals/redefine.js"(exports2, module2) {
  751. var global2 = require_global();
  752. var isCallable = require_is_callable();
  753. var hasOwn = require_has_own_property();
  754. var createNonEnumerableProperty = require_create_non_enumerable_property();
  755. var setGlobal = require_set_global();
  756. var inspectSource = require_inspect_source();
  757. var InternalStateModule = require_internal_state();
  758. var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
  759. var getInternalState = InternalStateModule.get;
  760. var enforceInternalState = InternalStateModule.enforce;
  761. var TEMPLATE = String(String).split("String");
  762. (module2.exports = function(O, key, value, options) {
  763. var unsafe = options ? !!options.unsafe : false;
  764. var simple = options ? !!options.enumerable : false;
  765. var noTargetGet = options ? !!options.noTargetGet : false;
  766. var name = options && options.name !== void 0 ? options.name : key;
  767. var state;
  768. if (isCallable(value)) {
  769. if (String(name).slice(0, 7) === "Symbol(") {
  770. name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
  771. }
  772. if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
  773. createNonEnumerableProperty(value, "name", name);
  774. }
  775. state = enforceInternalState(value);
  776. if (!state.source) {
  777. state.source = TEMPLATE.join(typeof name == "string" ? name : "");
  778. }
  779. }
  780. if (O === global2) {
  781. if (simple)
  782. O[key] = value;
  783. else
  784. setGlobal(key, value);
  785. return;
  786. } else if (!unsafe) {
  787. delete O[key];
  788. } else if (!noTargetGet && O[key]) {
  789. simple = true;
  790. }
  791. if (simple)
  792. O[key] = value;
  793. else
  794. createNonEnumerableProperty(O, key, value);
  795. })(Function.prototype, "toString", function toString() {
  796. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  797. });
  798. }
  799. });
  800. // node_modules/core-js/internals/to-integer-or-infinity.js
  801. var require_to_integer_or_infinity = __commonJS({
  802. "node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
  803. var ceil = Math.ceil;
  804. var floor = Math.floor;
  805. module2.exports = function(argument) {
  806. var number = +argument;
  807. return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
  808. };
  809. }
  810. });
  811. // node_modules/core-js/internals/to-absolute-index.js
  812. var require_to_absolute_index = __commonJS({
  813. "node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
  814. var toIntegerOrInfinity = require_to_integer_or_infinity();
  815. var max = Math.max;
  816. var min = Math.min;
  817. module2.exports = function(index, length) {
  818. var integer = toIntegerOrInfinity(index);
  819. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  820. };
  821. }
  822. });
  823. // node_modules/core-js/internals/to-length.js
  824. var require_to_length = __commonJS({
  825. "node_modules/core-js/internals/to-length.js"(exports2, module2) {
  826. var toIntegerOrInfinity = require_to_integer_or_infinity();
  827. var min = Math.min;
  828. module2.exports = function(argument) {
  829. return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
  830. };
  831. }
  832. });
  833. // node_modules/core-js/internals/length-of-array-like.js
  834. var require_length_of_array_like = __commonJS({
  835. "node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
  836. var toLength = require_to_length();
  837. module2.exports = function(obj) {
  838. return toLength(obj.length);
  839. };
  840. }
  841. });
  842. // node_modules/core-js/internals/array-includes.js
  843. var require_array_includes = __commonJS({
  844. "node_modules/core-js/internals/array-includes.js"(exports2, module2) {
  845. var toIndexedObject = require_to_indexed_object();
  846. var toAbsoluteIndex = require_to_absolute_index();
  847. var lengthOfArrayLike = require_length_of_array_like();
  848. var createMethod = function(IS_INCLUDES) {
  849. return function($this, el, fromIndex) {
  850. var O = toIndexedObject($this);
  851. var length = lengthOfArrayLike(O);
  852. var index = toAbsoluteIndex(fromIndex, length);
  853. var value;
  854. if (IS_INCLUDES && el != el)
  855. while (length > index) {
  856. value = O[index++];
  857. if (value != value)
  858. return true;
  859. }
  860. else
  861. for (; length > index; index++) {
  862. if ((IS_INCLUDES || index in O) && O[index] === el)
  863. return IS_INCLUDES || index || 0;
  864. }
  865. return !IS_INCLUDES && -1;
  866. };
  867. };
  868. module2.exports = {
  869. includes: createMethod(true),
  870. indexOf: createMethod(false)
  871. };
  872. }
  873. });
  874. // node_modules/core-js/internals/object-keys-internal.js
  875. var require_object_keys_internal = __commonJS({
  876. "node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
  877. var uncurryThis = require_function_uncurry_this();
  878. var hasOwn = require_has_own_property();
  879. var toIndexedObject = require_to_indexed_object();
  880. var indexOf = require_array_includes().indexOf;
  881. var hiddenKeys = require_hidden_keys();
  882. var push = uncurryThis([].push);
  883. module2.exports = function(object, names) {
  884. var O = toIndexedObject(object);
  885. var i = 0;
  886. var result = [];
  887. var key;
  888. for (key in O)
  889. !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
  890. while (names.length > i)
  891. if (hasOwn(O, key = names[i++])) {
  892. ~indexOf(result, key) || push(result, key);
  893. }
  894. return result;
  895. };
  896. }
  897. });
  898. // node_modules/core-js/internals/enum-bug-keys.js
  899. var require_enum_bug_keys = __commonJS({
  900. "node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
  901. module2.exports = [
  902. "constructor",
  903. "hasOwnProperty",
  904. "isPrototypeOf",
  905. "propertyIsEnumerable",
  906. "toLocaleString",
  907. "toString",
  908. "valueOf"
  909. ];
  910. }
  911. });
  912. // node_modules/core-js/internals/object-get-own-property-names.js
  913. var require_object_get_own_property_names = __commonJS({
  914. "node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
  915. var internalObjectKeys = require_object_keys_internal();
  916. var enumBugKeys = require_enum_bug_keys();
  917. var hiddenKeys = enumBugKeys.concat("length", "prototype");
  918. exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  919. return internalObjectKeys(O, hiddenKeys);
  920. };
  921. }
  922. });
  923. // node_modules/core-js/internals/object-get-own-property-symbols.js
  924. var require_object_get_own_property_symbols = __commonJS({
  925. "node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
  926. exports2.f = Object.getOwnPropertySymbols;
  927. }
  928. });
  929. // node_modules/core-js/internals/own-keys.js
  930. var require_own_keys = __commonJS({
  931. "node_modules/core-js/internals/own-keys.js"(exports2, module2) {
  932. var getBuiltIn = require_get_built_in();
  933. var uncurryThis = require_function_uncurry_this();
  934. var getOwnPropertyNamesModule = require_object_get_own_property_names();
  935. var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
  936. var anObject = require_an_object();
  937. var concat = uncurryThis([].concat);
  938. module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
  939. var keys = getOwnPropertyNamesModule.f(anObject(it));
  940. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  941. return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
  942. };
  943. }
  944. });
  945. // node_modules/core-js/internals/copy-constructor-properties.js
  946. var require_copy_constructor_properties = __commonJS({
  947. "node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
  948. var hasOwn = require_has_own_property();
  949. var ownKeys = require_own_keys();
  950. var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
  951. var definePropertyModule = require_object_define_property();
  952. module2.exports = function(target, source, exceptions) {
  953. var keys = ownKeys(source);
  954. var defineProperty = definePropertyModule.f;
  955. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  956. for (var i = 0; i < keys.length; i++) {
  957. var key = keys[i];
  958. if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
  959. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  960. }
  961. }
  962. };
  963. }
  964. });
  965. // node_modules/core-js/internals/is-forced.js
  966. var require_is_forced = __commonJS({
  967. "node_modules/core-js/internals/is-forced.js"(exports2, module2) {
  968. var fails = require_fails();
  969. var isCallable = require_is_callable();
  970. var replacement = /#|\.prototype\./;
  971. var isForced = function(feature, detection) {
  972. var value = data[normalize(feature)];
  973. return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
  974. };
  975. var normalize = isForced.normalize = function(string) {
  976. return String(string).replace(replacement, ".").toLowerCase();
  977. };
  978. var data = isForced.data = {};
  979. var NATIVE = isForced.NATIVE = "N";
  980. var POLYFILL = isForced.POLYFILL = "P";
  981. module2.exports = isForced;
  982. }
  983. });
  984. // node_modules/core-js/internals/export.js
  985. var require_export = __commonJS({
  986. "node_modules/core-js/internals/export.js"(exports2, module2) {
  987. var global2 = require_global();
  988. var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
  989. var createNonEnumerableProperty = require_create_non_enumerable_property();
  990. var redefine = require_redefine();
  991. var setGlobal = require_set_global();
  992. var copyConstructorProperties = require_copy_constructor_properties();
  993. var isForced = require_is_forced();
  994. module2.exports = function(options, source) {
  995. var TARGET = options.target;
  996. var GLOBAL = options.global;
  997. var STATIC = options.stat;
  998. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  999. if (GLOBAL) {
  1000. target = global2;
  1001. } else if (STATIC) {
  1002. target = global2[TARGET] || setGlobal(TARGET, {});
  1003. } else {
  1004. target = (global2[TARGET] || {}).prototype;
  1005. }
  1006. if (target)
  1007. for (key in source) {
  1008. sourceProperty = source[key];
  1009. if (options.noTargetGet) {
  1010. descriptor = getOwnPropertyDescriptor(target, key);
  1011. targetProperty = descriptor && descriptor.value;
  1012. } else
  1013. targetProperty = target[key];
  1014. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
  1015. if (!FORCED && targetProperty !== void 0) {
  1016. if (typeof sourceProperty == typeof targetProperty)
  1017. continue;
  1018. copyConstructorProperties(sourceProperty, targetProperty);
  1019. }
  1020. if (options.sham || targetProperty && targetProperty.sham) {
  1021. createNonEnumerableProperty(sourceProperty, "sham", true);
  1022. }
  1023. redefine(target, key, sourceProperty, options);
  1024. }
  1025. };
  1026. }
  1027. });
  1028. // node_modules/core-js/internals/is-array.js
  1029. var require_is_array = __commonJS({
  1030. "node_modules/core-js/internals/is-array.js"(exports2, module2) {
  1031. var classof = require_classof_raw();
  1032. module2.exports = Array.isArray || function isArray(argument) {
  1033. return classof(argument) == "Array";
  1034. };
  1035. }
  1036. });
  1037. // node_modules/core-js/internals/function-bind-context.js
  1038. var require_function_bind_context = __commonJS({
  1039. "node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
  1040. var uncurryThis = require_function_uncurry_this();
  1041. var aCallable = require_a_callable();
  1042. var NATIVE_BIND = require_function_bind_native();
  1043. var bind = uncurryThis(uncurryThis.bind);
  1044. module2.exports = function(fn, that) {
  1045. aCallable(fn);
  1046. return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
  1047. return fn.apply(that, arguments);
  1048. };
  1049. };
  1050. }
  1051. });
  1052. // node_modules/core-js/internals/flatten-into-array.js
  1053. var require_flatten_into_array = __commonJS({
  1054. "node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
  1055. "use strict";
  1056. var global2 = require_global();
  1057. var isArray = require_is_array();
  1058. var lengthOfArrayLike = require_length_of_array_like();
  1059. var bind = require_function_bind_context();
  1060. var TypeError2 = global2.TypeError;
  1061. var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
  1062. var targetIndex = start;
  1063. var sourceIndex = 0;
  1064. var mapFn = mapper ? bind(mapper, thisArg) : false;
  1065. var element, elementLen;
  1066. while (sourceIndex < sourceLen) {
  1067. if (sourceIndex in source) {
  1068. element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
  1069. if (depth > 0 && isArray(element)) {
  1070. elementLen = lengthOfArrayLike(element);
  1071. targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
  1072. } else {
  1073. if (targetIndex >= 9007199254740991)
  1074. throw TypeError2("Exceed the acceptable array length");
  1075. target[targetIndex] = element;
  1076. }
  1077. targetIndex++;
  1078. }
  1079. sourceIndex++;
  1080. }
  1081. return targetIndex;
  1082. };
  1083. module2.exports = flattenIntoArray;
  1084. }
  1085. });
  1086. // node_modules/core-js/internals/to-string-tag-support.js
  1087. var require_to_string_tag_support = __commonJS({
  1088. "node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
  1089. var wellKnownSymbol = require_well_known_symbol();
  1090. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1091. var test = {};
  1092. test[TO_STRING_TAG] = "z";
  1093. module2.exports = String(test) === "[object z]";
  1094. }
  1095. });
  1096. // node_modules/core-js/internals/classof.js
  1097. var require_classof = __commonJS({
  1098. "node_modules/core-js/internals/classof.js"(exports2, module2) {
  1099. var global2 = require_global();
  1100. var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
  1101. var isCallable = require_is_callable();
  1102. var classofRaw = require_classof_raw();
  1103. var wellKnownSymbol = require_well_known_symbol();
  1104. var TO_STRING_TAG = wellKnownSymbol("toStringTag");
  1105. var Object2 = global2.Object;
  1106. var CORRECT_ARGUMENTS = classofRaw(function() {
  1107. return arguments;
  1108. }()) == "Arguments";
  1109. var tryGet = function(it, key) {
  1110. try {
  1111. return it[key];
  1112. } catch (error) {
  1113. }
  1114. };
  1115. module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
  1116. var O, tag, result;
  1117. return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = Object2(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
  1118. };
  1119. }
  1120. });
  1121. // node_modules/core-js/internals/is-constructor.js
  1122. var require_is_constructor = __commonJS({
  1123. "node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
  1124. var uncurryThis = require_function_uncurry_this();
  1125. var fails = require_fails();
  1126. var isCallable = require_is_callable();
  1127. var classof = require_classof();
  1128. var getBuiltIn = require_get_built_in();
  1129. var inspectSource = require_inspect_source();
  1130. var noop = function() {
  1131. };
  1132. var empty = [];
  1133. var construct = getBuiltIn("Reflect", "construct");
  1134. var constructorRegExp = /^\s*(?:class|function)\b/;
  1135. var exec = uncurryThis(constructorRegExp.exec);
  1136. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  1137. var isConstructorModern = function isConstructor(argument) {
  1138. if (!isCallable(argument))
  1139. return false;
  1140. try {
  1141. construct(noop, empty, argument);
  1142. return true;
  1143. } catch (error) {
  1144. return false;
  1145. }
  1146. };
  1147. var isConstructorLegacy = function isConstructor(argument) {
  1148. if (!isCallable(argument))
  1149. return false;
  1150. switch (classof(argument)) {
  1151. case "AsyncFunction":
  1152. case "GeneratorFunction":
  1153. case "AsyncGeneratorFunction":
  1154. return false;
  1155. }
  1156. try {
  1157. return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
  1158. } catch (error) {
  1159. return true;
  1160. }
  1161. };
  1162. isConstructorLegacy.sham = true;
  1163. module2.exports = !construct || fails(function() {
  1164. var called;
  1165. return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
  1166. called = true;
  1167. }) || called;
  1168. }) ? isConstructorLegacy : isConstructorModern;
  1169. }
  1170. });
  1171. // node_modules/core-js/internals/array-species-constructor.js
  1172. var require_array_species_constructor = __commonJS({
  1173. "node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
  1174. var global2 = require_global();
  1175. var isArray = require_is_array();
  1176. var isConstructor = require_is_constructor();
  1177. var isObject = require_is_object();
  1178. var wellKnownSymbol = require_well_known_symbol();
  1179. var SPECIES = wellKnownSymbol("species");
  1180. var Array2 = global2.Array;
  1181. module2.exports = function(originalArray) {
  1182. var C;
  1183. if (isArray(originalArray)) {
  1184. C = originalArray.constructor;
  1185. if (isConstructor(C) && (C === Array2 || isArray(C.prototype)))
  1186. C = void 0;
  1187. else if (isObject(C)) {
  1188. C = C[SPECIES];
  1189. if (C === null)
  1190. C = void 0;
  1191. }
  1192. }
  1193. return C === void 0 ? Array2 : C;
  1194. };
  1195. }
  1196. });
  1197. // node_modules/core-js/internals/array-species-create.js
  1198. var require_array_species_create = __commonJS({
  1199. "node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
  1200. var arraySpeciesConstructor = require_array_species_constructor();
  1201. module2.exports = function(originalArray, length) {
  1202. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  1203. };
  1204. }
  1205. });
  1206. // node_modules/core-js/modules/es.array.flat-map.js
  1207. var require_es_array_flat_map = __commonJS({
  1208. "node_modules/core-js/modules/es.array.flat-map.js"() {
  1209. "use strict";
  1210. var $ = require_export();
  1211. var flattenIntoArray = require_flatten_into_array();
  1212. var aCallable = require_a_callable();
  1213. var toObject = require_to_object();
  1214. var lengthOfArrayLike = require_length_of_array_like();
  1215. var arraySpeciesCreate = require_array_species_create();
  1216. $({ target: "Array", proto: true }, {
  1217. flatMap: function flatMap(callbackfn) {
  1218. var O = toObject(this);
  1219. var sourceLen = lengthOfArrayLike(O);
  1220. var A;
  1221. aCallable(callbackfn);
  1222. A = arraySpeciesCreate(O, 0);
  1223. A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
  1224. return A;
  1225. }
  1226. });
  1227. }
  1228. });
  1229. // node_modules/core-js/internals/iterators.js
  1230. var require_iterators = __commonJS({
  1231. "node_modules/core-js/internals/iterators.js"(exports2, module2) {
  1232. module2.exports = {};
  1233. }
  1234. });
  1235. // node_modules/core-js/internals/is-array-iterator-method.js
  1236. var require_is_array_iterator_method = __commonJS({
  1237. "node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
  1238. var wellKnownSymbol = require_well_known_symbol();
  1239. var Iterators = require_iterators();
  1240. var ITERATOR = wellKnownSymbol("iterator");
  1241. var ArrayPrototype = Array.prototype;
  1242. module2.exports = function(it) {
  1243. return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  1244. };
  1245. }
  1246. });
  1247. // node_modules/core-js/internals/get-iterator-method.js
  1248. var require_get_iterator_method = __commonJS({
  1249. "node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
  1250. var classof = require_classof();
  1251. var getMethod = require_get_method();
  1252. var Iterators = require_iterators();
  1253. var wellKnownSymbol = require_well_known_symbol();
  1254. var ITERATOR = wellKnownSymbol("iterator");
  1255. module2.exports = function(it) {
  1256. if (it != void 0)
  1257. return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
  1258. };
  1259. }
  1260. });
  1261. // node_modules/core-js/internals/get-iterator.js
  1262. var require_get_iterator = __commonJS({
  1263. "node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
  1264. var global2 = require_global();
  1265. var call = require_function_call();
  1266. var aCallable = require_a_callable();
  1267. var anObject = require_an_object();
  1268. var tryToString = require_try_to_string();
  1269. var getIteratorMethod = require_get_iterator_method();
  1270. var TypeError2 = global2.TypeError;
  1271. module2.exports = function(argument, usingIterator) {
  1272. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
  1273. if (aCallable(iteratorMethod))
  1274. return anObject(call(iteratorMethod, argument));
  1275. throw TypeError2(tryToString(argument) + " is not iterable");
  1276. };
  1277. }
  1278. });
  1279. // node_modules/core-js/internals/iterator-close.js
  1280. var require_iterator_close = __commonJS({
  1281. "node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
  1282. var call = require_function_call();
  1283. var anObject = require_an_object();
  1284. var getMethod = require_get_method();
  1285. module2.exports = function(iterator, kind, value) {
  1286. var innerResult, innerError;
  1287. anObject(iterator);
  1288. try {
  1289. innerResult = getMethod(iterator, "return");
  1290. if (!innerResult) {
  1291. if (kind === "throw")
  1292. throw value;
  1293. return value;
  1294. }
  1295. innerResult = call(innerResult, iterator);
  1296. } catch (error) {
  1297. innerError = true;
  1298. innerResult = error;
  1299. }
  1300. if (kind === "throw")
  1301. throw value;
  1302. if (innerError)
  1303. throw innerResult;
  1304. anObject(innerResult);
  1305. return value;
  1306. };
  1307. }
  1308. });
  1309. // node_modules/core-js/internals/iterate.js
  1310. var require_iterate = __commonJS({
  1311. "node_modules/core-js/internals/iterate.js"(exports2, module2) {
  1312. var global2 = require_global();
  1313. var bind = require_function_bind_context();
  1314. var call = require_function_call();
  1315. var anObject = require_an_object();
  1316. var tryToString = require_try_to_string();
  1317. var isArrayIteratorMethod = require_is_array_iterator_method();
  1318. var lengthOfArrayLike = require_length_of_array_like();
  1319. var isPrototypeOf = require_object_is_prototype_of();
  1320. var getIterator = require_get_iterator();
  1321. var getIteratorMethod = require_get_iterator_method();
  1322. var iteratorClose = require_iterator_close();
  1323. var TypeError2 = global2.TypeError;
  1324. var Result = function(stopped, result) {
  1325. this.stopped = stopped;
  1326. this.result = result;
  1327. };
  1328. var ResultPrototype = Result.prototype;
  1329. module2.exports = function(iterable, unboundFunction, options) {
  1330. var that = options && options.that;
  1331. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  1332. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  1333. var INTERRUPTED = !!(options && options.INTERRUPTED);
  1334. var fn = bind(unboundFunction, that);
  1335. var iterator, iterFn, index, length, result, next, step;
  1336. var stop = function(condition) {
  1337. if (iterator)
  1338. iteratorClose(iterator, "normal", condition);
  1339. return new Result(true, condition);
  1340. };
  1341. var callFn = function(value) {
  1342. if (AS_ENTRIES) {
  1343. anObject(value);
  1344. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  1345. }
  1346. return INTERRUPTED ? fn(value, stop) : fn(value);
  1347. };
  1348. if (IS_ITERATOR) {
  1349. iterator = iterable;
  1350. } else {
  1351. iterFn = getIteratorMethod(iterable);
  1352. if (!iterFn)
  1353. throw TypeError2(tryToString(iterable) + " is not iterable");
  1354. if (isArrayIteratorMethod(iterFn)) {
  1355. for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
  1356. result = callFn(iterable[index]);
  1357. if (result && isPrototypeOf(ResultPrototype, result))
  1358. return result;
  1359. }
  1360. return new Result(false);
  1361. }
  1362. iterator = getIterator(iterable, iterFn);
  1363. }
  1364. next = iterator.next;
  1365. while (!(step = call(next, iterator)).done) {
  1366. try {
  1367. result = callFn(step.value);
  1368. } catch (error) {
  1369. iteratorClose(iterator, "throw", error);
  1370. }
  1371. if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
  1372. return result;
  1373. }
  1374. return new Result(false);
  1375. };
  1376. }
  1377. });
  1378. // node_modules/core-js/internals/create-property.js
  1379. var require_create_property = __commonJS({
  1380. "node_modules/core-js/internals/create-property.js"(exports2, module2) {
  1381. "use strict";
  1382. var toPropertyKey = require_to_property_key();
  1383. var definePropertyModule = require_object_define_property();
  1384. var createPropertyDescriptor = require_create_property_descriptor();
  1385. module2.exports = function(object, key, value) {
  1386. var propertyKey = toPropertyKey(key);
  1387. if (propertyKey in object)
  1388. definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  1389. else
  1390. object[propertyKey] = value;
  1391. };
  1392. }
  1393. });
  1394. // node_modules/core-js/modules/es.object.from-entries.js
  1395. var require_es_object_from_entries = __commonJS({
  1396. "node_modules/core-js/modules/es.object.from-entries.js"() {
  1397. var $ = require_export();
  1398. var iterate = require_iterate();
  1399. var createProperty = require_create_property();
  1400. $({ target: "Object", stat: true }, {
  1401. fromEntries: function fromEntries(iterable) {
  1402. var obj = {};
  1403. iterate(iterable, function(k, v) {
  1404. createProperty(obj, k, v);
  1405. }, { AS_ENTRIES: true });
  1406. return obj;
  1407. }
  1408. });
  1409. }
  1410. });
  1411. // node_modules/core-js/modules/es.array.flat.js
  1412. var require_es_array_flat = __commonJS({
  1413. "node_modules/core-js/modules/es.array.flat.js"() {
  1414. "use strict";
  1415. var $ = require_export();
  1416. var flattenIntoArray = require_flatten_into_array();
  1417. var toObject = require_to_object();
  1418. var lengthOfArrayLike = require_length_of_array_like();
  1419. var toIntegerOrInfinity = require_to_integer_or_infinity();
  1420. var arraySpeciesCreate = require_array_species_create();
  1421. $({ target: "Array", proto: true }, {
  1422. flat: function flat() {
  1423. var depthArg = arguments.length ? arguments[0] : void 0;
  1424. var O = toObject(this);
  1425. var sourceLen = lengthOfArrayLike(O);
  1426. var A = arraySpeciesCreate(O, 0);
  1427. A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
  1428. return A;
  1429. }
  1430. });
  1431. }
  1432. });
  1433. // dist/_index.js.cjs.js
  1434. var _excluded = ["cliName", "cliCategory", "cliDescription"];
  1435. var _excluded2 = ["_"];
  1436. var _excluded3 = ["overrides"];
  1437. var _excluded4 = ["languageId"];
  1438. function _objectWithoutProperties(source, excluded) {
  1439. if (source == null)
  1440. return {};
  1441. var target = _objectWithoutPropertiesLoose(source, excluded);
  1442. var key, i;
  1443. if (Object.getOwnPropertySymbols) {
  1444. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  1445. for (i = 0; i < sourceSymbolKeys.length; i++) {
  1446. key = sourceSymbolKeys[i];
  1447. if (excluded.indexOf(key) >= 0)
  1448. continue;
  1449. if (!Object.prototype.propertyIsEnumerable.call(source, key))
  1450. continue;
  1451. target[key] = source[key];
  1452. }
  1453. }
  1454. return target;
  1455. }
  1456. function _objectWithoutPropertiesLoose(source, excluded) {
  1457. if (source == null)
  1458. return {};
  1459. var target = {};
  1460. var sourceKeys = Object.keys(source);
  1461. var key, i;
  1462. for (i = 0; i < sourceKeys.length; i++) {
  1463. key = sourceKeys[i];
  1464. if (excluded.indexOf(key) >= 0)
  1465. continue;
  1466. target[key] = source[key];
  1467. }
  1468. return target;
  1469. }
  1470. require_es_array_flat_map();
  1471. require_es_object_from_entries();
  1472. require_es_array_flat();
  1473. var __create = Object.create;
  1474. var __defProp = Object.defineProperty;
  1475. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  1476. var __getOwnPropNames2 = Object.getOwnPropertyNames;
  1477. var __getProtoOf = Object.getPrototypeOf;
  1478. var __hasOwnProp = Object.prototype.hasOwnProperty;
  1479. var __esm = (fn, res) => function __init() {
  1480. return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
  1481. };
  1482. var __commonJS2 = (cb, mod) => function __require() {
  1483. return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
  1484. exports: {}
  1485. }).exports, mod), mod.exports;
  1486. };
  1487. var __export = (target, all) => {
  1488. for (var name in all)
  1489. __defProp(target, name, {
  1490. get: all[name],
  1491. enumerable: true
  1492. });
  1493. };
  1494. var __copyProps = (to, from, except, desc) => {
  1495. if (from && typeof from === "object" || typeof from === "function") {
  1496. for (let key of __getOwnPropNames2(from))
  1497. if (!__hasOwnProp.call(to, key) && key !== except)
  1498. __defProp(to, key, {
  1499. get: () => from[key],
  1500. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  1501. });
  1502. }
  1503. return to;
  1504. };
  1505. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  1506. value: mod,
  1507. enumerable: true
  1508. }) : target, mod));
  1509. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
  1510. value: true
  1511. }), mod);
  1512. var require_base = __commonJS2({
  1513. "node_modules/diff/lib/diff/base.js"(exports2) {
  1514. "use strict";
  1515. Object.defineProperty(exports2, "__esModule", {
  1516. value: true
  1517. });
  1518. exports2["default"] = Diff;
  1519. function Diff() {
  1520. }
  1521. Diff.prototype = {
  1522. diff: function diff(oldString, newString) {
  1523. var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
  1524. var callback = options.callback;
  1525. if (typeof options === "function") {
  1526. callback = options;
  1527. options = {};
  1528. }
  1529. this.options = options;
  1530. var self2 = this;
  1531. function done(value) {
  1532. if (callback) {
  1533. setTimeout(function() {
  1534. callback(void 0, value);
  1535. }, 0);
  1536. return true;
  1537. } else {
  1538. return value;
  1539. }
  1540. }
  1541. oldString = this.castInput(oldString);
  1542. newString = this.castInput(newString);
  1543. oldString = this.removeEmpty(this.tokenize(oldString));
  1544. newString = this.removeEmpty(this.tokenize(newString));
  1545. var newLen = newString.length, oldLen = oldString.length;
  1546. var editLength = 1;
  1547. var maxEditLength = newLen + oldLen;
  1548. var bestPath = [{
  1549. newPos: -1,
  1550. components: []
  1551. }];
  1552. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  1553. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  1554. return done([{
  1555. value: this.join(newString),
  1556. count: newString.length
  1557. }]);
  1558. }
  1559. function execEditLength() {
  1560. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  1561. var basePath = void 0;
  1562. var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  1563. if (addPath) {
  1564. bestPath[diagonalPath - 1] = void 0;
  1565. }
  1566. var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  1567. if (!canAdd && !canRemove) {
  1568. bestPath[diagonalPath] = void 0;
  1569. continue;
  1570. }
  1571. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  1572. basePath = clonePath(removePath);
  1573. self2.pushComponent(basePath.components, void 0, true);
  1574. } else {
  1575. basePath = addPath;
  1576. basePath.newPos++;
  1577. self2.pushComponent(basePath.components, true, void 0);
  1578. }
  1579. _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
  1580. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  1581. return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
  1582. } else {
  1583. bestPath[diagonalPath] = basePath;
  1584. }
  1585. }
  1586. editLength++;
  1587. }
  1588. if (callback) {
  1589. (function exec() {
  1590. setTimeout(function() {
  1591. if (editLength > maxEditLength) {
  1592. return callback();
  1593. }
  1594. if (!execEditLength()) {
  1595. exec();
  1596. }
  1597. }, 0);
  1598. })();
  1599. } else {
  1600. while (editLength <= maxEditLength) {
  1601. var ret = execEditLength();
  1602. if (ret) {
  1603. return ret;
  1604. }
  1605. }
  1606. }
  1607. },
  1608. pushComponent: function pushComponent(components, added, removed) {
  1609. var last = components[components.length - 1];
  1610. if (last && last.added === added && last.removed === removed) {
  1611. components[components.length - 1] = {
  1612. count: last.count + 1,
  1613. added,
  1614. removed
  1615. };
  1616. } else {
  1617. components.push({
  1618. count: 1,
  1619. added,
  1620. removed
  1621. });
  1622. }
  1623. },
  1624. extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  1625. var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
  1626. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  1627. newPos++;
  1628. oldPos++;
  1629. commonCount++;
  1630. }
  1631. if (commonCount) {
  1632. basePath.components.push({
  1633. count: commonCount
  1634. });
  1635. }
  1636. basePath.newPos = newPos;
  1637. return oldPos;
  1638. },
  1639. equals: function equals(left, right) {
  1640. if (this.options.comparator) {
  1641. return this.options.comparator(left, right);
  1642. } else {
  1643. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  1644. }
  1645. },
  1646. removeEmpty: function removeEmpty(array) {
  1647. var ret = [];
  1648. for (var i = 0; i < array.length; i++) {
  1649. if (array[i]) {
  1650. ret.push(array[i]);
  1651. }
  1652. }
  1653. return ret;
  1654. },
  1655. castInput: function castInput(value) {
  1656. return value;
  1657. },
  1658. tokenize: function tokenize(value) {
  1659. return value.split("");
  1660. },
  1661. join: function join(chars) {
  1662. return chars.join("");
  1663. }
  1664. };
  1665. function buildValues(diff, components, newString, oldString, useLongestToken) {
  1666. var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
  1667. for (; componentPos < componentLen; componentPos++) {
  1668. var component = components[componentPos];
  1669. if (!component.removed) {
  1670. if (!component.added && useLongestToken) {
  1671. var value = newString.slice(newPos, newPos + component.count);
  1672. value = value.map(function(value2, i) {
  1673. var oldValue = oldString[oldPos + i];
  1674. return oldValue.length > value2.length ? oldValue : value2;
  1675. });
  1676. component.value = diff.join(value);
  1677. } else {
  1678. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  1679. }
  1680. newPos += component.count;
  1681. if (!component.added) {
  1682. oldPos += component.count;
  1683. }
  1684. } else {
  1685. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  1686. oldPos += component.count;
  1687. if (componentPos && components[componentPos - 1].added) {
  1688. var tmp = components[componentPos - 1];
  1689. components[componentPos - 1] = components[componentPos];
  1690. components[componentPos] = tmp;
  1691. }
  1692. }
  1693. }
  1694. var lastComponent = components[componentLen - 1];
  1695. if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
  1696. components[componentLen - 2].value += lastComponent.value;
  1697. components.pop();
  1698. }
  1699. return components;
  1700. }
  1701. function clonePath(path) {
  1702. return {
  1703. newPos: path.newPos,
  1704. components: path.components.slice(0)
  1705. };
  1706. }
  1707. }
  1708. });
  1709. var require_array = __commonJS2({
  1710. "node_modules/diff/lib/diff/array.js"(exports2) {
  1711. "use strict";
  1712. Object.defineProperty(exports2, "__esModule", {
  1713. value: true
  1714. });
  1715. exports2.diffArrays = diffArrays;
  1716. exports2.arrayDiff = void 0;
  1717. var _base = _interopRequireDefault(require_base());
  1718. function _interopRequireDefault(obj) {
  1719. return obj && obj.__esModule ? obj : {
  1720. "default": obj
  1721. };
  1722. }
  1723. var arrayDiff = new _base["default"]();
  1724. exports2.arrayDiff = arrayDiff;
  1725. arrayDiff.tokenize = function(value) {
  1726. return value.slice();
  1727. };
  1728. arrayDiff.join = arrayDiff.removeEmpty = function(value) {
  1729. return value;
  1730. };
  1731. function diffArrays(oldArr, newArr, callback) {
  1732. return arrayDiff.diff(oldArr, newArr, callback);
  1733. }
  1734. }
  1735. });
  1736. var escape_string_regexp_exports = {};
  1737. __export(escape_string_regexp_exports, {
  1738. default: () => escapeStringRegexp
  1739. });
  1740. function escapeStringRegexp(string) {
  1741. if (typeof string !== "string") {
  1742. throw new TypeError("Expected a string");
  1743. }
  1744. return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  1745. }
  1746. var init_escape_string_regexp = __esm({
  1747. "node_modules/escape-string-regexp/index.js"() {
  1748. }
  1749. });
  1750. var require_get_last = __commonJS2({
  1751. "src/utils/get-last.js"(exports2, module2) {
  1752. "use strict";
  1753. var getLast = (arr) => arr[arr.length - 1];
  1754. module2.exports = getLast;
  1755. }
  1756. });
  1757. var require_debug = __commonJS2({
  1758. "node_modules/semver/internal/debug.js"(exports2, module2) {
  1759. var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
  1760. };
  1761. module2.exports = debug;
  1762. }
  1763. });
  1764. var require_constants = __commonJS2({
  1765. "node_modules/semver/internal/constants.js"(exports2, module2) {
  1766. var SEMVER_SPEC_VERSION = "2.0.0";
  1767. var MAX_LENGTH = 256;
  1768. var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
  1769. var MAX_SAFE_COMPONENT_LENGTH = 16;
  1770. module2.exports = {
  1771. SEMVER_SPEC_VERSION,
  1772. MAX_LENGTH,
  1773. MAX_SAFE_INTEGER,
  1774. MAX_SAFE_COMPONENT_LENGTH
  1775. };
  1776. }
  1777. });
  1778. var require_re = __commonJS2({
  1779. "node_modules/semver/internal/re.js"(exports2, module2) {
  1780. var {
  1781. MAX_SAFE_COMPONENT_LENGTH
  1782. } = require_constants();
  1783. var debug = require_debug();
  1784. exports2 = module2.exports = {};
  1785. var re = exports2.re = [];
  1786. var src = exports2.src = [];
  1787. var t = exports2.t = {};
  1788. var R = 0;
  1789. var createToken = (name, value, isGlobal) => {
  1790. const index = R++;
  1791. debug(name, index, value);
  1792. t[name] = index;
  1793. src[index] = value;
  1794. re[index] = new RegExp(value, isGlobal ? "g" : void 0);
  1795. };
  1796. createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
  1797. createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
  1798. createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
  1799. createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
  1800. createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
  1801. createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1802. createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
  1803. createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
  1804. createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
  1805. createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
  1806. createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
  1807. createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
  1808. createToken("FULL", `^${src[t.FULLPLAIN]}$`);
  1809. createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
  1810. createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
  1811. createToken("GTLT", "((?:<|>)?=?)");
  1812. createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
  1813. createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
  1814. createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
  1815. createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
  1816. createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
  1817. createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
  1818. createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
  1819. createToken("COERCERTL", src[t.COERCE], true);
  1820. createToken("LONETILDE", "(?:~>?)");
  1821. createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
  1822. exports2.tildeTrimReplace = "$1~";
  1823. createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
  1824. createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
  1825. createToken("LONECARET", "(?:\\^)");
  1826. createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
  1827. exports2.caretTrimReplace = "$1^";
  1828. createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
  1829. createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
  1830. createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
  1831. createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
  1832. createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
  1833. exports2.comparatorTrimReplace = "$1$2$3";
  1834. createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
  1835. createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
  1836. createToken("STAR", "(<|>)?=?\\s*\\*");
  1837. createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
  1838. createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
  1839. }
  1840. });
  1841. var require_parse_options = __commonJS2({
  1842. "node_modules/semver/internal/parse-options.js"(exports2, module2) {
  1843. var opts = ["includePrerelease", "loose", "rtl"];
  1844. var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {
  1845. loose: true
  1846. } : opts.filter((k) => options[k]).reduce((o, k) => {
  1847. o[k] = true;
  1848. return o;
  1849. }, {});
  1850. module2.exports = parseOptions;
  1851. }
  1852. });
  1853. var require_identifiers = __commonJS2({
  1854. "node_modules/semver/internal/identifiers.js"(exports2, module2) {
  1855. var numeric = /^[0-9]+$/;
  1856. var compareIdentifiers = (a, b) => {
  1857. const anum = numeric.test(a);
  1858. const bnum = numeric.test(b);
  1859. if (anum && bnum) {
  1860. a = +a;
  1861. b = +b;
  1862. }
  1863. return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
  1864. };
  1865. var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
  1866. module2.exports = {
  1867. compareIdentifiers,
  1868. rcompareIdentifiers
  1869. };
  1870. }
  1871. });
  1872. var require_semver = __commonJS2({
  1873. "node_modules/semver/classes/semver.js"(exports2, module2) {
  1874. var debug = require_debug();
  1875. var {
  1876. MAX_LENGTH,
  1877. MAX_SAFE_INTEGER
  1878. } = require_constants();
  1879. var {
  1880. re,
  1881. t
  1882. } = require_re();
  1883. var parseOptions = require_parse_options();
  1884. var {
  1885. compareIdentifiers
  1886. } = require_identifiers();
  1887. var SemVer = class {
  1888. constructor(version2, options) {
  1889. options = parseOptions(options);
  1890. if (version2 instanceof SemVer) {
  1891. if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
  1892. return version2;
  1893. } else {
  1894. version2 = version2.version;
  1895. }
  1896. } else if (typeof version2 !== "string") {
  1897. throw new TypeError(`Invalid Version: ${version2}`);
  1898. }
  1899. if (version2.length > MAX_LENGTH) {
  1900. throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
  1901. }
  1902. debug("SemVer", version2, options);
  1903. this.options = options;
  1904. this.loose = !!options.loose;
  1905. this.includePrerelease = !!options.includePrerelease;
  1906. const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
  1907. if (!m) {
  1908. throw new TypeError(`Invalid Version: ${version2}`);
  1909. }
  1910. this.raw = version2;
  1911. this.major = +m[1];
  1912. this.minor = +m[2];
  1913. this.patch = +m[3];
  1914. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  1915. throw new TypeError("Invalid major version");
  1916. }
  1917. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  1918. throw new TypeError("Invalid minor version");
  1919. }
  1920. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  1921. throw new TypeError("Invalid patch version");
  1922. }
  1923. if (!m[4]) {
  1924. this.prerelease = [];
  1925. } else {
  1926. this.prerelease = m[4].split(".").map((id) => {
  1927. if (/^[0-9]+$/.test(id)) {
  1928. const num = +id;
  1929. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  1930. return num;
  1931. }
  1932. }
  1933. return id;
  1934. });
  1935. }
  1936. this.build = m[5] ? m[5].split(".") : [];
  1937. this.format();
  1938. }
  1939. format() {
  1940. this.version = `${this.major}.${this.minor}.${this.patch}`;
  1941. if (this.prerelease.length) {
  1942. this.version += `-${this.prerelease.join(".")}`;
  1943. }
  1944. return this.version;
  1945. }
  1946. toString() {
  1947. return this.version;
  1948. }
  1949. compare(other) {
  1950. debug("SemVer.compare", this.version, this.options, other);
  1951. if (!(other instanceof SemVer)) {
  1952. if (typeof other === "string" && other === this.version) {
  1953. return 0;
  1954. }
  1955. other = new SemVer(other, this.options);
  1956. }
  1957. if (other.version === this.version) {
  1958. return 0;
  1959. }
  1960. return this.compareMain(other) || this.comparePre(other);
  1961. }
  1962. compareMain(other) {
  1963. if (!(other instanceof SemVer)) {
  1964. other = new SemVer(other, this.options);
  1965. }
  1966. return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
  1967. }
  1968. comparePre(other) {
  1969. if (!(other instanceof SemVer)) {
  1970. other = new SemVer(other, this.options);
  1971. }
  1972. if (this.prerelease.length && !other.prerelease.length) {
  1973. return -1;
  1974. } else if (!this.prerelease.length && other.prerelease.length) {
  1975. return 1;
  1976. } else if (!this.prerelease.length && !other.prerelease.length) {
  1977. return 0;
  1978. }
  1979. let i = 0;
  1980. do {
  1981. const a = this.prerelease[i];
  1982. const b = other.prerelease[i];
  1983. debug("prerelease compare", i, a, b);
  1984. if (a === void 0 && b === void 0) {
  1985. return 0;
  1986. } else if (b === void 0) {
  1987. return 1;
  1988. } else if (a === void 0) {
  1989. return -1;
  1990. } else if (a === b) {
  1991. continue;
  1992. } else {
  1993. return compareIdentifiers(a, b);
  1994. }
  1995. } while (++i);
  1996. }
  1997. compareBuild(other) {
  1998. if (!(other instanceof SemVer)) {
  1999. other = new SemVer(other, this.options);
  2000. }
  2001. let i = 0;
  2002. do {
  2003. const a = this.build[i];
  2004. const b = other.build[i];
  2005. debug("prerelease compare", i, a, b);
  2006. if (a === void 0 && b === void 0) {
  2007. return 0;
  2008. } else if (b === void 0) {
  2009. return 1;
  2010. } else if (a === void 0) {
  2011. return -1;
  2012. } else if (a === b) {
  2013. continue;
  2014. } else {
  2015. return compareIdentifiers(a, b);
  2016. }
  2017. } while (++i);
  2018. }
  2019. inc(release, identifier) {
  2020. switch (release) {
  2021. case "premajor":
  2022. this.prerelease.length = 0;
  2023. this.patch = 0;
  2024. this.minor = 0;
  2025. this.major++;
  2026. this.inc("pre", identifier);
  2027. break;
  2028. case "preminor":
  2029. this.prerelease.length = 0;
  2030. this.patch = 0;
  2031. this.minor++;
  2032. this.inc("pre", identifier);
  2033. break;
  2034. case "prepatch":
  2035. this.prerelease.length = 0;
  2036. this.inc("patch", identifier);
  2037. this.inc("pre", identifier);
  2038. break;
  2039. case "prerelease":
  2040. if (this.prerelease.length === 0) {
  2041. this.inc("patch", identifier);
  2042. }
  2043. this.inc("pre", identifier);
  2044. break;
  2045. case "major":
  2046. if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
  2047. this.major++;
  2048. }
  2049. this.minor = 0;
  2050. this.patch = 0;
  2051. this.prerelease = [];
  2052. break;
  2053. case "minor":
  2054. if (this.patch !== 0 || this.prerelease.length === 0) {
  2055. this.minor++;
  2056. }
  2057. this.patch = 0;
  2058. this.prerelease = [];
  2059. break;
  2060. case "patch":
  2061. if (this.prerelease.length === 0) {
  2062. this.patch++;
  2063. }
  2064. this.prerelease = [];
  2065. break;
  2066. case "pre":
  2067. if (this.prerelease.length === 0) {
  2068. this.prerelease = [0];
  2069. } else {
  2070. let i = this.prerelease.length;
  2071. while (--i >= 0) {
  2072. if (typeof this.prerelease[i] === "number") {
  2073. this.prerelease[i]++;
  2074. i = -2;
  2075. }
  2076. }
  2077. if (i === -1) {
  2078. this.prerelease.push(0);
  2079. }
  2080. }
  2081. if (identifier) {
  2082. if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
  2083. if (isNaN(this.prerelease[1])) {
  2084. this.prerelease = [identifier, 0];
  2085. }
  2086. } else {
  2087. this.prerelease = [identifier, 0];
  2088. }
  2089. }
  2090. break;
  2091. default:
  2092. throw new Error(`invalid increment argument: ${release}`);
  2093. }
  2094. this.format();
  2095. this.raw = this.version;
  2096. return this;
  2097. }
  2098. };
  2099. module2.exports = SemVer;
  2100. }
  2101. });
  2102. var require_compare = __commonJS2({
  2103. "node_modules/semver/functions/compare.js"(exports2, module2) {
  2104. var SemVer = require_semver();
  2105. var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
  2106. module2.exports = compare;
  2107. }
  2108. });
  2109. var require_lt = __commonJS2({
  2110. "node_modules/semver/functions/lt.js"(exports2, module2) {
  2111. var compare = require_compare();
  2112. var lt = (a, b, loose) => compare(a, b, loose) < 0;
  2113. module2.exports = lt;
  2114. }
  2115. });
  2116. var require_gte = __commonJS2({
  2117. "node_modules/semver/functions/gte.js"(exports2, module2) {
  2118. var compare = require_compare();
  2119. var gte = (a, b, loose) => compare(a, b, loose) >= 0;
  2120. module2.exports = gte;
  2121. }
  2122. });
  2123. var require_arrayify = __commonJS2({
  2124. "src/utils/arrayify.js"(exports2, module2) {
  2125. "use strict";
  2126. module2.exports = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
  2127. [keyName]: key
  2128. }, value));
  2129. }
  2130. });
  2131. var require_lib = __commonJS2({
  2132. "node_modules/outdent/lib/index.js"(exports2, module2) {
  2133. "use strict";
  2134. Object.defineProperty(exports2, "__esModule", {
  2135. value: true
  2136. });
  2137. exports2.outdent = void 0;
  2138. function noop() {
  2139. var args = [];
  2140. for (var _i = 0; _i < arguments.length; _i++) {
  2141. args[_i] = arguments[_i];
  2142. }
  2143. }
  2144. function createWeakMap() {
  2145. if (typeof WeakMap !== "undefined") {
  2146. return /* @__PURE__ */ new WeakMap();
  2147. } else {
  2148. return fakeSetOrMap();
  2149. }
  2150. }
  2151. function fakeSetOrMap() {
  2152. return {
  2153. add: noop,
  2154. delete: noop,
  2155. get: noop,
  2156. set: noop,
  2157. has: function(k) {
  2158. return false;
  2159. }
  2160. };
  2161. }
  2162. var hop = Object.prototype.hasOwnProperty;
  2163. var has = function(obj, prop) {
  2164. return hop.call(obj, prop);
  2165. };
  2166. function extend(target, source) {
  2167. for (var prop in source) {
  2168. if (has(source, prop)) {
  2169. target[prop] = source[prop];
  2170. }
  2171. }
  2172. return target;
  2173. }
  2174. var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
  2175. var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
  2176. var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
  2177. var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
  2178. var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
  2179. function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
  2180. var indentationLevel = 0;
  2181. var match = strings[0].match(reDetectIndentation);
  2182. if (match) {
  2183. indentationLevel = match[1].length;
  2184. }
  2185. var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
  2186. var reMatchIndent = new RegExp(reSource, "g");
  2187. if (firstInterpolatedValueSetsIndentationLevel) {
  2188. strings = strings.slice(1);
  2189. }
  2190. var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
  2191. var normalizeNewlines = typeof newline === "string";
  2192. var l = strings.length;
  2193. var outdentedStrings = strings.map(function(v, i) {
  2194. v = v.replace(reMatchIndent, "$1");
  2195. if (i === 0 && trimLeadingNewline) {
  2196. v = v.replace(reLeadingNewline, "");
  2197. }
  2198. if (i === l - 1 && trimTrailingNewline) {
  2199. v = v.replace(reTrailingNewline, "");
  2200. }
  2201. if (normalizeNewlines) {
  2202. v = v.replace(/\r\n|\n|\r/g, function(_) {
  2203. return newline;
  2204. });
  2205. }
  2206. return v;
  2207. });
  2208. return outdentedStrings;
  2209. }
  2210. function concatStringsAndValues(strings, values) {
  2211. var ret = "";
  2212. for (var i = 0, l = strings.length; i < l; i++) {
  2213. ret += strings[i];
  2214. if (i < l - 1) {
  2215. ret += values[i];
  2216. }
  2217. }
  2218. return ret;
  2219. }
  2220. function isTemplateStringsArray(v) {
  2221. return has(v, "raw") && has(v, "length");
  2222. }
  2223. function createInstance(options) {
  2224. var arrayAutoIndentCache = createWeakMap();
  2225. var arrayFirstInterpSetsIndentCache = createWeakMap();
  2226. function outdent(stringsOrOptions) {
  2227. var values = [];
  2228. for (var _i = 1; _i < arguments.length; _i++) {
  2229. values[_i - 1] = arguments[_i];
  2230. }
  2231. if (isTemplateStringsArray(stringsOrOptions)) {
  2232. var strings = stringsOrOptions;
  2233. var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
  2234. var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
  2235. var renderedArray = cache.get(strings);
  2236. if (!renderedArray) {
  2237. renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
  2238. cache.set(strings, renderedArray);
  2239. }
  2240. if (values.length === 0) {
  2241. return renderedArray[0];
  2242. }
  2243. var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
  2244. return rendered;
  2245. } else {
  2246. return createInstance(extend(extend({}, options), stringsOrOptions || {}));
  2247. }
  2248. }
  2249. var fullOutdent = extend(outdent, {
  2250. string: function(str) {
  2251. return _outdentArray([str], false, options)[0];
  2252. }
  2253. });
  2254. return fullOutdent;
  2255. }
  2256. var defaultOutdent = createInstance({
  2257. trimLeadingNewline: true,
  2258. trimTrailingNewline: true
  2259. });
  2260. exports2.outdent = defaultOutdent;
  2261. exports2.default = defaultOutdent;
  2262. if (typeof module2 !== "undefined") {
  2263. try {
  2264. module2.exports = defaultOutdent;
  2265. Object.defineProperty(defaultOutdent, "__esModule", {
  2266. value: true
  2267. });
  2268. defaultOutdent.default = defaultOutdent;
  2269. defaultOutdent.outdent = defaultOutdent;
  2270. } catch (e) {
  2271. }
  2272. }
  2273. }
  2274. });
  2275. var require_core_options = __commonJS2({
  2276. "src/main/core-options.js"(exports2, module2) {
  2277. "use strict";
  2278. var {
  2279. outdent
  2280. } = require_lib();
  2281. var CATEGORY_CONFIG = "Config";
  2282. var CATEGORY_EDITOR = "Editor";
  2283. var CATEGORY_FORMAT = "Format";
  2284. var CATEGORY_OTHER = "Other";
  2285. var CATEGORY_OUTPUT = "Output";
  2286. var CATEGORY_GLOBAL = "Global";
  2287. var CATEGORY_SPECIAL = "Special";
  2288. var options = {
  2289. cursorOffset: {
  2290. since: "1.4.0",
  2291. category: CATEGORY_SPECIAL,
  2292. type: "int",
  2293. default: -1,
  2294. range: {
  2295. start: -1,
  2296. end: Number.POSITIVE_INFINITY,
  2297. step: 1
  2298. },
  2299. description: outdent`
  2300. Print (to stderr) where a cursor at the given position would move to after formatting.
  2301. This option cannot be used with --range-start and --range-end.
  2302. `,
  2303. cliCategory: CATEGORY_EDITOR
  2304. },
  2305. endOfLine: {
  2306. since: "1.15.0",
  2307. category: CATEGORY_GLOBAL,
  2308. type: "choice",
  2309. default: [{
  2310. since: "1.15.0",
  2311. value: "auto"
  2312. }, {
  2313. since: "2.0.0",
  2314. value: "lf"
  2315. }],
  2316. description: "Which end of line characters to apply.",
  2317. choices: [{
  2318. value: "lf",
  2319. description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
  2320. }, {
  2321. value: "crlf",
  2322. description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
  2323. }, {
  2324. value: "cr",
  2325. description: "Carriage Return character only (\\r), used very rarely"
  2326. }, {
  2327. value: "auto",
  2328. description: outdent`
  2329. Maintain existing
  2330. (mixed values within one file are normalised by looking at what's used after the first line)
  2331. `
  2332. }]
  2333. },
  2334. filepath: {
  2335. since: "1.4.0",
  2336. category: CATEGORY_SPECIAL,
  2337. type: "path",
  2338. description: "Specify the input filepath. This will be used to do parser inference.",
  2339. cliName: "stdin-filepath",
  2340. cliCategory: CATEGORY_OTHER,
  2341. cliDescription: "Path to the file to pretend that stdin comes from."
  2342. },
  2343. insertPragma: {
  2344. since: "1.8.0",
  2345. category: CATEGORY_SPECIAL,
  2346. type: "boolean",
  2347. default: false,
  2348. description: "Insert @format pragma into file's first docblock comment.",
  2349. cliCategory: CATEGORY_OTHER
  2350. },
  2351. parser: {
  2352. since: "0.0.10",
  2353. category: CATEGORY_GLOBAL,
  2354. type: "choice",
  2355. default: [{
  2356. since: "0.0.10",
  2357. value: "babylon"
  2358. }, {
  2359. since: "1.13.0",
  2360. value: void 0
  2361. }],
  2362. description: "Which parser to use.",
  2363. exception: (value) => typeof value === "string" || typeof value === "function",
  2364. choices: [{
  2365. value: "flow",
  2366. description: "Flow"
  2367. }, {
  2368. value: "babel",
  2369. since: "1.16.0",
  2370. description: "JavaScript"
  2371. }, {
  2372. value: "babel-flow",
  2373. since: "1.16.0",
  2374. description: "Flow"
  2375. }, {
  2376. value: "babel-ts",
  2377. since: "2.0.0",
  2378. description: "TypeScript"
  2379. }, {
  2380. value: "typescript",
  2381. since: "1.4.0",
  2382. description: "TypeScript"
  2383. }, {
  2384. value: "acorn",
  2385. since: "2.6.0",
  2386. description: "JavaScript"
  2387. }, {
  2388. value: "espree",
  2389. since: "2.2.0",
  2390. description: "JavaScript"
  2391. }, {
  2392. value: "meriyah",
  2393. since: "2.2.0",
  2394. description: "JavaScript"
  2395. }, {
  2396. value: "css",
  2397. since: "1.7.1",
  2398. description: "CSS"
  2399. }, {
  2400. value: "less",
  2401. since: "1.7.1",
  2402. description: "Less"
  2403. }, {
  2404. value: "scss",
  2405. since: "1.7.1",
  2406. description: "SCSS"
  2407. }, {
  2408. value: "json",
  2409. since: "1.5.0",
  2410. description: "JSON"
  2411. }, {
  2412. value: "json5",
  2413. since: "1.13.0",
  2414. description: "JSON5"
  2415. }, {
  2416. value: "json-stringify",
  2417. since: "1.13.0",
  2418. description: "JSON.stringify"
  2419. }, {
  2420. value: "graphql",
  2421. since: "1.5.0",
  2422. description: "GraphQL"
  2423. }, {
  2424. value: "markdown",
  2425. since: "1.8.0",
  2426. description: "Markdown"
  2427. }, {
  2428. value: "mdx",
  2429. since: "1.15.0",
  2430. description: "MDX"
  2431. }, {
  2432. value: "vue",
  2433. since: "1.10.0",
  2434. description: "Vue"
  2435. }, {
  2436. value: "yaml",
  2437. since: "1.14.0",
  2438. description: "YAML"
  2439. }, {
  2440. value: "glimmer",
  2441. since: "2.3.0",
  2442. description: "Ember / Handlebars"
  2443. }, {
  2444. value: "html",
  2445. since: "1.15.0",
  2446. description: "HTML"
  2447. }, {
  2448. value: "angular",
  2449. since: "1.15.0",
  2450. description: "Angular"
  2451. }, {
  2452. value: "lwc",
  2453. since: "1.17.0",
  2454. description: "Lightning Web Components"
  2455. }]
  2456. },
  2457. plugins: {
  2458. since: "1.10.0",
  2459. type: "path",
  2460. array: true,
  2461. default: [{
  2462. value: []
  2463. }],
  2464. category: CATEGORY_GLOBAL,
  2465. description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
  2466. exception: (value) => typeof value === "string" || typeof value === "object",
  2467. cliName: "plugin",
  2468. cliCategory: CATEGORY_CONFIG
  2469. },
  2470. pluginSearchDirs: {
  2471. since: "1.13.0",
  2472. type: "path",
  2473. array: true,
  2474. default: [{
  2475. value: []
  2476. }],
  2477. category: CATEGORY_GLOBAL,
  2478. description: outdent`
  2479. Custom directory that contains prettier plugins in node_modules subdirectory.
  2480. Overrides default behavior when plugins are searched relatively to the location of Prettier.
  2481. Multiple values are accepted.
  2482. `,
  2483. exception: (value) => typeof value === "string" || typeof value === "object",
  2484. cliName: "plugin-search-dir",
  2485. cliCategory: CATEGORY_CONFIG
  2486. },
  2487. printWidth: {
  2488. since: "0.0.0",
  2489. category: CATEGORY_GLOBAL,
  2490. type: "int",
  2491. default: 80,
  2492. description: "The line length where Prettier will try wrap.",
  2493. range: {
  2494. start: 0,
  2495. end: Number.POSITIVE_INFINITY,
  2496. step: 1
  2497. }
  2498. },
  2499. rangeEnd: {
  2500. since: "1.4.0",
  2501. category: CATEGORY_SPECIAL,
  2502. type: "int",
  2503. default: Number.POSITIVE_INFINITY,
  2504. range: {
  2505. start: 0,
  2506. end: Number.POSITIVE_INFINITY,
  2507. step: 1
  2508. },
  2509. description: outdent`
  2510. Format code ending at a given character offset (exclusive).
  2511. The range will extend forwards to the end of the selected statement.
  2512. This option cannot be used with --cursor-offset.
  2513. `,
  2514. cliCategory: CATEGORY_EDITOR
  2515. },
  2516. rangeStart: {
  2517. since: "1.4.0",
  2518. category: CATEGORY_SPECIAL,
  2519. type: "int",
  2520. default: 0,
  2521. range: {
  2522. start: 0,
  2523. end: Number.POSITIVE_INFINITY,
  2524. step: 1
  2525. },
  2526. description: outdent`
  2527. Format code starting at a given character offset.
  2528. The range will extend backwards to the start of the first line containing the selected statement.
  2529. This option cannot be used with --cursor-offset.
  2530. `,
  2531. cliCategory: CATEGORY_EDITOR
  2532. },
  2533. requirePragma: {
  2534. since: "1.7.0",
  2535. category: CATEGORY_SPECIAL,
  2536. type: "boolean",
  2537. default: false,
  2538. description: outdent`
  2539. Require either '@prettier' or '@format' to be present in the file's first docblock comment
  2540. in order for it to be formatted.
  2541. `,
  2542. cliCategory: CATEGORY_OTHER
  2543. },
  2544. tabWidth: {
  2545. type: "int",
  2546. category: CATEGORY_GLOBAL,
  2547. default: 2,
  2548. description: "Number of spaces per indentation level.",
  2549. range: {
  2550. start: 0,
  2551. end: Number.POSITIVE_INFINITY,
  2552. step: 1
  2553. }
  2554. },
  2555. useTabs: {
  2556. since: "1.0.0",
  2557. category: CATEGORY_GLOBAL,
  2558. type: "boolean",
  2559. default: false,
  2560. description: "Indent with tabs instead of spaces."
  2561. },
  2562. embeddedLanguageFormatting: {
  2563. since: "2.1.0",
  2564. category: CATEGORY_GLOBAL,
  2565. type: "choice",
  2566. default: [{
  2567. since: "2.1.0",
  2568. value: "auto"
  2569. }],
  2570. description: "Control how Prettier formats quoted code embedded in the file.",
  2571. choices: [{
  2572. value: "auto",
  2573. description: "Format embedded code if Prettier can automatically identify it."
  2574. }, {
  2575. value: "off",
  2576. description: "Never automatically format embedded code."
  2577. }]
  2578. }
  2579. };
  2580. module2.exports = {
  2581. CATEGORY_CONFIG,
  2582. CATEGORY_EDITOR,
  2583. CATEGORY_FORMAT,
  2584. CATEGORY_OTHER,
  2585. CATEGORY_OUTPUT,
  2586. CATEGORY_GLOBAL,
  2587. CATEGORY_SPECIAL,
  2588. options
  2589. };
  2590. }
  2591. });
  2592. var require_support = __commonJS2({
  2593. "src/main/support.js"(exports2, module2) {
  2594. "use strict";
  2595. var semver = {
  2596. compare: require_compare(),
  2597. lt: require_lt(),
  2598. gte: require_gte()
  2599. };
  2600. var arrayify = require_arrayify();
  2601. var currentVersion = require("./package.json").version;
  2602. var coreOptions = require_core_options().options;
  2603. function getSupportInfo2({
  2604. plugins: plugins2 = [],
  2605. showUnreleased = false,
  2606. showDeprecated = false,
  2607. showInternal = false
  2608. } = {}) {
  2609. const version2 = currentVersion.split("-", 1)[0];
  2610. const languages = plugins2.flatMap((plugin) => plugin.languages || []).filter(filterSince);
  2611. const options = arrayify(Object.assign({}, ...plugins2.map(({
  2612. options: options2
  2613. }) => options2), coreOptions), "name").filter((option) => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map((option) => {
  2614. option = Object.assign({}, option);
  2615. if (Array.isArray(option.default)) {
  2616. option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver.compare(info2.since, info1.since))[0].value;
  2617. }
  2618. if (Array.isArray(option.choices)) {
  2619. option.choices = option.choices.filter((option2) => filterSince(option2) && filterDeprecated(option2));
  2620. if (option.name === "parser") {
  2621. collectParsersFromLanguages(option, languages, plugins2);
  2622. }
  2623. }
  2624. const pluginDefaults = Object.fromEntries(plugins2.filter((plugin) => plugin.defaultOptions && plugin.defaultOptions[option.name] !== void 0).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]]));
  2625. return Object.assign(Object.assign({}, option), {}, {
  2626. pluginDefaults
  2627. });
  2628. });
  2629. return {
  2630. languages,
  2631. options
  2632. };
  2633. function filterSince(object) {
  2634. return showUnreleased || !("since" in object) || object.since && semver.gte(version2, object.since);
  2635. }
  2636. function filterDeprecated(object) {
  2637. return showDeprecated || !("deprecated" in object) || object.deprecated && semver.lt(version2, object.deprecated);
  2638. }
  2639. function mapInternal(object) {
  2640. if (showInternal) {
  2641. return object;
  2642. }
  2643. const {
  2644. cliName,
  2645. cliCategory,
  2646. cliDescription
  2647. } = object, newObject = _objectWithoutProperties(object, _excluded);
  2648. return newObject;
  2649. }
  2650. }
  2651. function collectParsersFromLanguages(option, languages, plugins2) {
  2652. const existingValues = new Set(option.choices.map((choice) => choice.value));
  2653. for (const language of languages) {
  2654. if (language.parsers) {
  2655. for (const value of language.parsers) {
  2656. if (!existingValues.has(value)) {
  2657. existingValues.add(value);
  2658. const plugin = plugins2.find((plugin2) => plugin2.parsers && plugin2.parsers[value]);
  2659. let description = language.name;
  2660. if (plugin && plugin.name) {
  2661. description += ` (plugin: ${plugin.name})`;
  2662. }
  2663. option.choices.push({
  2664. value,
  2665. description
  2666. });
  2667. }
  2668. }
  2669. }
  2670. }
  2671. }
  2672. module2.exports = {
  2673. getSupportInfo: getSupportInfo2
  2674. };
  2675. }
  2676. });
  2677. var require_is_non_empty_array = __commonJS2({
  2678. "src/utils/is-non-empty-array.js"(exports2, module2) {
  2679. "use strict";
  2680. function isNonEmptyArray(object) {
  2681. return Array.isArray(object) && object.length > 0;
  2682. }
  2683. module2.exports = isNonEmptyArray;
  2684. }
  2685. });
  2686. function ansiRegex({
  2687. onlyFirst = false
  2688. } = {}) {
  2689. const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
  2690. return new RegExp(pattern, onlyFirst ? void 0 : "g");
  2691. }
  2692. var init_ansi_regex = __esm({
  2693. "node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
  2694. }
  2695. });
  2696. function stripAnsi(string) {
  2697. if (typeof string !== "string") {
  2698. throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
  2699. }
  2700. return string.replace(ansiRegex(), "");
  2701. }
  2702. var init_strip_ansi = __esm({
  2703. "node_modules/strip-ansi/index.js"() {
  2704. init_ansi_regex();
  2705. }
  2706. });
  2707. function isFullwidthCodePoint(codePoint) {
  2708. if (!Number.isInteger(codePoint)) {
  2709. return false;
  2710. }
  2711. return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141);
  2712. }
  2713. var init_is_fullwidth_code_point = __esm({
  2714. "node_modules/is-fullwidth-code-point/index.js"() {
  2715. }
  2716. });
  2717. var require_emoji_regex = __commonJS2({
  2718. "node_modules/emoji-regex/index.js"(exports2, module2) {
  2719. "use strict";
  2720. module2.exports = function() {
  2721. return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
  2722. };
  2723. }
  2724. });
  2725. var string_width_exports = {};
  2726. __export(string_width_exports, {
  2727. default: () => stringWidth
  2728. });
  2729. function stringWidth(string) {
  2730. if (typeof string !== "string" || string.length === 0) {
  2731. return 0;
  2732. }
  2733. string = stripAnsi(string);
  2734. if (string.length === 0) {
  2735. return 0;
  2736. }
  2737. string = string.replace((0, import_emoji_regex.default)(), " ");
  2738. let width = 0;
  2739. for (let index = 0; index < string.length; index++) {
  2740. const codePoint = string.codePointAt(index);
  2741. if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
  2742. continue;
  2743. }
  2744. if (codePoint >= 768 && codePoint <= 879) {
  2745. continue;
  2746. }
  2747. if (codePoint > 65535) {
  2748. index++;
  2749. }
  2750. width += isFullwidthCodePoint(codePoint) ? 2 : 1;
  2751. }
  2752. return width;
  2753. }
  2754. var import_emoji_regex;
  2755. var init_string_width = __esm({
  2756. "node_modules/string-width/index.js"() {
  2757. init_strip_ansi();
  2758. init_is_fullwidth_code_point();
  2759. import_emoji_regex = __toESM(require_emoji_regex());
  2760. }
  2761. });
  2762. var require_get_string_width = __commonJS2({
  2763. "src/utils/get-string-width.js"(exports2, module2) {
  2764. "use strict";
  2765. var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
  2766. var notAsciiRegex = /[^\x20-\x7F]/;
  2767. function getStringWidth(text) {
  2768. if (!text) {
  2769. return 0;
  2770. }
  2771. if (!notAsciiRegex.test(text)) {
  2772. return text.length;
  2773. }
  2774. return stringWidth2(text);
  2775. }
  2776. module2.exports = getStringWidth;
  2777. }
  2778. });
  2779. var require_skip = __commonJS2({
  2780. "src/utils/text/skip.js"(exports2, module2) {
  2781. "use strict";
  2782. function skip(chars) {
  2783. return (text, index, opts) => {
  2784. const backwards = opts && opts.backwards;
  2785. if (index === false) {
  2786. return false;
  2787. }
  2788. const {
  2789. length
  2790. } = text;
  2791. let cursor = index;
  2792. while (cursor >= 0 && cursor < length) {
  2793. const c = text.charAt(cursor);
  2794. if (chars instanceof RegExp) {
  2795. if (!chars.test(c)) {
  2796. return cursor;
  2797. }
  2798. } else if (!chars.includes(c)) {
  2799. return cursor;
  2800. }
  2801. backwards ? cursor-- : cursor++;
  2802. }
  2803. if (cursor === -1 || cursor === length) {
  2804. return cursor;
  2805. }
  2806. return false;
  2807. };
  2808. }
  2809. var skipWhitespace = skip(/\s/);
  2810. var skipSpaces = skip(" ");
  2811. var skipToLineEnd = skip(",; ");
  2812. var skipEverythingButNewLine = skip(/[^\n\r]/);
  2813. module2.exports = {
  2814. skipWhitespace,
  2815. skipSpaces,
  2816. skipToLineEnd,
  2817. skipEverythingButNewLine
  2818. };
  2819. }
  2820. });
  2821. var require_skip_inline_comment = __commonJS2({
  2822. "src/utils/text/skip-inline-comment.js"(exports2, module2) {
  2823. "use strict";
  2824. function skipInlineComment(text, index) {
  2825. if (index === false) {
  2826. return false;
  2827. }
  2828. if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
  2829. for (let i = index + 2; i < text.length; ++i) {
  2830. if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
  2831. return i + 2;
  2832. }
  2833. }
  2834. }
  2835. return index;
  2836. }
  2837. module2.exports = skipInlineComment;
  2838. }
  2839. });
  2840. var require_skip_trailing_comment = __commonJS2({
  2841. "src/utils/text/skip-trailing-comment.js"(exports2, module2) {
  2842. "use strict";
  2843. var {
  2844. skipEverythingButNewLine
  2845. } = require_skip();
  2846. function skipTrailingComment(text, index) {
  2847. if (index === false) {
  2848. return false;
  2849. }
  2850. if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
  2851. return skipEverythingButNewLine(text, index);
  2852. }
  2853. return index;
  2854. }
  2855. module2.exports = skipTrailingComment;
  2856. }
  2857. });
  2858. var require_skip_newline = __commonJS2({
  2859. "src/utils/text/skip-newline.js"(exports2, module2) {
  2860. "use strict";
  2861. function skipNewline(text, index, opts) {
  2862. const backwards = opts && opts.backwards;
  2863. if (index === false) {
  2864. return false;
  2865. }
  2866. const atIndex = text.charAt(index);
  2867. if (backwards) {
  2868. if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
  2869. return index - 2;
  2870. }
  2871. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  2872. return index - 1;
  2873. }
  2874. } else {
  2875. if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
  2876. return index + 2;
  2877. }
  2878. if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
  2879. return index + 1;
  2880. }
  2881. }
  2882. return index;
  2883. }
  2884. module2.exports = skipNewline;
  2885. }
  2886. });
  2887. var require_get_next_non_space_non_comment_character_index_with_start_index = __commonJS2({
  2888. "src/utils/text/get-next-non-space-non-comment-character-index-with-start-index.js"(exports2, module2) {
  2889. "use strict";
  2890. var skipInlineComment = require_skip_inline_comment();
  2891. var skipNewline = require_skip_newline();
  2892. var skipTrailingComment = require_skip_trailing_comment();
  2893. var {
  2894. skipSpaces
  2895. } = require_skip();
  2896. function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
  2897. let oldIdx = null;
  2898. let nextIdx = idx;
  2899. while (nextIdx !== oldIdx) {
  2900. oldIdx = nextIdx;
  2901. nextIdx = skipSpaces(text, nextIdx);
  2902. nextIdx = skipInlineComment(text, nextIdx);
  2903. nextIdx = skipTrailingComment(text, nextIdx);
  2904. nextIdx = skipNewline(text, nextIdx);
  2905. }
  2906. return nextIdx;
  2907. }
  2908. module2.exports = getNextNonSpaceNonCommentCharacterIndexWithStartIndex;
  2909. }
  2910. });
  2911. var require_util = __commonJS2({
  2912. "src/common/util.js"(exports2, module2) {
  2913. "use strict";
  2914. var {
  2915. default: escapeStringRegexp2
  2916. } = (init_escape_string_regexp(), __toCommonJS(escape_string_regexp_exports));
  2917. var getLast = require_get_last();
  2918. var {
  2919. getSupportInfo: getSupportInfo2
  2920. } = require_support();
  2921. var isNonEmptyArray = require_is_non_empty_array();
  2922. var getStringWidth = require_get_string_width();
  2923. var {
  2924. skipWhitespace,
  2925. skipSpaces,
  2926. skipToLineEnd,
  2927. skipEverythingButNewLine
  2928. } = require_skip();
  2929. var skipInlineComment = require_skip_inline_comment();
  2930. var skipTrailingComment = require_skip_trailing_comment();
  2931. var skipNewline = require_skip_newline();
  2932. var getNextNonSpaceNonCommentCharacterIndexWithStartIndex = require_get_next_non_space_non_comment_character_index_with_start_index();
  2933. var getPenultimate = (arr) => arr[arr.length - 2];
  2934. function skip(chars) {
  2935. return (text, index, opts) => {
  2936. const backwards = opts && opts.backwards;
  2937. if (index === false) {
  2938. return false;
  2939. }
  2940. const {
  2941. length
  2942. } = text;
  2943. let cursor = index;
  2944. while (cursor >= 0 && cursor < length) {
  2945. const c = text.charAt(cursor);
  2946. if (chars instanceof RegExp) {
  2947. if (!chars.test(c)) {
  2948. return cursor;
  2949. }
  2950. } else if (!chars.includes(c)) {
  2951. return cursor;
  2952. }
  2953. backwards ? cursor-- : cursor++;
  2954. }
  2955. if (cursor === -1 || cursor === length) {
  2956. return cursor;
  2957. }
  2958. return false;
  2959. };
  2960. }
  2961. function hasNewline(text, index, opts = {}) {
  2962. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  2963. const idx2 = skipNewline(text, idx, opts);
  2964. return idx !== idx2;
  2965. }
  2966. function hasNewlineInRange(text, start, end) {
  2967. for (let i = start; i < end; ++i) {
  2968. if (text.charAt(i) === "\n") {
  2969. return true;
  2970. }
  2971. }
  2972. return false;
  2973. }
  2974. function isPreviousLineEmpty(text, node, locStart) {
  2975. let idx = locStart(node) - 1;
  2976. idx = skipSpaces(text, idx, {
  2977. backwards: true
  2978. });
  2979. idx = skipNewline(text, idx, {
  2980. backwards: true
  2981. });
  2982. idx = skipSpaces(text, idx, {
  2983. backwards: true
  2984. });
  2985. const idx2 = skipNewline(text, idx, {
  2986. backwards: true
  2987. });
  2988. return idx !== idx2;
  2989. }
  2990. function isNextLineEmptyAfterIndex(text, index) {
  2991. let oldIdx = null;
  2992. let idx = index;
  2993. while (idx !== oldIdx) {
  2994. oldIdx = idx;
  2995. idx = skipToLineEnd(text, idx);
  2996. idx = skipInlineComment(text, idx);
  2997. idx = skipSpaces(text, idx);
  2998. }
  2999. idx = skipTrailingComment(text, idx);
  3000. idx = skipNewline(text, idx);
  3001. return idx !== false && hasNewline(text, idx);
  3002. }
  3003. function isNextLineEmpty(text, node, locEnd) {
  3004. return isNextLineEmptyAfterIndex(text, locEnd(node));
  3005. }
  3006. function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
  3007. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
  3008. }
  3009. function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
  3010. return text.charAt(getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
  3011. }
  3012. function hasSpaces(text, index, opts = {}) {
  3013. const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
  3014. return idx !== index;
  3015. }
  3016. function getAlignmentSize(value, tabWidth, startIndex = 0) {
  3017. let size = 0;
  3018. for (let i = startIndex; i < value.length; ++i) {
  3019. if (value[i] === " ") {
  3020. size = size + tabWidth - size % tabWidth;
  3021. } else {
  3022. size++;
  3023. }
  3024. }
  3025. return size;
  3026. }
  3027. function getIndentSize(value, tabWidth) {
  3028. const lastNewlineIndex = value.lastIndexOf("\n");
  3029. if (lastNewlineIndex === -1) {
  3030. return 0;
  3031. }
  3032. return getAlignmentSize(value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
  3033. }
  3034. function getPreferredQuote(rawContent, preferredQuote) {
  3035. const double = {
  3036. quote: '"',
  3037. regex: /"/g,
  3038. escaped: "&quot;"
  3039. };
  3040. const single = {
  3041. quote: "'",
  3042. regex: /'/g,
  3043. escaped: "&apos;"
  3044. };
  3045. const preferred = preferredQuote === "'" ? single : double;
  3046. const alternate = preferred === single ? double : single;
  3047. let result = preferred;
  3048. if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
  3049. const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
  3050. const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
  3051. result = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;
  3052. }
  3053. return result;
  3054. }
  3055. function printString(raw, options) {
  3056. const rawContent = raw.slice(1, -1);
  3057. const enclosingQuote = options.parser === "json" || options.parser === "json5" && options.quoteProps === "preserve" && !options.singleQuote ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(rawContent, options.singleQuote ? "'" : '"').quote;
  3058. return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.__embeddedInHtml));
  3059. }
  3060. function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
  3061. const otherQuote = enclosingQuote === '"' ? "'" : '"';
  3062. const regex = /\\(.)|(["'])/gs;
  3063. const newContent = rawContent.replace(regex, (match, escaped, quote) => {
  3064. if (escaped === otherQuote) {
  3065. return escaped;
  3066. }
  3067. if (quote === enclosingQuote) {
  3068. return "\\" + quote;
  3069. }
  3070. if (quote) {
  3071. return quote;
  3072. }
  3073. return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
  3074. });
  3075. return enclosingQuote + newContent + enclosingQuote;
  3076. }
  3077. function printNumber(rawNumber) {
  3078. return rawNumber.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3").replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1").replace(/^([+-])?\./, "$10.").replace(/(\.\d+?)0+(?=e|$)/, "$1").replace(/\.(?=e|$)/, "");
  3079. }
  3080. function getMaxContinuousCount(str, target) {
  3081. const results = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3082. if (results === null) {
  3083. return 0;
  3084. }
  3085. return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
  3086. }
  3087. function getMinNotPresentContinuousCount(str, target) {
  3088. const matches = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
  3089. if (matches === null) {
  3090. return 0;
  3091. }
  3092. const countPresent = /* @__PURE__ */ new Map();
  3093. let max = 0;
  3094. for (const match of matches) {
  3095. const count = match.length / target.length;
  3096. countPresent.set(count, true);
  3097. if (count > max) {
  3098. max = count;
  3099. }
  3100. }
  3101. for (let i = 1; i < max; i++) {
  3102. if (!countPresent.get(i)) {
  3103. return i;
  3104. }
  3105. }
  3106. return max + 1;
  3107. }
  3108. function addCommentHelper(node, comment) {
  3109. const comments = node.comments || (node.comments = []);
  3110. comments.push(comment);
  3111. comment.printed = false;
  3112. comment.nodeDescription = describeNodeForDebugging(node);
  3113. }
  3114. function addLeadingComment(node, comment) {
  3115. comment.leading = true;
  3116. comment.trailing = false;
  3117. addCommentHelper(node, comment);
  3118. }
  3119. function addDanglingComment(node, comment, marker) {
  3120. comment.leading = false;
  3121. comment.trailing = false;
  3122. if (marker) {
  3123. comment.marker = marker;
  3124. }
  3125. addCommentHelper(node, comment);
  3126. }
  3127. function addTrailingComment(node, comment) {
  3128. comment.leading = false;
  3129. comment.trailing = true;
  3130. addCommentHelper(node, comment);
  3131. }
  3132. function inferParserByLanguage(language, options) {
  3133. const {
  3134. languages
  3135. } = getSupportInfo2({
  3136. plugins: options.plugins
  3137. });
  3138. const matched = languages.find(({
  3139. name
  3140. }) => name.toLowerCase() === language) || languages.find(({
  3141. aliases
  3142. }) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
  3143. extensions
  3144. }) => Array.isArray(extensions) && extensions.includes(`.${language}`));
  3145. return matched && matched.parsers[0];
  3146. }
  3147. function isFrontMatterNode(node) {
  3148. return node && node.type === "front-matter";
  3149. }
  3150. function createGroupIdMapper(description) {
  3151. const groupIds = /* @__PURE__ */ new WeakMap();
  3152. return function(node) {
  3153. if (!groupIds.has(node)) {
  3154. groupIds.set(node, Symbol(description));
  3155. }
  3156. return groupIds.get(node);
  3157. };
  3158. }
  3159. function describeNodeForDebugging(node) {
  3160. const nodeType = node.type || node.kind || "(unknown type)";
  3161. let nodeName = String(node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "");
  3162. if (nodeName.length > 20) {
  3163. nodeName = nodeName.slice(0, 19) + "\u2026";
  3164. }
  3165. return nodeType + (nodeName ? " " + nodeName : "");
  3166. }
  3167. module2.exports = {
  3168. inferParserByLanguage,
  3169. getStringWidth,
  3170. getMaxContinuousCount,
  3171. getMinNotPresentContinuousCount,
  3172. getPenultimate,
  3173. getLast,
  3174. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  3175. getNextNonSpaceNonCommentCharacterIndex,
  3176. getNextNonSpaceNonCommentCharacter,
  3177. skip,
  3178. skipWhitespace,
  3179. skipSpaces,
  3180. skipToLineEnd,
  3181. skipEverythingButNewLine,
  3182. skipInlineComment,
  3183. skipTrailingComment,
  3184. skipNewline,
  3185. isNextLineEmptyAfterIndex,
  3186. isNextLineEmpty,
  3187. isPreviousLineEmpty,
  3188. hasNewline,
  3189. hasNewlineInRange,
  3190. hasSpaces,
  3191. getAlignmentSize,
  3192. getIndentSize,
  3193. getPreferredQuote,
  3194. printString,
  3195. printNumber,
  3196. makeString,
  3197. addLeadingComment,
  3198. addDanglingComment,
  3199. addTrailingComment,
  3200. isFrontMatterNode,
  3201. isNonEmptyArray,
  3202. createGroupIdMapper
  3203. };
  3204. }
  3205. });
  3206. var require_end_of_line = __commonJS2({
  3207. "src/common/end-of-line.js"(exports2, module2) {
  3208. "use strict";
  3209. function guessEndOfLine(text) {
  3210. const index = text.indexOf("\r");
  3211. if (index >= 0) {
  3212. return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
  3213. }
  3214. return "lf";
  3215. }
  3216. function convertEndOfLineToChars(value) {
  3217. switch (value) {
  3218. case "cr":
  3219. return "\r";
  3220. case "crlf":
  3221. return "\r\n";
  3222. default:
  3223. return "\n";
  3224. }
  3225. }
  3226. function countEndOfLineChars(text, eol) {
  3227. let regex;
  3228. switch (eol) {
  3229. case "\n":
  3230. regex = /\n/g;
  3231. break;
  3232. case "\r":
  3233. regex = /\r/g;
  3234. break;
  3235. case "\r\n":
  3236. regex = /\r\n/g;
  3237. break;
  3238. default:
  3239. throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
  3240. }
  3241. const endOfLines = text.match(regex);
  3242. return endOfLines ? endOfLines.length : 0;
  3243. }
  3244. function normalizeEndOfLine(text) {
  3245. return text.replace(/\r\n?/g, "\n");
  3246. }
  3247. module2.exports = {
  3248. guessEndOfLine,
  3249. convertEndOfLineToChars,
  3250. countEndOfLineChars,
  3251. normalizeEndOfLine
  3252. };
  3253. }
  3254. });
  3255. var require_errors = __commonJS2({
  3256. "src/common/errors.js"(exports2, module2) {
  3257. "use strict";
  3258. var ConfigError = class extends Error {
  3259. };
  3260. var DebugError = class extends Error {
  3261. };
  3262. var UndefinedParserError = class extends Error {
  3263. };
  3264. var ArgExpansionBailout = class extends Error {
  3265. };
  3266. module2.exports = {
  3267. ConfigError,
  3268. DebugError,
  3269. UndefinedParserError,
  3270. ArgExpansionBailout
  3271. };
  3272. }
  3273. });
  3274. var tslib_es6_exports = {};
  3275. __export(tslib_es6_exports, {
  3276. __assign: () => __assign,
  3277. __asyncDelegator: () => __asyncDelegator,
  3278. __asyncGenerator: () => __asyncGenerator,
  3279. __asyncValues: () => __asyncValues,
  3280. __await: () => __await,
  3281. __awaiter: () => __awaiter,
  3282. __classPrivateFieldGet: () => __classPrivateFieldGet,
  3283. __classPrivateFieldSet: () => __classPrivateFieldSet,
  3284. __createBinding: () => __createBinding,
  3285. __decorate: () => __decorate,
  3286. __exportStar: () => __exportStar,
  3287. __extends: () => __extends,
  3288. __generator: () => __generator,
  3289. __importDefault: () => __importDefault,
  3290. __importStar: () => __importStar,
  3291. __makeTemplateObject: () => __makeTemplateObject,
  3292. __metadata: () => __metadata,
  3293. __param: () => __param,
  3294. __read: () => __read,
  3295. __rest: () => __rest,
  3296. __spread: () => __spread,
  3297. __spreadArrays: () => __spreadArrays,
  3298. __values: () => __values
  3299. });
  3300. function __extends(d, b) {
  3301. extendStatics(d, b);
  3302. function __() {
  3303. this.constructor = d;
  3304. }
  3305. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3306. }
  3307. function __rest(s, e) {
  3308. var t = {};
  3309. for (var p in s)
  3310. if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  3311. t[p] = s[p];
  3312. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  3313. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  3314. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  3315. t[p[i]] = s[p[i]];
  3316. }
  3317. return t;
  3318. }
  3319. function __decorate(decorators, target, key, desc) {
  3320. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3321. if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
  3322. r = Reflect.decorate(decorators, target, key, desc);
  3323. else
  3324. for (var i = decorators.length - 1; i >= 0; i--)
  3325. if (d = decorators[i])
  3326. r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  3327. return c > 3 && r && Object.defineProperty(target, key, r), r;
  3328. }
  3329. function __param(paramIndex, decorator) {
  3330. return function(target, key) {
  3331. decorator(target, key, paramIndex);
  3332. };
  3333. }
  3334. function __metadata(metadataKey, metadataValue) {
  3335. if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
  3336. return Reflect.metadata(metadataKey, metadataValue);
  3337. }
  3338. function __awaiter(thisArg, _arguments, P, generator) {
  3339. function adopt(value) {
  3340. return value instanceof P ? value : new P(function(resolve) {
  3341. resolve(value);
  3342. });
  3343. }
  3344. return new (P || (P = Promise))(function(resolve, reject) {
  3345. function fulfilled(value) {
  3346. try {
  3347. step(generator.next(value));
  3348. } catch (e) {
  3349. reject(e);
  3350. }
  3351. }
  3352. function rejected(value) {
  3353. try {
  3354. step(generator["throw"](value));
  3355. } catch (e) {
  3356. reject(e);
  3357. }
  3358. }
  3359. function step(result) {
  3360. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  3361. }
  3362. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3363. });
  3364. }
  3365. function __generator(thisArg, body) {
  3366. var _ = {
  3367. label: 0,
  3368. sent: function() {
  3369. if (t[0] & 1)
  3370. throw t[1];
  3371. return t[1];
  3372. },
  3373. trys: [],
  3374. ops: []
  3375. }, f, y, t, g;
  3376. return g = {
  3377. next: verb(0),
  3378. "throw": verb(1),
  3379. "return": verb(2)
  3380. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  3381. return this;
  3382. }), g;
  3383. function verb(n) {
  3384. return function(v) {
  3385. return step([n, v]);
  3386. };
  3387. }
  3388. function step(op) {
  3389. if (f)
  3390. throw new TypeError("Generator is already executing.");
  3391. while (_)
  3392. try {
  3393. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
  3394. return t;
  3395. if (y = 0, t)
  3396. op = [op[0] & 2, t.value];
  3397. switch (op[0]) {
  3398. case 0:
  3399. case 1:
  3400. t = op;
  3401. break;
  3402. case 4:
  3403. _.label++;
  3404. return {
  3405. value: op[1],
  3406. done: false
  3407. };
  3408. case 5:
  3409. _.label++;
  3410. y = op[1];
  3411. op = [0];
  3412. continue;
  3413. case 7:
  3414. op = _.ops.pop();
  3415. _.trys.pop();
  3416. continue;
  3417. default:
  3418. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  3419. _ = 0;
  3420. continue;
  3421. }
  3422. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  3423. _.label = op[1];
  3424. break;
  3425. }
  3426. if (op[0] === 6 && _.label < t[1]) {
  3427. _.label = t[1];
  3428. t = op;
  3429. break;
  3430. }
  3431. if (t && _.label < t[2]) {
  3432. _.label = t[2];
  3433. _.ops.push(op);
  3434. break;
  3435. }
  3436. if (t[2])
  3437. _.ops.pop();
  3438. _.trys.pop();
  3439. continue;
  3440. }
  3441. op = body.call(thisArg, _);
  3442. } catch (e) {
  3443. op = [6, e];
  3444. y = 0;
  3445. } finally {
  3446. f = t = 0;
  3447. }
  3448. if (op[0] & 5)
  3449. throw op[1];
  3450. return {
  3451. value: op[0] ? op[1] : void 0,
  3452. done: true
  3453. };
  3454. }
  3455. }
  3456. function __createBinding(o, m, k, k2) {
  3457. if (k2 === void 0)
  3458. k2 = k;
  3459. o[k2] = m[k];
  3460. }
  3461. function __exportStar(m, exports2) {
  3462. for (var p in m)
  3463. if (p !== "default" && !exports2.hasOwnProperty(p))
  3464. exports2[p] = m[p];
  3465. }
  3466. function __values(o) {
  3467. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  3468. if (m)
  3469. return m.call(o);
  3470. if (o && typeof o.length === "number")
  3471. return {
  3472. next: function() {
  3473. if (o && i >= o.length)
  3474. o = void 0;
  3475. return {
  3476. value: o && o[i++],
  3477. done: !o
  3478. };
  3479. }
  3480. };
  3481. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  3482. }
  3483. function __read(o, n) {
  3484. var m = typeof Symbol === "function" && o[Symbol.iterator];
  3485. if (!m)
  3486. return o;
  3487. var i = m.call(o), r, ar = [], e;
  3488. try {
  3489. while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
  3490. ar.push(r.value);
  3491. } catch (error) {
  3492. e = {
  3493. error
  3494. };
  3495. } finally {
  3496. try {
  3497. if (r && !r.done && (m = i["return"]))
  3498. m.call(i);
  3499. } finally {
  3500. if (e)
  3501. throw e.error;
  3502. }
  3503. }
  3504. return ar;
  3505. }
  3506. function __spread() {
  3507. for (var ar = [], i = 0; i < arguments.length; i++)
  3508. ar = ar.concat(__read(arguments[i]));
  3509. return ar;
  3510. }
  3511. function __spreadArrays() {
  3512. for (var s = 0, i = 0, il = arguments.length; i < il; i++)
  3513. s += arguments[i].length;
  3514. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  3515. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  3516. r[k] = a[j];
  3517. return r;
  3518. }
  3519. function __await(v) {
  3520. return this instanceof __await ? (this.v = v, this) : new __await(v);
  3521. }
  3522. function __asyncGenerator(thisArg, _arguments, generator) {
  3523. if (!Symbol.asyncIterator)
  3524. throw new TypeError("Symbol.asyncIterator is not defined.");
  3525. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  3526. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  3527. return this;
  3528. }, i;
  3529. function verb(n) {
  3530. if (g[n])
  3531. i[n] = function(v) {
  3532. return new Promise(function(a, b) {
  3533. q.push([n, v, a, b]) > 1 || resume(n, v);
  3534. });
  3535. };
  3536. }
  3537. function resume(n, v) {
  3538. try {
  3539. step(g[n](v));
  3540. } catch (e) {
  3541. settle(q[0][3], e);
  3542. }
  3543. }
  3544. function step(r) {
  3545. r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  3546. }
  3547. function fulfill(value) {
  3548. resume("next", value);
  3549. }
  3550. function reject(value) {
  3551. resume("throw", value);
  3552. }
  3553. function settle(f, v) {
  3554. if (f(v), q.shift(), q.length)
  3555. resume(q[0][0], q[0][1]);
  3556. }
  3557. }
  3558. function __asyncDelegator(o) {
  3559. var i, p;
  3560. return i = {}, verb("next"), verb("throw", function(e) {
  3561. throw e;
  3562. }), verb("return"), i[Symbol.iterator] = function() {
  3563. return this;
  3564. }, i;
  3565. function verb(n, f) {
  3566. i[n] = o[n] ? function(v) {
  3567. return (p = !p) ? {
  3568. value: __await(o[n](v)),
  3569. done: n === "return"
  3570. } : f ? f(v) : v;
  3571. } : f;
  3572. }
  3573. }
  3574. function __asyncValues(o) {
  3575. if (!Symbol.asyncIterator)
  3576. throw new TypeError("Symbol.asyncIterator is not defined.");
  3577. var m = o[Symbol.asyncIterator], i;
  3578. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
  3579. return this;
  3580. }, i);
  3581. function verb(n) {
  3582. i[n] = o[n] && function(v) {
  3583. return new Promise(function(resolve, reject) {
  3584. v = o[n](v), settle(resolve, reject, v.done, v.value);
  3585. });
  3586. };
  3587. }
  3588. function settle(resolve, reject, d, v) {
  3589. Promise.resolve(v).then(function(v2) {
  3590. resolve({
  3591. value: v2,
  3592. done: d
  3593. });
  3594. }, reject);
  3595. }
  3596. }
  3597. function __makeTemplateObject(cooked, raw) {
  3598. if (Object.defineProperty) {
  3599. Object.defineProperty(cooked, "raw", {
  3600. value: raw
  3601. });
  3602. } else {
  3603. cooked.raw = raw;
  3604. }
  3605. return cooked;
  3606. }
  3607. function __importStar(mod) {
  3608. if (mod && mod.__esModule)
  3609. return mod;
  3610. var result = {};
  3611. if (mod != null) {
  3612. for (var k in mod)
  3613. if (Object.hasOwnProperty.call(mod, k))
  3614. result[k] = mod[k];
  3615. }
  3616. result.default = mod;
  3617. return result;
  3618. }
  3619. function __importDefault(mod) {
  3620. return mod && mod.__esModule ? mod : {
  3621. default: mod
  3622. };
  3623. }
  3624. function __classPrivateFieldGet(receiver, privateMap) {
  3625. if (!privateMap.has(receiver)) {
  3626. throw new TypeError("attempted to get private field on non-instance");
  3627. }
  3628. return privateMap.get(receiver);
  3629. }
  3630. function __classPrivateFieldSet(receiver, privateMap, value) {
  3631. if (!privateMap.has(receiver)) {
  3632. throw new TypeError("attempted to set private field on non-instance");
  3633. }
  3634. privateMap.set(receiver, value);
  3635. return value;
  3636. }
  3637. var extendStatics;
  3638. var __assign;
  3639. var init_tslib_es6 = __esm({
  3640. "node_modules/tslib/tslib.es6.js"() {
  3641. extendStatics = function(d, b) {
  3642. extendStatics = Object.setPrototypeOf || {
  3643. __proto__: []
  3644. } instanceof Array && function(d2, b2) {
  3645. d2.__proto__ = b2;
  3646. } || function(d2, b2) {
  3647. for (var p in b2)
  3648. if (b2.hasOwnProperty(p))
  3649. d2[p] = b2[p];
  3650. };
  3651. return extendStatics(d, b);
  3652. };
  3653. __assign = function() {
  3654. __assign = Object.assign || function __assign2(t) {
  3655. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3656. s = arguments[i];
  3657. for (var p in s)
  3658. if (Object.prototype.hasOwnProperty.call(s, p))
  3659. t[p] = s[p];
  3660. }
  3661. return t;
  3662. };
  3663. return __assign.apply(this, arguments);
  3664. };
  3665. }
  3666. });
  3667. var require_api = __commonJS2({
  3668. "node_modules/vnopts/lib/descriptors/api.js"(exports2) {
  3669. "use strict";
  3670. Object.defineProperty(exports2, "__esModule", {
  3671. value: true
  3672. });
  3673. exports2.apiDescriptor = {
  3674. key: (key) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key),
  3675. value(value) {
  3676. if (value === null || typeof value !== "object") {
  3677. return JSON.stringify(value);
  3678. }
  3679. if (Array.isArray(value)) {
  3680. return `[${value.map((subValue) => exports2.apiDescriptor.value(subValue)).join(", ")}]`;
  3681. }
  3682. const keys = Object.keys(value);
  3683. return keys.length === 0 ? "{}" : `{ ${keys.map((key) => `${exports2.apiDescriptor.key(key)}: ${exports2.apiDescriptor.value(value[key])}`).join(", ")} }`;
  3684. },
  3685. pair: ({
  3686. key,
  3687. value
  3688. }) => exports2.apiDescriptor.value({
  3689. [key]: value
  3690. })
  3691. };
  3692. }
  3693. });
  3694. var require_descriptors2 = __commonJS2({
  3695. "node_modules/vnopts/lib/descriptors/index.js"(exports2) {
  3696. "use strict";
  3697. Object.defineProperty(exports2, "__esModule", {
  3698. value: true
  3699. });
  3700. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  3701. tslib_1.__exportStar(require_api(), exports2);
  3702. }
  3703. });
  3704. var require_escape_string_regexp = __commonJS2({
  3705. "node_modules/vnopts/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  3706. "use strict";
  3707. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  3708. module2.exports = function(str) {
  3709. if (typeof str !== "string") {
  3710. throw new TypeError("Expected a string");
  3711. }
  3712. return str.replace(matchOperatorsRe, "\\$&");
  3713. };
  3714. }
  3715. });
  3716. var require_color_name = __commonJS2({
  3717. "node_modules/color-name/index.js"(exports2, module2) {
  3718. "use strict";
  3719. module2.exports = {
  3720. "aliceblue": [240, 248, 255],
  3721. "antiquewhite": [250, 235, 215],
  3722. "aqua": [0, 255, 255],
  3723. "aquamarine": [127, 255, 212],
  3724. "azure": [240, 255, 255],
  3725. "beige": [245, 245, 220],
  3726. "bisque": [255, 228, 196],
  3727. "black": [0, 0, 0],
  3728. "blanchedalmond": [255, 235, 205],
  3729. "blue": [0, 0, 255],
  3730. "blueviolet": [138, 43, 226],
  3731. "brown": [165, 42, 42],
  3732. "burlywood": [222, 184, 135],
  3733. "cadetblue": [95, 158, 160],
  3734. "chartreuse": [127, 255, 0],
  3735. "chocolate": [210, 105, 30],
  3736. "coral": [255, 127, 80],
  3737. "cornflowerblue": [100, 149, 237],
  3738. "cornsilk": [255, 248, 220],
  3739. "crimson": [220, 20, 60],
  3740. "cyan": [0, 255, 255],
  3741. "darkblue": [0, 0, 139],
  3742. "darkcyan": [0, 139, 139],
  3743. "darkgoldenrod": [184, 134, 11],
  3744. "darkgray": [169, 169, 169],
  3745. "darkgreen": [0, 100, 0],
  3746. "darkgrey": [169, 169, 169],
  3747. "darkkhaki": [189, 183, 107],
  3748. "darkmagenta": [139, 0, 139],
  3749. "darkolivegreen": [85, 107, 47],
  3750. "darkorange": [255, 140, 0],
  3751. "darkorchid": [153, 50, 204],
  3752. "darkred": [139, 0, 0],
  3753. "darksalmon": [233, 150, 122],
  3754. "darkseagreen": [143, 188, 143],
  3755. "darkslateblue": [72, 61, 139],
  3756. "darkslategray": [47, 79, 79],
  3757. "darkslategrey": [47, 79, 79],
  3758. "darkturquoise": [0, 206, 209],
  3759. "darkviolet": [148, 0, 211],
  3760. "deeppink": [255, 20, 147],
  3761. "deepskyblue": [0, 191, 255],
  3762. "dimgray": [105, 105, 105],
  3763. "dimgrey": [105, 105, 105],
  3764. "dodgerblue": [30, 144, 255],
  3765. "firebrick": [178, 34, 34],
  3766. "floralwhite": [255, 250, 240],
  3767. "forestgreen": [34, 139, 34],
  3768. "fuchsia": [255, 0, 255],
  3769. "gainsboro": [220, 220, 220],
  3770. "ghostwhite": [248, 248, 255],
  3771. "gold": [255, 215, 0],
  3772. "goldenrod": [218, 165, 32],
  3773. "gray": [128, 128, 128],
  3774. "green": [0, 128, 0],
  3775. "greenyellow": [173, 255, 47],
  3776. "grey": [128, 128, 128],
  3777. "honeydew": [240, 255, 240],
  3778. "hotpink": [255, 105, 180],
  3779. "indianred": [205, 92, 92],
  3780. "indigo": [75, 0, 130],
  3781. "ivory": [255, 255, 240],
  3782. "khaki": [240, 230, 140],
  3783. "lavender": [230, 230, 250],
  3784. "lavenderblush": [255, 240, 245],
  3785. "lawngreen": [124, 252, 0],
  3786. "lemonchiffon": [255, 250, 205],
  3787. "lightblue": [173, 216, 230],
  3788. "lightcoral": [240, 128, 128],
  3789. "lightcyan": [224, 255, 255],
  3790. "lightgoldenrodyellow": [250, 250, 210],
  3791. "lightgray": [211, 211, 211],
  3792. "lightgreen": [144, 238, 144],
  3793. "lightgrey": [211, 211, 211],
  3794. "lightpink": [255, 182, 193],
  3795. "lightsalmon": [255, 160, 122],
  3796. "lightseagreen": [32, 178, 170],
  3797. "lightskyblue": [135, 206, 250],
  3798. "lightslategray": [119, 136, 153],
  3799. "lightslategrey": [119, 136, 153],
  3800. "lightsteelblue": [176, 196, 222],
  3801. "lightyellow": [255, 255, 224],
  3802. "lime": [0, 255, 0],
  3803. "limegreen": [50, 205, 50],
  3804. "linen": [250, 240, 230],
  3805. "magenta": [255, 0, 255],
  3806. "maroon": [128, 0, 0],
  3807. "mediumaquamarine": [102, 205, 170],
  3808. "mediumblue": [0, 0, 205],
  3809. "mediumorchid": [186, 85, 211],
  3810. "mediumpurple": [147, 112, 219],
  3811. "mediumseagreen": [60, 179, 113],
  3812. "mediumslateblue": [123, 104, 238],
  3813. "mediumspringgreen": [0, 250, 154],
  3814. "mediumturquoise": [72, 209, 204],
  3815. "mediumvioletred": [199, 21, 133],
  3816. "midnightblue": [25, 25, 112],
  3817. "mintcream": [245, 255, 250],
  3818. "mistyrose": [255, 228, 225],
  3819. "moccasin": [255, 228, 181],
  3820. "navajowhite": [255, 222, 173],
  3821. "navy": [0, 0, 128],
  3822. "oldlace": [253, 245, 230],
  3823. "olive": [128, 128, 0],
  3824. "olivedrab": [107, 142, 35],
  3825. "orange": [255, 165, 0],
  3826. "orangered": [255, 69, 0],
  3827. "orchid": [218, 112, 214],
  3828. "palegoldenrod": [238, 232, 170],
  3829. "palegreen": [152, 251, 152],
  3830. "paleturquoise": [175, 238, 238],
  3831. "palevioletred": [219, 112, 147],
  3832. "papayawhip": [255, 239, 213],
  3833. "peachpuff": [255, 218, 185],
  3834. "peru": [205, 133, 63],
  3835. "pink": [255, 192, 203],
  3836. "plum": [221, 160, 221],
  3837. "powderblue": [176, 224, 230],
  3838. "purple": [128, 0, 128],
  3839. "rebeccapurple": [102, 51, 153],
  3840. "red": [255, 0, 0],
  3841. "rosybrown": [188, 143, 143],
  3842. "royalblue": [65, 105, 225],
  3843. "saddlebrown": [139, 69, 19],
  3844. "salmon": [250, 128, 114],
  3845. "sandybrown": [244, 164, 96],
  3846. "seagreen": [46, 139, 87],
  3847. "seashell": [255, 245, 238],
  3848. "sienna": [160, 82, 45],
  3849. "silver": [192, 192, 192],
  3850. "skyblue": [135, 206, 235],
  3851. "slateblue": [106, 90, 205],
  3852. "slategray": [112, 128, 144],
  3853. "slategrey": [112, 128, 144],
  3854. "snow": [255, 250, 250],
  3855. "springgreen": [0, 255, 127],
  3856. "steelblue": [70, 130, 180],
  3857. "tan": [210, 180, 140],
  3858. "teal": [0, 128, 128],
  3859. "thistle": [216, 191, 216],
  3860. "tomato": [255, 99, 71],
  3861. "turquoise": [64, 224, 208],
  3862. "violet": [238, 130, 238],
  3863. "wheat": [245, 222, 179],
  3864. "white": [255, 255, 255],
  3865. "whitesmoke": [245, 245, 245],
  3866. "yellow": [255, 255, 0],
  3867. "yellowgreen": [154, 205, 50]
  3868. };
  3869. }
  3870. });
  3871. var require_conversions = __commonJS2({
  3872. "node_modules/color-convert/conversions.js"(exports2, module2) {
  3873. var cssKeywords = require_color_name();
  3874. var reverseKeywords = {};
  3875. for (key in cssKeywords) {
  3876. if (cssKeywords.hasOwnProperty(key)) {
  3877. reverseKeywords[cssKeywords[key]] = key;
  3878. }
  3879. }
  3880. var key;
  3881. var convert = module2.exports = {
  3882. rgb: {
  3883. channels: 3,
  3884. labels: "rgb"
  3885. },
  3886. hsl: {
  3887. channels: 3,
  3888. labels: "hsl"
  3889. },
  3890. hsv: {
  3891. channels: 3,
  3892. labels: "hsv"
  3893. },
  3894. hwb: {
  3895. channels: 3,
  3896. labels: "hwb"
  3897. },
  3898. cmyk: {
  3899. channels: 4,
  3900. labels: "cmyk"
  3901. },
  3902. xyz: {
  3903. channels: 3,
  3904. labels: "xyz"
  3905. },
  3906. lab: {
  3907. channels: 3,
  3908. labels: "lab"
  3909. },
  3910. lch: {
  3911. channels: 3,
  3912. labels: "lch"
  3913. },
  3914. hex: {
  3915. channels: 1,
  3916. labels: ["hex"]
  3917. },
  3918. keyword: {
  3919. channels: 1,
  3920. labels: ["keyword"]
  3921. },
  3922. ansi16: {
  3923. channels: 1,
  3924. labels: ["ansi16"]
  3925. },
  3926. ansi256: {
  3927. channels: 1,
  3928. labels: ["ansi256"]
  3929. },
  3930. hcg: {
  3931. channels: 3,
  3932. labels: ["h", "c", "g"]
  3933. },
  3934. apple: {
  3935. channels: 3,
  3936. labels: ["r16", "g16", "b16"]
  3937. },
  3938. gray: {
  3939. channels: 1,
  3940. labels: ["gray"]
  3941. }
  3942. };
  3943. for (model in convert) {
  3944. if (convert.hasOwnProperty(model)) {
  3945. if (!("channels" in convert[model])) {
  3946. throw new Error("missing channels property: " + model);
  3947. }
  3948. if (!("labels" in convert[model])) {
  3949. throw new Error("missing channel labels property: " + model);
  3950. }
  3951. if (convert[model].labels.length !== convert[model].channels) {
  3952. throw new Error("channel and label counts mismatch: " + model);
  3953. }
  3954. channels = convert[model].channels;
  3955. labels = convert[model].labels;
  3956. delete convert[model].channels;
  3957. delete convert[model].labels;
  3958. Object.defineProperty(convert[model], "channels", {
  3959. value: channels
  3960. });
  3961. Object.defineProperty(convert[model], "labels", {
  3962. value: labels
  3963. });
  3964. }
  3965. }
  3966. var channels;
  3967. var labels;
  3968. var model;
  3969. convert.rgb.hsl = function(rgb) {
  3970. var r = rgb[0] / 255;
  3971. var g = rgb[1] / 255;
  3972. var b = rgb[2] / 255;
  3973. var min = Math.min(r, g, b);
  3974. var max = Math.max(r, g, b);
  3975. var delta = max - min;
  3976. var h;
  3977. var s;
  3978. var l;
  3979. if (max === min) {
  3980. h = 0;
  3981. } else if (r === max) {
  3982. h = (g - b) / delta;
  3983. } else if (g === max) {
  3984. h = 2 + (b - r) / delta;
  3985. } else if (b === max) {
  3986. h = 4 + (r - g) / delta;
  3987. }
  3988. h = Math.min(h * 60, 360);
  3989. if (h < 0) {
  3990. h += 360;
  3991. }
  3992. l = (min + max) / 2;
  3993. if (max === min) {
  3994. s = 0;
  3995. } else if (l <= 0.5) {
  3996. s = delta / (max + min);
  3997. } else {
  3998. s = delta / (2 - max - min);
  3999. }
  4000. return [h, s * 100, l * 100];
  4001. };
  4002. convert.rgb.hsv = function(rgb) {
  4003. var rdif;
  4004. var gdif;
  4005. var bdif;
  4006. var h;
  4007. var s;
  4008. var r = rgb[0] / 255;
  4009. var g = rgb[1] / 255;
  4010. var b = rgb[2] / 255;
  4011. var v = Math.max(r, g, b);
  4012. var diff = v - Math.min(r, g, b);
  4013. var diffc = function(c) {
  4014. return (v - c) / 6 / diff + 1 / 2;
  4015. };
  4016. if (diff === 0) {
  4017. h = s = 0;
  4018. } else {
  4019. s = diff / v;
  4020. rdif = diffc(r);
  4021. gdif = diffc(g);
  4022. bdif = diffc(b);
  4023. if (r === v) {
  4024. h = bdif - gdif;
  4025. } else if (g === v) {
  4026. h = 1 / 3 + rdif - bdif;
  4027. } else if (b === v) {
  4028. h = 2 / 3 + gdif - rdif;
  4029. }
  4030. if (h < 0) {
  4031. h += 1;
  4032. } else if (h > 1) {
  4033. h -= 1;
  4034. }
  4035. }
  4036. return [h * 360, s * 100, v * 100];
  4037. };
  4038. convert.rgb.hwb = function(rgb) {
  4039. var r = rgb[0];
  4040. var g = rgb[1];
  4041. var b = rgb[2];
  4042. var h = convert.rgb.hsl(rgb)[0];
  4043. var w = 1 / 255 * Math.min(r, Math.min(g, b));
  4044. b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
  4045. return [h, w * 100, b * 100];
  4046. };
  4047. convert.rgb.cmyk = function(rgb) {
  4048. var r = rgb[0] / 255;
  4049. var g = rgb[1] / 255;
  4050. var b = rgb[2] / 255;
  4051. var c;
  4052. var m;
  4053. var y;
  4054. var k;
  4055. k = Math.min(1 - r, 1 - g, 1 - b);
  4056. c = (1 - r - k) / (1 - k) || 0;
  4057. m = (1 - g - k) / (1 - k) || 0;
  4058. y = (1 - b - k) / (1 - k) || 0;
  4059. return [c * 100, m * 100, y * 100, k * 100];
  4060. };
  4061. function comparativeDistance(x, y) {
  4062. return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
  4063. }
  4064. convert.rgb.keyword = function(rgb) {
  4065. var reversed = reverseKeywords[rgb];
  4066. if (reversed) {
  4067. return reversed;
  4068. }
  4069. var currentClosestDistance = Infinity;
  4070. var currentClosestKeyword;
  4071. for (var keyword in cssKeywords) {
  4072. if (cssKeywords.hasOwnProperty(keyword)) {
  4073. var value = cssKeywords[keyword];
  4074. var distance = comparativeDistance(rgb, value);
  4075. if (distance < currentClosestDistance) {
  4076. currentClosestDistance = distance;
  4077. currentClosestKeyword = keyword;
  4078. }
  4079. }
  4080. }
  4081. return currentClosestKeyword;
  4082. };
  4083. convert.keyword.rgb = function(keyword) {
  4084. return cssKeywords[keyword];
  4085. };
  4086. convert.rgb.xyz = function(rgb) {
  4087. var r = rgb[0] / 255;
  4088. var g = rgb[1] / 255;
  4089. var b = rgb[2] / 255;
  4090. r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
  4091. g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
  4092. b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
  4093. var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
  4094. var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
  4095. var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
  4096. return [x * 100, y * 100, z * 100];
  4097. };
  4098. convert.rgb.lab = function(rgb) {
  4099. var xyz = convert.rgb.xyz(rgb);
  4100. var x = xyz[0];
  4101. var y = xyz[1];
  4102. var z = xyz[2];
  4103. var l;
  4104. var a;
  4105. var b;
  4106. x /= 95.047;
  4107. y /= 100;
  4108. z /= 108.883;
  4109. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4110. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4111. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4112. l = 116 * y - 16;
  4113. a = 500 * (x - y);
  4114. b = 200 * (y - z);
  4115. return [l, a, b];
  4116. };
  4117. convert.hsl.rgb = function(hsl) {
  4118. var h = hsl[0] / 360;
  4119. var s = hsl[1] / 100;
  4120. var l = hsl[2] / 100;
  4121. var t1;
  4122. var t2;
  4123. var t3;
  4124. var rgb;
  4125. var val;
  4126. if (s === 0) {
  4127. val = l * 255;
  4128. return [val, val, val];
  4129. }
  4130. if (l < 0.5) {
  4131. t2 = l * (1 + s);
  4132. } else {
  4133. t2 = l + s - l * s;
  4134. }
  4135. t1 = 2 * l - t2;
  4136. rgb = [0, 0, 0];
  4137. for (var i = 0; i < 3; i++) {
  4138. t3 = h + 1 / 3 * -(i - 1);
  4139. if (t3 < 0) {
  4140. t3++;
  4141. }
  4142. if (t3 > 1) {
  4143. t3--;
  4144. }
  4145. if (6 * t3 < 1) {
  4146. val = t1 + (t2 - t1) * 6 * t3;
  4147. } else if (2 * t3 < 1) {
  4148. val = t2;
  4149. } else if (3 * t3 < 2) {
  4150. val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
  4151. } else {
  4152. val = t1;
  4153. }
  4154. rgb[i] = val * 255;
  4155. }
  4156. return rgb;
  4157. };
  4158. convert.hsl.hsv = function(hsl) {
  4159. var h = hsl[0];
  4160. var s = hsl[1] / 100;
  4161. var l = hsl[2] / 100;
  4162. var smin = s;
  4163. var lmin = Math.max(l, 0.01);
  4164. var sv;
  4165. var v;
  4166. l *= 2;
  4167. s *= l <= 1 ? l : 2 - l;
  4168. smin *= lmin <= 1 ? lmin : 2 - lmin;
  4169. v = (l + s) / 2;
  4170. sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
  4171. return [h, sv * 100, v * 100];
  4172. };
  4173. convert.hsv.rgb = function(hsv) {
  4174. var h = hsv[0] / 60;
  4175. var s = hsv[1] / 100;
  4176. var v = hsv[2] / 100;
  4177. var hi = Math.floor(h) % 6;
  4178. var f = h - Math.floor(h);
  4179. var p = 255 * v * (1 - s);
  4180. var q = 255 * v * (1 - s * f);
  4181. var t = 255 * v * (1 - s * (1 - f));
  4182. v *= 255;
  4183. switch (hi) {
  4184. case 0:
  4185. return [v, t, p];
  4186. case 1:
  4187. return [q, v, p];
  4188. case 2:
  4189. return [p, v, t];
  4190. case 3:
  4191. return [p, q, v];
  4192. case 4:
  4193. return [t, p, v];
  4194. case 5:
  4195. return [v, p, q];
  4196. }
  4197. };
  4198. convert.hsv.hsl = function(hsv) {
  4199. var h = hsv[0];
  4200. var s = hsv[1] / 100;
  4201. var v = hsv[2] / 100;
  4202. var vmin = Math.max(v, 0.01);
  4203. var lmin;
  4204. var sl;
  4205. var l;
  4206. l = (2 - s) * v;
  4207. lmin = (2 - s) * vmin;
  4208. sl = s * vmin;
  4209. sl /= lmin <= 1 ? lmin : 2 - lmin;
  4210. sl = sl || 0;
  4211. l /= 2;
  4212. return [h, sl * 100, l * 100];
  4213. };
  4214. convert.hwb.rgb = function(hwb) {
  4215. var h = hwb[0] / 360;
  4216. var wh = hwb[1] / 100;
  4217. var bl = hwb[2] / 100;
  4218. var ratio = wh + bl;
  4219. var i;
  4220. var v;
  4221. var f;
  4222. var n;
  4223. if (ratio > 1) {
  4224. wh /= ratio;
  4225. bl /= ratio;
  4226. }
  4227. i = Math.floor(6 * h);
  4228. v = 1 - bl;
  4229. f = 6 * h - i;
  4230. if ((i & 1) !== 0) {
  4231. f = 1 - f;
  4232. }
  4233. n = wh + f * (v - wh);
  4234. var r;
  4235. var g;
  4236. var b;
  4237. switch (i) {
  4238. default:
  4239. case 6:
  4240. case 0:
  4241. r = v;
  4242. g = n;
  4243. b = wh;
  4244. break;
  4245. case 1:
  4246. r = n;
  4247. g = v;
  4248. b = wh;
  4249. break;
  4250. case 2:
  4251. r = wh;
  4252. g = v;
  4253. b = n;
  4254. break;
  4255. case 3:
  4256. r = wh;
  4257. g = n;
  4258. b = v;
  4259. break;
  4260. case 4:
  4261. r = n;
  4262. g = wh;
  4263. b = v;
  4264. break;
  4265. case 5:
  4266. r = v;
  4267. g = wh;
  4268. b = n;
  4269. break;
  4270. }
  4271. return [r * 255, g * 255, b * 255];
  4272. };
  4273. convert.cmyk.rgb = function(cmyk) {
  4274. var c = cmyk[0] / 100;
  4275. var m = cmyk[1] / 100;
  4276. var y = cmyk[2] / 100;
  4277. var k = cmyk[3] / 100;
  4278. var r;
  4279. var g;
  4280. var b;
  4281. r = 1 - Math.min(1, c * (1 - k) + k);
  4282. g = 1 - Math.min(1, m * (1 - k) + k);
  4283. b = 1 - Math.min(1, y * (1 - k) + k);
  4284. return [r * 255, g * 255, b * 255];
  4285. };
  4286. convert.xyz.rgb = function(xyz) {
  4287. var x = xyz[0] / 100;
  4288. var y = xyz[1] / 100;
  4289. var z = xyz[2] / 100;
  4290. var r;
  4291. var g;
  4292. var b;
  4293. r = x * 3.2406 + y * -1.5372 + z * -0.4986;
  4294. g = x * -0.9689 + y * 1.8758 + z * 0.0415;
  4295. b = x * 0.0557 + y * -0.204 + z * 1.057;
  4296. r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
  4297. g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
  4298. b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
  4299. r = Math.min(Math.max(0, r), 1);
  4300. g = Math.min(Math.max(0, g), 1);
  4301. b = Math.min(Math.max(0, b), 1);
  4302. return [r * 255, g * 255, b * 255];
  4303. };
  4304. convert.xyz.lab = function(xyz) {
  4305. var x = xyz[0];
  4306. var y = xyz[1];
  4307. var z = xyz[2];
  4308. var l;
  4309. var a;
  4310. var b;
  4311. x /= 95.047;
  4312. y /= 100;
  4313. z /= 108.883;
  4314. x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
  4315. y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
  4316. z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
  4317. l = 116 * y - 16;
  4318. a = 500 * (x - y);
  4319. b = 200 * (y - z);
  4320. return [l, a, b];
  4321. };
  4322. convert.lab.xyz = function(lab) {
  4323. var l = lab[0];
  4324. var a = lab[1];
  4325. var b = lab[2];
  4326. var x;
  4327. var y;
  4328. var z;
  4329. y = (l + 16) / 116;
  4330. x = a / 500 + y;
  4331. z = y - b / 200;
  4332. var y2 = Math.pow(y, 3);
  4333. var x2 = Math.pow(x, 3);
  4334. var z2 = Math.pow(z, 3);
  4335. y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
  4336. x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
  4337. z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
  4338. x *= 95.047;
  4339. y *= 100;
  4340. z *= 108.883;
  4341. return [x, y, z];
  4342. };
  4343. convert.lab.lch = function(lab) {
  4344. var l = lab[0];
  4345. var a = lab[1];
  4346. var b = lab[2];
  4347. var hr;
  4348. var h;
  4349. var c;
  4350. hr = Math.atan2(b, a);
  4351. h = hr * 360 / 2 / Math.PI;
  4352. if (h < 0) {
  4353. h += 360;
  4354. }
  4355. c = Math.sqrt(a * a + b * b);
  4356. return [l, c, h];
  4357. };
  4358. convert.lch.lab = function(lch) {
  4359. var l = lch[0];
  4360. var c = lch[1];
  4361. var h = lch[2];
  4362. var a;
  4363. var b;
  4364. var hr;
  4365. hr = h / 360 * 2 * Math.PI;
  4366. a = c * Math.cos(hr);
  4367. b = c * Math.sin(hr);
  4368. return [l, a, b];
  4369. };
  4370. convert.rgb.ansi16 = function(args) {
  4371. var r = args[0];
  4372. var g = args[1];
  4373. var b = args[2];
  4374. var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
  4375. value = Math.round(value / 50);
  4376. if (value === 0) {
  4377. return 30;
  4378. }
  4379. var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
  4380. if (value === 2) {
  4381. ansi += 60;
  4382. }
  4383. return ansi;
  4384. };
  4385. convert.hsv.ansi16 = function(args) {
  4386. return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
  4387. };
  4388. convert.rgb.ansi256 = function(args) {
  4389. var r = args[0];
  4390. var g = args[1];
  4391. var b = args[2];
  4392. if (r === g && g === b) {
  4393. if (r < 8) {
  4394. return 16;
  4395. }
  4396. if (r > 248) {
  4397. return 231;
  4398. }
  4399. return Math.round((r - 8) / 247 * 24) + 232;
  4400. }
  4401. var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
  4402. return ansi;
  4403. };
  4404. convert.ansi16.rgb = function(args) {
  4405. var color = args % 10;
  4406. if (color === 0 || color === 7) {
  4407. if (args > 50) {
  4408. color += 3.5;
  4409. }
  4410. color = color / 10.5 * 255;
  4411. return [color, color, color];
  4412. }
  4413. var mult = (~~(args > 50) + 1) * 0.5;
  4414. var r = (color & 1) * mult * 255;
  4415. var g = (color >> 1 & 1) * mult * 255;
  4416. var b = (color >> 2 & 1) * mult * 255;
  4417. return [r, g, b];
  4418. };
  4419. convert.ansi256.rgb = function(args) {
  4420. if (args >= 232) {
  4421. var c = (args - 232) * 10 + 8;
  4422. return [c, c, c];
  4423. }
  4424. args -= 16;
  4425. var rem;
  4426. var r = Math.floor(args / 36) / 5 * 255;
  4427. var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
  4428. var b = rem % 6 / 5 * 255;
  4429. return [r, g, b];
  4430. };
  4431. convert.rgb.hex = function(args) {
  4432. var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
  4433. var string = integer.toString(16).toUpperCase();
  4434. return "000000".substring(string.length) + string;
  4435. };
  4436. convert.hex.rgb = function(args) {
  4437. var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
  4438. if (!match) {
  4439. return [0, 0, 0];
  4440. }
  4441. var colorString = match[0];
  4442. if (match[0].length === 3) {
  4443. colorString = colorString.split("").map(function(char) {
  4444. return char + char;
  4445. }).join("");
  4446. }
  4447. var integer = parseInt(colorString, 16);
  4448. var r = integer >> 16 & 255;
  4449. var g = integer >> 8 & 255;
  4450. var b = integer & 255;
  4451. return [r, g, b];
  4452. };
  4453. convert.rgb.hcg = function(rgb) {
  4454. var r = rgb[0] / 255;
  4455. var g = rgb[1] / 255;
  4456. var b = rgb[2] / 255;
  4457. var max = Math.max(Math.max(r, g), b);
  4458. var min = Math.min(Math.min(r, g), b);
  4459. var chroma = max - min;
  4460. var grayscale;
  4461. var hue;
  4462. if (chroma < 1) {
  4463. grayscale = min / (1 - chroma);
  4464. } else {
  4465. grayscale = 0;
  4466. }
  4467. if (chroma <= 0) {
  4468. hue = 0;
  4469. } else if (max === r) {
  4470. hue = (g - b) / chroma % 6;
  4471. } else if (max === g) {
  4472. hue = 2 + (b - r) / chroma;
  4473. } else {
  4474. hue = 4 + (r - g) / chroma + 4;
  4475. }
  4476. hue /= 6;
  4477. hue %= 1;
  4478. return [hue * 360, chroma * 100, grayscale * 100];
  4479. };
  4480. convert.hsl.hcg = function(hsl) {
  4481. var s = hsl[1] / 100;
  4482. var l = hsl[2] / 100;
  4483. var c = 1;
  4484. var f = 0;
  4485. if (l < 0.5) {
  4486. c = 2 * s * l;
  4487. } else {
  4488. c = 2 * s * (1 - l);
  4489. }
  4490. if (c < 1) {
  4491. f = (l - 0.5 * c) / (1 - c);
  4492. }
  4493. return [hsl[0], c * 100, f * 100];
  4494. };
  4495. convert.hsv.hcg = function(hsv) {
  4496. var s = hsv[1] / 100;
  4497. var v = hsv[2] / 100;
  4498. var c = s * v;
  4499. var f = 0;
  4500. if (c < 1) {
  4501. f = (v - c) / (1 - c);
  4502. }
  4503. return [hsv[0], c * 100, f * 100];
  4504. };
  4505. convert.hcg.rgb = function(hcg) {
  4506. var h = hcg[0] / 360;
  4507. var c = hcg[1] / 100;
  4508. var g = hcg[2] / 100;
  4509. if (c === 0) {
  4510. return [g * 255, g * 255, g * 255];
  4511. }
  4512. var pure = [0, 0, 0];
  4513. var hi = h % 1 * 6;
  4514. var v = hi % 1;
  4515. var w = 1 - v;
  4516. var mg = 0;
  4517. switch (Math.floor(hi)) {
  4518. case 0:
  4519. pure[0] = 1;
  4520. pure[1] = v;
  4521. pure[2] = 0;
  4522. break;
  4523. case 1:
  4524. pure[0] = w;
  4525. pure[1] = 1;
  4526. pure[2] = 0;
  4527. break;
  4528. case 2:
  4529. pure[0] = 0;
  4530. pure[1] = 1;
  4531. pure[2] = v;
  4532. break;
  4533. case 3:
  4534. pure[0] = 0;
  4535. pure[1] = w;
  4536. pure[2] = 1;
  4537. break;
  4538. case 4:
  4539. pure[0] = v;
  4540. pure[1] = 0;
  4541. pure[2] = 1;
  4542. break;
  4543. default:
  4544. pure[0] = 1;
  4545. pure[1] = 0;
  4546. pure[2] = w;
  4547. }
  4548. mg = (1 - c) * g;
  4549. return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
  4550. };
  4551. convert.hcg.hsv = function(hcg) {
  4552. var c = hcg[1] / 100;
  4553. var g = hcg[2] / 100;
  4554. var v = c + g * (1 - c);
  4555. var f = 0;
  4556. if (v > 0) {
  4557. f = c / v;
  4558. }
  4559. return [hcg[0], f * 100, v * 100];
  4560. };
  4561. convert.hcg.hsl = function(hcg) {
  4562. var c = hcg[1] / 100;
  4563. var g = hcg[2] / 100;
  4564. var l = g * (1 - c) + 0.5 * c;
  4565. var s = 0;
  4566. if (l > 0 && l < 0.5) {
  4567. s = c / (2 * l);
  4568. } else if (l >= 0.5 && l < 1) {
  4569. s = c / (2 * (1 - l));
  4570. }
  4571. return [hcg[0], s * 100, l * 100];
  4572. };
  4573. convert.hcg.hwb = function(hcg) {
  4574. var c = hcg[1] / 100;
  4575. var g = hcg[2] / 100;
  4576. var v = c + g * (1 - c);
  4577. return [hcg[0], (v - c) * 100, (1 - v) * 100];
  4578. };
  4579. convert.hwb.hcg = function(hwb) {
  4580. var w = hwb[1] / 100;
  4581. var b = hwb[2] / 100;
  4582. var v = 1 - b;
  4583. var c = v - w;
  4584. var g = 0;
  4585. if (c < 1) {
  4586. g = (v - c) / (1 - c);
  4587. }
  4588. return [hwb[0], c * 100, g * 100];
  4589. };
  4590. convert.apple.rgb = function(apple) {
  4591. return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
  4592. };
  4593. convert.rgb.apple = function(rgb) {
  4594. return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
  4595. };
  4596. convert.gray.rgb = function(args) {
  4597. return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
  4598. };
  4599. convert.gray.hsl = convert.gray.hsv = function(args) {
  4600. return [0, 0, args[0]];
  4601. };
  4602. convert.gray.hwb = function(gray) {
  4603. return [0, 100, gray[0]];
  4604. };
  4605. convert.gray.cmyk = function(gray) {
  4606. return [0, 0, 0, gray[0]];
  4607. };
  4608. convert.gray.lab = function(gray) {
  4609. return [gray[0], 0, 0];
  4610. };
  4611. convert.gray.hex = function(gray) {
  4612. var val = Math.round(gray[0] / 100 * 255) & 255;
  4613. var integer = (val << 16) + (val << 8) + val;
  4614. var string = integer.toString(16).toUpperCase();
  4615. return "000000".substring(string.length) + string;
  4616. };
  4617. convert.rgb.gray = function(rgb) {
  4618. var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
  4619. return [val / 255 * 100];
  4620. };
  4621. }
  4622. });
  4623. var require_route = __commonJS2({
  4624. "node_modules/color-convert/route.js"(exports2, module2) {
  4625. var conversions = require_conversions();
  4626. function buildGraph() {
  4627. var graph = {};
  4628. var models = Object.keys(conversions);
  4629. for (var len = models.length, i = 0; i < len; i++) {
  4630. graph[models[i]] = {
  4631. distance: -1,
  4632. parent: null
  4633. };
  4634. }
  4635. return graph;
  4636. }
  4637. function deriveBFS(fromModel) {
  4638. var graph = buildGraph();
  4639. var queue = [fromModel];
  4640. graph[fromModel].distance = 0;
  4641. while (queue.length) {
  4642. var current = queue.pop();
  4643. var adjacents = Object.keys(conversions[current]);
  4644. for (var len = adjacents.length, i = 0; i < len; i++) {
  4645. var adjacent = adjacents[i];
  4646. var node = graph[adjacent];
  4647. if (node.distance === -1) {
  4648. node.distance = graph[current].distance + 1;
  4649. node.parent = current;
  4650. queue.unshift(adjacent);
  4651. }
  4652. }
  4653. }
  4654. return graph;
  4655. }
  4656. function link(from, to) {
  4657. return function(args) {
  4658. return to(from(args));
  4659. };
  4660. }
  4661. function wrapConversion(toModel, graph) {
  4662. var path = [graph[toModel].parent, toModel];
  4663. var fn = conversions[graph[toModel].parent][toModel];
  4664. var cur = graph[toModel].parent;
  4665. while (graph[cur].parent) {
  4666. path.unshift(graph[cur].parent);
  4667. fn = link(conversions[graph[cur].parent][cur], fn);
  4668. cur = graph[cur].parent;
  4669. }
  4670. fn.conversion = path;
  4671. return fn;
  4672. }
  4673. module2.exports = function(fromModel) {
  4674. var graph = deriveBFS(fromModel);
  4675. var conversion = {};
  4676. var models = Object.keys(graph);
  4677. for (var len = models.length, i = 0; i < len; i++) {
  4678. var toModel = models[i];
  4679. var node = graph[toModel];
  4680. if (node.parent === null) {
  4681. continue;
  4682. }
  4683. conversion[toModel] = wrapConversion(toModel, graph);
  4684. }
  4685. return conversion;
  4686. };
  4687. }
  4688. });
  4689. var require_color_convert = __commonJS2({
  4690. "node_modules/color-convert/index.js"(exports2, module2) {
  4691. var conversions = require_conversions();
  4692. var route = require_route();
  4693. var convert = {};
  4694. var models = Object.keys(conversions);
  4695. function wrapRaw(fn) {
  4696. var wrappedFn = function(args) {
  4697. if (args === void 0 || args === null) {
  4698. return args;
  4699. }
  4700. if (arguments.length > 1) {
  4701. args = Array.prototype.slice.call(arguments);
  4702. }
  4703. return fn(args);
  4704. };
  4705. if ("conversion" in fn) {
  4706. wrappedFn.conversion = fn.conversion;
  4707. }
  4708. return wrappedFn;
  4709. }
  4710. function wrapRounded(fn) {
  4711. var wrappedFn = function(args) {
  4712. if (args === void 0 || args === null) {
  4713. return args;
  4714. }
  4715. if (arguments.length > 1) {
  4716. args = Array.prototype.slice.call(arguments);
  4717. }
  4718. var result = fn(args);
  4719. if (typeof result === "object") {
  4720. for (var len = result.length, i = 0; i < len; i++) {
  4721. result[i] = Math.round(result[i]);
  4722. }
  4723. }
  4724. return result;
  4725. };
  4726. if ("conversion" in fn) {
  4727. wrappedFn.conversion = fn.conversion;
  4728. }
  4729. return wrappedFn;
  4730. }
  4731. models.forEach(function(fromModel) {
  4732. convert[fromModel] = {};
  4733. Object.defineProperty(convert[fromModel], "channels", {
  4734. value: conversions[fromModel].channels
  4735. });
  4736. Object.defineProperty(convert[fromModel], "labels", {
  4737. value: conversions[fromModel].labels
  4738. });
  4739. var routes = route(fromModel);
  4740. var routeModels = Object.keys(routes);
  4741. routeModels.forEach(function(toModel) {
  4742. var fn = routes[toModel];
  4743. convert[fromModel][toModel] = wrapRounded(fn);
  4744. convert[fromModel][toModel].raw = wrapRaw(fn);
  4745. });
  4746. });
  4747. module2.exports = convert;
  4748. }
  4749. });
  4750. var require_ansi_styles = __commonJS2({
  4751. "node_modules/ansi-styles/index.js"(exports2, module2) {
  4752. "use strict";
  4753. var colorConvert = require_color_convert();
  4754. var wrapAnsi16 = (fn, offset) => function() {
  4755. const code = fn.apply(colorConvert, arguments);
  4756. return `\x1B[${code + offset}m`;
  4757. };
  4758. var wrapAnsi256 = (fn, offset) => function() {
  4759. const code = fn.apply(colorConvert, arguments);
  4760. return `\x1B[${38 + offset};5;${code}m`;
  4761. };
  4762. var wrapAnsi16m = (fn, offset) => function() {
  4763. const rgb = fn.apply(colorConvert, arguments);
  4764. return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
  4765. };
  4766. function assembleStyles() {
  4767. const codes = /* @__PURE__ */ new Map();
  4768. const styles = {
  4769. modifier: {
  4770. reset: [0, 0],
  4771. bold: [1, 22],
  4772. dim: [2, 22],
  4773. italic: [3, 23],
  4774. underline: [4, 24],
  4775. inverse: [7, 27],
  4776. hidden: [8, 28],
  4777. strikethrough: [9, 29]
  4778. },
  4779. color: {
  4780. black: [30, 39],
  4781. red: [31, 39],
  4782. green: [32, 39],
  4783. yellow: [33, 39],
  4784. blue: [34, 39],
  4785. magenta: [35, 39],
  4786. cyan: [36, 39],
  4787. white: [37, 39],
  4788. gray: [90, 39],
  4789. redBright: [91, 39],
  4790. greenBright: [92, 39],
  4791. yellowBright: [93, 39],
  4792. blueBright: [94, 39],
  4793. magentaBright: [95, 39],
  4794. cyanBright: [96, 39],
  4795. whiteBright: [97, 39]
  4796. },
  4797. bgColor: {
  4798. bgBlack: [40, 49],
  4799. bgRed: [41, 49],
  4800. bgGreen: [42, 49],
  4801. bgYellow: [43, 49],
  4802. bgBlue: [44, 49],
  4803. bgMagenta: [45, 49],
  4804. bgCyan: [46, 49],
  4805. bgWhite: [47, 49],
  4806. bgBlackBright: [100, 49],
  4807. bgRedBright: [101, 49],
  4808. bgGreenBright: [102, 49],
  4809. bgYellowBright: [103, 49],
  4810. bgBlueBright: [104, 49],
  4811. bgMagentaBright: [105, 49],
  4812. bgCyanBright: [106, 49],
  4813. bgWhiteBright: [107, 49]
  4814. }
  4815. };
  4816. styles.color.grey = styles.color.gray;
  4817. for (const groupName of Object.keys(styles)) {
  4818. const group = styles[groupName];
  4819. for (const styleName of Object.keys(group)) {
  4820. const style = group[styleName];
  4821. styles[styleName] = {
  4822. open: `\x1B[${style[0]}m`,
  4823. close: `\x1B[${style[1]}m`
  4824. };
  4825. group[styleName] = styles[styleName];
  4826. codes.set(style[0], style[1]);
  4827. }
  4828. Object.defineProperty(styles, groupName, {
  4829. value: group,
  4830. enumerable: false
  4831. });
  4832. Object.defineProperty(styles, "codes", {
  4833. value: codes,
  4834. enumerable: false
  4835. });
  4836. }
  4837. const ansi2ansi = (n) => n;
  4838. const rgb2rgb = (r, g, b) => [r, g, b];
  4839. styles.color.close = "\x1B[39m";
  4840. styles.bgColor.close = "\x1B[49m";
  4841. styles.color.ansi = {
  4842. ansi: wrapAnsi16(ansi2ansi, 0)
  4843. };
  4844. styles.color.ansi256 = {
  4845. ansi256: wrapAnsi256(ansi2ansi, 0)
  4846. };
  4847. styles.color.ansi16m = {
  4848. rgb: wrapAnsi16m(rgb2rgb, 0)
  4849. };
  4850. styles.bgColor.ansi = {
  4851. ansi: wrapAnsi16(ansi2ansi, 10)
  4852. };
  4853. styles.bgColor.ansi256 = {
  4854. ansi256: wrapAnsi256(ansi2ansi, 10)
  4855. };
  4856. styles.bgColor.ansi16m = {
  4857. rgb: wrapAnsi16m(rgb2rgb, 10)
  4858. };
  4859. for (let key of Object.keys(colorConvert)) {
  4860. if (typeof colorConvert[key] !== "object") {
  4861. continue;
  4862. }
  4863. const suite = colorConvert[key];
  4864. if (key === "ansi16") {
  4865. key = "ansi";
  4866. }
  4867. if ("ansi16" in suite) {
  4868. styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
  4869. styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
  4870. }
  4871. if ("ansi256" in suite) {
  4872. styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
  4873. styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
  4874. }
  4875. if ("rgb" in suite) {
  4876. styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
  4877. styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
  4878. }
  4879. }
  4880. return styles;
  4881. }
  4882. Object.defineProperty(module2, "exports", {
  4883. enumerable: true,
  4884. get: assembleStyles
  4885. });
  4886. }
  4887. });
  4888. var require_has_flag = __commonJS2({
  4889. "node_modules/vnopts/node_modules/has-flag/index.js"(exports2, module2) {
  4890. "use strict";
  4891. module2.exports = (flag, argv) => {
  4892. argv = argv || process.argv;
  4893. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  4894. const pos = argv.indexOf(prefix + flag);
  4895. const terminatorPos = argv.indexOf("--");
  4896. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  4897. };
  4898. }
  4899. });
  4900. var require_supports_color = __commonJS2({
  4901. "node_modules/vnopts/node_modules/supports-color/index.js"(exports2, module2) {
  4902. "use strict";
  4903. var os = require("os");
  4904. var hasFlag = require_has_flag();
  4905. var env = process.env;
  4906. var forceColor;
  4907. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  4908. forceColor = false;
  4909. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  4910. forceColor = true;
  4911. }
  4912. if ("FORCE_COLOR" in env) {
  4913. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  4914. }
  4915. function translateLevel(level) {
  4916. if (level === 0) {
  4917. return false;
  4918. }
  4919. return {
  4920. level,
  4921. hasBasic: true,
  4922. has256: level >= 2,
  4923. has16m: level >= 3
  4924. };
  4925. }
  4926. function supportsColor(stream) {
  4927. if (forceColor === false) {
  4928. return 0;
  4929. }
  4930. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  4931. return 3;
  4932. }
  4933. if (hasFlag("color=256")) {
  4934. return 2;
  4935. }
  4936. if (stream && !stream.isTTY && forceColor !== true) {
  4937. return 0;
  4938. }
  4939. const min = forceColor ? 1 : 0;
  4940. if (process.platform === "win32") {
  4941. const osRelease = os.release().split(".");
  4942. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  4943. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  4944. }
  4945. return 1;
  4946. }
  4947. if ("CI" in env) {
  4948. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  4949. return 1;
  4950. }
  4951. return min;
  4952. }
  4953. if ("TEAMCITY_VERSION" in env) {
  4954. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  4955. }
  4956. if (env.COLORTERM === "truecolor") {
  4957. return 3;
  4958. }
  4959. if ("TERM_PROGRAM" in env) {
  4960. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  4961. switch (env.TERM_PROGRAM) {
  4962. case "iTerm.app":
  4963. return version2 >= 3 ? 3 : 2;
  4964. case "Apple_Terminal":
  4965. return 2;
  4966. }
  4967. }
  4968. if (/-256(color)?$/i.test(env.TERM)) {
  4969. return 2;
  4970. }
  4971. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  4972. return 1;
  4973. }
  4974. if ("COLORTERM" in env) {
  4975. return 1;
  4976. }
  4977. if (env.TERM === "dumb") {
  4978. return min;
  4979. }
  4980. return min;
  4981. }
  4982. function getSupportLevel(stream) {
  4983. const level = supportsColor(stream);
  4984. return translateLevel(level);
  4985. }
  4986. module2.exports = {
  4987. supportsColor: getSupportLevel,
  4988. stdout: getSupportLevel(process.stdout),
  4989. stderr: getSupportLevel(process.stderr)
  4990. };
  4991. }
  4992. });
  4993. var require_templates = __commonJS2({
  4994. "node_modules/vnopts/node_modules/chalk/templates.js"(exports2, module2) {
  4995. "use strict";
  4996. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  4997. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  4998. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  4999. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  5000. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  5001. function unescape(c) {
  5002. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  5003. return String.fromCharCode(parseInt(c.slice(1), 16));
  5004. }
  5005. return ESCAPES.get(c) || c;
  5006. }
  5007. function parseArguments(name, args) {
  5008. const results = [];
  5009. const chunks = args.trim().split(/\s*,\s*/g);
  5010. let matches;
  5011. for (const chunk of chunks) {
  5012. if (!isNaN(chunk)) {
  5013. results.push(Number(chunk));
  5014. } else if (matches = chunk.match(STRING_REGEX)) {
  5015. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  5016. } else {
  5017. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  5018. }
  5019. }
  5020. return results;
  5021. }
  5022. function parseStyle(style) {
  5023. STYLE_REGEX.lastIndex = 0;
  5024. const results = [];
  5025. let matches;
  5026. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  5027. const name = matches[1];
  5028. if (matches[2]) {
  5029. const args = parseArguments(name, matches[2]);
  5030. results.push([name].concat(args));
  5031. } else {
  5032. results.push([name]);
  5033. }
  5034. }
  5035. return results;
  5036. }
  5037. function buildStyle(chalk, styles) {
  5038. const enabled = {};
  5039. for (const layer of styles) {
  5040. for (const style of layer.styles) {
  5041. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  5042. }
  5043. }
  5044. let current = chalk;
  5045. for (const styleName of Object.keys(enabled)) {
  5046. if (Array.isArray(enabled[styleName])) {
  5047. if (!(styleName in current)) {
  5048. throw new Error(`Unknown Chalk style: ${styleName}`);
  5049. }
  5050. if (enabled[styleName].length > 0) {
  5051. current = current[styleName].apply(current, enabled[styleName]);
  5052. } else {
  5053. current = current[styleName];
  5054. }
  5055. }
  5056. }
  5057. return current;
  5058. }
  5059. module2.exports = (chalk, tmp) => {
  5060. const styles = [];
  5061. const chunks = [];
  5062. let chunk = [];
  5063. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  5064. if (escapeChar) {
  5065. chunk.push(unescape(escapeChar));
  5066. } else if (style) {
  5067. const str = chunk.join("");
  5068. chunk = [];
  5069. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  5070. styles.push({
  5071. inverse,
  5072. styles: parseStyle(style)
  5073. });
  5074. } else if (close) {
  5075. if (styles.length === 0) {
  5076. throw new Error("Found extraneous } in Chalk template literal");
  5077. }
  5078. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  5079. chunk = [];
  5080. styles.pop();
  5081. } else {
  5082. chunk.push(chr);
  5083. }
  5084. });
  5085. chunks.push(chunk.join(""));
  5086. if (styles.length > 0) {
  5087. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  5088. throw new Error(errMsg);
  5089. }
  5090. return chunks.join("");
  5091. };
  5092. }
  5093. });
  5094. var require_chalk = __commonJS2({
  5095. "node_modules/vnopts/node_modules/chalk/index.js"(exports2, module2) {
  5096. "use strict";
  5097. var escapeStringRegexp2 = require_escape_string_regexp();
  5098. var ansiStyles = require_ansi_styles();
  5099. var stdoutColor = require_supports_color().stdout;
  5100. var template = require_templates();
  5101. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  5102. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  5103. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  5104. var styles = /* @__PURE__ */ Object.create(null);
  5105. function applyOptions(obj, options) {
  5106. options = options || {};
  5107. const scLevel = stdoutColor ? stdoutColor.level : 0;
  5108. obj.level = options.level === void 0 ? scLevel : options.level;
  5109. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  5110. }
  5111. function Chalk(options) {
  5112. if (!this || !(this instanceof Chalk) || this.template) {
  5113. const chalk = {};
  5114. applyOptions(chalk, options);
  5115. chalk.template = function() {
  5116. const args = [].slice.call(arguments);
  5117. return chalkTag.apply(null, [chalk.template].concat(args));
  5118. };
  5119. Object.setPrototypeOf(chalk, Chalk.prototype);
  5120. Object.setPrototypeOf(chalk.template, chalk);
  5121. chalk.template.constructor = Chalk;
  5122. return chalk.template;
  5123. }
  5124. applyOptions(this, options);
  5125. }
  5126. if (isSimpleWindowsTerm) {
  5127. ansiStyles.blue.open = "\x1B[94m";
  5128. }
  5129. for (const key of Object.keys(ansiStyles)) {
  5130. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  5131. styles[key] = {
  5132. get() {
  5133. const codes = ansiStyles[key];
  5134. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  5135. }
  5136. };
  5137. }
  5138. styles.visible = {
  5139. get() {
  5140. return build.call(this, this._styles || [], true, "visible");
  5141. }
  5142. };
  5143. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  5144. for (const model of Object.keys(ansiStyles.color.ansi)) {
  5145. if (skipModels.has(model)) {
  5146. continue;
  5147. }
  5148. styles[model] = {
  5149. get() {
  5150. const level = this.level;
  5151. return function() {
  5152. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  5153. const codes = {
  5154. open,
  5155. close: ansiStyles.color.close,
  5156. closeRe: ansiStyles.color.closeRe
  5157. };
  5158. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5159. };
  5160. }
  5161. };
  5162. }
  5163. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  5164. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  5165. if (skipModels.has(model)) {
  5166. continue;
  5167. }
  5168. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  5169. styles[bgModel] = {
  5170. get() {
  5171. const level = this.level;
  5172. return function() {
  5173. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  5174. const codes = {
  5175. open,
  5176. close: ansiStyles.bgColor.close,
  5177. closeRe: ansiStyles.bgColor.closeRe
  5178. };
  5179. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  5180. };
  5181. }
  5182. };
  5183. }
  5184. var proto = Object.defineProperties(() => {
  5185. }, styles);
  5186. function build(_styles, _empty, key) {
  5187. const builder = function() {
  5188. return applyStyle.apply(builder, arguments);
  5189. };
  5190. builder._styles = _styles;
  5191. builder._empty = _empty;
  5192. const self2 = this;
  5193. Object.defineProperty(builder, "level", {
  5194. enumerable: true,
  5195. get() {
  5196. return self2.level;
  5197. },
  5198. set(level) {
  5199. self2.level = level;
  5200. }
  5201. });
  5202. Object.defineProperty(builder, "enabled", {
  5203. enumerable: true,
  5204. get() {
  5205. return self2.enabled;
  5206. },
  5207. set(enabled) {
  5208. self2.enabled = enabled;
  5209. }
  5210. });
  5211. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  5212. builder.__proto__ = proto;
  5213. return builder;
  5214. }
  5215. function applyStyle() {
  5216. const args = arguments;
  5217. const argsLen = args.length;
  5218. let str = String(arguments[0]);
  5219. if (argsLen === 0) {
  5220. return "";
  5221. }
  5222. if (argsLen > 1) {
  5223. for (let a = 1; a < argsLen; a++) {
  5224. str += " " + args[a];
  5225. }
  5226. }
  5227. if (!this.enabled || this.level <= 0 || !str) {
  5228. return this._empty ? "" : str;
  5229. }
  5230. const originalDim = ansiStyles.dim.open;
  5231. if (isSimpleWindowsTerm && this.hasGrey) {
  5232. ansiStyles.dim.open = "";
  5233. }
  5234. for (const code of this._styles.slice().reverse()) {
  5235. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  5236. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  5237. }
  5238. ansiStyles.dim.open = originalDim;
  5239. return str;
  5240. }
  5241. function chalkTag(chalk, strings) {
  5242. if (!Array.isArray(strings)) {
  5243. return [].slice.call(arguments, 1).join(" ");
  5244. }
  5245. const args = [].slice.call(arguments, 2);
  5246. const parts = [strings.raw[0]];
  5247. for (let i = 1; i < strings.length; i++) {
  5248. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  5249. parts.push(String(strings.raw[i]));
  5250. }
  5251. return template(chalk, parts.join(""));
  5252. }
  5253. Object.defineProperties(Chalk.prototype, styles);
  5254. module2.exports = Chalk();
  5255. module2.exports.supportsColor = stdoutColor;
  5256. module2.exports.default = module2.exports;
  5257. }
  5258. });
  5259. var require_common = __commonJS2({
  5260. "node_modules/vnopts/lib/handlers/deprecated/common.js"(exports2) {
  5261. "use strict";
  5262. Object.defineProperty(exports2, "__esModule", {
  5263. value: true
  5264. });
  5265. var chalk_1 = require_chalk();
  5266. exports2.commonDeprecatedHandler = (keyOrPair, redirectTo, {
  5267. descriptor
  5268. }) => {
  5269. const messages = [`${chalk_1.default.yellow(typeof keyOrPair === "string" ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`];
  5270. if (redirectTo) {
  5271. messages.push(`we now treat it as ${chalk_1.default.blue(typeof redirectTo === "string" ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
  5272. }
  5273. return messages.join("; ") + ".";
  5274. };
  5275. }
  5276. });
  5277. var require_deprecated = __commonJS2({
  5278. "node_modules/vnopts/lib/handlers/deprecated/index.js"(exports2) {
  5279. "use strict";
  5280. Object.defineProperty(exports2, "__esModule", {
  5281. value: true
  5282. });
  5283. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5284. tslib_1.__exportStar(require_common(), exports2);
  5285. }
  5286. });
  5287. var require_common2 = __commonJS2({
  5288. "node_modules/vnopts/lib/handlers/invalid/common.js"(exports2) {
  5289. "use strict";
  5290. Object.defineProperty(exports2, "__esModule", {
  5291. value: true
  5292. });
  5293. var chalk_1 = require_chalk();
  5294. exports2.commonInvalidHandler = (key, value, utils) => [`Invalid ${chalk_1.default.red(utils.descriptor.key(key))} value.`, `Expected ${chalk_1.default.blue(utils.schemas[key].expected(utils))},`, `but received ${chalk_1.default.red(utils.descriptor.value(value))}.`].join(" ");
  5295. }
  5296. });
  5297. var require_invalid = __commonJS2({
  5298. "node_modules/vnopts/lib/handlers/invalid/index.js"(exports2) {
  5299. "use strict";
  5300. Object.defineProperty(exports2, "__esModule", {
  5301. value: true
  5302. });
  5303. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5304. tslib_1.__exportStar(require_common2(), exports2);
  5305. }
  5306. });
  5307. var require_leven = __commonJS2({
  5308. "node_modules/vnopts/node_modules/leven/index.js"(exports2, module2) {
  5309. "use strict";
  5310. var arr = [];
  5311. var charCodeCache = [];
  5312. module2.exports = function(a, b) {
  5313. if (a === b) {
  5314. return 0;
  5315. }
  5316. var swap = a;
  5317. if (a.length > b.length) {
  5318. a = b;
  5319. b = swap;
  5320. }
  5321. var aLen = a.length;
  5322. var bLen = b.length;
  5323. if (aLen === 0) {
  5324. return bLen;
  5325. }
  5326. if (bLen === 0) {
  5327. return aLen;
  5328. }
  5329. while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
  5330. aLen--;
  5331. bLen--;
  5332. }
  5333. if (aLen === 0) {
  5334. return bLen;
  5335. }
  5336. var start = 0;
  5337. while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
  5338. start++;
  5339. }
  5340. aLen -= start;
  5341. bLen -= start;
  5342. if (aLen === 0) {
  5343. return bLen;
  5344. }
  5345. var bCharCode;
  5346. var ret;
  5347. var tmp;
  5348. var tmp2;
  5349. var i = 0;
  5350. var j = 0;
  5351. while (i < aLen) {
  5352. charCodeCache[start + i] = a.charCodeAt(start + i);
  5353. arr[i] = ++i;
  5354. }
  5355. while (j < bLen) {
  5356. bCharCode = b.charCodeAt(start + j);
  5357. tmp = j++;
  5358. ret = j;
  5359. for (i = 0; i < aLen; i++) {
  5360. tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
  5361. tmp = arr[i];
  5362. ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
  5363. }
  5364. }
  5365. return ret;
  5366. };
  5367. }
  5368. });
  5369. var require_leven2 = __commonJS2({
  5370. "node_modules/vnopts/lib/handlers/unknown/leven.js"(exports2) {
  5371. "use strict";
  5372. Object.defineProperty(exports2, "__esModule", {
  5373. value: true
  5374. });
  5375. var chalk_1 = require_chalk();
  5376. var leven = require_leven();
  5377. exports2.levenUnknownHandler = (key, value, {
  5378. descriptor,
  5379. logger,
  5380. schemas
  5381. }) => {
  5382. const messages = [`Ignored unknown option ${chalk_1.default.yellow(descriptor.pair({
  5383. key,
  5384. value
  5385. }))}.`];
  5386. const suggestion = Object.keys(schemas).sort().find((knownKey) => leven(key, knownKey) < 3);
  5387. if (suggestion) {
  5388. messages.push(`Did you mean ${chalk_1.default.blue(descriptor.key(suggestion))}?`);
  5389. }
  5390. logger.warn(messages.join(" "));
  5391. };
  5392. }
  5393. });
  5394. var require_unknown = __commonJS2({
  5395. "node_modules/vnopts/lib/handlers/unknown/index.js"(exports2) {
  5396. "use strict";
  5397. Object.defineProperty(exports2, "__esModule", {
  5398. value: true
  5399. });
  5400. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5401. tslib_1.__exportStar(require_leven2(), exports2);
  5402. }
  5403. });
  5404. var require_handlers = __commonJS2({
  5405. "node_modules/vnopts/lib/handlers/index.js"(exports2) {
  5406. "use strict";
  5407. Object.defineProperty(exports2, "__esModule", {
  5408. value: true
  5409. });
  5410. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5411. tslib_1.__exportStar(require_deprecated(), exports2);
  5412. tslib_1.__exportStar(require_invalid(), exports2);
  5413. tslib_1.__exportStar(require_unknown(), exports2);
  5414. }
  5415. });
  5416. var require_schema = __commonJS2({
  5417. "node_modules/vnopts/lib/schema.js"(exports2) {
  5418. "use strict";
  5419. Object.defineProperty(exports2, "__esModule", {
  5420. value: true
  5421. });
  5422. var HANDLER_KEYS = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
  5423. function createSchema(SchemaConstructor, parameters) {
  5424. const schema = new SchemaConstructor(parameters);
  5425. const subSchema = Object.create(schema);
  5426. for (const handlerKey of HANDLER_KEYS) {
  5427. if (handlerKey in parameters) {
  5428. subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
  5429. }
  5430. }
  5431. return subSchema;
  5432. }
  5433. exports2.createSchema = createSchema;
  5434. var Schema = class {
  5435. constructor(parameters) {
  5436. this.name = parameters.name;
  5437. }
  5438. static create(parameters) {
  5439. return createSchema(this, parameters);
  5440. }
  5441. default(_utils) {
  5442. return void 0;
  5443. }
  5444. expected(_utils) {
  5445. return "nothing";
  5446. }
  5447. validate(_value, _utils) {
  5448. return false;
  5449. }
  5450. deprecated(_value, _utils) {
  5451. return false;
  5452. }
  5453. forward(_value, _utils) {
  5454. return void 0;
  5455. }
  5456. redirect(_value, _utils) {
  5457. return void 0;
  5458. }
  5459. overlap(currentValue, _newValue, _utils) {
  5460. return currentValue;
  5461. }
  5462. preprocess(value, _utils) {
  5463. return value;
  5464. }
  5465. postprocess(value, _utils) {
  5466. return value;
  5467. }
  5468. };
  5469. exports2.Schema = Schema;
  5470. function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
  5471. return typeof handler === "function" ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
  5472. }
  5473. }
  5474. });
  5475. var require_alias = __commonJS2({
  5476. "node_modules/vnopts/lib/schemas/alias.js"(exports2) {
  5477. "use strict";
  5478. Object.defineProperty(exports2, "__esModule", {
  5479. value: true
  5480. });
  5481. var schema_1 = require_schema();
  5482. var AliasSchema = class extends schema_1.Schema {
  5483. constructor(parameters) {
  5484. super(parameters);
  5485. this._sourceName = parameters.sourceName;
  5486. }
  5487. expected(utils) {
  5488. return utils.schemas[this._sourceName].expected(utils);
  5489. }
  5490. validate(value, utils) {
  5491. return utils.schemas[this._sourceName].validate(value, utils);
  5492. }
  5493. redirect(_value, _utils) {
  5494. return this._sourceName;
  5495. }
  5496. };
  5497. exports2.AliasSchema = AliasSchema;
  5498. }
  5499. });
  5500. var require_any = __commonJS2({
  5501. "node_modules/vnopts/lib/schemas/any.js"(exports2) {
  5502. "use strict";
  5503. Object.defineProperty(exports2, "__esModule", {
  5504. value: true
  5505. });
  5506. var schema_1 = require_schema();
  5507. var AnySchema = class extends schema_1.Schema {
  5508. expected() {
  5509. return "anything";
  5510. }
  5511. validate() {
  5512. return true;
  5513. }
  5514. };
  5515. exports2.AnySchema = AnySchema;
  5516. }
  5517. });
  5518. var require_array2 = __commonJS2({
  5519. "node_modules/vnopts/lib/schemas/array.js"(exports2) {
  5520. "use strict";
  5521. Object.defineProperty(exports2, "__esModule", {
  5522. value: true
  5523. });
  5524. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5525. var schema_1 = require_schema();
  5526. var ArraySchema = class extends schema_1.Schema {
  5527. constructor(_a) {
  5528. var {
  5529. valueSchema,
  5530. name = valueSchema.name
  5531. } = _a, handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
  5532. super(Object.assign({}, handlers, {
  5533. name
  5534. }));
  5535. this._valueSchema = valueSchema;
  5536. }
  5537. expected(utils) {
  5538. return `an array of ${this._valueSchema.expected(utils)}`;
  5539. }
  5540. validate(value, utils) {
  5541. if (!Array.isArray(value)) {
  5542. return false;
  5543. }
  5544. const invalidValues = [];
  5545. for (const subValue of value) {
  5546. const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
  5547. if (subValidateResult !== true) {
  5548. invalidValues.push(subValidateResult.value);
  5549. }
  5550. }
  5551. return invalidValues.length === 0 ? true : {
  5552. value: invalidValues
  5553. };
  5554. }
  5555. deprecated(value, utils) {
  5556. const deprecatedResult = [];
  5557. for (const subValue of value) {
  5558. const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
  5559. if (subDeprecatedResult !== false) {
  5560. deprecatedResult.push(...subDeprecatedResult.map(({
  5561. value: deprecatedValue
  5562. }) => ({
  5563. value: [deprecatedValue]
  5564. })));
  5565. }
  5566. }
  5567. return deprecatedResult;
  5568. }
  5569. forward(value, utils) {
  5570. const forwardResult = [];
  5571. for (const subValue of value) {
  5572. const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
  5573. forwardResult.push(...subForwardResult.map(wrapTransferResult));
  5574. }
  5575. return forwardResult;
  5576. }
  5577. redirect(value, utils) {
  5578. const remain = [];
  5579. const redirect = [];
  5580. for (const subValue of value) {
  5581. const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
  5582. if ("remain" in subRedirectResult) {
  5583. remain.push(subRedirectResult.remain);
  5584. }
  5585. redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
  5586. }
  5587. return remain.length === 0 ? {
  5588. redirect
  5589. } : {
  5590. redirect,
  5591. remain
  5592. };
  5593. }
  5594. overlap(currentValue, newValue) {
  5595. return currentValue.concat(newValue);
  5596. }
  5597. };
  5598. exports2.ArraySchema = ArraySchema;
  5599. function wrapTransferResult({
  5600. from,
  5601. to
  5602. }) {
  5603. return {
  5604. from: [from],
  5605. to
  5606. };
  5607. }
  5608. }
  5609. });
  5610. var require_boolean = __commonJS2({
  5611. "node_modules/vnopts/lib/schemas/boolean.js"(exports2) {
  5612. "use strict";
  5613. Object.defineProperty(exports2, "__esModule", {
  5614. value: true
  5615. });
  5616. var schema_1 = require_schema();
  5617. var BooleanSchema = class extends schema_1.Schema {
  5618. expected() {
  5619. return "true or false";
  5620. }
  5621. validate(value) {
  5622. return typeof value === "boolean";
  5623. }
  5624. };
  5625. exports2.BooleanSchema = BooleanSchema;
  5626. }
  5627. });
  5628. var require_utils = __commonJS2({
  5629. "node_modules/vnopts/lib/utils.js"(exports2) {
  5630. "use strict";
  5631. Object.defineProperty(exports2, "__esModule", {
  5632. value: true
  5633. });
  5634. function recordFromArray(array, mainKey) {
  5635. const record = /* @__PURE__ */ Object.create(null);
  5636. for (const value of array) {
  5637. const key = value[mainKey];
  5638. if (record[key]) {
  5639. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5640. }
  5641. record[key] = value;
  5642. }
  5643. return record;
  5644. }
  5645. exports2.recordFromArray = recordFromArray;
  5646. function mapFromArray(array, mainKey) {
  5647. const map = /* @__PURE__ */ new Map();
  5648. for (const value of array) {
  5649. const key = value[mainKey];
  5650. if (map.has(key)) {
  5651. throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
  5652. }
  5653. map.set(key, value);
  5654. }
  5655. return map;
  5656. }
  5657. exports2.mapFromArray = mapFromArray;
  5658. function createAutoChecklist() {
  5659. const map = /* @__PURE__ */ Object.create(null);
  5660. return (id) => {
  5661. const idString = JSON.stringify(id);
  5662. if (map[idString]) {
  5663. return true;
  5664. }
  5665. map[idString] = true;
  5666. return false;
  5667. };
  5668. }
  5669. exports2.createAutoChecklist = createAutoChecklist;
  5670. function partition(array, predicate) {
  5671. const trueArray = [];
  5672. const falseArray = [];
  5673. for (const value of array) {
  5674. if (predicate(value)) {
  5675. trueArray.push(value);
  5676. } else {
  5677. falseArray.push(value);
  5678. }
  5679. }
  5680. return [trueArray, falseArray];
  5681. }
  5682. exports2.partition = partition;
  5683. function isInt(value) {
  5684. return value === Math.floor(value);
  5685. }
  5686. exports2.isInt = isInt;
  5687. function comparePrimitive(a, b) {
  5688. if (a === b) {
  5689. return 0;
  5690. }
  5691. const typeofA = typeof a;
  5692. const typeofB = typeof b;
  5693. const orders = ["undefined", "object", "boolean", "number", "string"];
  5694. if (typeofA !== typeofB) {
  5695. return orders.indexOf(typeofA) - orders.indexOf(typeofB);
  5696. }
  5697. if (typeofA !== "string") {
  5698. return Number(a) - Number(b);
  5699. }
  5700. return a.localeCompare(b);
  5701. }
  5702. exports2.comparePrimitive = comparePrimitive;
  5703. function normalizeDefaultResult(result) {
  5704. return result === void 0 ? {} : result;
  5705. }
  5706. exports2.normalizeDefaultResult = normalizeDefaultResult;
  5707. function normalizeValidateResult(result, value) {
  5708. return result === true ? true : result === false ? {
  5709. value
  5710. } : result;
  5711. }
  5712. exports2.normalizeValidateResult = normalizeValidateResult;
  5713. function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
  5714. return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
  5715. value
  5716. }] : "value" in result ? [result] : result.length === 0 ? false : result;
  5717. }
  5718. exports2.normalizeDeprecatedResult = normalizeDeprecatedResult;
  5719. function normalizeTransferResult(result, value) {
  5720. return typeof result === "string" || "key" in result ? {
  5721. from: value,
  5722. to: result
  5723. } : "from" in result ? {
  5724. from: result.from,
  5725. to: result.to
  5726. } : {
  5727. from: value,
  5728. to: result.to
  5729. };
  5730. }
  5731. exports2.normalizeTransferResult = normalizeTransferResult;
  5732. function normalizeForwardResult(result, value) {
  5733. return result === void 0 ? [] : Array.isArray(result) ? result.map((transferResult) => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
  5734. }
  5735. exports2.normalizeForwardResult = normalizeForwardResult;
  5736. function normalizeRedirectResult(result, value) {
  5737. const redirect = normalizeForwardResult(typeof result === "object" && "redirect" in result ? result.redirect : result, value);
  5738. return redirect.length === 0 ? {
  5739. remain: value,
  5740. redirect
  5741. } : typeof result === "object" && "remain" in result ? {
  5742. remain: result.remain,
  5743. redirect
  5744. } : {
  5745. redirect
  5746. };
  5747. }
  5748. exports2.normalizeRedirectResult = normalizeRedirectResult;
  5749. }
  5750. });
  5751. var require_choice = __commonJS2({
  5752. "node_modules/vnopts/lib/schemas/choice.js"(exports2) {
  5753. "use strict";
  5754. Object.defineProperty(exports2, "__esModule", {
  5755. value: true
  5756. });
  5757. var schema_1 = require_schema();
  5758. var utils_1 = require_utils();
  5759. var ChoiceSchema = class extends schema_1.Schema {
  5760. constructor(parameters) {
  5761. super(parameters);
  5762. this._choices = utils_1.mapFromArray(parameters.choices.map((choice) => choice && typeof choice === "object" ? choice : {
  5763. value: choice
  5764. }), "value");
  5765. }
  5766. expected({
  5767. descriptor
  5768. }) {
  5769. const choiceValues = Array.from(this._choices.keys()).map((value) => this._choices.get(value)).filter((choiceInfo) => !choiceInfo.deprecated).map((choiceInfo) => choiceInfo.value).sort(utils_1.comparePrimitive).map(descriptor.value);
  5770. const head = choiceValues.slice(0, -2);
  5771. const tail = choiceValues.slice(-2);
  5772. return head.concat(tail.join(" or ")).join(", ");
  5773. }
  5774. validate(value) {
  5775. return this._choices.has(value);
  5776. }
  5777. deprecated(value) {
  5778. const choiceInfo = this._choices.get(value);
  5779. return choiceInfo && choiceInfo.deprecated ? {
  5780. value
  5781. } : false;
  5782. }
  5783. forward(value) {
  5784. const choiceInfo = this._choices.get(value);
  5785. return choiceInfo ? choiceInfo.forward : void 0;
  5786. }
  5787. redirect(value) {
  5788. const choiceInfo = this._choices.get(value);
  5789. return choiceInfo ? choiceInfo.redirect : void 0;
  5790. }
  5791. };
  5792. exports2.ChoiceSchema = ChoiceSchema;
  5793. }
  5794. });
  5795. var require_number = __commonJS2({
  5796. "node_modules/vnopts/lib/schemas/number.js"(exports2) {
  5797. "use strict";
  5798. Object.defineProperty(exports2, "__esModule", {
  5799. value: true
  5800. });
  5801. var schema_1 = require_schema();
  5802. var NumberSchema = class extends schema_1.Schema {
  5803. expected() {
  5804. return "a number";
  5805. }
  5806. validate(value, _utils) {
  5807. return typeof value === "number";
  5808. }
  5809. };
  5810. exports2.NumberSchema = NumberSchema;
  5811. }
  5812. });
  5813. var require_integer = __commonJS2({
  5814. "node_modules/vnopts/lib/schemas/integer.js"(exports2) {
  5815. "use strict";
  5816. Object.defineProperty(exports2, "__esModule", {
  5817. value: true
  5818. });
  5819. var utils_1 = require_utils();
  5820. var number_1 = require_number();
  5821. var IntegerSchema = class extends number_1.NumberSchema {
  5822. expected() {
  5823. return "an integer";
  5824. }
  5825. validate(value, utils) {
  5826. return utils.normalizeValidateResult(super.validate(value, utils), value) === true && utils_1.isInt(value);
  5827. }
  5828. };
  5829. exports2.IntegerSchema = IntegerSchema;
  5830. }
  5831. });
  5832. var require_string = __commonJS2({
  5833. "node_modules/vnopts/lib/schemas/string.js"(exports2) {
  5834. "use strict";
  5835. Object.defineProperty(exports2, "__esModule", {
  5836. value: true
  5837. });
  5838. var schema_1 = require_schema();
  5839. var StringSchema = class extends schema_1.Schema {
  5840. expected() {
  5841. return "a string";
  5842. }
  5843. validate(value) {
  5844. return typeof value === "string";
  5845. }
  5846. };
  5847. exports2.StringSchema = StringSchema;
  5848. }
  5849. });
  5850. var require_schemas = __commonJS2({
  5851. "node_modules/vnopts/lib/schemas/index.js"(exports2) {
  5852. "use strict";
  5853. Object.defineProperty(exports2, "__esModule", {
  5854. value: true
  5855. });
  5856. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  5857. tslib_1.__exportStar(require_alias(), exports2);
  5858. tslib_1.__exportStar(require_any(), exports2);
  5859. tslib_1.__exportStar(require_array2(), exports2);
  5860. tslib_1.__exportStar(require_boolean(), exports2);
  5861. tslib_1.__exportStar(require_choice(), exports2);
  5862. tslib_1.__exportStar(require_integer(), exports2);
  5863. tslib_1.__exportStar(require_number(), exports2);
  5864. tslib_1.__exportStar(require_string(), exports2);
  5865. }
  5866. });
  5867. var require_defaults = __commonJS2({
  5868. "node_modules/vnopts/lib/defaults.js"(exports2) {
  5869. "use strict";
  5870. Object.defineProperty(exports2, "__esModule", {
  5871. value: true
  5872. });
  5873. var api_1 = require_api();
  5874. var common_1 = require_common();
  5875. var invalid_1 = require_invalid();
  5876. var leven_1 = require_leven2();
  5877. exports2.defaultDescriptor = api_1.apiDescriptor;
  5878. exports2.defaultUnknownHandler = leven_1.levenUnknownHandler;
  5879. exports2.defaultInvalidHandler = invalid_1.commonInvalidHandler;
  5880. exports2.defaultDeprecatedHandler = common_1.commonDeprecatedHandler;
  5881. }
  5882. });
  5883. var require_normalize = __commonJS2({
  5884. "node_modules/vnopts/lib/normalize.js"(exports2) {
  5885. "use strict";
  5886. Object.defineProperty(exports2, "__esModule", {
  5887. value: true
  5888. });
  5889. var defaults_1 = require_defaults();
  5890. var utils_1 = require_utils();
  5891. exports2.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
  5892. var Normalizer = class {
  5893. constructor(schemas, opts) {
  5894. const {
  5895. logger = console,
  5896. descriptor = defaults_1.defaultDescriptor,
  5897. unknown = defaults_1.defaultUnknownHandler,
  5898. invalid = defaults_1.defaultInvalidHandler,
  5899. deprecated = defaults_1.defaultDeprecatedHandler
  5900. } = opts || {};
  5901. this._utils = {
  5902. descriptor,
  5903. logger: logger || {
  5904. warn: () => {
  5905. }
  5906. },
  5907. schemas: utils_1.recordFromArray(schemas, "name"),
  5908. normalizeDefaultResult: utils_1.normalizeDefaultResult,
  5909. normalizeDeprecatedResult: utils_1.normalizeDeprecatedResult,
  5910. normalizeForwardResult: utils_1.normalizeForwardResult,
  5911. normalizeRedirectResult: utils_1.normalizeRedirectResult,
  5912. normalizeValidateResult: utils_1.normalizeValidateResult
  5913. };
  5914. this._unknownHandler = unknown;
  5915. this._invalidHandler = invalid;
  5916. this._deprecatedHandler = deprecated;
  5917. this.cleanHistory();
  5918. }
  5919. cleanHistory() {
  5920. this._hasDeprecationWarned = utils_1.createAutoChecklist();
  5921. }
  5922. normalize(options) {
  5923. const normalized = {};
  5924. const restOptionsArray = [options];
  5925. const applyNormalization = () => {
  5926. while (restOptionsArray.length !== 0) {
  5927. const currentOptions = restOptionsArray.shift();
  5928. const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
  5929. restOptionsArray.push(...transferredOptionsArray);
  5930. }
  5931. };
  5932. applyNormalization();
  5933. for (const key of Object.keys(this._utils.schemas)) {
  5934. const schema = this._utils.schemas[key];
  5935. if (!(key in normalized)) {
  5936. const defaultResult = utils_1.normalizeDefaultResult(schema.default(this._utils));
  5937. if ("value" in defaultResult) {
  5938. restOptionsArray.push({
  5939. [key]: defaultResult.value
  5940. });
  5941. }
  5942. }
  5943. }
  5944. applyNormalization();
  5945. for (const key of Object.keys(this._utils.schemas)) {
  5946. const schema = this._utils.schemas[key];
  5947. if (key in normalized) {
  5948. normalized[key] = schema.postprocess(normalized[key], this._utils);
  5949. }
  5950. }
  5951. return normalized;
  5952. }
  5953. _applyNormalization(options, normalized) {
  5954. const transferredOptionsArray = [];
  5955. const [knownOptionNames, unknownOptionNames] = utils_1.partition(Object.keys(options), (key) => key in this._utils.schemas);
  5956. for (const key of knownOptionNames) {
  5957. const schema = this._utils.schemas[key];
  5958. const value = schema.preprocess(options[key], this._utils);
  5959. const validateResult = utils_1.normalizeValidateResult(schema.validate(value, this._utils), value);
  5960. if (validateResult !== true) {
  5961. const {
  5962. value: invalidValue
  5963. } = validateResult;
  5964. const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
  5965. throw typeof errorMessageOrError === "string" ? new Error(errorMessageOrError) : errorMessageOrError;
  5966. }
  5967. const appendTransferredOptions = ({
  5968. from,
  5969. to
  5970. }) => {
  5971. transferredOptionsArray.push(typeof to === "string" ? {
  5972. [to]: from
  5973. } : {
  5974. [to.key]: to.value
  5975. });
  5976. };
  5977. const warnDeprecated = ({
  5978. value: currentValue,
  5979. redirectTo
  5980. }) => {
  5981. const deprecatedResult = utils_1.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value, true);
  5982. if (deprecatedResult === false) {
  5983. return;
  5984. }
  5985. if (deprecatedResult === true) {
  5986. if (!this._hasDeprecationWarned(key)) {
  5987. this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
  5988. }
  5989. } else {
  5990. for (const {
  5991. value: deprecatedValue
  5992. } of deprecatedResult) {
  5993. const pair = {
  5994. key,
  5995. value: deprecatedValue
  5996. };
  5997. if (!this._hasDeprecationWarned(pair)) {
  5998. const redirectToPair = typeof redirectTo === "string" ? {
  5999. key: redirectTo,
  6000. value: deprecatedValue
  6001. } : redirectTo;
  6002. this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
  6003. }
  6004. }
  6005. }
  6006. };
  6007. const forwardResult = utils_1.normalizeForwardResult(schema.forward(value, this._utils), value);
  6008. forwardResult.forEach(appendTransferredOptions);
  6009. const redirectResult = utils_1.normalizeRedirectResult(schema.redirect(value, this._utils), value);
  6010. redirectResult.redirect.forEach(appendTransferredOptions);
  6011. if ("remain" in redirectResult) {
  6012. const remainingValue = redirectResult.remain;
  6013. normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
  6014. warnDeprecated({
  6015. value: remainingValue
  6016. });
  6017. }
  6018. for (const {
  6019. from,
  6020. to
  6021. } of redirectResult.redirect) {
  6022. warnDeprecated({
  6023. value: from,
  6024. redirectTo: to
  6025. });
  6026. }
  6027. }
  6028. for (const key of unknownOptionNames) {
  6029. const value = options[key];
  6030. const unknownResult = this._unknownHandler(key, value, this._utils);
  6031. if (unknownResult) {
  6032. for (const unknownKey of Object.keys(unknownResult)) {
  6033. const unknownOption = {
  6034. [unknownKey]: unknownResult[unknownKey]
  6035. };
  6036. if (unknownKey in this._utils.schemas) {
  6037. transferredOptionsArray.push(unknownOption);
  6038. } else {
  6039. Object.assign(normalized, unknownOption);
  6040. }
  6041. }
  6042. }
  6043. }
  6044. return transferredOptionsArray;
  6045. }
  6046. };
  6047. exports2.Normalizer = Normalizer;
  6048. }
  6049. });
  6050. var require_lib2 = __commonJS2({
  6051. "node_modules/vnopts/lib/index.js"(exports2) {
  6052. "use strict";
  6053. Object.defineProperty(exports2, "__esModule", {
  6054. value: true
  6055. });
  6056. var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
  6057. tslib_1.__exportStar(require_descriptors2(), exports2);
  6058. tslib_1.__exportStar(require_handlers(), exports2);
  6059. tslib_1.__exportStar(require_schemas(), exports2);
  6060. tslib_1.__exportStar(require_normalize(), exports2);
  6061. tslib_1.__exportStar(require_schema(), exports2);
  6062. }
  6063. });
  6064. var require_options_normalizer = __commonJS2({
  6065. "src/main/options-normalizer.js"(exports2, module2) {
  6066. "use strict";
  6067. var vnopts = require_lib2();
  6068. var getLast = require_get_last();
  6069. var cliDescriptor = {
  6070. key: (key) => key.length === 1 ? `-${key}` : `--${key}`,
  6071. value: (value) => vnopts.apiDescriptor.value(value),
  6072. pair: ({
  6073. key,
  6074. value
  6075. }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}`
  6076. };
  6077. var getFlagSchema = ({
  6078. colorsModule,
  6079. levenshteinDistance
  6080. }) => class FlagSchema extends vnopts.ChoiceSchema {
  6081. constructor({
  6082. name,
  6083. flags
  6084. }) {
  6085. super({
  6086. name,
  6087. choices: flags
  6088. });
  6089. this._flags = [...flags].sort();
  6090. }
  6091. preprocess(value, utils) {
  6092. if (typeof value === "string" && value.length > 0 && !this._flags.includes(value)) {
  6093. const suggestion = this._flags.find((flag) => levenshteinDistance(flag, value) < 3);
  6094. if (suggestion) {
  6095. utils.logger.warn([`Unknown flag ${colorsModule.yellow(utils.descriptor.value(value))},`, `did you mean ${colorsModule.blue(utils.descriptor.value(suggestion))}?`].join(" "));
  6096. return suggestion;
  6097. }
  6098. }
  6099. return value;
  6100. }
  6101. expected() {
  6102. return "a flag";
  6103. }
  6104. };
  6105. var hasDeprecationWarned;
  6106. function normalizeOptions(options, optionInfos, {
  6107. logger = false,
  6108. isCLI = false,
  6109. passThrough = false,
  6110. colorsModule = null,
  6111. levenshteinDistance = null
  6112. } = {}) {
  6113. const unknown = !passThrough ? (key, value, options2) => {
  6114. const _options2$schemas = options2.schemas, {
  6115. _
  6116. } = _options2$schemas, schemas2 = _objectWithoutProperties(_options2$schemas, _excluded2);
  6117. return vnopts.levenUnknownHandler(key, value, Object.assign(Object.assign({}, options2), {}, {
  6118. schemas: schemas2
  6119. }));
  6120. } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? void 0 : {
  6121. [key]: value
  6122. } : (key, value) => ({
  6123. [key]: value
  6124. });
  6125. const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
  6126. const schemas = optionInfosToSchemas(optionInfos, {
  6127. isCLI,
  6128. colorsModule,
  6129. levenshteinDistance
  6130. });
  6131. const normalizer = new vnopts.Normalizer(schemas, {
  6132. logger,
  6133. unknown,
  6134. descriptor
  6135. });
  6136. const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
  6137. if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
  6138. normalizer._hasDeprecationWarned = hasDeprecationWarned;
  6139. }
  6140. const normalized = normalizer.normalize(options);
  6141. if (shouldSuppressDuplicateDeprecationWarnings) {
  6142. hasDeprecationWarned = normalizer._hasDeprecationWarned;
  6143. }
  6144. if (isCLI && normalized["plugin-search"] === false) {
  6145. normalized["plugin-search-dir"] = false;
  6146. }
  6147. return normalized;
  6148. }
  6149. function optionInfosToSchemas(optionInfos, {
  6150. isCLI,
  6151. colorsModule,
  6152. levenshteinDistance
  6153. }) {
  6154. const schemas = [];
  6155. if (isCLI) {
  6156. schemas.push(vnopts.AnySchema.create({
  6157. name: "_"
  6158. }));
  6159. }
  6160. for (const optionInfo of optionInfos) {
  6161. schemas.push(optionInfoToSchema(optionInfo, {
  6162. isCLI,
  6163. optionInfos,
  6164. colorsModule,
  6165. levenshteinDistance
  6166. }));
  6167. if (optionInfo.alias && isCLI) {
  6168. schemas.push(vnopts.AliasSchema.create({
  6169. name: optionInfo.alias,
  6170. sourceName: optionInfo.name
  6171. }));
  6172. }
  6173. }
  6174. return schemas;
  6175. }
  6176. function optionInfoToSchema(optionInfo, {
  6177. isCLI,
  6178. optionInfos,
  6179. colorsModule,
  6180. levenshteinDistance
  6181. }) {
  6182. const {
  6183. name
  6184. } = optionInfo;
  6185. if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
  6186. return vnopts.AnySchema.create({
  6187. name,
  6188. preprocess(value) {
  6189. if (value === false) {
  6190. return value;
  6191. }
  6192. value = Array.isArray(value) ? value : [value];
  6193. return value;
  6194. },
  6195. validate(value) {
  6196. if (value === false) {
  6197. return true;
  6198. }
  6199. return value.every((dir) => typeof dir === "string");
  6200. },
  6201. expected() {
  6202. return "false or paths to plugin search dir";
  6203. }
  6204. });
  6205. }
  6206. const parameters = {
  6207. name
  6208. };
  6209. let SchemaConstructor;
  6210. const handlers = {};
  6211. switch (optionInfo.type) {
  6212. case "int":
  6213. SchemaConstructor = vnopts.IntegerSchema;
  6214. if (isCLI) {
  6215. parameters.preprocess = Number;
  6216. }
  6217. break;
  6218. case "string":
  6219. SchemaConstructor = vnopts.StringSchema;
  6220. break;
  6221. case "choice":
  6222. SchemaConstructor = vnopts.ChoiceSchema;
  6223. parameters.choices = optionInfo.choices.map((choiceInfo) => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign(Object.assign({}, choiceInfo), {}, {
  6224. redirect: {
  6225. to: {
  6226. key: optionInfo.name,
  6227. value: choiceInfo.redirect
  6228. }
  6229. }
  6230. }) : choiceInfo);
  6231. break;
  6232. case "boolean":
  6233. SchemaConstructor = vnopts.BooleanSchema;
  6234. break;
  6235. case "flag":
  6236. SchemaConstructor = getFlagSchema({
  6237. colorsModule,
  6238. levenshteinDistance
  6239. });
  6240. parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean));
  6241. break;
  6242. case "path":
  6243. SchemaConstructor = vnopts.StringSchema;
  6244. break;
  6245. default:
  6246. throw new Error(`Unexpected type ${optionInfo.type}`);
  6247. }
  6248. if (optionInfo.exception) {
  6249. parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils);
  6250. } else {
  6251. parameters.validate = (value, schema, utils) => value === void 0 || schema.validate(value, utils);
  6252. }
  6253. if (optionInfo.redirect) {
  6254. handlers.redirect = (value) => !value ? void 0 : {
  6255. to: {
  6256. key: optionInfo.redirect.option,
  6257. value: optionInfo.redirect.value
  6258. }
  6259. };
  6260. }
  6261. if (optionInfo.deprecated) {
  6262. handlers.deprecated = true;
  6263. }
  6264. if (isCLI && !optionInfo.array) {
  6265. const originalPreprocess = parameters.preprocess || ((x) => x);
  6266. parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? getLast(value) : value), utils);
  6267. }
  6268. return optionInfo.array ? vnopts.ArraySchema.create(Object.assign(Object.assign(Object.assign({}, isCLI ? {
  6269. preprocess: (v) => Array.isArray(v) ? v : [v]
  6270. } : {}), handlers), {}, {
  6271. valueSchema: SchemaConstructor.create(parameters)
  6272. })) : SchemaConstructor.create(Object.assign(Object.assign({}, parameters), handlers));
  6273. }
  6274. function normalizeApiOptions(options, optionInfos, opts) {
  6275. return normalizeOptions(options, optionInfos, opts);
  6276. }
  6277. function normalizeCliOptions(options, optionInfos, opts) {
  6278. if (false) {
  6279. if (!opts.colorsModule) {
  6280. throw new Error("'colorsModule' option is required.");
  6281. }
  6282. if (!opts.levenshteinDistance) {
  6283. throw new Error("'levenshteinDistance' option is required.");
  6284. }
  6285. }
  6286. return normalizeOptions(options, optionInfos, Object.assign({
  6287. isCLI: true
  6288. }, opts));
  6289. }
  6290. module2.exports = {
  6291. normalizeApiOptions,
  6292. normalizeCliOptions
  6293. };
  6294. }
  6295. });
  6296. var require_loc = __commonJS2({
  6297. "src/language-js/loc.js"(exports2, module2) {
  6298. "use strict";
  6299. var isNonEmptyArray = require_is_non_empty_array();
  6300. function locStart(node, opts) {
  6301. const {
  6302. ignoreDecorators
  6303. } = opts || {};
  6304. if (!ignoreDecorators) {
  6305. const decorators = node.declaration && node.declaration.decorators || node.decorators;
  6306. if (isNonEmptyArray(decorators)) {
  6307. return locStart(decorators[0]);
  6308. }
  6309. }
  6310. return node.range ? node.range[0] : node.start;
  6311. }
  6312. function locEnd(node) {
  6313. return node.range ? node.range[1] : node.end;
  6314. }
  6315. function hasSameLocStart(nodeA, nodeB) {
  6316. const nodeAStart = locStart(nodeA);
  6317. return Number.isInteger(nodeAStart) && nodeAStart === locStart(nodeB);
  6318. }
  6319. function hasSameLocEnd(nodeA, nodeB) {
  6320. const nodeAEnd = locEnd(nodeA);
  6321. return Number.isInteger(nodeAEnd) && nodeAEnd === locEnd(nodeB);
  6322. }
  6323. function hasSameLoc(nodeA, nodeB) {
  6324. return hasSameLocStart(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB);
  6325. }
  6326. module2.exports = {
  6327. locStart,
  6328. locEnd,
  6329. hasSameLocStart,
  6330. hasSameLoc
  6331. };
  6332. }
  6333. });
  6334. var require_load_parser = __commonJS2({
  6335. "src/main/load-parser.js"(exports2, module2) {
  6336. "use strict";
  6337. var path = require("path");
  6338. var {
  6339. ConfigError
  6340. } = require_errors();
  6341. var {
  6342. locStart,
  6343. locEnd
  6344. } = require_loc();
  6345. function requireParser(parser) {
  6346. try {
  6347. return {
  6348. parse: require(path.resolve(process.cwd(), parser)),
  6349. astFormat: "estree",
  6350. locStart,
  6351. locEnd
  6352. };
  6353. } catch {
  6354. throw new ConfigError(`Couldn't resolve parser "${parser}"`);
  6355. }
  6356. }
  6357. module2.exports = requireParser;
  6358. }
  6359. });
  6360. var require_js_tokens = __commonJS2({
  6361. "node_modules/js-tokens/index.js"(exports2) {
  6362. Object.defineProperty(exports2, "__esModule", {
  6363. value: true
  6364. });
  6365. 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;
  6366. exports2.matchToToken = function(match) {
  6367. var token = {
  6368. type: "invalid",
  6369. value: match[0],
  6370. closed: void 0
  6371. };
  6372. if (match[1])
  6373. token.type = "string", token.closed = !!(match[3] || match[4]);
  6374. else if (match[5])
  6375. token.type = "comment";
  6376. else if (match[6])
  6377. token.type = "comment", token.closed = !!match[7];
  6378. else if (match[8])
  6379. token.type = "regex";
  6380. else if (match[9])
  6381. token.type = "number";
  6382. else if (match[10])
  6383. token.type = "name";
  6384. else if (match[11])
  6385. token.type = "punctuator";
  6386. else if (match[12])
  6387. token.type = "whitespace";
  6388. return token;
  6389. };
  6390. }
  6391. });
  6392. var require_identifier = __commonJS2({
  6393. "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
  6394. "use strict";
  6395. Object.defineProperty(exports2, "__esModule", {
  6396. value: true
  6397. });
  6398. exports2.isIdentifierChar = isIdentifierChar;
  6399. exports2.isIdentifierName = isIdentifierName;
  6400. exports2.isIdentifierStart = isIdentifierStart;
  6401. 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";
  6402. var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
  6403. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  6404. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  6405. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  6406. var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
  6407. var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
  6408. function isInAstralSet(code, set) {
  6409. let pos = 65536;
  6410. for (let i = 0, length = set.length; i < length; i += 2) {
  6411. pos += set[i];
  6412. if (pos > code)
  6413. return false;
  6414. pos += set[i + 1];
  6415. if (pos >= code)
  6416. return true;
  6417. }
  6418. return false;
  6419. }
  6420. function isIdentifierStart(code) {
  6421. if (code < 65)
  6422. return code === 36;
  6423. if (code <= 90)
  6424. return true;
  6425. if (code < 97)
  6426. return code === 95;
  6427. if (code <= 122)
  6428. return true;
  6429. if (code <= 65535) {
  6430. return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
  6431. }
  6432. return isInAstralSet(code, astralIdentifierStartCodes);
  6433. }
  6434. function isIdentifierChar(code) {
  6435. if (code < 48)
  6436. return code === 36;
  6437. if (code < 58)
  6438. return true;
  6439. if (code < 65)
  6440. return false;
  6441. if (code <= 90)
  6442. return true;
  6443. if (code < 97)
  6444. return code === 95;
  6445. if (code <= 122)
  6446. return true;
  6447. if (code <= 65535) {
  6448. return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
  6449. }
  6450. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  6451. }
  6452. function isIdentifierName(name) {
  6453. let isFirst = true;
  6454. for (let i = 0; i < name.length; i++) {
  6455. let cp = name.charCodeAt(i);
  6456. if ((cp & 64512) === 55296 && i + 1 < name.length) {
  6457. const trail = name.charCodeAt(++i);
  6458. if ((trail & 64512) === 56320) {
  6459. cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
  6460. }
  6461. }
  6462. if (isFirst) {
  6463. isFirst = false;
  6464. if (!isIdentifierStart(cp)) {
  6465. return false;
  6466. }
  6467. } else if (!isIdentifierChar(cp)) {
  6468. return false;
  6469. }
  6470. }
  6471. return !isFirst;
  6472. }
  6473. }
  6474. });
  6475. var require_keyword = __commonJS2({
  6476. "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
  6477. "use strict";
  6478. Object.defineProperty(exports2, "__esModule", {
  6479. value: true
  6480. });
  6481. exports2.isKeyword = isKeyword;
  6482. exports2.isReservedWord = isReservedWord;
  6483. exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
  6484. exports2.isStrictBindReservedWord = isStrictBindReservedWord;
  6485. exports2.isStrictReservedWord = isStrictReservedWord;
  6486. var reservedWords = {
  6487. 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"],
  6488. strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
  6489. strictBind: ["eval", "arguments"]
  6490. };
  6491. var keywords = new Set(reservedWords.keyword);
  6492. var reservedWordsStrictSet = new Set(reservedWords.strict);
  6493. var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
  6494. function isReservedWord(word, inModule) {
  6495. return inModule && word === "await" || word === "enum";
  6496. }
  6497. function isStrictReservedWord(word, inModule) {
  6498. return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
  6499. }
  6500. function isStrictBindOnlyReservedWord(word) {
  6501. return reservedWordsStrictBindSet.has(word);
  6502. }
  6503. function isStrictBindReservedWord(word, inModule) {
  6504. return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
  6505. }
  6506. function isKeyword(word) {
  6507. return keywords.has(word);
  6508. }
  6509. }
  6510. });
  6511. var require_lib3 = __commonJS2({
  6512. "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
  6513. "use strict";
  6514. Object.defineProperty(exports2, "__esModule", {
  6515. value: true
  6516. });
  6517. Object.defineProperty(exports2, "isIdentifierChar", {
  6518. enumerable: true,
  6519. get: function() {
  6520. return _identifier.isIdentifierChar;
  6521. }
  6522. });
  6523. Object.defineProperty(exports2, "isIdentifierName", {
  6524. enumerable: true,
  6525. get: function() {
  6526. return _identifier.isIdentifierName;
  6527. }
  6528. });
  6529. Object.defineProperty(exports2, "isIdentifierStart", {
  6530. enumerable: true,
  6531. get: function() {
  6532. return _identifier.isIdentifierStart;
  6533. }
  6534. });
  6535. Object.defineProperty(exports2, "isKeyword", {
  6536. enumerable: true,
  6537. get: function() {
  6538. return _keyword.isKeyword;
  6539. }
  6540. });
  6541. Object.defineProperty(exports2, "isReservedWord", {
  6542. enumerable: true,
  6543. get: function() {
  6544. return _keyword.isReservedWord;
  6545. }
  6546. });
  6547. Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
  6548. enumerable: true,
  6549. get: function() {
  6550. return _keyword.isStrictBindOnlyReservedWord;
  6551. }
  6552. });
  6553. Object.defineProperty(exports2, "isStrictBindReservedWord", {
  6554. enumerable: true,
  6555. get: function() {
  6556. return _keyword.isStrictBindReservedWord;
  6557. }
  6558. });
  6559. Object.defineProperty(exports2, "isStrictReservedWord", {
  6560. enumerable: true,
  6561. get: function() {
  6562. return _keyword.isStrictReservedWord;
  6563. }
  6564. });
  6565. var _identifier = require_identifier();
  6566. var _keyword = require_keyword();
  6567. }
  6568. });
  6569. var require_escape_string_regexp2 = __commonJS2({
  6570. "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
  6571. "use strict";
  6572. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  6573. module2.exports = function(str) {
  6574. if (typeof str !== "string") {
  6575. throw new TypeError("Expected a string");
  6576. }
  6577. return str.replace(matchOperatorsRe, "\\$&");
  6578. };
  6579. }
  6580. });
  6581. var require_has_flag2 = __commonJS2({
  6582. "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
  6583. "use strict";
  6584. module2.exports = (flag, argv) => {
  6585. argv = argv || process.argv;
  6586. const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
  6587. const pos = argv.indexOf(prefix + flag);
  6588. const terminatorPos = argv.indexOf("--");
  6589. return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
  6590. };
  6591. }
  6592. });
  6593. var require_supports_color2 = __commonJS2({
  6594. "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
  6595. "use strict";
  6596. var os = require("os");
  6597. var hasFlag = require_has_flag2();
  6598. var env = process.env;
  6599. var forceColor;
  6600. if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
  6601. forceColor = false;
  6602. } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
  6603. forceColor = true;
  6604. }
  6605. if ("FORCE_COLOR" in env) {
  6606. forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
  6607. }
  6608. function translateLevel(level) {
  6609. if (level === 0) {
  6610. return false;
  6611. }
  6612. return {
  6613. level,
  6614. hasBasic: true,
  6615. has256: level >= 2,
  6616. has16m: level >= 3
  6617. };
  6618. }
  6619. function supportsColor(stream) {
  6620. if (forceColor === false) {
  6621. return 0;
  6622. }
  6623. if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
  6624. return 3;
  6625. }
  6626. if (hasFlag("color=256")) {
  6627. return 2;
  6628. }
  6629. if (stream && !stream.isTTY && forceColor !== true) {
  6630. return 0;
  6631. }
  6632. const min = forceColor ? 1 : 0;
  6633. if (process.platform === "win32") {
  6634. const osRelease = os.release().split(".");
  6635. if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
  6636. return Number(osRelease[2]) >= 14931 ? 3 : 2;
  6637. }
  6638. return 1;
  6639. }
  6640. if ("CI" in env) {
  6641. if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
  6642. return 1;
  6643. }
  6644. return min;
  6645. }
  6646. if ("TEAMCITY_VERSION" in env) {
  6647. return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
  6648. }
  6649. if (env.COLORTERM === "truecolor") {
  6650. return 3;
  6651. }
  6652. if ("TERM_PROGRAM" in env) {
  6653. const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
  6654. switch (env.TERM_PROGRAM) {
  6655. case "iTerm.app":
  6656. return version2 >= 3 ? 3 : 2;
  6657. case "Apple_Terminal":
  6658. return 2;
  6659. }
  6660. }
  6661. if (/-256(color)?$/i.test(env.TERM)) {
  6662. return 2;
  6663. }
  6664. if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
  6665. return 1;
  6666. }
  6667. if ("COLORTERM" in env) {
  6668. return 1;
  6669. }
  6670. if (env.TERM === "dumb") {
  6671. return min;
  6672. }
  6673. return min;
  6674. }
  6675. function getSupportLevel(stream) {
  6676. const level = supportsColor(stream);
  6677. return translateLevel(level);
  6678. }
  6679. module2.exports = {
  6680. supportsColor: getSupportLevel,
  6681. stdout: getSupportLevel(process.stdout),
  6682. stderr: getSupportLevel(process.stderr)
  6683. };
  6684. }
  6685. });
  6686. var require_templates2 = __commonJS2({
  6687. "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
  6688. "use strict";
  6689. var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
  6690. var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
  6691. var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
  6692. var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
  6693. var ESCAPES = /* @__PURE__ */ new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
  6694. function unescape(c) {
  6695. if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
  6696. return String.fromCharCode(parseInt(c.slice(1), 16));
  6697. }
  6698. return ESCAPES.get(c) || c;
  6699. }
  6700. function parseArguments(name, args) {
  6701. const results = [];
  6702. const chunks = args.trim().split(/\s*,\s*/g);
  6703. let matches;
  6704. for (const chunk of chunks) {
  6705. if (!isNaN(chunk)) {
  6706. results.push(Number(chunk));
  6707. } else if (matches = chunk.match(STRING_REGEX)) {
  6708. results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
  6709. } else {
  6710. throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
  6711. }
  6712. }
  6713. return results;
  6714. }
  6715. function parseStyle(style) {
  6716. STYLE_REGEX.lastIndex = 0;
  6717. const results = [];
  6718. let matches;
  6719. while ((matches = STYLE_REGEX.exec(style)) !== null) {
  6720. const name = matches[1];
  6721. if (matches[2]) {
  6722. const args = parseArguments(name, matches[2]);
  6723. results.push([name].concat(args));
  6724. } else {
  6725. results.push([name]);
  6726. }
  6727. }
  6728. return results;
  6729. }
  6730. function buildStyle(chalk, styles) {
  6731. const enabled = {};
  6732. for (const layer of styles) {
  6733. for (const style of layer.styles) {
  6734. enabled[style[0]] = layer.inverse ? null : style.slice(1);
  6735. }
  6736. }
  6737. let current = chalk;
  6738. for (const styleName of Object.keys(enabled)) {
  6739. if (Array.isArray(enabled[styleName])) {
  6740. if (!(styleName in current)) {
  6741. throw new Error(`Unknown Chalk style: ${styleName}`);
  6742. }
  6743. if (enabled[styleName].length > 0) {
  6744. current = current[styleName].apply(current, enabled[styleName]);
  6745. } else {
  6746. current = current[styleName];
  6747. }
  6748. }
  6749. }
  6750. return current;
  6751. }
  6752. module2.exports = (chalk, tmp) => {
  6753. const styles = [];
  6754. const chunks = [];
  6755. let chunk = [];
  6756. tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
  6757. if (escapeChar) {
  6758. chunk.push(unescape(escapeChar));
  6759. } else if (style) {
  6760. const str = chunk.join("");
  6761. chunk = [];
  6762. chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
  6763. styles.push({
  6764. inverse,
  6765. styles: parseStyle(style)
  6766. });
  6767. } else if (close) {
  6768. if (styles.length === 0) {
  6769. throw new Error("Found extraneous } in Chalk template literal");
  6770. }
  6771. chunks.push(buildStyle(chalk, styles)(chunk.join("")));
  6772. chunk = [];
  6773. styles.pop();
  6774. } else {
  6775. chunk.push(chr);
  6776. }
  6777. });
  6778. chunks.push(chunk.join(""));
  6779. if (styles.length > 0) {
  6780. const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
  6781. throw new Error(errMsg);
  6782. }
  6783. return chunks.join("");
  6784. };
  6785. }
  6786. });
  6787. var require_chalk2 = __commonJS2({
  6788. "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
  6789. "use strict";
  6790. var escapeStringRegexp2 = require_escape_string_regexp2();
  6791. var ansiStyles = require_ansi_styles();
  6792. var stdoutColor = require_supports_color2().stdout;
  6793. var template = require_templates2();
  6794. var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
  6795. var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
  6796. var skipModels = /* @__PURE__ */ new Set(["gray"]);
  6797. var styles = /* @__PURE__ */ Object.create(null);
  6798. function applyOptions(obj, options) {
  6799. options = options || {};
  6800. const scLevel = stdoutColor ? stdoutColor.level : 0;
  6801. obj.level = options.level === void 0 ? scLevel : options.level;
  6802. obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
  6803. }
  6804. function Chalk(options) {
  6805. if (!this || !(this instanceof Chalk) || this.template) {
  6806. const chalk = {};
  6807. applyOptions(chalk, options);
  6808. chalk.template = function() {
  6809. const args = [].slice.call(arguments);
  6810. return chalkTag.apply(null, [chalk.template].concat(args));
  6811. };
  6812. Object.setPrototypeOf(chalk, Chalk.prototype);
  6813. Object.setPrototypeOf(chalk.template, chalk);
  6814. chalk.template.constructor = Chalk;
  6815. return chalk.template;
  6816. }
  6817. applyOptions(this, options);
  6818. }
  6819. if (isSimpleWindowsTerm) {
  6820. ansiStyles.blue.open = "\x1B[94m";
  6821. }
  6822. for (const key of Object.keys(ansiStyles)) {
  6823. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
  6824. styles[key] = {
  6825. get() {
  6826. const codes = ansiStyles[key];
  6827. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
  6828. }
  6829. };
  6830. }
  6831. styles.visible = {
  6832. get() {
  6833. return build.call(this, this._styles || [], true, "visible");
  6834. }
  6835. };
  6836. ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
  6837. for (const model of Object.keys(ansiStyles.color.ansi)) {
  6838. if (skipModels.has(model)) {
  6839. continue;
  6840. }
  6841. styles[model] = {
  6842. get() {
  6843. const level = this.level;
  6844. return function() {
  6845. const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
  6846. const codes = {
  6847. open,
  6848. close: ansiStyles.color.close,
  6849. closeRe: ansiStyles.color.closeRe
  6850. };
  6851. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  6852. };
  6853. }
  6854. };
  6855. }
  6856. ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
  6857. for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
  6858. if (skipModels.has(model)) {
  6859. continue;
  6860. }
  6861. const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
  6862. styles[bgModel] = {
  6863. get() {
  6864. const level = this.level;
  6865. return function() {
  6866. const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
  6867. const codes = {
  6868. open,
  6869. close: ansiStyles.bgColor.close,
  6870. closeRe: ansiStyles.bgColor.closeRe
  6871. };
  6872. return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
  6873. };
  6874. }
  6875. };
  6876. }
  6877. var proto = Object.defineProperties(() => {
  6878. }, styles);
  6879. function build(_styles, _empty, key) {
  6880. const builder = function() {
  6881. return applyStyle.apply(builder, arguments);
  6882. };
  6883. builder._styles = _styles;
  6884. builder._empty = _empty;
  6885. const self2 = this;
  6886. Object.defineProperty(builder, "level", {
  6887. enumerable: true,
  6888. get() {
  6889. return self2.level;
  6890. },
  6891. set(level) {
  6892. self2.level = level;
  6893. }
  6894. });
  6895. Object.defineProperty(builder, "enabled", {
  6896. enumerable: true,
  6897. get() {
  6898. return self2.enabled;
  6899. },
  6900. set(enabled) {
  6901. self2.enabled = enabled;
  6902. }
  6903. });
  6904. builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
  6905. builder.__proto__ = proto;
  6906. return builder;
  6907. }
  6908. function applyStyle() {
  6909. const args = arguments;
  6910. const argsLen = args.length;
  6911. let str = String(arguments[0]);
  6912. if (argsLen === 0) {
  6913. return "";
  6914. }
  6915. if (argsLen > 1) {
  6916. for (let a = 1; a < argsLen; a++) {
  6917. str += " " + args[a];
  6918. }
  6919. }
  6920. if (!this.enabled || this.level <= 0 || !str) {
  6921. return this._empty ? "" : str;
  6922. }
  6923. const originalDim = ansiStyles.dim.open;
  6924. if (isSimpleWindowsTerm && this.hasGrey) {
  6925. ansiStyles.dim.open = "";
  6926. }
  6927. for (const code of this._styles.slice().reverse()) {
  6928. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  6929. str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
  6930. }
  6931. ansiStyles.dim.open = originalDim;
  6932. return str;
  6933. }
  6934. function chalkTag(chalk, strings) {
  6935. if (!Array.isArray(strings)) {
  6936. return [].slice.call(arguments, 1).join(" ");
  6937. }
  6938. const args = [].slice.call(arguments, 2);
  6939. const parts = [strings.raw[0]];
  6940. for (let i = 1; i < strings.length; i++) {
  6941. parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
  6942. parts.push(String(strings.raw[i]));
  6943. }
  6944. return template(chalk, parts.join(""));
  6945. }
  6946. Object.defineProperties(Chalk.prototype, styles);
  6947. module2.exports = Chalk();
  6948. module2.exports.supportsColor = stdoutColor;
  6949. module2.exports.default = module2.exports;
  6950. }
  6951. });
  6952. var require_lib4 = __commonJS2({
  6953. "node_modules/@babel/highlight/lib/index.js"(exports2) {
  6954. "use strict";
  6955. Object.defineProperty(exports2, "__esModule", {
  6956. value: true
  6957. });
  6958. exports2.default = highlight;
  6959. exports2.getChalk = getChalk;
  6960. exports2.shouldHighlight = shouldHighlight;
  6961. var _jsTokens = require_js_tokens();
  6962. var _helperValidatorIdentifier = require_lib3();
  6963. var _chalk = require_chalk2();
  6964. var sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]);
  6965. function getDefs(chalk) {
  6966. return {
  6967. keyword: chalk.cyan,
  6968. capitalized: chalk.yellow,
  6969. jsxIdentifier: chalk.yellow,
  6970. punctuator: chalk.yellow,
  6971. number: chalk.magenta,
  6972. string: chalk.green,
  6973. regex: chalk.magenta,
  6974. comment: chalk.grey,
  6975. invalid: chalk.white.bgRed.bold
  6976. };
  6977. }
  6978. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  6979. var BRACKET = /^[()[\]{}]$/;
  6980. var tokenize;
  6981. {
  6982. const JSX_TAG = /^[a-z][\w-]*$/i;
  6983. const getTokenType = function(token, offset, text) {
  6984. if (token.type === "name") {
  6985. if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
  6986. return "keyword";
  6987. }
  6988. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
  6989. return "jsxIdentifier";
  6990. }
  6991. if (token.value[0] !== token.value[0].toLowerCase()) {
  6992. return "capitalized";
  6993. }
  6994. }
  6995. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  6996. return "bracket";
  6997. }
  6998. if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
  6999. return "punctuator";
  7000. }
  7001. return token.type;
  7002. };
  7003. tokenize = function* (text) {
  7004. let match;
  7005. while (match = _jsTokens.default.exec(text)) {
  7006. const token = _jsTokens.matchToToken(match);
  7007. yield {
  7008. type: getTokenType(token, match.index, text),
  7009. value: token.value
  7010. };
  7011. }
  7012. };
  7013. }
  7014. function highlightTokens(defs, text) {
  7015. let highlighted = "";
  7016. for (const {
  7017. type,
  7018. value
  7019. } of tokenize(text)) {
  7020. const colorize = defs[type];
  7021. if (colorize) {
  7022. highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
  7023. } else {
  7024. highlighted += value;
  7025. }
  7026. }
  7027. return highlighted;
  7028. }
  7029. function shouldHighlight(options) {
  7030. return !!_chalk.supportsColor || options.forceColor;
  7031. }
  7032. function getChalk(options) {
  7033. return options.forceColor ? new _chalk.constructor({
  7034. enabled: true,
  7035. level: 1
  7036. }) : _chalk;
  7037. }
  7038. function highlight(code, options = {}) {
  7039. if (code !== "" && shouldHighlight(options)) {
  7040. const chalk = getChalk(options);
  7041. const defs = getDefs(chalk);
  7042. return highlightTokens(defs, code);
  7043. } else {
  7044. return code;
  7045. }
  7046. }
  7047. }
  7048. });
  7049. var require_lib5 = __commonJS2({
  7050. "node_modules/@babel/code-frame/lib/index.js"(exports2) {
  7051. "use strict";
  7052. Object.defineProperty(exports2, "__esModule", {
  7053. value: true
  7054. });
  7055. exports2.codeFrameColumns = codeFrameColumns;
  7056. exports2.default = _default;
  7057. var _highlight = require_lib4();
  7058. var deprecationWarningShown = false;
  7059. function getDefs(chalk) {
  7060. return {
  7061. gutter: chalk.grey,
  7062. marker: chalk.red.bold,
  7063. message: chalk.red.bold
  7064. };
  7065. }
  7066. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  7067. function getMarkerLines(loc, source, opts) {
  7068. const startLoc = Object.assign({
  7069. column: 0,
  7070. line: -1
  7071. }, loc.start);
  7072. const endLoc = Object.assign({}, startLoc, loc.end);
  7073. const {
  7074. linesAbove = 2,
  7075. linesBelow = 3
  7076. } = opts || {};
  7077. const startLine = startLoc.line;
  7078. const startColumn = startLoc.column;
  7079. const endLine = endLoc.line;
  7080. const endColumn = endLoc.column;
  7081. let start = Math.max(startLine - (linesAbove + 1), 0);
  7082. let end = Math.min(source.length, endLine + linesBelow);
  7083. if (startLine === -1) {
  7084. start = 0;
  7085. }
  7086. if (endLine === -1) {
  7087. end = source.length;
  7088. }
  7089. const lineDiff = endLine - startLine;
  7090. const markerLines = {};
  7091. if (lineDiff) {
  7092. for (let i = 0; i <= lineDiff; i++) {
  7093. const lineNumber = i + startLine;
  7094. if (!startColumn) {
  7095. markerLines[lineNumber] = true;
  7096. } else if (i === 0) {
  7097. const sourceLength = source[lineNumber - 1].length;
  7098. markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
  7099. } else if (i === lineDiff) {
  7100. markerLines[lineNumber] = [0, endColumn];
  7101. } else {
  7102. const sourceLength = source[lineNumber - i].length;
  7103. markerLines[lineNumber] = [0, sourceLength];
  7104. }
  7105. }
  7106. } else {
  7107. if (startColumn === endColumn) {
  7108. if (startColumn) {
  7109. markerLines[startLine] = [startColumn, 0];
  7110. } else {
  7111. markerLines[startLine] = true;
  7112. }
  7113. } else {
  7114. markerLines[startLine] = [startColumn, endColumn - startColumn];
  7115. }
  7116. }
  7117. return {
  7118. start,
  7119. end,
  7120. markerLines
  7121. };
  7122. }
  7123. function codeFrameColumns(rawLines, loc, opts = {}) {
  7124. const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
  7125. const chalk = (0, _highlight.getChalk)(opts);
  7126. const defs = getDefs(chalk);
  7127. const maybeHighlight = (chalkFn, string) => {
  7128. return highlighted ? chalkFn(string) : string;
  7129. };
  7130. const lines = rawLines.split(NEWLINE);
  7131. const {
  7132. start,
  7133. end,
  7134. markerLines
  7135. } = getMarkerLines(loc, lines, opts);
  7136. const hasColumns = loc.start && typeof loc.start.column === "number";
  7137. const numberMaxWidth = String(end).length;
  7138. const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
  7139. let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
  7140. const number = start + 1 + index;
  7141. const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
  7142. const gutter = ` ${paddedNumber} |`;
  7143. const hasMarker = markerLines[number];
  7144. const lastMarkerLine = !markerLines[number + 1];
  7145. if (hasMarker) {
  7146. let markerLine = "";
  7147. if (Array.isArray(hasMarker)) {
  7148. const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
  7149. const numberOfMarkers = hasMarker[1] || 1;
  7150. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
  7151. if (lastMarkerLine && opts.message) {
  7152. markerLine += " " + maybeHighlight(defs.message, opts.message);
  7153. }
  7154. }
  7155. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
  7156. } else {
  7157. return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
  7158. }
  7159. }).join("\n");
  7160. if (opts.message && !hasColumns) {
  7161. frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
  7162. ${frame}`;
  7163. }
  7164. if (highlighted) {
  7165. return chalk.reset(frame);
  7166. } else {
  7167. return frame;
  7168. }
  7169. }
  7170. function _default(rawLines, lineNumber, colNumber, opts = {}) {
  7171. if (!deprecationWarningShown) {
  7172. deprecationWarningShown = true;
  7173. const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
  7174. if (process.emitWarning) {
  7175. process.emitWarning(message, "DeprecationWarning");
  7176. } else {
  7177. const deprecationError = new Error(message);
  7178. deprecationError.name = "DeprecationWarning";
  7179. console.warn(new Error(message));
  7180. }
  7181. }
  7182. colNumber = Math.max(colNumber, 0);
  7183. const location = {
  7184. start: {
  7185. column: colNumber,
  7186. line: lineNumber
  7187. }
  7188. };
  7189. return codeFrameColumns(rawLines, location, opts);
  7190. }
  7191. }
  7192. });
  7193. var require_parser = __commonJS2({
  7194. "src/main/parser.js"(exports2, module2) {
  7195. "use strict";
  7196. var {
  7197. ConfigError
  7198. } = require_errors();
  7199. var jsLoc = require_loc();
  7200. var loadParser = require_load_parser();
  7201. var {
  7202. locStart,
  7203. locEnd
  7204. } = jsLoc;
  7205. var ownNames = Object.getOwnPropertyNames;
  7206. var ownDescriptor = Object.getOwnPropertyDescriptor;
  7207. function getParsers(options) {
  7208. const parsers = {};
  7209. for (const plugin of options.plugins) {
  7210. if (!plugin.parsers) {
  7211. continue;
  7212. }
  7213. for (const name of ownNames(plugin.parsers)) {
  7214. Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
  7215. }
  7216. }
  7217. return parsers;
  7218. }
  7219. function resolveParser(opts, parsers = getParsers(opts)) {
  7220. if (typeof opts.parser === "function") {
  7221. return {
  7222. parse: opts.parser,
  7223. astFormat: "estree",
  7224. locStart,
  7225. locEnd
  7226. };
  7227. }
  7228. if (typeof opts.parser === "string") {
  7229. if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
  7230. return parsers[opts.parser];
  7231. }
  7232. if (false) {
  7233. throw new ConfigError(`Couldn't resolve parser "${opts.parser}". Parsers must be explicitly added to the standalone bundle.`);
  7234. }
  7235. return loadParser(opts.parser);
  7236. }
  7237. }
  7238. function parse(text, opts) {
  7239. const parsers = getParsers(opts);
  7240. const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map((parserName) => [parserName, {
  7241. enumerable: true,
  7242. get() {
  7243. return parsers[parserName].parse;
  7244. }
  7245. }])));
  7246. const parser = resolveParser(opts, parsers);
  7247. try {
  7248. if (parser.preprocess) {
  7249. text = parser.preprocess(text, opts);
  7250. }
  7251. return {
  7252. text,
  7253. ast: parser.parse(text, parsersForCustomParserApi, opts)
  7254. };
  7255. } catch (error) {
  7256. const {
  7257. loc
  7258. } = error;
  7259. if (loc) {
  7260. const {
  7261. codeFrameColumns
  7262. } = require_lib5();
  7263. error.codeFrame = codeFrameColumns(text, loc, {
  7264. highlightCode: true
  7265. });
  7266. error.message += "\n" + error.codeFrame;
  7267. throw error;
  7268. }
  7269. throw error.stack;
  7270. }
  7271. }
  7272. module2.exports = {
  7273. parse,
  7274. resolveParser
  7275. };
  7276. }
  7277. });
  7278. var require_readlines = __commonJS2({
  7279. "node_modules/n-readlines/readlines.js"(exports2, module2) {
  7280. "use strict";
  7281. var fs = require("fs");
  7282. var LineByLine = class {
  7283. constructor(file, options) {
  7284. options = options || {};
  7285. if (!options.readChunk)
  7286. options.readChunk = 1024;
  7287. if (!options.newLineCharacter) {
  7288. options.newLineCharacter = 10;
  7289. } else {
  7290. options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
  7291. }
  7292. if (typeof file === "number") {
  7293. this.fd = file;
  7294. } else {
  7295. this.fd = fs.openSync(file, "r");
  7296. }
  7297. this.options = options;
  7298. this.newLineCharacter = options.newLineCharacter;
  7299. this.reset();
  7300. }
  7301. _searchInBuffer(buffer, hexNeedle) {
  7302. let found = -1;
  7303. for (let i = 0; i <= buffer.length; i++) {
  7304. let b_byte = buffer[i];
  7305. if (b_byte === hexNeedle) {
  7306. found = i;
  7307. break;
  7308. }
  7309. }
  7310. return found;
  7311. }
  7312. reset() {
  7313. this.eofReached = false;
  7314. this.linesCache = [];
  7315. this.fdPosition = 0;
  7316. }
  7317. close() {
  7318. fs.closeSync(this.fd);
  7319. this.fd = null;
  7320. }
  7321. _extractLines(buffer) {
  7322. let line;
  7323. const lines = [];
  7324. let bufferPosition = 0;
  7325. let lastNewLineBufferPosition = 0;
  7326. while (true) {
  7327. let bufferPositionValue = buffer[bufferPosition++];
  7328. if (bufferPositionValue === this.newLineCharacter) {
  7329. line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7330. lines.push(line);
  7331. lastNewLineBufferPosition = bufferPosition;
  7332. } else if (bufferPositionValue === void 0) {
  7333. break;
  7334. }
  7335. }
  7336. let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
  7337. if (leftovers.length) {
  7338. lines.push(leftovers);
  7339. }
  7340. return lines;
  7341. }
  7342. _readChunk(lineLeftovers) {
  7343. let totalBytesRead = 0;
  7344. let bytesRead;
  7345. const buffers = [];
  7346. do {
  7347. const readBuffer = new Buffer(this.options.readChunk);
  7348. bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
  7349. totalBytesRead = totalBytesRead + bytesRead;
  7350. this.fdPosition = this.fdPosition + bytesRead;
  7351. buffers.push(readBuffer);
  7352. } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
  7353. let bufferData = Buffer.concat(buffers);
  7354. if (bytesRead < this.options.readChunk) {
  7355. this.eofReached = true;
  7356. bufferData = bufferData.slice(0, totalBytesRead);
  7357. }
  7358. if (totalBytesRead) {
  7359. this.linesCache = this._extractLines(bufferData);
  7360. if (lineLeftovers) {
  7361. this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
  7362. }
  7363. }
  7364. return totalBytesRead;
  7365. }
  7366. next() {
  7367. if (!this.fd)
  7368. return false;
  7369. let line = false;
  7370. if (this.eofReached && this.linesCache.length === 0) {
  7371. return line;
  7372. }
  7373. let bytesRead;
  7374. if (!this.linesCache.length) {
  7375. bytesRead = this._readChunk();
  7376. }
  7377. if (this.linesCache.length) {
  7378. line = this.linesCache.shift();
  7379. const lastLineCharacter = line[line.length - 1];
  7380. if (lastLineCharacter !== this.newLineCharacter) {
  7381. bytesRead = this._readChunk(line);
  7382. if (bytesRead) {
  7383. line = this.linesCache.shift();
  7384. }
  7385. }
  7386. }
  7387. if (this.eofReached && this.linesCache.length === 0) {
  7388. this.close();
  7389. }
  7390. if (line && line[line.length - 1] === this.newLineCharacter) {
  7391. line = line.slice(0, line.length - 1);
  7392. }
  7393. return line;
  7394. }
  7395. };
  7396. module2.exports = LineByLine;
  7397. }
  7398. });
  7399. var require_get_interpreter = __commonJS2({
  7400. "src/utils/get-interpreter.js"(exports2, module2) {
  7401. "use strict";
  7402. var fs = require("fs");
  7403. var readlines = require_readlines();
  7404. function getInterpreter(filepath) {
  7405. if (typeof filepath !== "string") {
  7406. return "";
  7407. }
  7408. let fd;
  7409. try {
  7410. fd = fs.openSync(filepath, "r");
  7411. } catch {
  7412. return "";
  7413. }
  7414. try {
  7415. const liner = new readlines(fd);
  7416. const firstLine = liner.next().toString("utf8");
  7417. const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
  7418. if (m1) {
  7419. return m1[1];
  7420. }
  7421. const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
  7422. if (m2) {
  7423. return m2[1];
  7424. }
  7425. return "";
  7426. } catch {
  7427. return "";
  7428. } finally {
  7429. try {
  7430. fs.closeSync(fd);
  7431. } catch {
  7432. }
  7433. }
  7434. }
  7435. module2.exports = getInterpreter;
  7436. }
  7437. });
  7438. var require_options = __commonJS2({
  7439. "src/main/options.js"(exports2, module2) {
  7440. "use strict";
  7441. var path = require("path");
  7442. var {
  7443. UndefinedParserError
  7444. } = require_errors();
  7445. var {
  7446. getSupportInfo: getSupportInfo2
  7447. } = require_support();
  7448. var normalizer = require_options_normalizer();
  7449. var {
  7450. resolveParser
  7451. } = require_parser();
  7452. var hiddenDefaults = {
  7453. astFormat: "estree",
  7454. printer: {},
  7455. originalText: void 0,
  7456. locStart: null,
  7457. locEnd: null
  7458. };
  7459. function normalize(options, opts = {}) {
  7460. const rawOptions = Object.assign({}, options);
  7461. const supportOptions = getSupportInfo2({
  7462. plugins: options.plugins,
  7463. showUnreleased: true,
  7464. showDeprecated: true
  7465. }).options;
  7466. const defaults = Object.assign(Object.assign({}, hiddenDefaults), Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default])));
  7467. if (!rawOptions.parser) {
  7468. if (!rawOptions.filepath) {
  7469. const logger = opts.logger || console;
  7470. 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.");
  7471. rawOptions.parser = "babel";
  7472. } else {
  7473. rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
  7474. if (!rawOptions.parser) {
  7475. throw new UndefinedParserError(`No parser could be inferred for file: ${rawOptions.filepath}`);
  7476. }
  7477. }
  7478. }
  7479. const parser = resolveParser(normalizer.normalizeApiOptions(rawOptions, [supportOptions.find((x) => x.name === "parser")], {
  7480. passThrough: true,
  7481. logger: false
  7482. }));
  7483. rawOptions.astFormat = parser.astFormat;
  7484. rawOptions.locEnd = parser.locEnd;
  7485. rawOptions.locStart = parser.locStart;
  7486. const plugin = getPlugin(rawOptions);
  7487. rawOptions.printer = plugin.printers[rawOptions.astFormat];
  7488. const pluginDefaults = Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== void 0).map((optionInfo) => [optionInfo.name, optionInfo.pluginDefaults[plugin.name]]));
  7489. const mixedDefaults = Object.assign(Object.assign({}, defaults), pluginDefaults);
  7490. for (const [k, value] of Object.entries(mixedDefaults)) {
  7491. if (rawOptions[k] === null || rawOptions[k] === void 0) {
  7492. rawOptions[k] = value;
  7493. }
  7494. }
  7495. if (rawOptions.parser === "json") {
  7496. rawOptions.trailingComma = "none";
  7497. }
  7498. return normalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
  7499. passThrough: Object.keys(hiddenDefaults)
  7500. }, opts));
  7501. }
  7502. function getPlugin(options) {
  7503. const {
  7504. astFormat
  7505. } = options;
  7506. if (!astFormat) {
  7507. throw new Error("getPlugin() requires astFormat to be set");
  7508. }
  7509. const printerPlugin = options.plugins.find((plugin) => plugin.printers && plugin.printers[astFormat]);
  7510. if (!printerPlugin) {
  7511. throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
  7512. }
  7513. return printerPlugin;
  7514. }
  7515. function inferParser(filepath, plugins2) {
  7516. const filename = path.basename(filepath).toLowerCase();
  7517. const languages = getSupportInfo2({
  7518. plugins: plugins2
  7519. }).languages.filter((language2) => language2.since !== null);
  7520. let language = languages.find((language2) => language2.extensions && language2.extensions.some((extension) => filename.endsWith(extension)) || language2.filenames && language2.filenames.some((name) => name.toLowerCase() === filename));
  7521. if (!language && !filename.includes(".")) {
  7522. const getInterpreter = require_get_interpreter();
  7523. const interpreter = getInterpreter(filepath);
  7524. language = languages.find((language2) => language2.interpreters && language2.interpreters.includes(interpreter));
  7525. }
  7526. return language && language.parsers[0];
  7527. }
  7528. module2.exports = {
  7529. normalize,
  7530. hiddenDefaults,
  7531. inferParser
  7532. };
  7533. }
  7534. });
  7535. var require_massage_ast = __commonJS2({
  7536. "src/main/massage-ast.js"(exports2, module2) {
  7537. "use strict";
  7538. function massageAST(ast, options, parent) {
  7539. if (Array.isArray(ast)) {
  7540. return ast.map((e) => massageAST(e, options, parent)).filter(Boolean);
  7541. }
  7542. if (!ast || typeof ast !== "object") {
  7543. return ast;
  7544. }
  7545. const cleanFunction = options.printer.massageAstNode;
  7546. let ignoredProperties;
  7547. if (cleanFunction && cleanFunction.ignoredProperties) {
  7548. ignoredProperties = cleanFunction.ignoredProperties;
  7549. } else {
  7550. ignoredProperties = /* @__PURE__ */ new Set();
  7551. }
  7552. const newObj = {};
  7553. for (const [key, value] of Object.entries(ast)) {
  7554. if (!ignoredProperties.has(key) && typeof value !== "function") {
  7555. newObj[key] = massageAST(value, options, ast);
  7556. }
  7557. }
  7558. if (cleanFunction) {
  7559. const result = cleanFunction(ast, newObj, parent);
  7560. if (result === null) {
  7561. return;
  7562. }
  7563. if (result) {
  7564. return result;
  7565. }
  7566. }
  7567. return newObj;
  7568. }
  7569. module2.exports = massageAST;
  7570. }
  7571. });
  7572. var require_comments = __commonJS2({
  7573. "src/main/comments.js"(exports2, module2) {
  7574. "use strict";
  7575. var assert = require("assert");
  7576. var {
  7577. builders: {
  7578. line,
  7579. hardline,
  7580. breakParent,
  7581. indent,
  7582. lineSuffix,
  7583. join,
  7584. cursor
  7585. }
  7586. } = require("./doc.js");
  7587. var {
  7588. hasNewline,
  7589. skipNewline,
  7590. skipSpaces,
  7591. isPreviousLineEmpty,
  7592. addLeadingComment,
  7593. addDanglingComment,
  7594. addTrailingComment
  7595. } = require_util();
  7596. var childNodesCache = /* @__PURE__ */ new WeakMap();
  7597. function getSortedChildNodes(node, options, resultArray) {
  7598. if (!node) {
  7599. return;
  7600. }
  7601. const {
  7602. printer,
  7603. locStart,
  7604. locEnd
  7605. } = options;
  7606. if (resultArray) {
  7607. if (printer.canAttachComment && printer.canAttachComment(node)) {
  7608. let i;
  7609. for (i = resultArray.length - 1; i >= 0; --i) {
  7610. if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
  7611. break;
  7612. }
  7613. }
  7614. resultArray.splice(i + 1, 0, node);
  7615. return;
  7616. }
  7617. } else if (childNodesCache.has(node)) {
  7618. return childNodesCache.get(node);
  7619. }
  7620. 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);
  7621. if (!childNodes) {
  7622. return;
  7623. }
  7624. if (!resultArray) {
  7625. resultArray = [];
  7626. childNodesCache.set(node, resultArray);
  7627. }
  7628. for (const childNode of childNodes) {
  7629. getSortedChildNodes(childNode, options, resultArray);
  7630. }
  7631. return resultArray;
  7632. }
  7633. function decorateComment(node, comment, options, enclosingNode) {
  7634. const {
  7635. locStart,
  7636. locEnd
  7637. } = options;
  7638. const commentStart = locStart(comment);
  7639. const commentEnd = locEnd(comment);
  7640. const childNodes = getSortedChildNodes(node, options);
  7641. let precedingNode;
  7642. let followingNode;
  7643. let left = 0;
  7644. let right = childNodes.length;
  7645. while (left < right) {
  7646. const middle = left + right >> 1;
  7647. const child = childNodes[middle];
  7648. const start = locStart(child);
  7649. const end = locEnd(child);
  7650. if (start <= commentStart && commentEnd <= end) {
  7651. return decorateComment(child, comment, options, child);
  7652. }
  7653. if (end <= commentStart) {
  7654. precedingNode = child;
  7655. left = middle + 1;
  7656. continue;
  7657. }
  7658. if (commentEnd <= start) {
  7659. followingNode = child;
  7660. right = middle;
  7661. continue;
  7662. }
  7663. throw new Error("Comment location overlaps with node location");
  7664. }
  7665. if (enclosingNode && enclosingNode.type === "TemplateLiteral") {
  7666. const {
  7667. quasis
  7668. } = enclosingNode;
  7669. const commentIndex = findExpressionIndexForComment(quasis, comment, options);
  7670. if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
  7671. precedingNode = null;
  7672. }
  7673. if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
  7674. followingNode = null;
  7675. }
  7676. }
  7677. return {
  7678. enclosingNode,
  7679. precedingNode,
  7680. followingNode
  7681. };
  7682. }
  7683. var returnFalse = () => false;
  7684. function attach(comments, ast, text, options) {
  7685. if (!Array.isArray(comments)) {
  7686. return;
  7687. }
  7688. const tiesToBreak = [];
  7689. const {
  7690. locStart,
  7691. locEnd,
  7692. printer: {
  7693. handleComments = {}
  7694. }
  7695. } = options;
  7696. const {
  7697. avoidAstMutation,
  7698. ownLine: handleOwnLineComment = returnFalse,
  7699. endOfLine: handleEndOfLineComment = returnFalse,
  7700. remaining: handleRemainingComment = returnFalse
  7701. } = handleComments;
  7702. const decoratedComments = comments.map((comment, index) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
  7703. comment,
  7704. text,
  7705. options,
  7706. ast,
  7707. isLastComment: comments.length - 1 === index
  7708. }));
  7709. for (const [index, context] of decoratedComments.entries()) {
  7710. const {
  7711. comment,
  7712. precedingNode,
  7713. enclosingNode,
  7714. followingNode,
  7715. text: text2,
  7716. options: options2,
  7717. ast: ast2,
  7718. isLastComment
  7719. } = context;
  7720. if (options2.parser === "json" || options2.parser === "json5" || options2.parser === "__js_expression" || options2.parser === "__vue_expression" || options2.parser === "__vue_ts_expression") {
  7721. if (locStart(comment) - locStart(ast2) <= 0) {
  7722. addLeadingComment(ast2, comment);
  7723. continue;
  7724. }
  7725. if (locEnd(comment) - locEnd(ast2) >= 0) {
  7726. addTrailingComment(ast2, comment);
  7727. continue;
  7728. }
  7729. }
  7730. let args;
  7731. if (avoidAstMutation) {
  7732. args = [context];
  7733. } else {
  7734. comment.enclosingNode = enclosingNode;
  7735. comment.precedingNode = precedingNode;
  7736. comment.followingNode = followingNode;
  7737. args = [comment, text2, options2, ast2, isLastComment];
  7738. }
  7739. if (isOwnLineComment(text2, options2, decoratedComments, index)) {
  7740. comment.placement = "ownLine";
  7741. if (handleOwnLineComment(...args)) {
  7742. } else if (followingNode) {
  7743. addLeadingComment(followingNode, comment);
  7744. } else if (precedingNode) {
  7745. addTrailingComment(precedingNode, comment);
  7746. } else if (enclosingNode) {
  7747. addDanglingComment(enclosingNode, comment);
  7748. } else {
  7749. addDanglingComment(ast2, comment);
  7750. }
  7751. } else if (isEndOfLineComment(text2, options2, decoratedComments, index)) {
  7752. comment.placement = "endOfLine";
  7753. if (handleEndOfLineComment(...args)) {
  7754. } else if (precedingNode) {
  7755. addTrailingComment(precedingNode, comment);
  7756. } else if (followingNode) {
  7757. addLeadingComment(followingNode, comment);
  7758. } else if (enclosingNode) {
  7759. addDanglingComment(enclosingNode, comment);
  7760. } else {
  7761. addDanglingComment(ast2, comment);
  7762. }
  7763. } else {
  7764. comment.placement = "remaining";
  7765. if (handleRemainingComment(...args)) {
  7766. } else if (precedingNode && followingNode) {
  7767. const tieCount = tiesToBreak.length;
  7768. if (tieCount > 0) {
  7769. const lastTie = tiesToBreak[tieCount - 1];
  7770. if (lastTie.followingNode !== followingNode) {
  7771. breakTies(tiesToBreak, text2, options2);
  7772. }
  7773. }
  7774. tiesToBreak.push(context);
  7775. } else if (precedingNode) {
  7776. addTrailingComment(precedingNode, comment);
  7777. } else if (followingNode) {
  7778. addLeadingComment(followingNode, comment);
  7779. } else if (enclosingNode) {
  7780. addDanglingComment(enclosingNode, comment);
  7781. } else {
  7782. addDanglingComment(ast2, comment);
  7783. }
  7784. }
  7785. }
  7786. breakTies(tiesToBreak, text, options);
  7787. if (!avoidAstMutation) {
  7788. for (const comment of comments) {
  7789. delete comment.precedingNode;
  7790. delete comment.enclosingNode;
  7791. delete comment.followingNode;
  7792. }
  7793. }
  7794. }
  7795. var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text);
  7796. function isOwnLineComment(text, options, decoratedComments, commentIndex) {
  7797. const {
  7798. comment,
  7799. precedingNode
  7800. } = decoratedComments[commentIndex];
  7801. const {
  7802. locStart,
  7803. locEnd
  7804. } = options;
  7805. let start = locStart(comment);
  7806. if (precedingNode) {
  7807. for (let index = commentIndex - 1; index >= 0; index--) {
  7808. const {
  7809. comment: comment2,
  7810. precedingNode: currentCommentPrecedingNode
  7811. } = decoratedComments[index];
  7812. if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) {
  7813. break;
  7814. }
  7815. start = locStart(comment2);
  7816. }
  7817. }
  7818. return hasNewline(text, start, {
  7819. backwards: true
  7820. });
  7821. }
  7822. function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
  7823. const {
  7824. comment,
  7825. followingNode
  7826. } = decoratedComments[commentIndex];
  7827. const {
  7828. locStart,
  7829. locEnd
  7830. } = options;
  7831. let end = locEnd(comment);
  7832. if (followingNode) {
  7833. for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
  7834. const {
  7835. comment: comment2,
  7836. followingNode: currentCommentFollowingNode
  7837. } = decoratedComments[index];
  7838. if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) {
  7839. break;
  7840. }
  7841. end = locEnd(comment2);
  7842. }
  7843. }
  7844. return hasNewline(text, end);
  7845. }
  7846. function breakTies(tiesToBreak, text, options) {
  7847. const tieCount = tiesToBreak.length;
  7848. if (tieCount === 0) {
  7849. return;
  7850. }
  7851. const {
  7852. precedingNode,
  7853. followingNode,
  7854. enclosingNode
  7855. } = tiesToBreak[0];
  7856. const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
  7857. let gapEndPos = options.locStart(followingNode);
  7858. let indexOfFirstLeadingComment;
  7859. for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
  7860. const {
  7861. comment,
  7862. precedingNode: currentCommentPrecedingNode,
  7863. followingNode: currentCommentFollowingNode
  7864. } = tiesToBreak[indexOfFirstLeadingComment - 1];
  7865. assert.strictEqual(currentCommentPrecedingNode, precedingNode);
  7866. assert.strictEqual(currentCommentFollowingNode, followingNode);
  7867. const gap = text.slice(options.locEnd(comment), gapEndPos);
  7868. if (gapRegExp.test(gap)) {
  7869. gapEndPos = options.locStart(comment);
  7870. } else {
  7871. break;
  7872. }
  7873. }
  7874. for (const [i, {
  7875. comment
  7876. }] of tiesToBreak.entries()) {
  7877. if (i < indexOfFirstLeadingComment) {
  7878. addTrailingComment(precedingNode, comment);
  7879. } else {
  7880. addLeadingComment(followingNode, comment);
  7881. }
  7882. }
  7883. for (const node of [precedingNode, followingNode]) {
  7884. if (node.comments && node.comments.length > 1) {
  7885. node.comments.sort((a, b) => options.locStart(a) - options.locStart(b));
  7886. }
  7887. }
  7888. tiesToBreak.length = 0;
  7889. }
  7890. function printComment(path, options) {
  7891. const comment = path.getValue();
  7892. comment.printed = true;
  7893. return options.printer.printComment(path, options);
  7894. }
  7895. function findExpressionIndexForComment(quasis, comment, options) {
  7896. const startPos = options.locStart(comment) - 1;
  7897. for (let i = 1; i < quasis.length; ++i) {
  7898. if (startPos < options.locStart(quasis[i])) {
  7899. return i - 1;
  7900. }
  7901. }
  7902. return 0;
  7903. }
  7904. function printLeadingComment(path, options) {
  7905. const comment = path.getValue();
  7906. const parts = [printComment(path, options)];
  7907. const {
  7908. printer,
  7909. originalText,
  7910. locStart,
  7911. locEnd
  7912. } = options;
  7913. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  7914. if (isBlock) {
  7915. const lineBreak = hasNewline(originalText, locEnd(comment)) ? hasNewline(originalText, locStart(comment), {
  7916. backwards: true
  7917. }) ? hardline : line : " ";
  7918. parts.push(lineBreak);
  7919. } else {
  7920. parts.push(hardline);
  7921. }
  7922. const index = skipNewline(originalText, skipSpaces(originalText, locEnd(comment)));
  7923. if (index !== false && hasNewline(originalText, index)) {
  7924. parts.push(hardline);
  7925. }
  7926. return parts;
  7927. }
  7928. function printTrailingComment(path, options) {
  7929. const comment = path.getValue();
  7930. const printed = printComment(path, options);
  7931. const {
  7932. printer,
  7933. originalText,
  7934. locStart
  7935. } = options;
  7936. const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
  7937. if (hasNewline(originalText, locStart(comment), {
  7938. backwards: true
  7939. })) {
  7940. const isLineBeforeEmpty = isPreviousLineEmpty(originalText, comment, locStart);
  7941. return lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]);
  7942. }
  7943. let parts = [" ", printed];
  7944. if (!isBlock) {
  7945. parts = [lineSuffix(parts), breakParent];
  7946. }
  7947. return parts;
  7948. }
  7949. function printDanglingComments(path, options, sameIndent, filter) {
  7950. const parts = [];
  7951. const node = path.getValue();
  7952. if (!node || !node.comments) {
  7953. return "";
  7954. }
  7955. path.each(() => {
  7956. const comment = path.getValue();
  7957. if (!comment.leading && !comment.trailing && (!filter || filter(comment))) {
  7958. parts.push(printComment(path, options));
  7959. }
  7960. }, "comments");
  7961. if (parts.length === 0) {
  7962. return "";
  7963. }
  7964. if (sameIndent) {
  7965. return join(hardline, parts);
  7966. }
  7967. return indent([hardline, join(hardline, parts)]);
  7968. }
  7969. function printCommentsSeparately(path, options, ignored) {
  7970. const value = path.getValue();
  7971. if (!value) {
  7972. return {};
  7973. }
  7974. let comments = value.comments || [];
  7975. if (ignored) {
  7976. comments = comments.filter((comment) => !ignored.has(comment));
  7977. }
  7978. const isCursorNode = value === options.cursorNode;
  7979. if (comments.length === 0) {
  7980. const maybeCursor = isCursorNode ? cursor : "";
  7981. return {
  7982. leading: maybeCursor,
  7983. trailing: maybeCursor
  7984. };
  7985. }
  7986. const leadingParts = [];
  7987. const trailingParts = [];
  7988. path.each(() => {
  7989. const comment = path.getValue();
  7990. if (ignored && ignored.has(comment)) {
  7991. return;
  7992. }
  7993. const {
  7994. leading,
  7995. trailing
  7996. } = comment;
  7997. if (leading) {
  7998. leadingParts.push(printLeadingComment(path, options));
  7999. } else if (trailing) {
  8000. trailingParts.push(printTrailingComment(path, options));
  8001. }
  8002. }, "comments");
  8003. if (isCursorNode) {
  8004. leadingParts.unshift(cursor);
  8005. trailingParts.push(cursor);
  8006. }
  8007. return {
  8008. leading: leadingParts,
  8009. trailing: trailingParts
  8010. };
  8011. }
  8012. function printComments(path, doc2, options, ignored) {
  8013. const {
  8014. leading,
  8015. trailing
  8016. } = printCommentsSeparately(path, options, ignored);
  8017. if (!leading && !trailing) {
  8018. return doc2;
  8019. }
  8020. return [leading, doc2, trailing];
  8021. }
  8022. function ensureAllCommentsPrinted(astComments) {
  8023. if (!astComments) {
  8024. return;
  8025. }
  8026. for (const comment of astComments) {
  8027. if (!comment.printed) {
  8028. throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
  8029. }
  8030. delete comment.printed;
  8031. }
  8032. }
  8033. module2.exports = {
  8034. attach,
  8035. printComments,
  8036. printCommentsSeparately,
  8037. printDanglingComments,
  8038. getSortedChildNodes,
  8039. ensureAllCommentsPrinted
  8040. };
  8041. }
  8042. });
  8043. var require_ast_path = __commonJS2({
  8044. "src/common/ast-path.js"(exports2, module2) {
  8045. "use strict";
  8046. var getLast = require_get_last();
  8047. function getNodeHelper(path, count) {
  8048. const stackIndex = getNodeStackIndexHelper(path.stack, count);
  8049. return stackIndex === -1 ? null : path.stack[stackIndex];
  8050. }
  8051. function getNodeStackIndexHelper(stack, count) {
  8052. for (let i = stack.length - 1; i >= 0; i -= 2) {
  8053. const value = stack[i];
  8054. if (value && !Array.isArray(value) && --count < 0) {
  8055. return i;
  8056. }
  8057. }
  8058. return -1;
  8059. }
  8060. var AstPath = class {
  8061. constructor(value) {
  8062. this.stack = [value];
  8063. }
  8064. getName() {
  8065. const {
  8066. stack
  8067. } = this;
  8068. const {
  8069. length
  8070. } = stack;
  8071. if (length > 1) {
  8072. return stack[length - 2];
  8073. }
  8074. return null;
  8075. }
  8076. getValue() {
  8077. return getLast(this.stack);
  8078. }
  8079. getNode(count = 0) {
  8080. return getNodeHelper(this, count);
  8081. }
  8082. getParentNode(count = 0) {
  8083. return getNodeHelper(this, count + 1);
  8084. }
  8085. call(callback, ...names) {
  8086. const {
  8087. stack
  8088. } = this;
  8089. const {
  8090. length
  8091. } = stack;
  8092. let value = getLast(stack);
  8093. for (const name of names) {
  8094. value = value[name];
  8095. stack.push(name, value);
  8096. }
  8097. const result = callback(this);
  8098. stack.length = length;
  8099. return result;
  8100. }
  8101. callParent(callback, count = 0) {
  8102. const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
  8103. const parentValues = this.stack.splice(stackIndex + 1);
  8104. const result = callback(this);
  8105. this.stack.push(...parentValues);
  8106. return result;
  8107. }
  8108. each(callback, ...names) {
  8109. const {
  8110. stack
  8111. } = this;
  8112. const {
  8113. length
  8114. } = stack;
  8115. let value = getLast(stack);
  8116. for (const name of names) {
  8117. value = value[name];
  8118. stack.push(name, value);
  8119. }
  8120. for (let i = 0; i < value.length; ++i) {
  8121. stack.push(i, value[i]);
  8122. callback(this, i, value);
  8123. stack.length -= 2;
  8124. }
  8125. stack.length = length;
  8126. }
  8127. map(callback, ...names) {
  8128. const result = [];
  8129. this.each((path, index, value) => {
  8130. result[index] = callback(path, index, value);
  8131. }, ...names);
  8132. return result;
  8133. }
  8134. try(callback) {
  8135. const {
  8136. stack
  8137. } = this;
  8138. const stackBackup = [...stack];
  8139. try {
  8140. return callback();
  8141. } finally {
  8142. stack.length = 0;
  8143. stack.push(...stackBackup);
  8144. }
  8145. }
  8146. match(...predicates) {
  8147. let stackPointer = this.stack.length - 1;
  8148. let name = null;
  8149. let node = this.stack[stackPointer--];
  8150. for (const predicate of predicates) {
  8151. if (node === void 0) {
  8152. return false;
  8153. }
  8154. let number = null;
  8155. if (typeof name === "number") {
  8156. number = name;
  8157. name = this.stack[stackPointer--];
  8158. node = this.stack[stackPointer--];
  8159. }
  8160. if (predicate && !predicate(node, name, number)) {
  8161. return false;
  8162. }
  8163. name = this.stack[stackPointer--];
  8164. node = this.stack[stackPointer--];
  8165. }
  8166. return true;
  8167. }
  8168. findAncestor(predicate) {
  8169. let stackPointer = this.stack.length - 1;
  8170. let name = null;
  8171. let node = this.stack[stackPointer--];
  8172. while (node) {
  8173. let number = null;
  8174. if (typeof name === "number") {
  8175. number = name;
  8176. name = this.stack[stackPointer--];
  8177. node = this.stack[stackPointer--];
  8178. }
  8179. if (name !== null && predicate(node, name, number)) {
  8180. return node;
  8181. }
  8182. name = this.stack[stackPointer--];
  8183. node = this.stack[stackPointer--];
  8184. }
  8185. }
  8186. };
  8187. module2.exports = AstPath;
  8188. }
  8189. });
  8190. var require_multiparser = __commonJS2({
  8191. "src/main/multiparser.js"(exports2, module2) {
  8192. "use strict";
  8193. var {
  8194. utils: {
  8195. stripTrailingHardline
  8196. }
  8197. } = require("./doc.js");
  8198. var {
  8199. normalize
  8200. } = require_options();
  8201. var comments = require_comments();
  8202. function printSubtree(path, print, options, printAstToDoc) {
  8203. if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
  8204. return options.printer.embed(path, print, (text, partialNextOptions, textToDocOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
  8205. }
  8206. }
  8207. function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc, {
  8208. stripTrailingHardline: shouldStripTrailingHardline = false
  8209. } = {}) {
  8210. const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
  8211. parentParser: parentOptions.parser,
  8212. originalText: text
  8213. }), {
  8214. passThrough: true
  8215. });
  8216. const result = require_parser().parse(text, nextOptions);
  8217. const {
  8218. ast
  8219. } = result;
  8220. text = result.text;
  8221. const astComments = ast.comments;
  8222. delete ast.comments;
  8223. comments.attach(astComments, ast, text, nextOptions);
  8224. nextOptions[Symbol.for("comments")] = astComments || [];
  8225. nextOptions[Symbol.for("tokens")] = ast.tokens || [];
  8226. const doc2 = printAstToDoc(ast, nextOptions);
  8227. comments.ensureAllCommentsPrinted(astComments);
  8228. if (shouldStripTrailingHardline) {
  8229. if (typeof doc2 === "string") {
  8230. return doc2.replace(/(?:\r?\n)*$/, "");
  8231. }
  8232. return stripTrailingHardline(doc2);
  8233. }
  8234. return doc2;
  8235. }
  8236. module2.exports = {
  8237. printSubtree
  8238. };
  8239. }
  8240. });
  8241. var require_ast_to_doc = __commonJS2({
  8242. "src/main/ast-to-doc.js"(exports2, module2) {
  8243. "use strict";
  8244. var AstPath = require_ast_path();
  8245. var {
  8246. builders: {
  8247. hardline,
  8248. addAlignmentToDoc
  8249. },
  8250. utils: {
  8251. propagateBreaks
  8252. }
  8253. } = require("./doc.js");
  8254. var {
  8255. printComments
  8256. } = require_comments();
  8257. var multiparser = require_multiparser();
  8258. function printAstToDoc(ast, options, alignmentSize = 0) {
  8259. const {
  8260. printer
  8261. } = options;
  8262. if (printer.preprocess) {
  8263. ast = printer.preprocess(ast, options);
  8264. }
  8265. const cache = /* @__PURE__ */ new Map();
  8266. const path = new AstPath(ast);
  8267. let doc2 = mainPrint();
  8268. if (alignmentSize > 0) {
  8269. doc2 = addAlignmentToDoc([hardline, doc2], alignmentSize, options.tabWidth);
  8270. }
  8271. propagateBreaks(doc2);
  8272. return doc2;
  8273. function mainPrint(selector, args) {
  8274. if (selector === void 0 || selector === path) {
  8275. return mainPrintInternal(args);
  8276. }
  8277. if (Array.isArray(selector)) {
  8278. return path.call(() => mainPrintInternal(args), ...selector);
  8279. }
  8280. return path.call(() => mainPrintInternal(args), selector);
  8281. }
  8282. function mainPrintInternal(args) {
  8283. const value = path.getValue();
  8284. const shouldCache = value && typeof value === "object" && args === void 0;
  8285. if (shouldCache && cache.has(value)) {
  8286. return cache.get(value);
  8287. }
  8288. const doc3 = callPluginPrintFunction(path, options, mainPrint, args);
  8289. if (shouldCache) {
  8290. cache.set(value, doc3);
  8291. }
  8292. return doc3;
  8293. }
  8294. }
  8295. function printPrettierIgnoredNode(node, options) {
  8296. const {
  8297. originalText,
  8298. [Symbol.for("comments")]: comments,
  8299. locStart,
  8300. locEnd
  8301. } = options;
  8302. const start = locStart(node);
  8303. const end = locEnd(node);
  8304. const printedComments = /* @__PURE__ */ new Set();
  8305. for (const comment of comments) {
  8306. if (locStart(comment) >= start && locEnd(comment) <= end) {
  8307. comment.printed = true;
  8308. printedComments.add(comment);
  8309. }
  8310. }
  8311. return {
  8312. doc: originalText.slice(start, end),
  8313. printedComments
  8314. };
  8315. }
  8316. function callPluginPrintFunction(path, options, printPath, args) {
  8317. const node = path.getValue();
  8318. const {
  8319. printer
  8320. } = options;
  8321. let doc2;
  8322. let printedComments;
  8323. if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
  8324. ({
  8325. doc: doc2,
  8326. printedComments
  8327. } = printPrettierIgnoredNode(node, options));
  8328. } else {
  8329. if (node) {
  8330. try {
  8331. doc2 = multiparser.printSubtree(path, printPath, options, printAstToDoc);
  8332. } catch (error) {
  8333. if (process.env.PRETTIER_DEBUG) {
  8334. throw error;
  8335. }
  8336. }
  8337. }
  8338. if (!doc2) {
  8339. doc2 = printer.print(path, options, printPath, args);
  8340. }
  8341. }
  8342. if (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path, options)) {
  8343. doc2 = printComments(path, doc2, options, printedComments);
  8344. }
  8345. return doc2;
  8346. }
  8347. module2.exports = printAstToDoc;
  8348. }
  8349. });
  8350. var require_range_util = __commonJS2({
  8351. "src/main/range-util.js"(exports2, module2) {
  8352. "use strict";
  8353. var assert = require("assert");
  8354. var comments = require_comments();
  8355. var isJsonParser = ({
  8356. parser
  8357. }) => parser === "json" || parser === "json5" || parser === "json-stringify";
  8358. function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
  8359. const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
  8360. const endNodeAndAncestors = /* @__PURE__ */ new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
  8361. return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
  8362. }
  8363. function dropRootParents(parents) {
  8364. let lastParentIndex = parents.length - 1;
  8365. for (; ; ) {
  8366. const parent = parents[lastParentIndex];
  8367. if (parent && (parent.type === "Program" || parent.type === "File")) {
  8368. lastParentIndex--;
  8369. } else {
  8370. break;
  8371. }
  8372. }
  8373. return parents.slice(0, lastParentIndex + 1);
  8374. }
  8375. function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
  8376. locStart,
  8377. locEnd
  8378. }) {
  8379. let resultStartNode = startNodeAndParents.node;
  8380. let resultEndNode = endNodeAndParents.node;
  8381. if (resultStartNode === resultEndNode) {
  8382. return {
  8383. startNode: resultStartNode,
  8384. endNode: resultEndNode
  8385. };
  8386. }
  8387. const startNodeStart = locStart(startNodeAndParents.node);
  8388. for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
  8389. if (locStart(endParent) >= startNodeStart) {
  8390. resultEndNode = endParent;
  8391. } else {
  8392. break;
  8393. }
  8394. }
  8395. const endNodeEnd = locEnd(endNodeAndParents.node);
  8396. for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
  8397. if (locEnd(startParent) <= endNodeEnd) {
  8398. resultStartNode = startParent;
  8399. } else {
  8400. break;
  8401. }
  8402. }
  8403. return {
  8404. startNode: resultStartNode,
  8405. endNode: resultEndNode
  8406. };
  8407. }
  8408. function findNodeAtOffset(node, offset, options, predicate, parentNodes = [], type) {
  8409. const {
  8410. locStart,
  8411. locEnd
  8412. } = options;
  8413. const start = locStart(node);
  8414. const end = locEnd(node);
  8415. if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) {
  8416. return;
  8417. }
  8418. for (const childNode of comments.getSortedChildNodes(node, options)) {
  8419. const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node, ...parentNodes], type);
  8420. if (childResult) {
  8421. return childResult;
  8422. }
  8423. }
  8424. if (!predicate || predicate(node, parentNodes[0])) {
  8425. return {
  8426. node,
  8427. parentNodes
  8428. };
  8429. }
  8430. }
  8431. function isJsSourceElement(type, parentType) {
  8432. return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration"));
  8433. }
  8434. var jsonSourceElements = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
  8435. var graphqlSourceElements = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
  8436. function isSourceElement(opts, node, parentNode) {
  8437. if (!node) {
  8438. return false;
  8439. }
  8440. switch (opts.parser) {
  8441. case "flow":
  8442. case "babel":
  8443. case "babel-flow":
  8444. case "babel-ts":
  8445. case "typescript":
  8446. case "acorn":
  8447. case "espree":
  8448. case "meriyah":
  8449. case "__babel_estree":
  8450. return isJsSourceElement(node.type, parentNode && parentNode.type);
  8451. case "json":
  8452. case "json5":
  8453. case "json-stringify":
  8454. return jsonSourceElements.has(node.type);
  8455. case "graphql":
  8456. return graphqlSourceElements.has(node.kind);
  8457. case "vue":
  8458. return node.tag !== "root";
  8459. }
  8460. return false;
  8461. }
  8462. function calculateRange(text, opts, ast) {
  8463. let {
  8464. rangeStart: start,
  8465. rangeEnd: end,
  8466. locStart,
  8467. locEnd
  8468. } = opts;
  8469. assert.ok(end > start);
  8470. const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
  8471. const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
  8472. if (!isAllWhitespace) {
  8473. start += firstNonWhitespaceCharacterIndex;
  8474. for (; end > start; --end) {
  8475. if (/\S/.test(text[end - 1])) {
  8476. break;
  8477. }
  8478. }
  8479. }
  8480. const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
  8481. const endNodeAndParents = isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd");
  8482. if (!startNodeAndParents || !endNodeAndParents) {
  8483. return {
  8484. rangeStart: 0,
  8485. rangeEnd: 0
  8486. };
  8487. }
  8488. let startNode;
  8489. let endNode;
  8490. if (isJsonParser(opts)) {
  8491. const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
  8492. startNode = commonAncestor;
  8493. endNode = commonAncestor;
  8494. } else {
  8495. ({
  8496. startNode,
  8497. endNode
  8498. } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
  8499. }
  8500. return {
  8501. rangeStart: Math.min(locStart(startNode), locStart(endNode)),
  8502. rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
  8503. };
  8504. }
  8505. module2.exports = {
  8506. calculateRange,
  8507. findNodeAtOffset
  8508. };
  8509. }
  8510. });
  8511. var require_core = __commonJS2({
  8512. "src/main/core.js"(exports2, module2) {
  8513. "use strict";
  8514. var {
  8515. diffArrays
  8516. } = require_array();
  8517. var {
  8518. printer: {
  8519. printDocToString
  8520. },
  8521. debug: {
  8522. printDocToDebug
  8523. }
  8524. } = require("./doc.js");
  8525. var {
  8526. getAlignmentSize
  8527. } = require_util();
  8528. var {
  8529. guessEndOfLine,
  8530. convertEndOfLineToChars,
  8531. countEndOfLineChars,
  8532. normalizeEndOfLine
  8533. } = require_end_of_line();
  8534. var normalizeOptions = require_options().normalize;
  8535. var massageAST = require_massage_ast();
  8536. var comments = require_comments();
  8537. var parser = require_parser();
  8538. var printAstToDoc = require_ast_to_doc();
  8539. var rangeUtil = require_range_util();
  8540. var BOM = "\uFEFF";
  8541. var CURSOR = Symbol("cursor");
  8542. function attachComments(text, ast, opts) {
  8543. const astComments = ast.comments;
  8544. if (astComments) {
  8545. delete ast.comments;
  8546. comments.attach(astComments, ast, text, opts);
  8547. }
  8548. opts[Symbol.for("comments")] = astComments || [];
  8549. opts[Symbol.for("tokens")] = ast.tokens || [];
  8550. opts.originalText = text;
  8551. return astComments;
  8552. }
  8553. function coreFormat(originalText, opts, addAlignmentSize = 0) {
  8554. if (!originalText || originalText.trim().length === 0) {
  8555. return {
  8556. formatted: "",
  8557. cursorOffset: -1,
  8558. comments: []
  8559. };
  8560. }
  8561. const {
  8562. ast,
  8563. text
  8564. } = parser.parse(originalText, opts);
  8565. if (opts.cursorOffset >= 0) {
  8566. const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
  8567. if (nodeResult && nodeResult.node) {
  8568. opts.cursorNode = nodeResult.node;
  8569. }
  8570. }
  8571. const astComments = attachComments(text, ast, opts);
  8572. const doc2 = printAstToDoc(ast, opts, addAlignmentSize);
  8573. const result = printDocToString(doc2, opts);
  8574. comments.ensureAllCommentsPrinted(astComments);
  8575. if (addAlignmentSize > 0) {
  8576. const trimmed = result.formatted.trim();
  8577. if (result.cursorNodeStart !== void 0) {
  8578. result.cursorNodeStart -= result.formatted.indexOf(trimmed);
  8579. }
  8580. result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
  8581. }
  8582. if (opts.cursorOffset >= 0) {
  8583. let oldCursorNodeStart;
  8584. let oldCursorNodeText;
  8585. let cursorOffsetRelativeToOldCursorNode;
  8586. let newCursorNodeStart;
  8587. let newCursorNodeText;
  8588. if (opts.cursorNode && result.cursorNodeText) {
  8589. oldCursorNodeStart = opts.locStart(opts.cursorNode);
  8590. oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
  8591. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
  8592. newCursorNodeStart = result.cursorNodeStart;
  8593. newCursorNodeText = result.cursorNodeText;
  8594. } else {
  8595. oldCursorNodeStart = 0;
  8596. oldCursorNodeText = text;
  8597. cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
  8598. newCursorNodeStart = 0;
  8599. newCursorNodeText = result.formatted;
  8600. }
  8601. if (oldCursorNodeText === newCursorNodeText) {
  8602. return {
  8603. formatted: result.formatted,
  8604. cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
  8605. comments: astComments
  8606. };
  8607. }
  8608. const oldCursorNodeCharArray = [...oldCursorNodeText];
  8609. oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
  8610. const newCursorNodeCharArray = [...newCursorNodeText];
  8611. const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
  8612. let cursorOffset = newCursorNodeStart;
  8613. for (const entry of cursorNodeDiff) {
  8614. if (entry.removed) {
  8615. if (entry.value.includes(CURSOR)) {
  8616. break;
  8617. }
  8618. } else {
  8619. cursorOffset += entry.count;
  8620. }
  8621. }
  8622. return {
  8623. formatted: result.formatted,
  8624. cursorOffset,
  8625. comments: astComments
  8626. };
  8627. }
  8628. return {
  8629. formatted: result.formatted,
  8630. cursorOffset: -1,
  8631. comments: astComments
  8632. };
  8633. }
  8634. function formatRange(originalText, opts) {
  8635. const {
  8636. ast,
  8637. text
  8638. } = parser.parse(originalText, opts);
  8639. const {
  8640. rangeStart,
  8641. rangeEnd
  8642. } = rangeUtil.calculateRange(text, opts, ast);
  8643. const rangeString = text.slice(rangeStart, rangeEnd);
  8644. const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
  8645. const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
  8646. const alignmentSize = getAlignmentSize(indentString, opts.tabWidth);
  8647. const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
  8648. rangeStart: 0,
  8649. rangeEnd: Number.POSITIVE_INFINITY,
  8650. cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
  8651. endOfLine: "lf"
  8652. }), alignmentSize);
  8653. const rangeTrimmed = rangeResult.formatted.trimEnd();
  8654. let {
  8655. cursorOffset
  8656. } = opts;
  8657. if (cursorOffset > rangeEnd) {
  8658. cursorOffset += rangeTrimmed.length - rangeString.length;
  8659. } else if (rangeResult.cursorOffset >= 0) {
  8660. cursorOffset = rangeResult.cursorOffset + rangeStart;
  8661. }
  8662. let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
  8663. if (opts.endOfLine !== "lf") {
  8664. const eol = convertEndOfLineToChars(opts.endOfLine);
  8665. if (cursorOffset >= 0 && eol === "\r\n") {
  8666. cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
  8667. }
  8668. formatted = formatted.replace(/\n/g, eol);
  8669. }
  8670. return {
  8671. formatted,
  8672. cursorOffset,
  8673. comments: rangeResult.comments
  8674. };
  8675. }
  8676. function ensureIndexInText(text, index, defaultValue) {
  8677. if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
  8678. return defaultValue;
  8679. }
  8680. return index;
  8681. }
  8682. function normalizeIndexes(text, options) {
  8683. let {
  8684. cursorOffset,
  8685. rangeStart,
  8686. rangeEnd
  8687. } = options;
  8688. cursorOffset = ensureIndexInText(text, cursorOffset, -1);
  8689. rangeStart = ensureIndexInText(text, rangeStart, 0);
  8690. rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
  8691. return Object.assign(Object.assign({}, options), {}, {
  8692. cursorOffset,
  8693. rangeStart,
  8694. rangeEnd
  8695. });
  8696. }
  8697. function normalizeInputAndOptions(text, options) {
  8698. let {
  8699. cursorOffset,
  8700. rangeStart,
  8701. rangeEnd,
  8702. endOfLine
  8703. } = normalizeIndexes(text, options);
  8704. const hasBOM = text.charAt(0) === BOM;
  8705. if (hasBOM) {
  8706. text = text.slice(1);
  8707. cursorOffset--;
  8708. rangeStart--;
  8709. rangeEnd--;
  8710. }
  8711. if (endOfLine === "auto") {
  8712. endOfLine = guessEndOfLine(text);
  8713. }
  8714. if (text.includes("\r")) {
  8715. const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
  8716. cursorOffset -= countCrlfBefore(cursorOffset);
  8717. rangeStart -= countCrlfBefore(rangeStart);
  8718. rangeEnd -= countCrlfBefore(rangeEnd);
  8719. text = normalizeEndOfLine(text);
  8720. }
  8721. return {
  8722. hasBOM,
  8723. text,
  8724. options: normalizeIndexes(text, Object.assign(Object.assign({}, options), {}, {
  8725. cursorOffset,
  8726. rangeStart,
  8727. rangeEnd,
  8728. endOfLine
  8729. }))
  8730. };
  8731. }
  8732. function hasPragma(text, options) {
  8733. const selectedParser = parser.resolveParser(options);
  8734. return !selectedParser.hasPragma || selectedParser.hasPragma(text);
  8735. }
  8736. function formatWithCursor2(originalText, originalOptions) {
  8737. let {
  8738. hasBOM,
  8739. text,
  8740. options
  8741. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8742. if (options.rangeStart >= options.rangeEnd && text !== "" || options.requirePragma && !hasPragma(text, options)) {
  8743. return {
  8744. formatted: originalText,
  8745. cursorOffset: originalOptions.cursorOffset,
  8746. comments: []
  8747. };
  8748. }
  8749. let result;
  8750. if (options.rangeStart > 0 || options.rangeEnd < text.length) {
  8751. result = formatRange(text, options);
  8752. } else {
  8753. if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(text, options)) {
  8754. text = options.printer.insertPragma(text);
  8755. }
  8756. result = coreFormat(text, options);
  8757. }
  8758. if (hasBOM) {
  8759. result.formatted = BOM + result.formatted;
  8760. if (result.cursorOffset >= 0) {
  8761. result.cursorOffset++;
  8762. }
  8763. }
  8764. return result;
  8765. }
  8766. module2.exports = {
  8767. formatWithCursor: formatWithCursor2,
  8768. parse(originalText, originalOptions, massage) {
  8769. const {
  8770. text,
  8771. options
  8772. } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
  8773. const parsed = parser.parse(text, options);
  8774. if (massage) {
  8775. parsed.ast = massageAST(parsed.ast, options);
  8776. }
  8777. return parsed;
  8778. },
  8779. formatAST(ast, options) {
  8780. options = normalizeOptions(options);
  8781. const doc2 = printAstToDoc(ast, options);
  8782. return printDocToString(doc2, options);
  8783. },
  8784. formatDoc(doc2, options) {
  8785. return formatWithCursor2(printDocToDebug(doc2), Object.assign(Object.assign({}, options), {}, {
  8786. parser: "__js_expression"
  8787. })).formatted;
  8788. },
  8789. printToDoc(originalText, options) {
  8790. options = normalizeOptions(options);
  8791. const {
  8792. ast,
  8793. text
  8794. } = parser.parse(originalText, options);
  8795. attachComments(text, ast, options);
  8796. return printAstToDoc(ast, options);
  8797. },
  8798. printDocToString(doc2, options) {
  8799. return printDocToString(doc2, normalizeOptions(options));
  8800. }
  8801. };
  8802. }
  8803. });
  8804. var require_utils2 = __commonJS2({
  8805. "node_modules/braces/lib/utils.js"(exports2) {
  8806. "use strict";
  8807. exports2.isInteger = (num) => {
  8808. if (typeof num === "number") {
  8809. return Number.isInteger(num);
  8810. }
  8811. if (typeof num === "string" && num.trim() !== "") {
  8812. return Number.isInteger(Number(num));
  8813. }
  8814. return false;
  8815. };
  8816. exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
  8817. exports2.exceedsLimit = (min, max, step = 1, limit) => {
  8818. if (limit === false)
  8819. return false;
  8820. if (!exports2.isInteger(min) || !exports2.isInteger(max))
  8821. return false;
  8822. return (Number(max) - Number(min)) / Number(step) >= limit;
  8823. };
  8824. exports2.escapeNode = (block, n = 0, type) => {
  8825. let node = block.nodes[n];
  8826. if (!node)
  8827. return;
  8828. if (type && node.type === type || node.type === "open" || node.type === "close") {
  8829. if (node.escaped !== true) {
  8830. node.value = "\\" + node.value;
  8831. node.escaped = true;
  8832. }
  8833. }
  8834. };
  8835. exports2.encloseBrace = (node) => {
  8836. if (node.type !== "brace")
  8837. return false;
  8838. if (node.commas >> 0 + node.ranges >> 0 === 0) {
  8839. node.invalid = true;
  8840. return true;
  8841. }
  8842. return false;
  8843. };
  8844. exports2.isInvalidBrace = (block) => {
  8845. if (block.type !== "brace")
  8846. return false;
  8847. if (block.invalid === true || block.dollar)
  8848. return true;
  8849. if (block.commas >> 0 + block.ranges >> 0 === 0) {
  8850. block.invalid = true;
  8851. return true;
  8852. }
  8853. if (block.open !== true || block.close !== true) {
  8854. block.invalid = true;
  8855. return true;
  8856. }
  8857. return false;
  8858. };
  8859. exports2.isOpenOrClose = (node) => {
  8860. if (node.type === "open" || node.type === "close") {
  8861. return true;
  8862. }
  8863. return node.open === true || node.close === true;
  8864. };
  8865. exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
  8866. if (node.type === "text")
  8867. acc.push(node.value);
  8868. if (node.type === "range")
  8869. node.type = "text";
  8870. return acc;
  8871. }, []);
  8872. exports2.flatten = (...args) => {
  8873. const result = [];
  8874. const flat = (arr) => {
  8875. for (let i = 0; i < arr.length; i++) {
  8876. let ele = arr[i];
  8877. Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
  8878. }
  8879. return result;
  8880. };
  8881. flat(args);
  8882. return result;
  8883. };
  8884. }
  8885. });
  8886. var require_stringify = __commonJS2({
  8887. "node_modules/braces/lib/stringify.js"(exports2, module2) {
  8888. "use strict";
  8889. var utils = require_utils2();
  8890. module2.exports = (ast, options = {}) => {
  8891. let stringify = (node, parent = {}) => {
  8892. let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
  8893. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  8894. let output = "";
  8895. if (node.value) {
  8896. if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
  8897. return "\\" + node.value;
  8898. }
  8899. return node.value;
  8900. }
  8901. if (node.value) {
  8902. return node.value;
  8903. }
  8904. if (node.nodes) {
  8905. for (let child of node.nodes) {
  8906. output += stringify(child);
  8907. }
  8908. }
  8909. return output;
  8910. };
  8911. return stringify(ast);
  8912. };
  8913. }
  8914. });
  8915. var require_is_number = __commonJS2({
  8916. "node_modules/is-number/index.js"(exports2, module2) {
  8917. "use strict";
  8918. module2.exports = function(num) {
  8919. if (typeof num === "number") {
  8920. return num - num === 0;
  8921. }
  8922. if (typeof num === "string" && num.trim() !== "") {
  8923. return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  8924. }
  8925. return false;
  8926. };
  8927. }
  8928. });
  8929. var require_to_regex_range = __commonJS2({
  8930. "node_modules/to-regex-range/index.js"(exports2, module2) {
  8931. "use strict";
  8932. var isNumber = require_is_number();
  8933. var toRegexRange = (min, max, options) => {
  8934. if (isNumber(min) === false) {
  8935. throw new TypeError("toRegexRange: expected the first argument to be a number");
  8936. }
  8937. if (max === void 0 || min === max) {
  8938. return String(min);
  8939. }
  8940. if (isNumber(max) === false) {
  8941. throw new TypeError("toRegexRange: expected the second argument to be a number.");
  8942. }
  8943. let opts = Object.assign({
  8944. relaxZeros: true
  8945. }, options);
  8946. if (typeof opts.strictZeros === "boolean") {
  8947. opts.relaxZeros = opts.strictZeros === false;
  8948. }
  8949. let relax = String(opts.relaxZeros);
  8950. let shorthand = String(opts.shorthand);
  8951. let capture = String(opts.capture);
  8952. let wrap = String(opts.wrap);
  8953. let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
  8954. if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
  8955. return toRegexRange.cache[cacheKey].result;
  8956. }
  8957. let a = Math.min(min, max);
  8958. let b = Math.max(min, max);
  8959. if (Math.abs(a - b) === 1) {
  8960. let result = min + "|" + max;
  8961. if (opts.capture) {
  8962. return `(${result})`;
  8963. }
  8964. if (opts.wrap === false) {
  8965. return result;
  8966. }
  8967. return `(?:${result})`;
  8968. }
  8969. let isPadded = hasPadding(min) || hasPadding(max);
  8970. let state = {
  8971. min,
  8972. max,
  8973. a,
  8974. b
  8975. };
  8976. let positives = [];
  8977. let negatives = [];
  8978. if (isPadded) {
  8979. state.isPadded = isPadded;
  8980. state.maxLen = String(state.max).length;
  8981. }
  8982. if (a < 0) {
  8983. let newMin = b < 0 ? Math.abs(b) : 1;
  8984. negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
  8985. a = state.a = 0;
  8986. }
  8987. if (b >= 0) {
  8988. positives = splitToPatterns(a, b, state, opts);
  8989. }
  8990. state.negatives = negatives;
  8991. state.positives = positives;
  8992. state.result = collatePatterns(negatives, positives, opts);
  8993. if (opts.capture === true) {
  8994. state.result = `(${state.result})`;
  8995. } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
  8996. state.result = `(?:${state.result})`;
  8997. }
  8998. toRegexRange.cache[cacheKey] = state;
  8999. return state.result;
  9000. };
  9001. function collatePatterns(neg, pos, options) {
  9002. let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
  9003. let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
  9004. let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
  9005. let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
  9006. return subpatterns.join("|");
  9007. }
  9008. function splitToRanges(min, max) {
  9009. let nines = 1;
  9010. let zeros = 1;
  9011. let stop = countNines(min, nines);
  9012. let stops = /* @__PURE__ */ new Set([max]);
  9013. while (min <= stop && stop <= max) {
  9014. stops.add(stop);
  9015. nines += 1;
  9016. stop = countNines(min, nines);
  9017. }
  9018. stop = countZeros(max + 1, zeros) - 1;
  9019. while (min < stop && stop <= max) {
  9020. stops.add(stop);
  9021. zeros += 1;
  9022. stop = countZeros(max + 1, zeros) - 1;
  9023. }
  9024. stops = [...stops];
  9025. stops.sort(compare);
  9026. return stops;
  9027. }
  9028. function rangeToPattern(start, stop, options) {
  9029. if (start === stop) {
  9030. return {
  9031. pattern: start,
  9032. count: [],
  9033. digits: 0
  9034. };
  9035. }
  9036. let zipped = zip(start, stop);
  9037. let digits = zipped.length;
  9038. let pattern = "";
  9039. let count = 0;
  9040. for (let i = 0; i < digits; i++) {
  9041. let [startDigit, stopDigit] = zipped[i];
  9042. if (startDigit === stopDigit) {
  9043. pattern += startDigit;
  9044. } else if (startDigit !== "0" || stopDigit !== "9") {
  9045. pattern += toCharacterClass(startDigit, stopDigit, options);
  9046. } else {
  9047. count++;
  9048. }
  9049. }
  9050. if (count) {
  9051. pattern += options.shorthand === true ? "\\d" : "[0-9]";
  9052. }
  9053. return {
  9054. pattern,
  9055. count: [count],
  9056. digits
  9057. };
  9058. }
  9059. function splitToPatterns(min, max, tok, options) {
  9060. let ranges = splitToRanges(min, max);
  9061. let tokens = [];
  9062. let start = min;
  9063. let prev;
  9064. for (let i = 0; i < ranges.length; i++) {
  9065. let max2 = ranges[i];
  9066. let obj = rangeToPattern(String(start), String(max2), options);
  9067. let zeros = "";
  9068. if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
  9069. if (prev.count.length > 1) {
  9070. prev.count.pop();
  9071. }
  9072. prev.count.push(obj.count[0]);
  9073. prev.string = prev.pattern + toQuantifier(prev.count);
  9074. start = max2 + 1;
  9075. continue;
  9076. }
  9077. if (tok.isPadded) {
  9078. zeros = padZeros(max2, tok, options);
  9079. }
  9080. obj.string = zeros + obj.pattern + toQuantifier(obj.count);
  9081. tokens.push(obj);
  9082. start = max2 + 1;
  9083. prev = obj;
  9084. }
  9085. return tokens;
  9086. }
  9087. function filterPatterns(arr, comparison, prefix, intersection, options) {
  9088. let result = [];
  9089. for (let ele of arr) {
  9090. let {
  9091. string
  9092. } = ele;
  9093. if (!intersection && !contains(comparison, "string", string)) {
  9094. result.push(prefix + string);
  9095. }
  9096. if (intersection && contains(comparison, "string", string)) {
  9097. result.push(prefix + string);
  9098. }
  9099. }
  9100. return result;
  9101. }
  9102. function zip(a, b) {
  9103. let arr = [];
  9104. for (let i = 0; i < a.length; i++)
  9105. arr.push([a[i], b[i]]);
  9106. return arr;
  9107. }
  9108. function compare(a, b) {
  9109. return a > b ? 1 : b > a ? -1 : 0;
  9110. }
  9111. function contains(arr, key, val) {
  9112. return arr.some((ele) => ele[key] === val);
  9113. }
  9114. function countNines(min, len) {
  9115. return Number(String(min).slice(0, -len) + "9".repeat(len));
  9116. }
  9117. function countZeros(integer, zeros) {
  9118. return integer - integer % Math.pow(10, zeros);
  9119. }
  9120. function toQuantifier(digits) {
  9121. let [start = 0, stop = ""] = digits;
  9122. if (stop || start > 1) {
  9123. return `{${start + (stop ? "," + stop : "")}}`;
  9124. }
  9125. return "";
  9126. }
  9127. function toCharacterClass(a, b, options) {
  9128. return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
  9129. }
  9130. function hasPadding(str) {
  9131. return /^-?(0+)\d/.test(str);
  9132. }
  9133. function padZeros(value, tok, options) {
  9134. if (!tok.isPadded) {
  9135. return value;
  9136. }
  9137. let diff = Math.abs(tok.maxLen - String(value).length);
  9138. let relax = options.relaxZeros !== false;
  9139. switch (diff) {
  9140. case 0:
  9141. return "";
  9142. case 1:
  9143. return relax ? "0?" : "0";
  9144. case 2:
  9145. return relax ? "0{0,2}" : "00";
  9146. default: {
  9147. return relax ? `0{0,${diff}}` : `0{${diff}}`;
  9148. }
  9149. }
  9150. }
  9151. toRegexRange.cache = {};
  9152. toRegexRange.clearCache = () => toRegexRange.cache = {};
  9153. module2.exports = toRegexRange;
  9154. }
  9155. });
  9156. var require_fill_range = __commonJS2({
  9157. "node_modules/fill-range/index.js"(exports2, module2) {
  9158. "use strict";
  9159. var util = require("util");
  9160. var toRegexRange = require_to_regex_range();
  9161. var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  9162. var transform = (toNumber) => {
  9163. return (value) => toNumber === true ? Number(value) : String(value);
  9164. };
  9165. var isValidValue = (value) => {
  9166. return typeof value === "number" || typeof value === "string" && value !== "";
  9167. };
  9168. var isNumber = (num) => Number.isInteger(+num);
  9169. var zeros = (input) => {
  9170. let value = `${input}`;
  9171. let index = -1;
  9172. if (value[0] === "-")
  9173. value = value.slice(1);
  9174. if (value === "0")
  9175. return false;
  9176. while (value[++index] === "0")
  9177. ;
  9178. return index > 0;
  9179. };
  9180. var stringify = (start, end, options) => {
  9181. if (typeof start === "string" || typeof end === "string") {
  9182. return true;
  9183. }
  9184. return options.stringify === true;
  9185. };
  9186. var pad = (input, maxLength, toNumber) => {
  9187. if (maxLength > 0) {
  9188. let dash = input[0] === "-" ? "-" : "";
  9189. if (dash)
  9190. input = input.slice(1);
  9191. input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
  9192. }
  9193. if (toNumber === false) {
  9194. return String(input);
  9195. }
  9196. return input;
  9197. };
  9198. var toMaxLen = (input, maxLength) => {
  9199. let negative = input[0] === "-" ? "-" : "";
  9200. if (negative) {
  9201. input = input.slice(1);
  9202. maxLength--;
  9203. }
  9204. while (input.length < maxLength)
  9205. input = "0" + input;
  9206. return negative ? "-" + input : input;
  9207. };
  9208. var toSequence = (parts, options) => {
  9209. parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9210. parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
  9211. let prefix = options.capture ? "" : "?:";
  9212. let positives = "";
  9213. let negatives = "";
  9214. let result;
  9215. if (parts.positives.length) {
  9216. positives = parts.positives.join("|");
  9217. }
  9218. if (parts.negatives.length) {
  9219. negatives = `-(${prefix}${parts.negatives.join("|")})`;
  9220. }
  9221. if (positives && negatives) {
  9222. result = `${positives}|${negatives}`;
  9223. } else {
  9224. result = positives || negatives;
  9225. }
  9226. if (options.wrap) {
  9227. return `(${prefix}${result})`;
  9228. }
  9229. return result;
  9230. };
  9231. var toRange = (a, b, isNumbers, options) => {
  9232. if (isNumbers) {
  9233. return toRegexRange(a, b, Object.assign({
  9234. wrap: false
  9235. }, options));
  9236. }
  9237. let start = String.fromCharCode(a);
  9238. if (a === b)
  9239. return start;
  9240. let stop = String.fromCharCode(b);
  9241. return `[${start}-${stop}]`;
  9242. };
  9243. var toRegex = (start, end, options) => {
  9244. if (Array.isArray(start)) {
  9245. let wrap = options.wrap === true;
  9246. let prefix = options.capture ? "" : "?:";
  9247. return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
  9248. }
  9249. return toRegexRange(start, end, options);
  9250. };
  9251. var rangeError = (...args) => {
  9252. return new RangeError("Invalid range arguments: " + util.inspect(...args));
  9253. };
  9254. var invalidRange = (start, end, options) => {
  9255. if (options.strictRanges === true)
  9256. throw rangeError([start, end]);
  9257. return [];
  9258. };
  9259. var invalidStep = (step, options) => {
  9260. if (options.strictRanges === true) {
  9261. throw new TypeError(`Expected step "${step}" to be a number`);
  9262. }
  9263. return [];
  9264. };
  9265. var fillNumbers = (start, end, step = 1, options = {}) => {
  9266. let a = Number(start);
  9267. let b = Number(end);
  9268. if (!Number.isInteger(a) || !Number.isInteger(b)) {
  9269. if (options.strictRanges === true)
  9270. throw rangeError([start, end]);
  9271. return [];
  9272. }
  9273. if (a === 0)
  9274. a = 0;
  9275. if (b === 0)
  9276. b = 0;
  9277. let descending = a > b;
  9278. let startString = String(start);
  9279. let endString = String(end);
  9280. let stepString = String(step);
  9281. step = Math.max(Math.abs(step), 1);
  9282. let padded = zeros(startString) || zeros(endString) || zeros(stepString);
  9283. let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
  9284. let toNumber = padded === false && stringify(start, end, options) === false;
  9285. let format = options.transform || transform(toNumber);
  9286. if (options.toRegex && step === 1) {
  9287. return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
  9288. }
  9289. let parts = {
  9290. negatives: [],
  9291. positives: []
  9292. };
  9293. let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
  9294. let range = [];
  9295. let index = 0;
  9296. while (descending ? a >= b : a <= b) {
  9297. if (options.toRegex === true && step > 1) {
  9298. push(a);
  9299. } else {
  9300. range.push(pad(format(a, index), maxLen, toNumber));
  9301. }
  9302. a = descending ? a - step : a + step;
  9303. index++;
  9304. }
  9305. if (options.toRegex === true) {
  9306. return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
  9307. wrap: false
  9308. }, options));
  9309. }
  9310. return range;
  9311. };
  9312. var fillLetters = (start, end, step = 1, options = {}) => {
  9313. if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
  9314. return invalidRange(start, end, options);
  9315. }
  9316. let format = options.transform || ((val) => String.fromCharCode(val));
  9317. let a = `${start}`.charCodeAt(0);
  9318. let b = `${end}`.charCodeAt(0);
  9319. let descending = a > b;
  9320. let min = Math.min(a, b);
  9321. let max = Math.max(a, b);
  9322. if (options.toRegex && step === 1) {
  9323. return toRange(min, max, false, options);
  9324. }
  9325. let range = [];
  9326. let index = 0;
  9327. while (descending ? a >= b : a <= b) {
  9328. range.push(format(a, index));
  9329. a = descending ? a - step : a + step;
  9330. index++;
  9331. }
  9332. if (options.toRegex === true) {
  9333. return toRegex(range, null, {
  9334. wrap: false,
  9335. options
  9336. });
  9337. }
  9338. return range;
  9339. };
  9340. var fill = (start, end, step, options = {}) => {
  9341. if (end == null && isValidValue(start)) {
  9342. return [start];
  9343. }
  9344. if (!isValidValue(start) || !isValidValue(end)) {
  9345. return invalidRange(start, end, options);
  9346. }
  9347. if (typeof step === "function") {
  9348. return fill(start, end, 1, {
  9349. transform: step
  9350. });
  9351. }
  9352. if (isObject(step)) {
  9353. return fill(start, end, 0, step);
  9354. }
  9355. let opts = Object.assign({}, options);
  9356. if (opts.capture === true)
  9357. opts.wrap = true;
  9358. step = step || opts.step || 1;
  9359. if (!isNumber(step)) {
  9360. if (step != null && !isObject(step))
  9361. return invalidStep(step, opts);
  9362. return fill(start, end, 1, step);
  9363. }
  9364. if (isNumber(start) && isNumber(end)) {
  9365. return fillNumbers(start, end, step, opts);
  9366. }
  9367. return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
  9368. };
  9369. module2.exports = fill;
  9370. }
  9371. });
  9372. var require_compile = __commonJS2({
  9373. "node_modules/braces/lib/compile.js"(exports2, module2) {
  9374. "use strict";
  9375. var fill = require_fill_range();
  9376. var utils = require_utils2();
  9377. var compile = (ast, options = {}) => {
  9378. let walk = (node, parent = {}) => {
  9379. let invalidBlock = utils.isInvalidBrace(parent);
  9380. let invalidNode = node.invalid === true && options.escapeInvalid === true;
  9381. let invalid = invalidBlock === true || invalidNode === true;
  9382. let prefix = options.escapeInvalid === true ? "\\" : "";
  9383. let output = "";
  9384. if (node.isOpen === true) {
  9385. return prefix + node.value;
  9386. }
  9387. if (node.isClose === true) {
  9388. return prefix + node.value;
  9389. }
  9390. if (node.type === "open") {
  9391. return invalid ? prefix + node.value : "(";
  9392. }
  9393. if (node.type === "close") {
  9394. return invalid ? prefix + node.value : ")";
  9395. }
  9396. if (node.type === "comma") {
  9397. return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
  9398. }
  9399. if (node.value) {
  9400. return node.value;
  9401. }
  9402. if (node.nodes && node.ranges > 0) {
  9403. let args = utils.reduce(node.nodes);
  9404. let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
  9405. wrap: false,
  9406. toRegex: true
  9407. }));
  9408. if (range.length !== 0) {
  9409. return args.length > 1 && range.length > 1 ? `(${range})` : range;
  9410. }
  9411. }
  9412. if (node.nodes) {
  9413. for (let child of node.nodes) {
  9414. output += walk(child, node);
  9415. }
  9416. }
  9417. return output;
  9418. };
  9419. return walk(ast);
  9420. };
  9421. module2.exports = compile;
  9422. }
  9423. });
  9424. var require_expand = __commonJS2({
  9425. "node_modules/braces/lib/expand.js"(exports2, module2) {
  9426. "use strict";
  9427. var fill = require_fill_range();
  9428. var stringify = require_stringify();
  9429. var utils = require_utils2();
  9430. var append = (queue = "", stash = "", enclose = false) => {
  9431. let result = [];
  9432. queue = [].concat(queue);
  9433. stash = [].concat(stash);
  9434. if (!stash.length)
  9435. return queue;
  9436. if (!queue.length) {
  9437. return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
  9438. }
  9439. for (let item of queue) {
  9440. if (Array.isArray(item)) {
  9441. for (let value of item) {
  9442. result.push(append(value, stash, enclose));
  9443. }
  9444. } else {
  9445. for (let ele of stash) {
  9446. if (enclose === true && typeof ele === "string")
  9447. ele = `{${ele}}`;
  9448. result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
  9449. }
  9450. }
  9451. }
  9452. return utils.flatten(result);
  9453. };
  9454. var expand = (ast, options = {}) => {
  9455. let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
  9456. let walk = (node, parent = {}) => {
  9457. node.queue = [];
  9458. let p = parent;
  9459. let q = parent.queue;
  9460. while (p.type !== "brace" && p.type !== "root" && p.parent) {
  9461. p = p.parent;
  9462. q = p.queue;
  9463. }
  9464. if (node.invalid || node.dollar) {
  9465. q.push(append(q.pop(), stringify(node, options)));
  9466. return;
  9467. }
  9468. if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
  9469. q.push(append(q.pop(), ["{}"]));
  9470. return;
  9471. }
  9472. if (node.nodes && node.ranges > 0) {
  9473. let args = utils.reduce(node.nodes);
  9474. if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
  9475. throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
  9476. }
  9477. let range = fill(...args, options);
  9478. if (range.length === 0) {
  9479. range = stringify(node, options);
  9480. }
  9481. q.push(append(q.pop(), range));
  9482. node.nodes = [];
  9483. return;
  9484. }
  9485. let enclose = utils.encloseBrace(node);
  9486. let queue = node.queue;
  9487. let block = node;
  9488. while (block.type !== "brace" && block.type !== "root" && block.parent) {
  9489. block = block.parent;
  9490. queue = block.queue;
  9491. }
  9492. for (let i = 0; i < node.nodes.length; i++) {
  9493. let child = node.nodes[i];
  9494. if (child.type === "comma" && node.type === "brace") {
  9495. if (i === 1)
  9496. queue.push("");
  9497. queue.push("");
  9498. continue;
  9499. }
  9500. if (child.type === "close") {
  9501. q.push(append(q.pop(), queue, enclose));
  9502. continue;
  9503. }
  9504. if (child.value && child.type !== "open") {
  9505. queue.push(append(queue.pop(), child.value));
  9506. continue;
  9507. }
  9508. if (child.nodes) {
  9509. walk(child, node);
  9510. }
  9511. }
  9512. return queue;
  9513. };
  9514. return utils.flatten(walk(ast));
  9515. };
  9516. module2.exports = expand;
  9517. }
  9518. });
  9519. var require_constants2 = __commonJS2({
  9520. "node_modules/braces/lib/constants.js"(exports2, module2) {
  9521. "use strict";
  9522. module2.exports = {
  9523. MAX_LENGTH: 1024 * 64,
  9524. CHAR_0: "0",
  9525. CHAR_9: "9",
  9526. CHAR_UPPERCASE_A: "A",
  9527. CHAR_LOWERCASE_A: "a",
  9528. CHAR_UPPERCASE_Z: "Z",
  9529. CHAR_LOWERCASE_Z: "z",
  9530. CHAR_LEFT_PARENTHESES: "(",
  9531. CHAR_RIGHT_PARENTHESES: ")",
  9532. CHAR_ASTERISK: "*",
  9533. CHAR_AMPERSAND: "&",
  9534. CHAR_AT: "@",
  9535. CHAR_BACKSLASH: "\\",
  9536. CHAR_BACKTICK: "`",
  9537. CHAR_CARRIAGE_RETURN: "\r",
  9538. CHAR_CIRCUMFLEX_ACCENT: "^",
  9539. CHAR_COLON: ":",
  9540. CHAR_COMMA: ",",
  9541. CHAR_DOLLAR: "$",
  9542. CHAR_DOT: ".",
  9543. CHAR_DOUBLE_QUOTE: '"',
  9544. CHAR_EQUAL: "=",
  9545. CHAR_EXCLAMATION_MARK: "!",
  9546. CHAR_FORM_FEED: "\f",
  9547. CHAR_FORWARD_SLASH: "/",
  9548. CHAR_HASH: "#",
  9549. CHAR_HYPHEN_MINUS: "-",
  9550. CHAR_LEFT_ANGLE_BRACKET: "<",
  9551. CHAR_LEFT_CURLY_BRACE: "{",
  9552. CHAR_LEFT_SQUARE_BRACKET: "[",
  9553. CHAR_LINE_FEED: "\n",
  9554. CHAR_NO_BREAK_SPACE: "\xA0",
  9555. CHAR_PERCENT: "%",
  9556. CHAR_PLUS: "+",
  9557. CHAR_QUESTION_MARK: "?",
  9558. CHAR_RIGHT_ANGLE_BRACKET: ">",
  9559. CHAR_RIGHT_CURLY_BRACE: "}",
  9560. CHAR_RIGHT_SQUARE_BRACKET: "]",
  9561. CHAR_SEMICOLON: ";",
  9562. CHAR_SINGLE_QUOTE: "'",
  9563. CHAR_SPACE: " ",
  9564. CHAR_TAB: " ",
  9565. CHAR_UNDERSCORE: "_",
  9566. CHAR_VERTICAL_LINE: "|",
  9567. CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
  9568. };
  9569. }
  9570. });
  9571. var require_parse = __commonJS2({
  9572. "node_modules/braces/lib/parse.js"(exports2, module2) {
  9573. "use strict";
  9574. var stringify = require_stringify();
  9575. var {
  9576. MAX_LENGTH,
  9577. CHAR_BACKSLASH,
  9578. CHAR_BACKTICK,
  9579. CHAR_COMMA,
  9580. CHAR_DOT,
  9581. CHAR_LEFT_PARENTHESES,
  9582. CHAR_RIGHT_PARENTHESES,
  9583. CHAR_LEFT_CURLY_BRACE,
  9584. CHAR_RIGHT_CURLY_BRACE,
  9585. CHAR_LEFT_SQUARE_BRACKET,
  9586. CHAR_RIGHT_SQUARE_BRACKET,
  9587. CHAR_DOUBLE_QUOTE,
  9588. CHAR_SINGLE_QUOTE,
  9589. CHAR_NO_BREAK_SPACE,
  9590. CHAR_ZERO_WIDTH_NOBREAK_SPACE
  9591. } = require_constants2();
  9592. var parse = (input, options = {}) => {
  9593. if (typeof input !== "string") {
  9594. throw new TypeError("Expected a string");
  9595. }
  9596. let opts = options || {};
  9597. let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  9598. if (input.length > max) {
  9599. throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
  9600. }
  9601. let ast = {
  9602. type: "root",
  9603. input,
  9604. nodes: []
  9605. };
  9606. let stack = [ast];
  9607. let block = ast;
  9608. let prev = ast;
  9609. let brackets = 0;
  9610. let length = input.length;
  9611. let index = 0;
  9612. let depth = 0;
  9613. let value;
  9614. let memo = {};
  9615. const advance = () => input[index++];
  9616. const push = (node) => {
  9617. if (node.type === "text" && prev.type === "dot") {
  9618. prev.type = "text";
  9619. }
  9620. if (prev && prev.type === "text" && node.type === "text") {
  9621. prev.value += node.value;
  9622. return;
  9623. }
  9624. block.nodes.push(node);
  9625. node.parent = block;
  9626. node.prev = prev;
  9627. prev = node;
  9628. return node;
  9629. };
  9630. push({
  9631. type: "bos"
  9632. });
  9633. while (index < length) {
  9634. block = stack[stack.length - 1];
  9635. value = advance();
  9636. if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
  9637. continue;
  9638. }
  9639. if (value === CHAR_BACKSLASH) {
  9640. push({
  9641. type: "text",
  9642. value: (options.keepEscaping ? value : "") + advance()
  9643. });
  9644. continue;
  9645. }
  9646. if (value === CHAR_RIGHT_SQUARE_BRACKET) {
  9647. push({
  9648. type: "text",
  9649. value: "\\" + value
  9650. });
  9651. continue;
  9652. }
  9653. if (value === CHAR_LEFT_SQUARE_BRACKET) {
  9654. brackets++;
  9655. let closed = true;
  9656. let next;
  9657. while (index < length && (next = advance())) {
  9658. value += next;
  9659. if (next === CHAR_LEFT_SQUARE_BRACKET) {
  9660. brackets++;
  9661. continue;
  9662. }
  9663. if (next === CHAR_BACKSLASH) {
  9664. value += advance();
  9665. continue;
  9666. }
  9667. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  9668. brackets--;
  9669. if (brackets === 0) {
  9670. break;
  9671. }
  9672. }
  9673. }
  9674. push({
  9675. type: "text",
  9676. value
  9677. });
  9678. continue;
  9679. }
  9680. if (value === CHAR_LEFT_PARENTHESES) {
  9681. block = push({
  9682. type: "paren",
  9683. nodes: []
  9684. });
  9685. stack.push(block);
  9686. push({
  9687. type: "text",
  9688. value
  9689. });
  9690. continue;
  9691. }
  9692. if (value === CHAR_RIGHT_PARENTHESES) {
  9693. if (block.type !== "paren") {
  9694. push({
  9695. type: "text",
  9696. value
  9697. });
  9698. continue;
  9699. }
  9700. block = stack.pop();
  9701. push({
  9702. type: "text",
  9703. value
  9704. });
  9705. block = stack[stack.length - 1];
  9706. continue;
  9707. }
  9708. if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
  9709. let open = value;
  9710. let next;
  9711. if (options.keepQuotes !== true) {
  9712. value = "";
  9713. }
  9714. while (index < length && (next = advance())) {
  9715. if (next === CHAR_BACKSLASH) {
  9716. value += next + advance();
  9717. continue;
  9718. }
  9719. if (next === open) {
  9720. if (options.keepQuotes === true)
  9721. value += next;
  9722. break;
  9723. }
  9724. value += next;
  9725. }
  9726. push({
  9727. type: "text",
  9728. value
  9729. });
  9730. continue;
  9731. }
  9732. if (value === CHAR_LEFT_CURLY_BRACE) {
  9733. depth++;
  9734. let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
  9735. let brace = {
  9736. type: "brace",
  9737. open: true,
  9738. close: false,
  9739. dollar,
  9740. depth,
  9741. commas: 0,
  9742. ranges: 0,
  9743. nodes: []
  9744. };
  9745. block = push(brace);
  9746. stack.push(block);
  9747. push({
  9748. type: "open",
  9749. value
  9750. });
  9751. continue;
  9752. }
  9753. if (value === CHAR_RIGHT_CURLY_BRACE) {
  9754. if (block.type !== "brace") {
  9755. push({
  9756. type: "text",
  9757. value
  9758. });
  9759. continue;
  9760. }
  9761. let type = "close";
  9762. block = stack.pop();
  9763. block.close = true;
  9764. push({
  9765. type,
  9766. value
  9767. });
  9768. depth--;
  9769. block = stack[stack.length - 1];
  9770. continue;
  9771. }
  9772. if (value === CHAR_COMMA && depth > 0) {
  9773. if (block.ranges > 0) {
  9774. block.ranges = 0;
  9775. let open = block.nodes.shift();
  9776. block.nodes = [open, {
  9777. type: "text",
  9778. value: stringify(block)
  9779. }];
  9780. }
  9781. push({
  9782. type: "comma",
  9783. value
  9784. });
  9785. block.commas++;
  9786. continue;
  9787. }
  9788. if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
  9789. let siblings = block.nodes;
  9790. if (depth === 0 || siblings.length === 0) {
  9791. push({
  9792. type: "text",
  9793. value
  9794. });
  9795. continue;
  9796. }
  9797. if (prev.type === "dot") {
  9798. block.range = [];
  9799. prev.value += value;
  9800. prev.type = "range";
  9801. if (block.nodes.length !== 3 && block.nodes.length !== 5) {
  9802. block.invalid = true;
  9803. block.ranges = 0;
  9804. prev.type = "text";
  9805. continue;
  9806. }
  9807. block.ranges++;
  9808. block.args = [];
  9809. continue;
  9810. }
  9811. if (prev.type === "range") {
  9812. siblings.pop();
  9813. let before = siblings[siblings.length - 1];
  9814. before.value += prev.value + value;
  9815. prev = before;
  9816. block.ranges--;
  9817. continue;
  9818. }
  9819. push({
  9820. type: "dot",
  9821. value
  9822. });
  9823. continue;
  9824. }
  9825. push({
  9826. type: "text",
  9827. value
  9828. });
  9829. }
  9830. do {
  9831. block = stack.pop();
  9832. if (block.type !== "root") {
  9833. block.nodes.forEach((node) => {
  9834. if (!node.nodes) {
  9835. if (node.type === "open")
  9836. node.isOpen = true;
  9837. if (node.type === "close")
  9838. node.isClose = true;
  9839. if (!node.nodes)
  9840. node.type = "text";
  9841. node.invalid = true;
  9842. }
  9843. });
  9844. let parent = stack[stack.length - 1];
  9845. let index2 = parent.nodes.indexOf(block);
  9846. parent.nodes.splice(index2, 1, ...block.nodes);
  9847. }
  9848. } while (stack.length > 0);
  9849. push({
  9850. type: "eos"
  9851. });
  9852. return ast;
  9853. };
  9854. module2.exports = parse;
  9855. }
  9856. });
  9857. var require_braces = __commonJS2({
  9858. "node_modules/braces/index.js"(exports2, module2) {
  9859. "use strict";
  9860. var stringify = require_stringify();
  9861. var compile = require_compile();
  9862. var expand = require_expand();
  9863. var parse = require_parse();
  9864. var braces = (input, options = {}) => {
  9865. let output = [];
  9866. if (Array.isArray(input)) {
  9867. for (let pattern of input) {
  9868. let result = braces.create(pattern, options);
  9869. if (Array.isArray(result)) {
  9870. output.push(...result);
  9871. } else {
  9872. output.push(result);
  9873. }
  9874. }
  9875. } else {
  9876. output = [].concat(braces.create(input, options));
  9877. }
  9878. if (options && options.expand === true && options.nodupes === true) {
  9879. output = [...new Set(output)];
  9880. }
  9881. return output;
  9882. };
  9883. braces.parse = (input, options = {}) => parse(input, options);
  9884. braces.stringify = (input, options = {}) => {
  9885. if (typeof input === "string") {
  9886. return stringify(braces.parse(input, options), options);
  9887. }
  9888. return stringify(input, options);
  9889. };
  9890. braces.compile = (input, options = {}) => {
  9891. if (typeof input === "string") {
  9892. input = braces.parse(input, options);
  9893. }
  9894. return compile(input, options);
  9895. };
  9896. braces.expand = (input, options = {}) => {
  9897. if (typeof input === "string") {
  9898. input = braces.parse(input, options);
  9899. }
  9900. let result = expand(input, options);
  9901. if (options.noempty === true) {
  9902. result = result.filter(Boolean);
  9903. }
  9904. if (options.nodupes === true) {
  9905. result = [...new Set(result)];
  9906. }
  9907. return result;
  9908. };
  9909. braces.create = (input, options = {}) => {
  9910. if (input === "" || input.length < 3) {
  9911. return [input];
  9912. }
  9913. return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
  9914. };
  9915. module2.exports = braces;
  9916. }
  9917. });
  9918. var require_constants3 = __commonJS2({
  9919. "node_modules/picomatch/lib/constants.js"(exports2, module2) {
  9920. "use strict";
  9921. var path = require("path");
  9922. var WIN_SLASH = "\\\\/";
  9923. var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
  9924. var DOT_LITERAL = "\\.";
  9925. var PLUS_LITERAL = "\\+";
  9926. var QMARK_LITERAL = "\\?";
  9927. var SLASH_LITERAL = "\\/";
  9928. var ONE_CHAR = "(?=.)";
  9929. var QMARK = "[^/]";
  9930. var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
  9931. var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
  9932. var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
  9933. var NO_DOT = `(?!${DOT_LITERAL})`;
  9934. var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
  9935. var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
  9936. var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
  9937. var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
  9938. var STAR = `${QMARK}*?`;
  9939. var POSIX_CHARS = {
  9940. DOT_LITERAL,
  9941. PLUS_LITERAL,
  9942. QMARK_LITERAL,
  9943. SLASH_LITERAL,
  9944. ONE_CHAR,
  9945. QMARK,
  9946. END_ANCHOR,
  9947. DOTS_SLASH,
  9948. NO_DOT,
  9949. NO_DOTS,
  9950. NO_DOT_SLASH,
  9951. NO_DOTS_SLASH,
  9952. QMARK_NO_DOT,
  9953. STAR,
  9954. START_ANCHOR
  9955. };
  9956. var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
  9957. SLASH_LITERAL: `[${WIN_SLASH}]`,
  9958. QMARK: WIN_NO_SLASH,
  9959. STAR: `${WIN_NO_SLASH}*?`,
  9960. DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
  9961. NO_DOT: `(?!${DOT_LITERAL})`,
  9962. NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  9963. NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
  9964. NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
  9965. QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
  9966. START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
  9967. END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
  9968. });
  9969. var POSIX_REGEX_SOURCE = {
  9970. alnum: "a-zA-Z0-9",
  9971. alpha: "a-zA-Z",
  9972. ascii: "\\x00-\\x7F",
  9973. blank: " \\t",
  9974. cntrl: "\\x00-\\x1F\\x7F",
  9975. digit: "0-9",
  9976. graph: "\\x21-\\x7E",
  9977. lower: "a-z",
  9978. print: "\\x20-\\x7E ",
  9979. punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
  9980. space: " \\t\\r\\n\\v\\f",
  9981. upper: "A-Z",
  9982. word: "A-Za-z0-9_",
  9983. xdigit: "A-Fa-f0-9"
  9984. };
  9985. module2.exports = {
  9986. MAX_LENGTH: 1024 * 64,
  9987. POSIX_REGEX_SOURCE,
  9988. REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
  9989. REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
  9990. REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
  9991. REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
  9992. REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
  9993. REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
  9994. REPLACEMENTS: {
  9995. "***": "*",
  9996. "**/**": "**",
  9997. "**/**/**": "**"
  9998. },
  9999. CHAR_0: 48,
  10000. CHAR_9: 57,
  10001. CHAR_UPPERCASE_A: 65,
  10002. CHAR_LOWERCASE_A: 97,
  10003. CHAR_UPPERCASE_Z: 90,
  10004. CHAR_LOWERCASE_Z: 122,
  10005. CHAR_LEFT_PARENTHESES: 40,
  10006. CHAR_RIGHT_PARENTHESES: 41,
  10007. CHAR_ASTERISK: 42,
  10008. CHAR_AMPERSAND: 38,
  10009. CHAR_AT: 64,
  10010. CHAR_BACKWARD_SLASH: 92,
  10011. CHAR_CARRIAGE_RETURN: 13,
  10012. CHAR_CIRCUMFLEX_ACCENT: 94,
  10013. CHAR_COLON: 58,
  10014. CHAR_COMMA: 44,
  10015. CHAR_DOT: 46,
  10016. CHAR_DOUBLE_QUOTE: 34,
  10017. CHAR_EQUAL: 61,
  10018. CHAR_EXCLAMATION_MARK: 33,
  10019. CHAR_FORM_FEED: 12,
  10020. CHAR_FORWARD_SLASH: 47,
  10021. CHAR_GRAVE_ACCENT: 96,
  10022. CHAR_HASH: 35,
  10023. CHAR_HYPHEN_MINUS: 45,
  10024. CHAR_LEFT_ANGLE_BRACKET: 60,
  10025. CHAR_LEFT_CURLY_BRACE: 123,
  10026. CHAR_LEFT_SQUARE_BRACKET: 91,
  10027. CHAR_LINE_FEED: 10,
  10028. CHAR_NO_BREAK_SPACE: 160,
  10029. CHAR_PERCENT: 37,
  10030. CHAR_PLUS: 43,
  10031. CHAR_QUESTION_MARK: 63,
  10032. CHAR_RIGHT_ANGLE_BRACKET: 62,
  10033. CHAR_RIGHT_CURLY_BRACE: 125,
  10034. CHAR_RIGHT_SQUARE_BRACKET: 93,
  10035. CHAR_SEMICOLON: 59,
  10036. CHAR_SINGLE_QUOTE: 39,
  10037. CHAR_SPACE: 32,
  10038. CHAR_TAB: 9,
  10039. CHAR_UNDERSCORE: 95,
  10040. CHAR_VERTICAL_LINE: 124,
  10041. CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
  10042. SEP: path.sep,
  10043. extglobChars(chars) {
  10044. return {
  10045. "!": {
  10046. type: "negate",
  10047. open: "(?:(?!(?:",
  10048. close: `))${chars.STAR})`
  10049. },
  10050. "?": {
  10051. type: "qmark",
  10052. open: "(?:",
  10053. close: ")?"
  10054. },
  10055. "+": {
  10056. type: "plus",
  10057. open: "(?:",
  10058. close: ")+"
  10059. },
  10060. "*": {
  10061. type: "star",
  10062. open: "(?:",
  10063. close: ")*"
  10064. },
  10065. "@": {
  10066. type: "at",
  10067. open: "(?:",
  10068. close: ")"
  10069. }
  10070. };
  10071. },
  10072. globChars(win32) {
  10073. return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
  10074. }
  10075. };
  10076. }
  10077. });
  10078. var require_utils3 = __commonJS2({
  10079. "node_modules/picomatch/lib/utils.js"(exports2) {
  10080. "use strict";
  10081. var path = require("path");
  10082. var win32 = process.platform === "win32";
  10083. var {
  10084. REGEX_BACKSLASH,
  10085. REGEX_REMOVE_BACKSLASH,
  10086. REGEX_SPECIAL_CHARS,
  10087. REGEX_SPECIAL_CHARS_GLOBAL
  10088. } = require_constants3();
  10089. exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
  10090. exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
  10091. exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
  10092. exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
  10093. exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
  10094. exports2.removeBackslashes = (str) => {
  10095. return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
  10096. return match === "\\" ? "" : match;
  10097. });
  10098. };
  10099. exports2.supportsLookbehinds = () => {
  10100. const segs = process.version.slice(1).split(".").map(Number);
  10101. if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
  10102. return true;
  10103. }
  10104. return false;
  10105. };
  10106. exports2.isWindows = (options) => {
  10107. if (options && typeof options.windows === "boolean") {
  10108. return options.windows;
  10109. }
  10110. return win32 === true || path.sep === "\\";
  10111. };
  10112. exports2.escapeLast = (input, char, lastIdx) => {
  10113. const idx = input.lastIndexOf(char, lastIdx);
  10114. if (idx === -1)
  10115. return input;
  10116. if (input[idx - 1] === "\\")
  10117. return exports2.escapeLast(input, char, idx - 1);
  10118. return `${input.slice(0, idx)}\\${input.slice(idx)}`;
  10119. };
  10120. exports2.removePrefix = (input, state = {}) => {
  10121. let output = input;
  10122. if (output.startsWith("./")) {
  10123. output = output.slice(2);
  10124. state.prefix = "./";
  10125. }
  10126. return output;
  10127. };
  10128. exports2.wrapOutput = (input, state = {}, options = {}) => {
  10129. const prepend = options.contains ? "" : "^";
  10130. const append = options.contains ? "" : "$";
  10131. let output = `${prepend}(?:${input})${append}`;
  10132. if (state.negated === true) {
  10133. output = `(?:^(?!${output}).*$)`;
  10134. }
  10135. return output;
  10136. };
  10137. }
  10138. });
  10139. var require_scan = __commonJS2({
  10140. "node_modules/picomatch/lib/scan.js"(exports2, module2) {
  10141. "use strict";
  10142. var utils = require_utils3();
  10143. var {
  10144. CHAR_ASTERISK,
  10145. CHAR_AT,
  10146. CHAR_BACKWARD_SLASH,
  10147. CHAR_COMMA,
  10148. CHAR_DOT,
  10149. CHAR_EXCLAMATION_MARK,
  10150. CHAR_FORWARD_SLASH,
  10151. CHAR_LEFT_CURLY_BRACE,
  10152. CHAR_LEFT_PARENTHESES,
  10153. CHAR_LEFT_SQUARE_BRACKET,
  10154. CHAR_PLUS,
  10155. CHAR_QUESTION_MARK,
  10156. CHAR_RIGHT_CURLY_BRACE,
  10157. CHAR_RIGHT_PARENTHESES,
  10158. CHAR_RIGHT_SQUARE_BRACKET
  10159. } = require_constants3();
  10160. var isPathSeparator = (code) => {
  10161. return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
  10162. };
  10163. var depth = (token) => {
  10164. if (token.isPrefix !== true) {
  10165. token.depth = token.isGlobstar ? Infinity : 1;
  10166. }
  10167. };
  10168. var scan = (input, options) => {
  10169. const opts = options || {};
  10170. const length = input.length - 1;
  10171. const scanToEnd = opts.parts === true || opts.scanToEnd === true;
  10172. const slashes = [];
  10173. const tokens = [];
  10174. const parts = [];
  10175. let str = input;
  10176. let index = -1;
  10177. let start = 0;
  10178. let lastIndex = 0;
  10179. let isBrace = false;
  10180. let isBracket = false;
  10181. let isGlob = false;
  10182. let isExtglob = false;
  10183. let isGlobstar = false;
  10184. let braceEscaped = false;
  10185. let backslashes = false;
  10186. let negated = false;
  10187. let negatedExtglob = false;
  10188. let finished = false;
  10189. let braces = 0;
  10190. let prev;
  10191. let code;
  10192. let token = {
  10193. value: "",
  10194. depth: 0,
  10195. isGlob: false
  10196. };
  10197. const eos = () => index >= length;
  10198. const peek = () => str.charCodeAt(index + 1);
  10199. const advance = () => {
  10200. prev = code;
  10201. return str.charCodeAt(++index);
  10202. };
  10203. while (index < length) {
  10204. code = advance();
  10205. let next;
  10206. if (code === CHAR_BACKWARD_SLASH) {
  10207. backslashes = token.backslashes = true;
  10208. code = advance();
  10209. if (code === CHAR_LEFT_CURLY_BRACE) {
  10210. braceEscaped = true;
  10211. }
  10212. continue;
  10213. }
  10214. if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
  10215. braces++;
  10216. while (eos() !== true && (code = advance())) {
  10217. if (code === CHAR_BACKWARD_SLASH) {
  10218. backslashes = token.backslashes = true;
  10219. advance();
  10220. continue;
  10221. }
  10222. if (code === CHAR_LEFT_CURLY_BRACE) {
  10223. braces++;
  10224. continue;
  10225. }
  10226. if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
  10227. isBrace = token.isBrace = true;
  10228. isGlob = token.isGlob = true;
  10229. finished = true;
  10230. if (scanToEnd === true) {
  10231. continue;
  10232. }
  10233. break;
  10234. }
  10235. if (braceEscaped !== true && code === CHAR_COMMA) {
  10236. isBrace = token.isBrace = true;
  10237. isGlob = token.isGlob = true;
  10238. finished = true;
  10239. if (scanToEnd === true) {
  10240. continue;
  10241. }
  10242. break;
  10243. }
  10244. if (code === CHAR_RIGHT_CURLY_BRACE) {
  10245. braces--;
  10246. if (braces === 0) {
  10247. braceEscaped = false;
  10248. isBrace = token.isBrace = true;
  10249. finished = true;
  10250. break;
  10251. }
  10252. }
  10253. }
  10254. if (scanToEnd === true) {
  10255. continue;
  10256. }
  10257. break;
  10258. }
  10259. if (code === CHAR_FORWARD_SLASH) {
  10260. slashes.push(index);
  10261. tokens.push(token);
  10262. token = {
  10263. value: "",
  10264. depth: 0,
  10265. isGlob: false
  10266. };
  10267. if (finished === true)
  10268. continue;
  10269. if (prev === CHAR_DOT && index === start + 1) {
  10270. start += 2;
  10271. continue;
  10272. }
  10273. lastIndex = index + 1;
  10274. continue;
  10275. }
  10276. if (opts.noext !== true) {
  10277. const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
  10278. if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
  10279. isGlob = token.isGlob = true;
  10280. isExtglob = token.isExtglob = true;
  10281. finished = true;
  10282. if (code === CHAR_EXCLAMATION_MARK && index === start) {
  10283. negatedExtglob = true;
  10284. }
  10285. if (scanToEnd === true) {
  10286. while (eos() !== true && (code = advance())) {
  10287. if (code === CHAR_BACKWARD_SLASH) {
  10288. backslashes = token.backslashes = true;
  10289. code = advance();
  10290. continue;
  10291. }
  10292. if (code === CHAR_RIGHT_PARENTHESES) {
  10293. isGlob = token.isGlob = true;
  10294. finished = true;
  10295. break;
  10296. }
  10297. }
  10298. continue;
  10299. }
  10300. break;
  10301. }
  10302. }
  10303. if (code === CHAR_ASTERISK) {
  10304. if (prev === CHAR_ASTERISK)
  10305. isGlobstar = token.isGlobstar = true;
  10306. isGlob = token.isGlob = true;
  10307. finished = true;
  10308. if (scanToEnd === true) {
  10309. continue;
  10310. }
  10311. break;
  10312. }
  10313. if (code === CHAR_QUESTION_MARK) {
  10314. isGlob = token.isGlob = true;
  10315. finished = true;
  10316. if (scanToEnd === true) {
  10317. continue;
  10318. }
  10319. break;
  10320. }
  10321. if (code === CHAR_LEFT_SQUARE_BRACKET) {
  10322. while (eos() !== true && (next = advance())) {
  10323. if (next === CHAR_BACKWARD_SLASH) {
  10324. backslashes = token.backslashes = true;
  10325. advance();
  10326. continue;
  10327. }
  10328. if (next === CHAR_RIGHT_SQUARE_BRACKET) {
  10329. isBracket = token.isBracket = true;
  10330. isGlob = token.isGlob = true;
  10331. finished = true;
  10332. break;
  10333. }
  10334. }
  10335. if (scanToEnd === true) {
  10336. continue;
  10337. }
  10338. break;
  10339. }
  10340. if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
  10341. negated = token.negated = true;
  10342. start++;
  10343. continue;
  10344. }
  10345. if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
  10346. isGlob = token.isGlob = true;
  10347. if (scanToEnd === true) {
  10348. while (eos() !== true && (code = advance())) {
  10349. if (code === CHAR_LEFT_PARENTHESES) {
  10350. backslashes = token.backslashes = true;
  10351. code = advance();
  10352. continue;
  10353. }
  10354. if (code === CHAR_RIGHT_PARENTHESES) {
  10355. finished = true;
  10356. break;
  10357. }
  10358. }
  10359. continue;
  10360. }
  10361. break;
  10362. }
  10363. if (isGlob === true) {
  10364. finished = true;
  10365. if (scanToEnd === true) {
  10366. continue;
  10367. }
  10368. break;
  10369. }
  10370. }
  10371. if (opts.noext === true) {
  10372. isExtglob = false;
  10373. isGlob = false;
  10374. }
  10375. let base = str;
  10376. let prefix = "";
  10377. let glob = "";
  10378. if (start > 0) {
  10379. prefix = str.slice(0, start);
  10380. str = str.slice(start);
  10381. lastIndex -= start;
  10382. }
  10383. if (base && isGlob === true && lastIndex > 0) {
  10384. base = str.slice(0, lastIndex);
  10385. glob = str.slice(lastIndex);
  10386. } else if (isGlob === true) {
  10387. base = "";
  10388. glob = str;
  10389. } else {
  10390. base = str;
  10391. }
  10392. if (base && base !== "" && base !== "/" && base !== str) {
  10393. if (isPathSeparator(base.charCodeAt(base.length - 1))) {
  10394. base = base.slice(0, -1);
  10395. }
  10396. }
  10397. if (opts.unescape === true) {
  10398. if (glob)
  10399. glob = utils.removeBackslashes(glob);
  10400. if (base && backslashes === true) {
  10401. base = utils.removeBackslashes(base);
  10402. }
  10403. }
  10404. const state = {
  10405. prefix,
  10406. input,
  10407. start,
  10408. base,
  10409. glob,
  10410. isBrace,
  10411. isBracket,
  10412. isGlob,
  10413. isExtglob,
  10414. isGlobstar,
  10415. negated,
  10416. negatedExtglob
  10417. };
  10418. if (opts.tokens === true) {
  10419. state.maxDepth = 0;
  10420. if (!isPathSeparator(code)) {
  10421. tokens.push(token);
  10422. }
  10423. state.tokens = tokens;
  10424. }
  10425. if (opts.parts === true || opts.tokens === true) {
  10426. let prevIndex;
  10427. for (let idx = 0; idx < slashes.length; idx++) {
  10428. const n = prevIndex ? prevIndex + 1 : start;
  10429. const i = slashes[idx];
  10430. const value = input.slice(n, i);
  10431. if (opts.tokens) {
  10432. if (idx === 0 && start !== 0) {
  10433. tokens[idx].isPrefix = true;
  10434. tokens[idx].value = prefix;
  10435. } else {
  10436. tokens[idx].value = value;
  10437. }
  10438. depth(tokens[idx]);
  10439. state.maxDepth += tokens[idx].depth;
  10440. }
  10441. if (idx !== 0 || value !== "") {
  10442. parts.push(value);
  10443. }
  10444. prevIndex = i;
  10445. }
  10446. if (prevIndex && prevIndex + 1 < input.length) {
  10447. const value = input.slice(prevIndex + 1);
  10448. parts.push(value);
  10449. if (opts.tokens) {
  10450. tokens[tokens.length - 1].value = value;
  10451. depth(tokens[tokens.length - 1]);
  10452. state.maxDepth += tokens[tokens.length - 1].depth;
  10453. }
  10454. }
  10455. state.slashes = slashes;
  10456. state.parts = parts;
  10457. }
  10458. return state;
  10459. };
  10460. module2.exports = scan;
  10461. }
  10462. });
  10463. var require_parse2 = __commonJS2({
  10464. "node_modules/picomatch/lib/parse.js"(exports2, module2) {
  10465. "use strict";
  10466. var constants = require_constants3();
  10467. var utils = require_utils3();
  10468. var {
  10469. MAX_LENGTH,
  10470. POSIX_REGEX_SOURCE,
  10471. REGEX_NON_SPECIAL_CHARS,
  10472. REGEX_SPECIAL_CHARS_BACKREF,
  10473. REPLACEMENTS
  10474. } = constants;
  10475. var expandRange = (args, options) => {
  10476. if (typeof options.expandRange === "function") {
  10477. return options.expandRange(...args, options);
  10478. }
  10479. args.sort();
  10480. const value = `[${args.join("-")}]`;
  10481. try {
  10482. new RegExp(value);
  10483. } catch (ex) {
  10484. return args.map((v) => utils.escapeRegex(v)).join("..");
  10485. }
  10486. return value;
  10487. };
  10488. var syntaxError = (type, char) => {
  10489. return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
  10490. };
  10491. var parse = (input, options) => {
  10492. if (typeof input !== "string") {
  10493. throw new TypeError("Expected a string");
  10494. }
  10495. input = REPLACEMENTS[input] || input;
  10496. const opts = Object.assign({}, options);
  10497. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  10498. let len = input.length;
  10499. if (len > max) {
  10500. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  10501. }
  10502. const bos = {
  10503. type: "bos",
  10504. value: "",
  10505. output: opts.prepend || ""
  10506. };
  10507. const tokens = [bos];
  10508. const capture = opts.capture ? "" : "?:";
  10509. const win32 = utils.isWindows(options);
  10510. const PLATFORM_CHARS = constants.globChars(win32);
  10511. const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
  10512. const {
  10513. DOT_LITERAL,
  10514. PLUS_LITERAL,
  10515. SLASH_LITERAL,
  10516. ONE_CHAR,
  10517. DOTS_SLASH,
  10518. NO_DOT,
  10519. NO_DOT_SLASH,
  10520. NO_DOTS_SLASH,
  10521. QMARK,
  10522. QMARK_NO_DOT,
  10523. STAR,
  10524. START_ANCHOR
  10525. } = PLATFORM_CHARS;
  10526. const globstar = (opts2) => {
  10527. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  10528. };
  10529. const nodot = opts.dot ? "" : NO_DOT;
  10530. const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
  10531. let star = opts.bash === true ? globstar(opts) : STAR;
  10532. if (opts.capture) {
  10533. star = `(${star})`;
  10534. }
  10535. if (typeof opts.noext === "boolean") {
  10536. opts.noextglob = opts.noext;
  10537. }
  10538. const state = {
  10539. input,
  10540. index: -1,
  10541. start: 0,
  10542. dot: opts.dot === true,
  10543. consumed: "",
  10544. output: "",
  10545. prefix: "",
  10546. backtrack: false,
  10547. negated: false,
  10548. brackets: 0,
  10549. braces: 0,
  10550. parens: 0,
  10551. quotes: 0,
  10552. globstar: false,
  10553. tokens
  10554. };
  10555. input = utils.removePrefix(input, state);
  10556. len = input.length;
  10557. const extglobs = [];
  10558. const braces = [];
  10559. const stack = [];
  10560. let prev = bos;
  10561. let value;
  10562. const eos = () => state.index === len - 1;
  10563. const peek = state.peek = (n = 1) => input[state.index + n];
  10564. const advance = state.advance = () => input[++state.index] || "";
  10565. const remaining = () => input.slice(state.index + 1);
  10566. const consume = (value2 = "", num = 0) => {
  10567. state.consumed += value2;
  10568. state.index += num;
  10569. };
  10570. const append = (token) => {
  10571. state.output += token.output != null ? token.output : token.value;
  10572. consume(token.value);
  10573. };
  10574. const negate = () => {
  10575. let count = 1;
  10576. while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
  10577. advance();
  10578. state.start++;
  10579. count++;
  10580. }
  10581. if (count % 2 === 0) {
  10582. return false;
  10583. }
  10584. state.negated = true;
  10585. state.start++;
  10586. return true;
  10587. };
  10588. const increment = (type) => {
  10589. state[type]++;
  10590. stack.push(type);
  10591. };
  10592. const decrement = (type) => {
  10593. state[type]--;
  10594. stack.pop();
  10595. };
  10596. const push = (tok) => {
  10597. if (prev.type === "globstar") {
  10598. const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
  10599. const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
  10600. if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
  10601. state.output = state.output.slice(0, -prev.output.length);
  10602. prev.type = "star";
  10603. prev.value = "*";
  10604. prev.output = star;
  10605. state.output += prev.output;
  10606. }
  10607. }
  10608. if (extglobs.length && tok.type !== "paren") {
  10609. extglobs[extglobs.length - 1].inner += tok.value;
  10610. }
  10611. if (tok.value || tok.output)
  10612. append(tok);
  10613. if (prev && prev.type === "text" && tok.type === "text") {
  10614. prev.value += tok.value;
  10615. prev.output = (prev.output || "") + tok.value;
  10616. return;
  10617. }
  10618. tok.prev = prev;
  10619. tokens.push(tok);
  10620. prev = tok;
  10621. };
  10622. const extglobOpen = (type, value2) => {
  10623. const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
  10624. conditions: 1,
  10625. inner: ""
  10626. });
  10627. token.prev = prev;
  10628. token.parens = state.parens;
  10629. token.output = state.output;
  10630. const output = (opts.capture ? "(" : "") + token.open;
  10631. increment("parens");
  10632. push({
  10633. type,
  10634. value: value2,
  10635. output: state.output ? "" : ONE_CHAR
  10636. });
  10637. push({
  10638. type: "paren",
  10639. extglob: true,
  10640. value: advance(),
  10641. output
  10642. });
  10643. extglobs.push(token);
  10644. };
  10645. const extglobClose = (token) => {
  10646. let output = token.close + (opts.capture ? ")" : "");
  10647. let rest;
  10648. if (token.type === "negate") {
  10649. let extglobStar = star;
  10650. if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
  10651. extglobStar = globstar(opts);
  10652. }
  10653. if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
  10654. output = token.close = `)$))${extglobStar}`;
  10655. }
  10656. if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
  10657. const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
  10658. fastpaths: false
  10659. })).output;
  10660. output = token.close = `)${expression})${extglobStar})`;
  10661. }
  10662. if (token.prev.type === "bos") {
  10663. state.negatedExtglob = true;
  10664. }
  10665. }
  10666. push({
  10667. type: "paren",
  10668. extglob: true,
  10669. value,
  10670. output
  10671. });
  10672. decrement("parens");
  10673. };
  10674. if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
  10675. let backslashes = false;
  10676. let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
  10677. if (first === "\\") {
  10678. backslashes = true;
  10679. return m;
  10680. }
  10681. if (first === "?") {
  10682. if (esc) {
  10683. return esc + first + (rest ? QMARK.repeat(rest.length) : "");
  10684. }
  10685. if (index === 0) {
  10686. return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
  10687. }
  10688. return QMARK.repeat(chars.length);
  10689. }
  10690. if (first === ".") {
  10691. return DOT_LITERAL.repeat(chars.length);
  10692. }
  10693. if (first === "*") {
  10694. if (esc) {
  10695. return esc + first + (rest ? star : "");
  10696. }
  10697. return star;
  10698. }
  10699. return esc ? m : `\\${m}`;
  10700. });
  10701. if (backslashes === true) {
  10702. if (opts.unescape === true) {
  10703. output = output.replace(/\\/g, "");
  10704. } else {
  10705. output = output.replace(/\\+/g, (m) => {
  10706. return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
  10707. });
  10708. }
  10709. }
  10710. if (output === input && opts.contains === true) {
  10711. state.output = input;
  10712. return state;
  10713. }
  10714. state.output = utils.wrapOutput(output, state, options);
  10715. return state;
  10716. }
  10717. while (!eos()) {
  10718. value = advance();
  10719. if (value === "\0") {
  10720. continue;
  10721. }
  10722. if (value === "\\") {
  10723. const next = peek();
  10724. if (next === "/" && opts.bash !== true) {
  10725. continue;
  10726. }
  10727. if (next === "." || next === ";") {
  10728. continue;
  10729. }
  10730. if (!next) {
  10731. value += "\\";
  10732. push({
  10733. type: "text",
  10734. value
  10735. });
  10736. continue;
  10737. }
  10738. const match = /^\\+/.exec(remaining());
  10739. let slashes = 0;
  10740. if (match && match[0].length > 2) {
  10741. slashes = match[0].length;
  10742. state.index += slashes;
  10743. if (slashes % 2 !== 0) {
  10744. value += "\\";
  10745. }
  10746. }
  10747. if (opts.unescape === true) {
  10748. value = advance();
  10749. } else {
  10750. value += advance();
  10751. }
  10752. if (state.brackets === 0) {
  10753. push({
  10754. type: "text",
  10755. value
  10756. });
  10757. continue;
  10758. }
  10759. }
  10760. if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
  10761. if (opts.posix !== false && value === ":") {
  10762. const inner = prev.value.slice(1);
  10763. if (inner.includes("[")) {
  10764. prev.posix = true;
  10765. if (inner.includes(":")) {
  10766. const idx = prev.value.lastIndexOf("[");
  10767. const pre = prev.value.slice(0, idx);
  10768. const rest2 = prev.value.slice(idx + 2);
  10769. const posix = POSIX_REGEX_SOURCE[rest2];
  10770. if (posix) {
  10771. prev.value = pre + posix;
  10772. state.backtrack = true;
  10773. advance();
  10774. if (!bos.output && tokens.indexOf(prev) === 1) {
  10775. bos.output = ONE_CHAR;
  10776. }
  10777. continue;
  10778. }
  10779. }
  10780. }
  10781. }
  10782. if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
  10783. value = `\\${value}`;
  10784. }
  10785. if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
  10786. value = `\\${value}`;
  10787. }
  10788. if (opts.posix === true && value === "!" && prev.value === "[") {
  10789. value = "^";
  10790. }
  10791. prev.value += value;
  10792. append({
  10793. value
  10794. });
  10795. continue;
  10796. }
  10797. if (state.quotes === 1 && value !== '"') {
  10798. value = utils.escapeRegex(value);
  10799. prev.value += value;
  10800. append({
  10801. value
  10802. });
  10803. continue;
  10804. }
  10805. if (value === '"') {
  10806. state.quotes = state.quotes === 1 ? 0 : 1;
  10807. if (opts.keepQuotes === true) {
  10808. push({
  10809. type: "text",
  10810. value
  10811. });
  10812. }
  10813. continue;
  10814. }
  10815. if (value === "(") {
  10816. increment("parens");
  10817. push({
  10818. type: "paren",
  10819. value
  10820. });
  10821. continue;
  10822. }
  10823. if (value === ")") {
  10824. if (state.parens === 0 && opts.strictBrackets === true) {
  10825. throw new SyntaxError(syntaxError("opening", "("));
  10826. }
  10827. const extglob = extglobs[extglobs.length - 1];
  10828. if (extglob && state.parens === extglob.parens + 1) {
  10829. extglobClose(extglobs.pop());
  10830. continue;
  10831. }
  10832. push({
  10833. type: "paren",
  10834. value,
  10835. output: state.parens ? ")" : "\\)"
  10836. });
  10837. decrement("parens");
  10838. continue;
  10839. }
  10840. if (value === "[") {
  10841. if (opts.nobracket === true || !remaining().includes("]")) {
  10842. if (opts.nobracket !== true && opts.strictBrackets === true) {
  10843. throw new SyntaxError(syntaxError("closing", "]"));
  10844. }
  10845. value = `\\${value}`;
  10846. } else {
  10847. increment("brackets");
  10848. }
  10849. push({
  10850. type: "bracket",
  10851. value
  10852. });
  10853. continue;
  10854. }
  10855. if (value === "]") {
  10856. if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
  10857. push({
  10858. type: "text",
  10859. value,
  10860. output: `\\${value}`
  10861. });
  10862. continue;
  10863. }
  10864. if (state.brackets === 0) {
  10865. if (opts.strictBrackets === true) {
  10866. throw new SyntaxError(syntaxError("opening", "["));
  10867. }
  10868. push({
  10869. type: "text",
  10870. value,
  10871. output: `\\${value}`
  10872. });
  10873. continue;
  10874. }
  10875. decrement("brackets");
  10876. const prevValue = prev.value.slice(1);
  10877. if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
  10878. value = `/${value}`;
  10879. }
  10880. prev.value += value;
  10881. append({
  10882. value
  10883. });
  10884. if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
  10885. continue;
  10886. }
  10887. const escaped = utils.escapeRegex(prev.value);
  10888. state.output = state.output.slice(0, -prev.value.length);
  10889. if (opts.literalBrackets === true) {
  10890. state.output += escaped;
  10891. prev.value = escaped;
  10892. continue;
  10893. }
  10894. prev.value = `(${capture}${escaped}|${prev.value})`;
  10895. state.output += prev.value;
  10896. continue;
  10897. }
  10898. if (value === "{" && opts.nobrace !== true) {
  10899. increment("braces");
  10900. const open = {
  10901. type: "brace",
  10902. value,
  10903. output: "(",
  10904. outputIndex: state.output.length,
  10905. tokensIndex: state.tokens.length
  10906. };
  10907. braces.push(open);
  10908. push(open);
  10909. continue;
  10910. }
  10911. if (value === "}") {
  10912. const brace = braces[braces.length - 1];
  10913. if (opts.nobrace === true || !brace) {
  10914. push({
  10915. type: "text",
  10916. value,
  10917. output: value
  10918. });
  10919. continue;
  10920. }
  10921. let output = ")";
  10922. if (brace.dots === true) {
  10923. const arr = tokens.slice();
  10924. const range = [];
  10925. for (let i = arr.length - 1; i >= 0; i--) {
  10926. tokens.pop();
  10927. if (arr[i].type === "brace") {
  10928. break;
  10929. }
  10930. if (arr[i].type !== "dots") {
  10931. range.unshift(arr[i].value);
  10932. }
  10933. }
  10934. output = expandRange(range, opts);
  10935. state.backtrack = true;
  10936. }
  10937. if (brace.comma !== true && brace.dots !== true) {
  10938. const out = state.output.slice(0, brace.outputIndex);
  10939. const toks = state.tokens.slice(brace.tokensIndex);
  10940. brace.value = brace.output = "\\{";
  10941. value = output = "\\}";
  10942. state.output = out;
  10943. for (const t of toks) {
  10944. state.output += t.output || t.value;
  10945. }
  10946. }
  10947. push({
  10948. type: "brace",
  10949. value,
  10950. output
  10951. });
  10952. decrement("braces");
  10953. braces.pop();
  10954. continue;
  10955. }
  10956. if (value === "|") {
  10957. if (extglobs.length > 0) {
  10958. extglobs[extglobs.length - 1].conditions++;
  10959. }
  10960. push({
  10961. type: "text",
  10962. value
  10963. });
  10964. continue;
  10965. }
  10966. if (value === ",") {
  10967. let output = value;
  10968. const brace = braces[braces.length - 1];
  10969. if (brace && stack[stack.length - 1] === "braces") {
  10970. brace.comma = true;
  10971. output = "|";
  10972. }
  10973. push({
  10974. type: "comma",
  10975. value,
  10976. output
  10977. });
  10978. continue;
  10979. }
  10980. if (value === "/") {
  10981. if (prev.type === "dot" && state.index === state.start + 1) {
  10982. state.start = state.index + 1;
  10983. state.consumed = "";
  10984. state.output = "";
  10985. tokens.pop();
  10986. prev = bos;
  10987. continue;
  10988. }
  10989. push({
  10990. type: "slash",
  10991. value,
  10992. output: SLASH_LITERAL
  10993. });
  10994. continue;
  10995. }
  10996. if (value === ".") {
  10997. if (state.braces > 0 && prev.type === "dot") {
  10998. if (prev.value === ".")
  10999. prev.output = DOT_LITERAL;
  11000. const brace = braces[braces.length - 1];
  11001. prev.type = "dots";
  11002. prev.output += value;
  11003. prev.value += value;
  11004. brace.dots = true;
  11005. continue;
  11006. }
  11007. if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
  11008. push({
  11009. type: "text",
  11010. value,
  11011. output: DOT_LITERAL
  11012. });
  11013. continue;
  11014. }
  11015. push({
  11016. type: "dot",
  11017. value,
  11018. output: DOT_LITERAL
  11019. });
  11020. continue;
  11021. }
  11022. if (value === "?") {
  11023. const isGroup = prev && prev.value === "(";
  11024. if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11025. extglobOpen("qmark", value);
  11026. continue;
  11027. }
  11028. if (prev && prev.type === "paren") {
  11029. const next = peek();
  11030. let output = value;
  11031. if (next === "<" && !utils.supportsLookbehinds()) {
  11032. throw new Error("Node.js v10 or higher is required for regex lookbehinds");
  11033. }
  11034. if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
  11035. output = `\\${value}`;
  11036. }
  11037. push({
  11038. type: "text",
  11039. value,
  11040. output
  11041. });
  11042. continue;
  11043. }
  11044. if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
  11045. push({
  11046. type: "qmark",
  11047. value,
  11048. output: QMARK_NO_DOT
  11049. });
  11050. continue;
  11051. }
  11052. push({
  11053. type: "qmark",
  11054. value,
  11055. output: QMARK
  11056. });
  11057. continue;
  11058. }
  11059. if (value === "!") {
  11060. if (opts.noextglob !== true && peek() === "(") {
  11061. if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
  11062. extglobOpen("negate", value);
  11063. continue;
  11064. }
  11065. }
  11066. if (opts.nonegate !== true && state.index === 0) {
  11067. negate();
  11068. continue;
  11069. }
  11070. }
  11071. if (value === "+") {
  11072. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11073. extglobOpen("plus", value);
  11074. continue;
  11075. }
  11076. if (prev && prev.value === "(" || opts.regex === false) {
  11077. push({
  11078. type: "plus",
  11079. value,
  11080. output: PLUS_LITERAL
  11081. });
  11082. continue;
  11083. }
  11084. if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
  11085. push({
  11086. type: "plus",
  11087. value
  11088. });
  11089. continue;
  11090. }
  11091. push({
  11092. type: "plus",
  11093. value: PLUS_LITERAL
  11094. });
  11095. continue;
  11096. }
  11097. if (value === "@") {
  11098. if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
  11099. push({
  11100. type: "at",
  11101. extglob: true,
  11102. value,
  11103. output: ""
  11104. });
  11105. continue;
  11106. }
  11107. push({
  11108. type: "text",
  11109. value
  11110. });
  11111. continue;
  11112. }
  11113. if (value !== "*") {
  11114. if (value === "$" || value === "^") {
  11115. value = `\\${value}`;
  11116. }
  11117. const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
  11118. if (match) {
  11119. value += match[0];
  11120. state.index += match[0].length;
  11121. }
  11122. push({
  11123. type: "text",
  11124. value
  11125. });
  11126. continue;
  11127. }
  11128. if (prev && (prev.type === "globstar" || prev.star === true)) {
  11129. prev.type = "star";
  11130. prev.star = true;
  11131. prev.value += value;
  11132. prev.output = star;
  11133. state.backtrack = true;
  11134. state.globstar = true;
  11135. consume(value);
  11136. continue;
  11137. }
  11138. let rest = remaining();
  11139. if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
  11140. extglobOpen("star", value);
  11141. continue;
  11142. }
  11143. if (prev.type === "star") {
  11144. if (opts.noglobstar === true) {
  11145. consume(value);
  11146. continue;
  11147. }
  11148. const prior = prev.prev;
  11149. const before = prior.prev;
  11150. const isStart = prior.type === "slash" || prior.type === "bos";
  11151. const afterStar = before && (before.type === "star" || before.type === "globstar");
  11152. if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
  11153. push({
  11154. type: "star",
  11155. value,
  11156. output: ""
  11157. });
  11158. continue;
  11159. }
  11160. const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
  11161. const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
  11162. if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
  11163. push({
  11164. type: "star",
  11165. value,
  11166. output: ""
  11167. });
  11168. continue;
  11169. }
  11170. while (rest.slice(0, 3) === "/**") {
  11171. const after = input[state.index + 4];
  11172. if (after && after !== "/") {
  11173. break;
  11174. }
  11175. rest = rest.slice(3);
  11176. consume("/**", 3);
  11177. }
  11178. if (prior.type === "bos" && eos()) {
  11179. prev.type = "globstar";
  11180. prev.value += value;
  11181. prev.output = globstar(opts);
  11182. state.output = prev.output;
  11183. state.globstar = true;
  11184. consume(value);
  11185. continue;
  11186. }
  11187. if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
  11188. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11189. prior.output = `(?:${prior.output}`;
  11190. prev.type = "globstar";
  11191. prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
  11192. prev.value += value;
  11193. state.globstar = true;
  11194. state.output += prior.output + prev.output;
  11195. consume(value);
  11196. continue;
  11197. }
  11198. if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
  11199. const end = rest[1] !== void 0 ? "|$" : "";
  11200. state.output = state.output.slice(0, -(prior.output + prev.output).length);
  11201. prior.output = `(?:${prior.output}`;
  11202. prev.type = "globstar";
  11203. prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
  11204. prev.value += value;
  11205. state.output += prior.output + prev.output;
  11206. state.globstar = true;
  11207. consume(value + advance());
  11208. push({
  11209. type: "slash",
  11210. value: "/",
  11211. output: ""
  11212. });
  11213. continue;
  11214. }
  11215. if (prior.type === "bos" && rest[0] === "/") {
  11216. prev.type = "globstar";
  11217. prev.value += value;
  11218. prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
  11219. state.output = prev.output;
  11220. state.globstar = true;
  11221. consume(value + advance());
  11222. push({
  11223. type: "slash",
  11224. value: "/",
  11225. output: ""
  11226. });
  11227. continue;
  11228. }
  11229. state.output = state.output.slice(0, -prev.output.length);
  11230. prev.type = "globstar";
  11231. prev.output = globstar(opts);
  11232. prev.value += value;
  11233. state.output += prev.output;
  11234. state.globstar = true;
  11235. consume(value);
  11236. continue;
  11237. }
  11238. const token = {
  11239. type: "star",
  11240. value,
  11241. output: star
  11242. };
  11243. if (opts.bash === true) {
  11244. token.output = ".*?";
  11245. if (prev.type === "bos" || prev.type === "slash") {
  11246. token.output = nodot + token.output;
  11247. }
  11248. push(token);
  11249. continue;
  11250. }
  11251. if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
  11252. token.output = value;
  11253. push(token);
  11254. continue;
  11255. }
  11256. if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
  11257. if (prev.type === "dot") {
  11258. state.output += NO_DOT_SLASH;
  11259. prev.output += NO_DOT_SLASH;
  11260. } else if (opts.dot === true) {
  11261. state.output += NO_DOTS_SLASH;
  11262. prev.output += NO_DOTS_SLASH;
  11263. } else {
  11264. state.output += nodot;
  11265. prev.output += nodot;
  11266. }
  11267. if (peek() !== "*") {
  11268. state.output += ONE_CHAR;
  11269. prev.output += ONE_CHAR;
  11270. }
  11271. }
  11272. push(token);
  11273. }
  11274. while (state.brackets > 0) {
  11275. if (opts.strictBrackets === true)
  11276. throw new SyntaxError(syntaxError("closing", "]"));
  11277. state.output = utils.escapeLast(state.output, "[");
  11278. decrement("brackets");
  11279. }
  11280. while (state.parens > 0) {
  11281. if (opts.strictBrackets === true)
  11282. throw new SyntaxError(syntaxError("closing", ")"));
  11283. state.output = utils.escapeLast(state.output, "(");
  11284. decrement("parens");
  11285. }
  11286. while (state.braces > 0) {
  11287. if (opts.strictBrackets === true)
  11288. throw new SyntaxError(syntaxError("closing", "}"));
  11289. state.output = utils.escapeLast(state.output, "{");
  11290. decrement("braces");
  11291. }
  11292. if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
  11293. push({
  11294. type: "maybe_slash",
  11295. value: "",
  11296. output: `${SLASH_LITERAL}?`
  11297. });
  11298. }
  11299. if (state.backtrack === true) {
  11300. state.output = "";
  11301. for (const token of state.tokens) {
  11302. state.output += token.output != null ? token.output : token.value;
  11303. if (token.suffix) {
  11304. state.output += token.suffix;
  11305. }
  11306. }
  11307. }
  11308. return state;
  11309. };
  11310. parse.fastpaths = (input, options) => {
  11311. const opts = Object.assign({}, options);
  11312. const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
  11313. const len = input.length;
  11314. if (len > max) {
  11315. throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
  11316. }
  11317. input = REPLACEMENTS[input] || input;
  11318. const win32 = utils.isWindows(options);
  11319. const {
  11320. DOT_LITERAL,
  11321. SLASH_LITERAL,
  11322. ONE_CHAR,
  11323. DOTS_SLASH,
  11324. NO_DOT,
  11325. NO_DOTS,
  11326. NO_DOTS_SLASH,
  11327. STAR,
  11328. START_ANCHOR
  11329. } = constants.globChars(win32);
  11330. const nodot = opts.dot ? NO_DOTS : NO_DOT;
  11331. const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
  11332. const capture = opts.capture ? "" : "?:";
  11333. const state = {
  11334. negated: false,
  11335. prefix: ""
  11336. };
  11337. let star = opts.bash === true ? ".*?" : STAR;
  11338. if (opts.capture) {
  11339. star = `(${star})`;
  11340. }
  11341. const globstar = (opts2) => {
  11342. if (opts2.noglobstar === true)
  11343. return star;
  11344. return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
  11345. };
  11346. const create = (str) => {
  11347. switch (str) {
  11348. case "*":
  11349. return `${nodot}${ONE_CHAR}${star}`;
  11350. case ".*":
  11351. return `${DOT_LITERAL}${ONE_CHAR}${star}`;
  11352. case "*.*":
  11353. return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11354. case "*/*":
  11355. return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
  11356. case "**":
  11357. return nodot + globstar(opts);
  11358. case "**/*":
  11359. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
  11360. case "**/*.*":
  11361. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
  11362. case "**/.*":
  11363. return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
  11364. default: {
  11365. const match = /^(.*?)\.(\w+)$/.exec(str);
  11366. if (!match)
  11367. return;
  11368. const source2 = create(match[1]);
  11369. if (!source2)
  11370. return;
  11371. return source2 + DOT_LITERAL + match[2];
  11372. }
  11373. }
  11374. };
  11375. const output = utils.removePrefix(input, state);
  11376. let source = create(output);
  11377. if (source && opts.strictSlashes !== true) {
  11378. source += `${SLASH_LITERAL}?`;
  11379. }
  11380. return source;
  11381. };
  11382. module2.exports = parse;
  11383. }
  11384. });
  11385. var require_picomatch = __commonJS2({
  11386. "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
  11387. "use strict";
  11388. var path = require("path");
  11389. var scan = require_scan();
  11390. var parse = require_parse2();
  11391. var utils = require_utils3();
  11392. var constants = require_constants3();
  11393. var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
  11394. var picomatch = (glob, options, returnState = false) => {
  11395. if (Array.isArray(glob)) {
  11396. const fns = glob.map((input) => picomatch(input, options, returnState));
  11397. const arrayMatcher = (str) => {
  11398. for (const isMatch of fns) {
  11399. const state2 = isMatch(str);
  11400. if (state2)
  11401. return state2;
  11402. }
  11403. return false;
  11404. };
  11405. return arrayMatcher;
  11406. }
  11407. const isState = isObject(glob) && glob.tokens && glob.input;
  11408. if (glob === "" || typeof glob !== "string" && !isState) {
  11409. throw new TypeError("Expected pattern to be a non-empty string");
  11410. }
  11411. const opts = options || {};
  11412. const posix = utils.isWindows(options);
  11413. const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
  11414. const state = regex.state;
  11415. delete regex.state;
  11416. let isIgnored = () => false;
  11417. if (opts.ignore) {
  11418. const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
  11419. ignore: null,
  11420. onMatch: null,
  11421. onResult: null
  11422. });
  11423. isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
  11424. }
  11425. const matcher = (input, returnObject = false) => {
  11426. const {
  11427. isMatch,
  11428. match,
  11429. output
  11430. } = picomatch.test(input, regex, options, {
  11431. glob,
  11432. posix
  11433. });
  11434. const result = {
  11435. glob,
  11436. state,
  11437. regex,
  11438. posix,
  11439. input,
  11440. output,
  11441. match,
  11442. isMatch
  11443. };
  11444. if (typeof opts.onResult === "function") {
  11445. opts.onResult(result);
  11446. }
  11447. if (isMatch === false) {
  11448. result.isMatch = false;
  11449. return returnObject ? result : false;
  11450. }
  11451. if (isIgnored(input)) {
  11452. if (typeof opts.onIgnore === "function") {
  11453. opts.onIgnore(result);
  11454. }
  11455. result.isMatch = false;
  11456. return returnObject ? result : false;
  11457. }
  11458. if (typeof opts.onMatch === "function") {
  11459. opts.onMatch(result);
  11460. }
  11461. return returnObject ? result : true;
  11462. };
  11463. if (returnState) {
  11464. matcher.state = state;
  11465. }
  11466. return matcher;
  11467. };
  11468. picomatch.test = (input, regex, options, {
  11469. glob,
  11470. posix
  11471. } = {}) => {
  11472. if (typeof input !== "string") {
  11473. throw new TypeError("Expected input to be a string");
  11474. }
  11475. if (input === "") {
  11476. return {
  11477. isMatch: false,
  11478. output: ""
  11479. };
  11480. }
  11481. const opts = options || {};
  11482. const format = opts.format || (posix ? utils.toPosixSlashes : null);
  11483. let match = input === glob;
  11484. let output = match && format ? format(input) : input;
  11485. if (match === false) {
  11486. output = format ? format(input) : input;
  11487. match = output === glob;
  11488. }
  11489. if (match === false || opts.capture === true) {
  11490. if (opts.matchBase === true || opts.basename === true) {
  11491. match = picomatch.matchBase(input, regex, options, posix);
  11492. } else {
  11493. match = regex.exec(output);
  11494. }
  11495. }
  11496. return {
  11497. isMatch: Boolean(match),
  11498. match,
  11499. output
  11500. };
  11501. };
  11502. picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
  11503. const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
  11504. return regex.test(path.basename(input));
  11505. };
  11506. picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11507. picomatch.parse = (pattern, options) => {
  11508. if (Array.isArray(pattern))
  11509. return pattern.map((p) => picomatch.parse(p, options));
  11510. return parse(pattern, Object.assign(Object.assign({}, options), {}, {
  11511. fastpaths: false
  11512. }));
  11513. };
  11514. picomatch.scan = (input, options) => scan(input, options);
  11515. picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
  11516. if (returnOutput === true) {
  11517. return state.output;
  11518. }
  11519. const opts = options || {};
  11520. const prepend = opts.contains ? "" : "^";
  11521. const append = opts.contains ? "" : "$";
  11522. let source = `${prepend}(?:${state.output})${append}`;
  11523. if (state && state.negated === true) {
  11524. source = `^(?!${source}).*$`;
  11525. }
  11526. const regex = picomatch.toRegex(source, options);
  11527. if (returnState === true) {
  11528. regex.state = state;
  11529. }
  11530. return regex;
  11531. };
  11532. picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
  11533. if (!input || typeof input !== "string") {
  11534. throw new TypeError("Expected a non-empty string");
  11535. }
  11536. let parsed = {
  11537. negated: false,
  11538. fastpaths: true
  11539. };
  11540. if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
  11541. parsed.output = parse.fastpaths(input, options);
  11542. }
  11543. if (!parsed.output) {
  11544. parsed = parse(input, options);
  11545. }
  11546. return picomatch.compileRe(parsed, options, returnOutput, returnState);
  11547. };
  11548. picomatch.toRegex = (source, options) => {
  11549. try {
  11550. const opts = options || {};
  11551. return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
  11552. } catch (err) {
  11553. if (options && options.debug === true)
  11554. throw err;
  11555. return /$^/;
  11556. }
  11557. };
  11558. picomatch.constants = constants;
  11559. module2.exports = picomatch;
  11560. }
  11561. });
  11562. var require_picomatch2 = __commonJS2({
  11563. "node_modules/picomatch/index.js"(exports2, module2) {
  11564. "use strict";
  11565. module2.exports = require_picomatch();
  11566. }
  11567. });
  11568. var require_micromatch = __commonJS2({
  11569. "node_modules/micromatch/index.js"(exports2, module2) {
  11570. "use strict";
  11571. var util = require("util");
  11572. var braces = require_braces();
  11573. var picomatch = require_picomatch2();
  11574. var utils = require_utils3();
  11575. var isEmptyString = (val) => val === "" || val === "./";
  11576. var micromatch = (list, patterns, options) => {
  11577. patterns = [].concat(patterns);
  11578. list = [].concat(list);
  11579. let omit = /* @__PURE__ */ new Set();
  11580. let keep = /* @__PURE__ */ new Set();
  11581. let items = /* @__PURE__ */ new Set();
  11582. let negatives = 0;
  11583. let onResult = (state) => {
  11584. items.add(state.output);
  11585. if (options && options.onResult) {
  11586. options.onResult(state);
  11587. }
  11588. };
  11589. for (let i = 0; i < patterns.length; i++) {
  11590. let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
  11591. onResult
  11592. }), true);
  11593. let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
  11594. if (negated)
  11595. negatives++;
  11596. for (let item of list) {
  11597. let matched = isMatch(item, true);
  11598. let match = negated ? !matched.isMatch : matched.isMatch;
  11599. if (!match)
  11600. continue;
  11601. if (negated) {
  11602. omit.add(matched.output);
  11603. } else {
  11604. omit.delete(matched.output);
  11605. keep.add(matched.output);
  11606. }
  11607. }
  11608. }
  11609. let result = negatives === patterns.length ? [...items] : [...keep];
  11610. let matches = result.filter((item) => !omit.has(item));
  11611. if (options && matches.length === 0) {
  11612. if (options.failglob === true) {
  11613. throw new Error(`No matches found for "${patterns.join(", ")}"`);
  11614. }
  11615. if (options.nonull === true || options.nullglob === true) {
  11616. return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
  11617. }
  11618. }
  11619. return matches;
  11620. };
  11621. micromatch.match = micromatch;
  11622. micromatch.matcher = (pattern, options) => picomatch(pattern, options);
  11623. micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
  11624. micromatch.any = micromatch.isMatch;
  11625. micromatch.not = (list, patterns, options = {}) => {
  11626. patterns = [].concat(patterns).map(String);
  11627. let result = /* @__PURE__ */ new Set();
  11628. let items = [];
  11629. let onResult = (state) => {
  11630. if (options.onResult)
  11631. options.onResult(state);
  11632. items.push(state.output);
  11633. };
  11634. let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
  11635. onResult
  11636. })));
  11637. for (let item of items) {
  11638. if (!matches.has(item)) {
  11639. result.add(item);
  11640. }
  11641. }
  11642. return [...result];
  11643. };
  11644. micromatch.contains = (str, pattern, options) => {
  11645. if (typeof str !== "string") {
  11646. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11647. }
  11648. if (Array.isArray(pattern)) {
  11649. return pattern.some((p) => micromatch.contains(str, p, options));
  11650. }
  11651. if (typeof pattern === "string") {
  11652. if (isEmptyString(str) || isEmptyString(pattern)) {
  11653. return false;
  11654. }
  11655. if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
  11656. return true;
  11657. }
  11658. }
  11659. return micromatch.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
  11660. contains: true
  11661. }));
  11662. };
  11663. micromatch.matchKeys = (obj, patterns, options) => {
  11664. if (!utils.isObject(obj)) {
  11665. throw new TypeError("Expected the first argument to be an object");
  11666. }
  11667. let keys = micromatch(Object.keys(obj), patterns, options);
  11668. let res = {};
  11669. for (let key of keys)
  11670. res[key] = obj[key];
  11671. return res;
  11672. };
  11673. micromatch.some = (list, patterns, options) => {
  11674. let items = [].concat(list);
  11675. for (let pattern of [].concat(patterns)) {
  11676. let isMatch = picomatch(String(pattern), options);
  11677. if (items.some((item) => isMatch(item))) {
  11678. return true;
  11679. }
  11680. }
  11681. return false;
  11682. };
  11683. micromatch.every = (list, patterns, options) => {
  11684. let items = [].concat(list);
  11685. for (let pattern of [].concat(patterns)) {
  11686. let isMatch = picomatch(String(pattern), options);
  11687. if (!items.every((item) => isMatch(item))) {
  11688. return false;
  11689. }
  11690. }
  11691. return true;
  11692. };
  11693. micromatch.all = (str, patterns, options) => {
  11694. if (typeof str !== "string") {
  11695. throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
  11696. }
  11697. return [].concat(patterns).every((p) => picomatch(p, options)(str));
  11698. };
  11699. micromatch.capture = (glob, input, options) => {
  11700. let posix = utils.isWindows(options);
  11701. let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
  11702. capture: true
  11703. }));
  11704. let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
  11705. if (match) {
  11706. return match.slice(1).map((v) => v === void 0 ? "" : v);
  11707. }
  11708. };
  11709. micromatch.makeRe = (...args) => picomatch.makeRe(...args);
  11710. micromatch.scan = (...args) => picomatch.scan(...args);
  11711. micromatch.parse = (patterns, options) => {
  11712. let res = [];
  11713. for (let pattern of [].concat(patterns || [])) {
  11714. for (let str of braces(String(pattern), options)) {
  11715. res.push(picomatch.parse(str, options));
  11716. }
  11717. }
  11718. return res;
  11719. };
  11720. micromatch.braces = (pattern, options) => {
  11721. if (typeof pattern !== "string")
  11722. throw new TypeError("Expected a string");
  11723. if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
  11724. return [pattern];
  11725. }
  11726. return braces(pattern, options);
  11727. };
  11728. micromatch.braceExpand = (pattern, options) => {
  11729. if (typeof pattern !== "string")
  11730. throw new TypeError("Expected a string");
  11731. return micromatch.braces(pattern, Object.assign(Object.assign({}, options), {}, {
  11732. expand: true
  11733. }));
  11734. };
  11735. module2.exports = micromatch;
  11736. }
  11737. });
  11738. var require_parser2 = __commonJS2({
  11739. "node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
  11740. "use strict";
  11741. var ParserEND = 1114112;
  11742. var ParserError = class extends Error {
  11743. constructor(msg, filename, linenumber) {
  11744. super("[ParserError] " + msg, filename, linenumber);
  11745. this.name = "ParserError";
  11746. this.code = "ParserError";
  11747. if (Error.captureStackTrace)
  11748. Error.captureStackTrace(this, ParserError);
  11749. }
  11750. };
  11751. var State = class {
  11752. constructor(parser) {
  11753. this.parser = parser;
  11754. this.buf = "";
  11755. this.returned = null;
  11756. this.result = null;
  11757. this.resultTable = null;
  11758. this.resultArr = null;
  11759. }
  11760. };
  11761. var Parser = class {
  11762. constructor() {
  11763. this.pos = 0;
  11764. this.col = 0;
  11765. this.line = 0;
  11766. this.obj = {};
  11767. this.ctx = this.obj;
  11768. this.stack = [];
  11769. this._buf = "";
  11770. this.char = null;
  11771. this.ii = 0;
  11772. this.state = new State(this.parseStart);
  11773. }
  11774. parse(str) {
  11775. if (str.length === 0 || str.length == null)
  11776. return;
  11777. this._buf = String(str);
  11778. this.ii = -1;
  11779. this.char = -1;
  11780. let getNext;
  11781. while (getNext === false || this.nextChar()) {
  11782. getNext = this.runOne();
  11783. }
  11784. this._buf = null;
  11785. }
  11786. nextChar() {
  11787. if (this.char === 10) {
  11788. ++this.line;
  11789. this.col = -1;
  11790. }
  11791. ++this.ii;
  11792. this.char = this._buf.codePointAt(this.ii);
  11793. ++this.pos;
  11794. ++this.col;
  11795. return this.haveBuffer();
  11796. }
  11797. haveBuffer() {
  11798. return this.ii < this._buf.length;
  11799. }
  11800. runOne() {
  11801. return this.state.parser.call(this, this.state.returned);
  11802. }
  11803. finish() {
  11804. this.char = ParserEND;
  11805. let last;
  11806. do {
  11807. last = this.state.parser;
  11808. this.runOne();
  11809. } while (this.state.parser !== last);
  11810. this.ctx = null;
  11811. this.state = null;
  11812. this._buf = null;
  11813. return this.obj;
  11814. }
  11815. next(fn) {
  11816. if (typeof fn !== "function")
  11817. throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
  11818. this.state.parser = fn;
  11819. }
  11820. goto(fn) {
  11821. this.next(fn);
  11822. return this.runOne();
  11823. }
  11824. call(fn, returnWith) {
  11825. if (returnWith)
  11826. this.next(returnWith);
  11827. this.stack.push(this.state);
  11828. this.state = new State(fn);
  11829. }
  11830. callNow(fn, returnWith) {
  11831. this.call(fn, returnWith);
  11832. return this.runOne();
  11833. }
  11834. return(value) {
  11835. if (this.stack.length === 0)
  11836. throw this.error(new ParserError("Stack underflow"));
  11837. if (value === void 0)
  11838. value = this.state.buf;
  11839. this.state = this.stack.pop();
  11840. this.state.returned = value;
  11841. }
  11842. returnNow(value) {
  11843. this.return(value);
  11844. return this.runOne();
  11845. }
  11846. consume() {
  11847. if (this.char === ParserEND)
  11848. throw this.error(new ParserError("Unexpected end-of-buffer"));
  11849. this.state.buf += this._buf[this.ii];
  11850. }
  11851. error(err) {
  11852. err.line = this.line;
  11853. err.col = this.col;
  11854. err.pos = this.pos;
  11855. return err;
  11856. }
  11857. parseStart() {
  11858. throw new ParserError("Must declare a parseStart method");
  11859. }
  11860. };
  11861. Parser.END = ParserEND;
  11862. Parser.Error = ParserError;
  11863. module2.exports = Parser;
  11864. }
  11865. });
  11866. var require_create_datetime = __commonJS2({
  11867. "node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
  11868. "use strict";
  11869. module2.exports = (value) => {
  11870. const date = new Date(value);
  11871. if (isNaN(date)) {
  11872. throw new TypeError("Invalid Datetime");
  11873. } else {
  11874. return date;
  11875. }
  11876. };
  11877. }
  11878. });
  11879. var require_format_num = __commonJS2({
  11880. "node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
  11881. "use strict";
  11882. module2.exports = (d, num) => {
  11883. num = String(num);
  11884. while (num.length < d)
  11885. num = "0" + num;
  11886. return num;
  11887. };
  11888. }
  11889. });
  11890. var require_create_datetime_float = __commonJS2({
  11891. "node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
  11892. "use strict";
  11893. var f = require_format_num();
  11894. var FloatingDateTime = class extends Date {
  11895. constructor(value) {
  11896. super(value + "Z");
  11897. this.isFloating = true;
  11898. }
  11899. toISOString() {
  11900. const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  11901. const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  11902. return `${date}T${time}`;
  11903. }
  11904. };
  11905. module2.exports = (value) => {
  11906. const date = new FloatingDateTime(value);
  11907. if (isNaN(date)) {
  11908. throw new TypeError("Invalid Datetime");
  11909. } else {
  11910. return date;
  11911. }
  11912. };
  11913. }
  11914. });
  11915. var require_create_date = __commonJS2({
  11916. "node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
  11917. "use strict";
  11918. var f = require_format_num();
  11919. var DateTime = global.Date;
  11920. var Date2 = class extends DateTime {
  11921. constructor(value) {
  11922. super(value);
  11923. this.isDate = true;
  11924. }
  11925. toISOString() {
  11926. return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
  11927. }
  11928. };
  11929. module2.exports = (value) => {
  11930. const date = new Date2(value);
  11931. if (isNaN(date)) {
  11932. throw new TypeError("Invalid Datetime");
  11933. } else {
  11934. return date;
  11935. }
  11936. };
  11937. }
  11938. });
  11939. var require_create_time = __commonJS2({
  11940. "node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
  11941. "use strict";
  11942. var f = require_format_num();
  11943. var Time = class extends Date {
  11944. constructor(value) {
  11945. super(`0000-01-01T${value}Z`);
  11946. this.isTime = true;
  11947. }
  11948. toISOString() {
  11949. return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
  11950. }
  11951. };
  11952. module2.exports = (value) => {
  11953. const date = new Time(value);
  11954. if (isNaN(date)) {
  11955. throw new TypeError("Invalid Datetime");
  11956. } else {
  11957. return date;
  11958. }
  11959. };
  11960. }
  11961. });
  11962. var require_toml_parser = __commonJS2({
  11963. "node_modules/@iarna/toml/lib/toml-parser.js"(exports2, module2) {
  11964. "use strict";
  11965. module2.exports = makeParserClass(require_parser2());
  11966. module2.exports.makeParserClass = makeParserClass;
  11967. var TomlError = class extends Error {
  11968. constructor(msg) {
  11969. super(msg);
  11970. this.name = "TomlError";
  11971. if (Error.captureStackTrace)
  11972. Error.captureStackTrace(this, TomlError);
  11973. this.fromTOML = true;
  11974. this.wrapped = null;
  11975. }
  11976. };
  11977. TomlError.wrap = (err) => {
  11978. const terr = new TomlError(err.message);
  11979. terr.code = err.code;
  11980. terr.wrapped = err;
  11981. return terr;
  11982. };
  11983. module2.exports.TomlError = TomlError;
  11984. var createDateTime = require_create_datetime();
  11985. var createDateTimeFloat = require_create_datetime_float();
  11986. var createDate = require_create_date();
  11987. var createTime = require_create_time();
  11988. var CTRL_I = 9;
  11989. var CTRL_J = 10;
  11990. var CTRL_M = 13;
  11991. var CTRL_CHAR_BOUNDARY = 31;
  11992. var CHAR_SP = 32;
  11993. var CHAR_QUOT = 34;
  11994. var CHAR_NUM = 35;
  11995. var CHAR_APOS = 39;
  11996. var CHAR_PLUS = 43;
  11997. var CHAR_COMMA = 44;
  11998. var CHAR_HYPHEN = 45;
  11999. var CHAR_PERIOD = 46;
  12000. var CHAR_0 = 48;
  12001. var CHAR_1 = 49;
  12002. var CHAR_7 = 55;
  12003. var CHAR_9 = 57;
  12004. var CHAR_COLON = 58;
  12005. var CHAR_EQUALS = 61;
  12006. var CHAR_A = 65;
  12007. var CHAR_E = 69;
  12008. var CHAR_F = 70;
  12009. var CHAR_T = 84;
  12010. var CHAR_U = 85;
  12011. var CHAR_Z = 90;
  12012. var CHAR_LOWBAR = 95;
  12013. var CHAR_a = 97;
  12014. var CHAR_b = 98;
  12015. var CHAR_e = 101;
  12016. var CHAR_f = 102;
  12017. var CHAR_i = 105;
  12018. var CHAR_l = 108;
  12019. var CHAR_n = 110;
  12020. var CHAR_o = 111;
  12021. var CHAR_r = 114;
  12022. var CHAR_s = 115;
  12023. var CHAR_t = 116;
  12024. var CHAR_u = 117;
  12025. var CHAR_x = 120;
  12026. var CHAR_z = 122;
  12027. var CHAR_LCUB = 123;
  12028. var CHAR_RCUB = 125;
  12029. var CHAR_LSQB = 91;
  12030. var CHAR_BSOL = 92;
  12031. var CHAR_RSQB = 93;
  12032. var CHAR_DEL = 127;
  12033. var SURROGATE_FIRST = 55296;
  12034. var SURROGATE_LAST = 57343;
  12035. var escapes = {
  12036. [CHAR_b]: "\b",
  12037. [CHAR_t]: " ",
  12038. [CHAR_n]: "\n",
  12039. [CHAR_f]: "\f",
  12040. [CHAR_r]: "\r",
  12041. [CHAR_QUOT]: '"',
  12042. [CHAR_BSOL]: "\\"
  12043. };
  12044. function isDigit(cp) {
  12045. return cp >= CHAR_0 && cp <= CHAR_9;
  12046. }
  12047. function isHexit(cp) {
  12048. return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
  12049. }
  12050. function isBit(cp) {
  12051. return cp === CHAR_1 || cp === CHAR_0;
  12052. }
  12053. function isOctit(cp) {
  12054. return cp >= CHAR_0 && cp <= CHAR_7;
  12055. }
  12056. function isAlphaNumQuoteHyphen(cp) {
  12057. return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
  12058. }
  12059. function isAlphaNumHyphen(cp) {
  12060. return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
  12061. }
  12062. var _type = Symbol("type");
  12063. var _declared = Symbol("declared");
  12064. var hasOwnProperty = Object.prototype.hasOwnProperty;
  12065. var defineProperty = Object.defineProperty;
  12066. var descriptor = {
  12067. configurable: true,
  12068. enumerable: true,
  12069. writable: true,
  12070. value: void 0
  12071. };
  12072. function hasKey(obj, key) {
  12073. if (hasOwnProperty.call(obj, key))
  12074. return true;
  12075. if (key === "__proto__")
  12076. defineProperty(obj, "__proto__", descriptor);
  12077. return false;
  12078. }
  12079. var INLINE_TABLE = Symbol("inline-table");
  12080. function InlineTable() {
  12081. return Object.defineProperties({}, {
  12082. [_type]: {
  12083. value: INLINE_TABLE
  12084. }
  12085. });
  12086. }
  12087. function isInlineTable(obj) {
  12088. if (obj === null || typeof obj !== "object")
  12089. return false;
  12090. return obj[_type] === INLINE_TABLE;
  12091. }
  12092. var TABLE = Symbol("table");
  12093. function Table() {
  12094. return Object.defineProperties({}, {
  12095. [_type]: {
  12096. value: TABLE
  12097. },
  12098. [_declared]: {
  12099. value: false,
  12100. writable: true
  12101. }
  12102. });
  12103. }
  12104. function isTable(obj) {
  12105. if (obj === null || typeof obj !== "object")
  12106. return false;
  12107. return obj[_type] === TABLE;
  12108. }
  12109. var _contentType = Symbol("content-type");
  12110. var INLINE_LIST = Symbol("inline-list");
  12111. function InlineList(type) {
  12112. return Object.defineProperties([], {
  12113. [_type]: {
  12114. value: INLINE_LIST
  12115. },
  12116. [_contentType]: {
  12117. value: type
  12118. }
  12119. });
  12120. }
  12121. function isInlineList(obj) {
  12122. if (obj === null || typeof obj !== "object")
  12123. return false;
  12124. return obj[_type] === INLINE_LIST;
  12125. }
  12126. var LIST = Symbol("list");
  12127. function List() {
  12128. return Object.defineProperties([], {
  12129. [_type]: {
  12130. value: LIST
  12131. }
  12132. });
  12133. }
  12134. function isList(obj) {
  12135. if (obj === null || typeof obj !== "object")
  12136. return false;
  12137. return obj[_type] === LIST;
  12138. }
  12139. var _custom;
  12140. try {
  12141. const utilInspect = require("util").inspect;
  12142. _custom = utilInspect.custom;
  12143. } catch (_) {
  12144. }
  12145. var _inspect = _custom || "inspect";
  12146. var BoxedBigInt = class {
  12147. constructor(value) {
  12148. try {
  12149. this.value = global.BigInt.asIntN(64, value);
  12150. } catch (_) {
  12151. this.value = null;
  12152. }
  12153. Object.defineProperty(this, _type, {
  12154. value: INTEGER
  12155. });
  12156. }
  12157. isNaN() {
  12158. return this.value === null;
  12159. }
  12160. toString() {
  12161. return String(this.value);
  12162. }
  12163. [_inspect]() {
  12164. return `[BigInt: ${this.toString()}]}`;
  12165. }
  12166. valueOf() {
  12167. return this.value;
  12168. }
  12169. };
  12170. var INTEGER = Symbol("integer");
  12171. function Integer(value) {
  12172. let num = Number(value);
  12173. if (Object.is(num, -0))
  12174. num = 0;
  12175. if (global.BigInt && !Number.isSafeInteger(num)) {
  12176. return new BoxedBigInt(value);
  12177. } else {
  12178. return Object.defineProperties(new Number(num), {
  12179. isNaN: {
  12180. value: function() {
  12181. return isNaN(this);
  12182. }
  12183. },
  12184. [_type]: {
  12185. value: INTEGER
  12186. },
  12187. [_inspect]: {
  12188. value: () => `[Integer: ${value}]`
  12189. }
  12190. });
  12191. }
  12192. }
  12193. function isInteger(obj) {
  12194. if (obj === null || typeof obj !== "object")
  12195. return false;
  12196. return obj[_type] === INTEGER;
  12197. }
  12198. var FLOAT = Symbol("float");
  12199. function Float(value) {
  12200. return Object.defineProperties(new Number(value), {
  12201. [_type]: {
  12202. value: FLOAT
  12203. },
  12204. [_inspect]: {
  12205. value: () => `[Float: ${value}]`
  12206. }
  12207. });
  12208. }
  12209. function isFloat(obj) {
  12210. if (obj === null || typeof obj !== "object")
  12211. return false;
  12212. return obj[_type] === FLOAT;
  12213. }
  12214. function tomlType(value) {
  12215. const type = typeof value;
  12216. if (type === "object") {
  12217. if (value === null)
  12218. return "null";
  12219. if (value instanceof Date)
  12220. return "datetime";
  12221. if (_type in value) {
  12222. switch (value[_type]) {
  12223. case INLINE_TABLE:
  12224. return "inline-table";
  12225. case INLINE_LIST:
  12226. return "inline-list";
  12227. case TABLE:
  12228. return "table";
  12229. case LIST:
  12230. return "list";
  12231. case FLOAT:
  12232. return "float";
  12233. case INTEGER:
  12234. return "integer";
  12235. }
  12236. }
  12237. }
  12238. return type;
  12239. }
  12240. function makeParserClass(Parser) {
  12241. class TOMLParser extends Parser {
  12242. constructor() {
  12243. super();
  12244. this.ctx = this.obj = Table();
  12245. }
  12246. atEndOfWord() {
  12247. return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
  12248. }
  12249. atEndOfLine() {
  12250. return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
  12251. }
  12252. parseStart() {
  12253. if (this.char === Parser.END) {
  12254. return null;
  12255. } else if (this.char === CHAR_LSQB) {
  12256. return this.call(this.parseTableOrList);
  12257. } else if (this.char === CHAR_NUM) {
  12258. return this.call(this.parseComment);
  12259. } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12260. return null;
  12261. } else if (isAlphaNumQuoteHyphen(this.char)) {
  12262. return this.callNow(this.parseAssignStatement);
  12263. } else {
  12264. throw this.error(new TomlError(`Unknown character "${this.char}"`));
  12265. }
  12266. }
  12267. parseWhitespaceToEOL() {
  12268. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12269. return null;
  12270. } else if (this.char === CHAR_NUM) {
  12271. return this.goto(this.parseComment);
  12272. } else if (this.char === Parser.END || this.char === CTRL_J) {
  12273. return this.return();
  12274. } else {
  12275. throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
  12276. }
  12277. }
  12278. parseAssignStatement() {
  12279. return this.callNow(this.parseAssign, this.recordAssignStatement);
  12280. }
  12281. recordAssignStatement(kv) {
  12282. let target = this.ctx;
  12283. let finalKey = kv.key.pop();
  12284. for (let kw of kv.key) {
  12285. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  12286. throw this.error(new TomlError("Can't redefine existing key"));
  12287. }
  12288. target = target[kw] = target[kw] || Table();
  12289. }
  12290. if (hasKey(target, finalKey)) {
  12291. throw this.error(new TomlError("Can't redefine existing key"));
  12292. }
  12293. if (isInteger(kv.value) || isFloat(kv.value)) {
  12294. target[finalKey] = kv.value.valueOf();
  12295. } else {
  12296. target[finalKey] = kv.value;
  12297. }
  12298. return this.goto(this.parseWhitespaceToEOL);
  12299. }
  12300. parseAssign() {
  12301. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12302. }
  12303. recordAssignKeyword(key) {
  12304. if (this.state.resultTable) {
  12305. this.state.resultTable.push(key);
  12306. } else {
  12307. this.state.resultTable = [key];
  12308. }
  12309. return this.goto(this.parseAssignKeywordPreDot);
  12310. }
  12311. parseAssignKeywordPreDot() {
  12312. if (this.char === CHAR_PERIOD) {
  12313. return this.next(this.parseAssignKeywordPostDot);
  12314. } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12315. return this.goto(this.parseAssignEqual);
  12316. }
  12317. }
  12318. parseAssignKeywordPostDot() {
  12319. if (this.char !== CHAR_SP && this.char !== CTRL_I) {
  12320. return this.callNow(this.parseKeyword, this.recordAssignKeyword);
  12321. }
  12322. }
  12323. parseAssignEqual() {
  12324. if (this.char === CHAR_EQUALS) {
  12325. return this.next(this.parseAssignPreValue);
  12326. } else {
  12327. throw this.error(new TomlError('Invalid character, expected "="'));
  12328. }
  12329. }
  12330. parseAssignPreValue() {
  12331. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12332. return null;
  12333. } else {
  12334. return this.callNow(this.parseValue, this.recordAssignValue);
  12335. }
  12336. }
  12337. recordAssignValue(value) {
  12338. return this.returnNow({
  12339. key: this.state.resultTable,
  12340. value
  12341. });
  12342. }
  12343. parseComment() {
  12344. do {
  12345. if (this.char === Parser.END || this.char === CTRL_J) {
  12346. return this.return();
  12347. }
  12348. } while (this.nextChar());
  12349. }
  12350. parseTableOrList() {
  12351. if (this.char === CHAR_LSQB) {
  12352. this.next(this.parseList);
  12353. } else {
  12354. return this.goto(this.parseTable);
  12355. }
  12356. }
  12357. parseTable() {
  12358. this.ctx = this.obj;
  12359. return this.goto(this.parseTableNext);
  12360. }
  12361. parseTableNext() {
  12362. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12363. return null;
  12364. } else {
  12365. return this.callNow(this.parseKeyword, this.parseTableMore);
  12366. }
  12367. }
  12368. parseTableMore(keyword) {
  12369. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12370. return null;
  12371. } else if (this.char === CHAR_RSQB) {
  12372. if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
  12373. throw this.error(new TomlError("Can't redefine existing key"));
  12374. } else {
  12375. this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
  12376. this.ctx[_declared] = true;
  12377. }
  12378. return this.next(this.parseWhitespaceToEOL);
  12379. } else if (this.char === CHAR_PERIOD) {
  12380. if (!hasKey(this.ctx, keyword)) {
  12381. this.ctx = this.ctx[keyword] = Table();
  12382. } else if (isTable(this.ctx[keyword])) {
  12383. this.ctx = this.ctx[keyword];
  12384. } else if (isList(this.ctx[keyword])) {
  12385. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12386. } else {
  12387. throw this.error(new TomlError("Can't redefine existing key"));
  12388. }
  12389. return this.next(this.parseTableNext);
  12390. } else {
  12391. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12392. }
  12393. }
  12394. parseList() {
  12395. this.ctx = this.obj;
  12396. return this.goto(this.parseListNext);
  12397. }
  12398. parseListNext() {
  12399. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12400. return null;
  12401. } else {
  12402. return this.callNow(this.parseKeyword, this.parseListMore);
  12403. }
  12404. }
  12405. parseListMore(keyword) {
  12406. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12407. return null;
  12408. } else if (this.char === CHAR_RSQB) {
  12409. if (!hasKey(this.ctx, keyword)) {
  12410. this.ctx[keyword] = List();
  12411. }
  12412. if (isInlineList(this.ctx[keyword])) {
  12413. throw this.error(new TomlError("Can't extend an inline array"));
  12414. } else if (isList(this.ctx[keyword])) {
  12415. const next = Table();
  12416. this.ctx[keyword].push(next);
  12417. this.ctx = next;
  12418. } else {
  12419. throw this.error(new TomlError("Can't redefine an existing key"));
  12420. }
  12421. return this.next(this.parseListEnd);
  12422. } else if (this.char === CHAR_PERIOD) {
  12423. if (!hasKey(this.ctx, keyword)) {
  12424. this.ctx = this.ctx[keyword] = Table();
  12425. } else if (isInlineList(this.ctx[keyword])) {
  12426. throw this.error(new TomlError("Can't extend an inline array"));
  12427. } else if (isInlineTable(this.ctx[keyword])) {
  12428. throw this.error(new TomlError("Can't extend an inline table"));
  12429. } else if (isList(this.ctx[keyword])) {
  12430. this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
  12431. } else if (isTable(this.ctx[keyword])) {
  12432. this.ctx = this.ctx[keyword];
  12433. } else {
  12434. throw this.error(new TomlError("Can't redefine an existing key"));
  12435. }
  12436. return this.next(this.parseListNext);
  12437. } else {
  12438. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12439. }
  12440. }
  12441. parseListEnd(keyword) {
  12442. if (this.char === CHAR_RSQB) {
  12443. return this.next(this.parseWhitespaceToEOL);
  12444. } else {
  12445. throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
  12446. }
  12447. }
  12448. parseValue() {
  12449. if (this.char === Parser.END) {
  12450. throw this.error(new TomlError("Key without value"));
  12451. } else if (this.char === CHAR_QUOT) {
  12452. return this.next(this.parseDoubleString);
  12453. }
  12454. if (this.char === CHAR_APOS) {
  12455. return this.next(this.parseSingleString);
  12456. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  12457. return this.goto(this.parseNumberSign);
  12458. } else if (this.char === CHAR_i) {
  12459. return this.next(this.parseInf);
  12460. } else if (this.char === CHAR_n) {
  12461. return this.next(this.parseNan);
  12462. } else if (isDigit(this.char)) {
  12463. return this.goto(this.parseNumberOrDateTime);
  12464. } else if (this.char === CHAR_t || this.char === CHAR_f) {
  12465. return this.goto(this.parseBoolean);
  12466. } else if (this.char === CHAR_LSQB) {
  12467. return this.call(this.parseInlineList, this.recordValue);
  12468. } else if (this.char === CHAR_LCUB) {
  12469. return this.call(this.parseInlineTable, this.recordValue);
  12470. } else {
  12471. throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
  12472. }
  12473. }
  12474. recordValue(value) {
  12475. return this.returnNow(value);
  12476. }
  12477. parseInf() {
  12478. if (this.char === CHAR_n) {
  12479. return this.next(this.parseInf2);
  12480. } else {
  12481. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12482. }
  12483. }
  12484. parseInf2() {
  12485. if (this.char === CHAR_f) {
  12486. if (this.state.buf === "-") {
  12487. return this.return(-Infinity);
  12488. } else {
  12489. return this.return(Infinity);
  12490. }
  12491. } else {
  12492. throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
  12493. }
  12494. }
  12495. parseNan() {
  12496. if (this.char === CHAR_a) {
  12497. return this.next(this.parseNan2);
  12498. } else {
  12499. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12500. }
  12501. }
  12502. parseNan2() {
  12503. if (this.char === CHAR_n) {
  12504. return this.return(NaN);
  12505. } else {
  12506. throw this.error(new TomlError('Unexpected character, expected "nan"'));
  12507. }
  12508. }
  12509. parseKeyword() {
  12510. if (this.char === CHAR_QUOT) {
  12511. return this.next(this.parseBasicString);
  12512. } else if (this.char === CHAR_APOS) {
  12513. return this.next(this.parseLiteralString);
  12514. } else {
  12515. return this.goto(this.parseBareKey);
  12516. }
  12517. }
  12518. parseBareKey() {
  12519. do {
  12520. if (this.char === Parser.END) {
  12521. throw this.error(new TomlError("Key ended without value"));
  12522. } else if (isAlphaNumHyphen(this.char)) {
  12523. this.consume();
  12524. } else if (this.state.buf.length === 0) {
  12525. throw this.error(new TomlError("Empty bare keys are not allowed"));
  12526. } else {
  12527. return this.returnNow();
  12528. }
  12529. } while (this.nextChar());
  12530. }
  12531. parseSingleString() {
  12532. if (this.char === CHAR_APOS) {
  12533. return this.next(this.parseLiteralMultiStringMaybe);
  12534. } else {
  12535. return this.goto(this.parseLiteralString);
  12536. }
  12537. }
  12538. parseLiteralString() {
  12539. do {
  12540. if (this.char === CHAR_APOS) {
  12541. return this.return();
  12542. } else if (this.atEndOfLine()) {
  12543. throw this.error(new TomlError("Unterminated string"));
  12544. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12545. throw this.errorControlCharInString();
  12546. } else {
  12547. this.consume();
  12548. }
  12549. } while (this.nextChar());
  12550. }
  12551. parseLiteralMultiStringMaybe() {
  12552. if (this.char === CHAR_APOS) {
  12553. return this.next(this.parseLiteralMultiString);
  12554. } else {
  12555. return this.returnNow();
  12556. }
  12557. }
  12558. parseLiteralMultiString() {
  12559. if (this.char === CTRL_M) {
  12560. return null;
  12561. } else if (this.char === CTRL_J) {
  12562. return this.next(this.parseLiteralMultiStringContent);
  12563. } else {
  12564. return this.goto(this.parseLiteralMultiStringContent);
  12565. }
  12566. }
  12567. parseLiteralMultiStringContent() {
  12568. do {
  12569. if (this.char === CHAR_APOS) {
  12570. return this.next(this.parseLiteralMultiEnd);
  12571. } else if (this.char === Parser.END) {
  12572. throw this.error(new TomlError("Unterminated multi-line string"));
  12573. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12574. throw this.errorControlCharInString();
  12575. } else {
  12576. this.consume();
  12577. }
  12578. } while (this.nextChar());
  12579. }
  12580. parseLiteralMultiEnd() {
  12581. if (this.char === CHAR_APOS) {
  12582. return this.next(this.parseLiteralMultiEnd2);
  12583. } else {
  12584. this.state.buf += "'";
  12585. return this.goto(this.parseLiteralMultiStringContent);
  12586. }
  12587. }
  12588. parseLiteralMultiEnd2() {
  12589. if (this.char === CHAR_APOS) {
  12590. return this.return();
  12591. } else {
  12592. this.state.buf += "''";
  12593. return this.goto(this.parseLiteralMultiStringContent);
  12594. }
  12595. }
  12596. parseDoubleString() {
  12597. if (this.char === CHAR_QUOT) {
  12598. return this.next(this.parseMultiStringMaybe);
  12599. } else {
  12600. return this.goto(this.parseBasicString);
  12601. }
  12602. }
  12603. parseBasicString() {
  12604. do {
  12605. if (this.char === CHAR_BSOL) {
  12606. return this.call(this.parseEscape, this.recordEscapeReplacement);
  12607. } else if (this.char === CHAR_QUOT) {
  12608. return this.return();
  12609. } else if (this.atEndOfLine()) {
  12610. throw this.error(new TomlError("Unterminated string"));
  12611. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
  12612. throw this.errorControlCharInString();
  12613. } else {
  12614. this.consume();
  12615. }
  12616. } while (this.nextChar());
  12617. }
  12618. recordEscapeReplacement(replacement) {
  12619. this.state.buf += replacement;
  12620. return this.goto(this.parseBasicString);
  12621. }
  12622. parseMultiStringMaybe() {
  12623. if (this.char === CHAR_QUOT) {
  12624. return this.next(this.parseMultiString);
  12625. } else {
  12626. return this.returnNow();
  12627. }
  12628. }
  12629. parseMultiString() {
  12630. if (this.char === CTRL_M) {
  12631. return null;
  12632. } else if (this.char === CTRL_J) {
  12633. return this.next(this.parseMultiStringContent);
  12634. } else {
  12635. return this.goto(this.parseMultiStringContent);
  12636. }
  12637. }
  12638. parseMultiStringContent() {
  12639. do {
  12640. if (this.char === CHAR_BSOL) {
  12641. return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
  12642. } else if (this.char === CHAR_QUOT) {
  12643. return this.next(this.parseMultiEnd);
  12644. } else if (this.char === Parser.END) {
  12645. throw this.error(new TomlError("Unterminated multi-line string"));
  12646. } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
  12647. throw this.errorControlCharInString();
  12648. } else {
  12649. this.consume();
  12650. }
  12651. } while (this.nextChar());
  12652. }
  12653. errorControlCharInString() {
  12654. let displayCode = "\\u00";
  12655. if (this.char < 16) {
  12656. displayCode += "0";
  12657. }
  12658. displayCode += this.char.toString(16);
  12659. return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
  12660. }
  12661. recordMultiEscapeReplacement(replacement) {
  12662. this.state.buf += replacement;
  12663. return this.goto(this.parseMultiStringContent);
  12664. }
  12665. parseMultiEnd() {
  12666. if (this.char === CHAR_QUOT) {
  12667. return this.next(this.parseMultiEnd2);
  12668. } else {
  12669. this.state.buf += '"';
  12670. return this.goto(this.parseMultiStringContent);
  12671. }
  12672. }
  12673. parseMultiEnd2() {
  12674. if (this.char === CHAR_QUOT) {
  12675. return this.return();
  12676. } else {
  12677. this.state.buf += '""';
  12678. return this.goto(this.parseMultiStringContent);
  12679. }
  12680. }
  12681. parseMultiEscape() {
  12682. if (this.char === CTRL_M || this.char === CTRL_J) {
  12683. return this.next(this.parseMultiTrim);
  12684. } else if (this.char === CHAR_SP || this.char === CTRL_I) {
  12685. return this.next(this.parsePreMultiTrim);
  12686. } else {
  12687. return this.goto(this.parseEscape);
  12688. }
  12689. }
  12690. parsePreMultiTrim() {
  12691. if (this.char === CHAR_SP || this.char === CTRL_I) {
  12692. return null;
  12693. } else if (this.char === CTRL_M || this.char === CTRL_J) {
  12694. return this.next(this.parseMultiTrim);
  12695. } else {
  12696. throw this.error(new TomlError("Can't escape whitespace"));
  12697. }
  12698. }
  12699. parseMultiTrim() {
  12700. if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
  12701. return null;
  12702. } else {
  12703. return this.returnNow();
  12704. }
  12705. }
  12706. parseEscape() {
  12707. if (this.char in escapes) {
  12708. return this.return(escapes[this.char]);
  12709. } else if (this.char === CHAR_u) {
  12710. return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
  12711. } else if (this.char === CHAR_U) {
  12712. return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
  12713. } else {
  12714. throw this.error(new TomlError("Unknown escape character: " + this.char));
  12715. }
  12716. }
  12717. parseUnicodeReturn(char) {
  12718. try {
  12719. const codePoint = parseInt(char, 16);
  12720. if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
  12721. throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
  12722. }
  12723. return this.returnNow(String.fromCodePoint(codePoint));
  12724. } catch (err) {
  12725. throw this.error(TomlError.wrap(err));
  12726. }
  12727. }
  12728. parseSmallUnicode() {
  12729. if (!isHexit(this.char)) {
  12730. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12731. } else {
  12732. this.consume();
  12733. if (this.state.buf.length >= 4)
  12734. return this.return();
  12735. }
  12736. }
  12737. parseLargeUnicode() {
  12738. if (!isHexit(this.char)) {
  12739. throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
  12740. } else {
  12741. this.consume();
  12742. if (this.state.buf.length >= 8)
  12743. return this.return();
  12744. }
  12745. }
  12746. parseNumberSign() {
  12747. this.consume();
  12748. return this.next(this.parseMaybeSignedInfOrNan);
  12749. }
  12750. parseMaybeSignedInfOrNan() {
  12751. if (this.char === CHAR_i) {
  12752. return this.next(this.parseInf);
  12753. } else if (this.char === CHAR_n) {
  12754. return this.next(this.parseNan);
  12755. } else {
  12756. return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
  12757. }
  12758. }
  12759. parseNumberIntegerStart() {
  12760. if (this.char === CHAR_0) {
  12761. this.consume();
  12762. return this.next(this.parseNumberIntegerExponentOrDecimal);
  12763. } else {
  12764. return this.goto(this.parseNumberInteger);
  12765. }
  12766. }
  12767. parseNumberIntegerExponentOrDecimal() {
  12768. if (this.char === CHAR_PERIOD) {
  12769. this.consume();
  12770. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12771. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12772. this.consume();
  12773. return this.next(this.parseNumberExponentSign);
  12774. } else {
  12775. return this.returnNow(Integer(this.state.buf));
  12776. }
  12777. }
  12778. parseNumberInteger() {
  12779. if (isDigit(this.char)) {
  12780. this.consume();
  12781. } else if (this.char === CHAR_LOWBAR) {
  12782. return this.call(this.parseNoUnder);
  12783. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12784. this.consume();
  12785. return this.next(this.parseNumberExponentSign);
  12786. } else if (this.char === CHAR_PERIOD) {
  12787. this.consume();
  12788. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12789. } else {
  12790. const result = Integer(this.state.buf);
  12791. if (result.isNaN()) {
  12792. throw this.error(new TomlError("Invalid number"));
  12793. } else {
  12794. return this.returnNow(result);
  12795. }
  12796. }
  12797. }
  12798. parseNoUnder() {
  12799. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
  12800. throw this.error(new TomlError("Unexpected character, expected digit"));
  12801. } else if (this.atEndOfWord()) {
  12802. throw this.error(new TomlError("Incomplete number"));
  12803. }
  12804. return this.returnNow();
  12805. }
  12806. parseNoUnderHexOctBinLiteral() {
  12807. if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
  12808. throw this.error(new TomlError("Unexpected character, expected digit"));
  12809. } else if (this.atEndOfWord()) {
  12810. throw this.error(new TomlError("Incomplete number"));
  12811. }
  12812. return this.returnNow();
  12813. }
  12814. parseNumberFloat() {
  12815. if (this.char === CHAR_LOWBAR) {
  12816. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12817. } else if (isDigit(this.char)) {
  12818. this.consume();
  12819. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12820. this.consume();
  12821. return this.next(this.parseNumberExponentSign);
  12822. } else {
  12823. return this.returnNow(Float(this.state.buf));
  12824. }
  12825. }
  12826. parseNumberExponentSign() {
  12827. if (isDigit(this.char)) {
  12828. return this.goto(this.parseNumberExponent);
  12829. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  12830. this.consume();
  12831. this.call(this.parseNoUnder, this.parseNumberExponent);
  12832. } else {
  12833. throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
  12834. }
  12835. }
  12836. parseNumberExponent() {
  12837. if (isDigit(this.char)) {
  12838. this.consume();
  12839. } else if (this.char === CHAR_LOWBAR) {
  12840. return this.call(this.parseNoUnder);
  12841. } else {
  12842. return this.returnNow(Float(this.state.buf));
  12843. }
  12844. }
  12845. parseNumberOrDateTime() {
  12846. if (this.char === CHAR_0) {
  12847. this.consume();
  12848. return this.next(this.parseNumberBaseOrDateTime);
  12849. } else {
  12850. return this.goto(this.parseNumberOrDateTimeOnly);
  12851. }
  12852. }
  12853. parseNumberOrDateTimeOnly() {
  12854. if (this.char === CHAR_LOWBAR) {
  12855. return this.call(this.parseNoUnder, this.parseNumberInteger);
  12856. } else if (isDigit(this.char)) {
  12857. this.consume();
  12858. if (this.state.buf.length > 4)
  12859. this.next(this.parseNumberInteger);
  12860. } else if (this.char === CHAR_E || this.char === CHAR_e) {
  12861. this.consume();
  12862. return this.next(this.parseNumberExponentSign);
  12863. } else if (this.char === CHAR_PERIOD) {
  12864. this.consume();
  12865. return this.call(this.parseNoUnder, this.parseNumberFloat);
  12866. } else if (this.char === CHAR_HYPHEN) {
  12867. return this.goto(this.parseDateTime);
  12868. } else if (this.char === CHAR_COLON) {
  12869. return this.goto(this.parseOnlyTimeHour);
  12870. } else {
  12871. return this.returnNow(Integer(this.state.buf));
  12872. }
  12873. }
  12874. parseDateTimeOnly() {
  12875. if (this.state.buf.length < 4) {
  12876. if (isDigit(this.char)) {
  12877. return this.consume();
  12878. } else if (this.char === CHAR_COLON) {
  12879. return this.goto(this.parseOnlyTimeHour);
  12880. } else {
  12881. throw this.error(new TomlError("Expected digit while parsing year part of a date"));
  12882. }
  12883. } else {
  12884. if (this.char === CHAR_HYPHEN) {
  12885. return this.goto(this.parseDateTime);
  12886. } else {
  12887. throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
  12888. }
  12889. }
  12890. }
  12891. parseNumberBaseOrDateTime() {
  12892. if (this.char === CHAR_b) {
  12893. this.consume();
  12894. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
  12895. } else if (this.char === CHAR_o) {
  12896. this.consume();
  12897. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
  12898. } else if (this.char === CHAR_x) {
  12899. this.consume();
  12900. return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
  12901. } else if (this.char === CHAR_PERIOD) {
  12902. return this.goto(this.parseNumberInteger);
  12903. } else if (isDigit(this.char)) {
  12904. return this.goto(this.parseDateTimeOnly);
  12905. } else {
  12906. return this.returnNow(Integer(this.state.buf));
  12907. }
  12908. }
  12909. parseIntegerHex() {
  12910. if (isHexit(this.char)) {
  12911. this.consume();
  12912. } else if (this.char === CHAR_LOWBAR) {
  12913. return this.call(this.parseNoUnderHexOctBinLiteral);
  12914. } else {
  12915. const result = Integer(this.state.buf);
  12916. if (result.isNaN()) {
  12917. throw this.error(new TomlError("Invalid number"));
  12918. } else {
  12919. return this.returnNow(result);
  12920. }
  12921. }
  12922. }
  12923. parseIntegerOct() {
  12924. if (isOctit(this.char)) {
  12925. this.consume();
  12926. } else if (this.char === CHAR_LOWBAR) {
  12927. return this.call(this.parseNoUnderHexOctBinLiteral);
  12928. } else {
  12929. const result = Integer(this.state.buf);
  12930. if (result.isNaN()) {
  12931. throw this.error(new TomlError("Invalid number"));
  12932. } else {
  12933. return this.returnNow(result);
  12934. }
  12935. }
  12936. }
  12937. parseIntegerBin() {
  12938. if (isBit(this.char)) {
  12939. this.consume();
  12940. } else if (this.char === CHAR_LOWBAR) {
  12941. return this.call(this.parseNoUnderHexOctBinLiteral);
  12942. } else {
  12943. const result = Integer(this.state.buf);
  12944. if (result.isNaN()) {
  12945. throw this.error(new TomlError("Invalid number"));
  12946. } else {
  12947. return this.returnNow(result);
  12948. }
  12949. }
  12950. }
  12951. parseDateTime() {
  12952. if (this.state.buf.length < 4) {
  12953. throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
  12954. }
  12955. this.state.result = this.state.buf;
  12956. this.state.buf = "";
  12957. return this.next(this.parseDateMonth);
  12958. }
  12959. parseDateMonth() {
  12960. if (this.char === CHAR_HYPHEN) {
  12961. if (this.state.buf.length < 2) {
  12962. throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
  12963. }
  12964. this.state.result += "-" + this.state.buf;
  12965. this.state.buf = "";
  12966. return this.next(this.parseDateDay);
  12967. } else if (isDigit(this.char)) {
  12968. this.consume();
  12969. } else {
  12970. throw this.error(new TomlError("Incomplete datetime"));
  12971. }
  12972. }
  12973. parseDateDay() {
  12974. if (this.char === CHAR_T || this.char === CHAR_SP) {
  12975. if (this.state.buf.length < 2) {
  12976. throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
  12977. }
  12978. this.state.result += "-" + this.state.buf;
  12979. this.state.buf = "";
  12980. return this.next(this.parseStartTimeHour);
  12981. } else if (this.atEndOfWord()) {
  12982. return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
  12983. } else if (isDigit(this.char)) {
  12984. this.consume();
  12985. } else {
  12986. throw this.error(new TomlError("Incomplete datetime"));
  12987. }
  12988. }
  12989. parseStartTimeHour() {
  12990. if (this.atEndOfWord()) {
  12991. return this.returnNow(createDate(this.state.result));
  12992. } else {
  12993. return this.goto(this.parseTimeHour);
  12994. }
  12995. }
  12996. parseTimeHour() {
  12997. if (this.char === CHAR_COLON) {
  12998. if (this.state.buf.length < 2) {
  12999. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13000. }
  13001. this.state.result += "T" + this.state.buf;
  13002. this.state.buf = "";
  13003. return this.next(this.parseTimeMin);
  13004. } else if (isDigit(this.char)) {
  13005. this.consume();
  13006. } else {
  13007. throw this.error(new TomlError("Incomplete datetime"));
  13008. }
  13009. }
  13010. parseTimeMin() {
  13011. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13012. this.consume();
  13013. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13014. this.state.result += ":" + this.state.buf;
  13015. this.state.buf = "";
  13016. return this.next(this.parseTimeSec);
  13017. } else {
  13018. throw this.error(new TomlError("Incomplete datetime"));
  13019. }
  13020. }
  13021. parseTimeSec() {
  13022. if (isDigit(this.char)) {
  13023. this.consume();
  13024. if (this.state.buf.length === 2) {
  13025. this.state.result += ":" + this.state.buf;
  13026. this.state.buf = "";
  13027. return this.next(this.parseTimeZoneOrFraction);
  13028. }
  13029. } else {
  13030. throw this.error(new TomlError("Incomplete datetime"));
  13031. }
  13032. }
  13033. parseOnlyTimeHour() {
  13034. if (this.char === CHAR_COLON) {
  13035. if (this.state.buf.length < 2) {
  13036. throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
  13037. }
  13038. this.state.result = this.state.buf;
  13039. this.state.buf = "";
  13040. return this.next(this.parseOnlyTimeMin);
  13041. } else {
  13042. throw this.error(new TomlError("Incomplete time"));
  13043. }
  13044. }
  13045. parseOnlyTimeMin() {
  13046. if (this.state.buf.length < 2 && isDigit(this.char)) {
  13047. this.consume();
  13048. } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
  13049. this.state.result += ":" + this.state.buf;
  13050. this.state.buf = "";
  13051. return this.next(this.parseOnlyTimeSec);
  13052. } else {
  13053. throw this.error(new TomlError("Incomplete time"));
  13054. }
  13055. }
  13056. parseOnlyTimeSec() {
  13057. if (isDigit(this.char)) {
  13058. this.consume();
  13059. if (this.state.buf.length === 2) {
  13060. return this.next(this.parseOnlyTimeFractionMaybe);
  13061. }
  13062. } else {
  13063. throw this.error(new TomlError("Incomplete time"));
  13064. }
  13065. }
  13066. parseOnlyTimeFractionMaybe() {
  13067. this.state.result += ":" + this.state.buf;
  13068. if (this.char === CHAR_PERIOD) {
  13069. this.state.buf = "";
  13070. this.next(this.parseOnlyTimeFraction);
  13071. } else {
  13072. return this.return(createTime(this.state.result));
  13073. }
  13074. }
  13075. parseOnlyTimeFraction() {
  13076. if (isDigit(this.char)) {
  13077. this.consume();
  13078. } else if (this.atEndOfWord()) {
  13079. if (this.state.buf.length === 0)
  13080. throw this.error(new TomlError("Expected digit in milliseconds"));
  13081. return this.returnNow(createTime(this.state.result + "." + this.state.buf));
  13082. } else {
  13083. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13084. }
  13085. }
  13086. parseTimeZoneOrFraction() {
  13087. if (this.char === CHAR_PERIOD) {
  13088. this.consume();
  13089. this.next(this.parseDateTimeFraction);
  13090. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13091. this.consume();
  13092. this.next(this.parseTimeZoneHour);
  13093. } else if (this.char === CHAR_Z) {
  13094. this.consume();
  13095. return this.return(createDateTime(this.state.result + this.state.buf));
  13096. } else if (this.atEndOfWord()) {
  13097. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13098. } else {
  13099. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13100. }
  13101. }
  13102. parseDateTimeFraction() {
  13103. if (isDigit(this.char)) {
  13104. this.consume();
  13105. } else if (this.state.buf.length === 1) {
  13106. throw this.error(new TomlError("Expected digit in milliseconds"));
  13107. } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
  13108. this.consume();
  13109. this.next(this.parseTimeZoneHour);
  13110. } else if (this.char === CHAR_Z) {
  13111. this.consume();
  13112. return this.return(createDateTime(this.state.result + this.state.buf));
  13113. } else if (this.atEndOfWord()) {
  13114. return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
  13115. } else {
  13116. throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
  13117. }
  13118. }
  13119. parseTimeZoneHour() {
  13120. if (isDigit(this.char)) {
  13121. this.consume();
  13122. if (/\d\d$/.test(this.state.buf))
  13123. return this.next(this.parseTimeZoneSep);
  13124. } else {
  13125. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13126. }
  13127. }
  13128. parseTimeZoneSep() {
  13129. if (this.char === CHAR_COLON) {
  13130. this.consume();
  13131. this.next(this.parseTimeZoneMin);
  13132. } else {
  13133. throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
  13134. }
  13135. }
  13136. parseTimeZoneMin() {
  13137. if (isDigit(this.char)) {
  13138. this.consume();
  13139. if (/\d\d$/.test(this.state.buf))
  13140. return this.return(createDateTime(this.state.result + this.state.buf));
  13141. } else {
  13142. throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
  13143. }
  13144. }
  13145. parseBoolean() {
  13146. if (this.char === CHAR_t) {
  13147. this.consume();
  13148. return this.next(this.parseTrue_r);
  13149. } else if (this.char === CHAR_f) {
  13150. this.consume();
  13151. return this.next(this.parseFalse_a);
  13152. }
  13153. }
  13154. parseTrue_r() {
  13155. if (this.char === CHAR_r) {
  13156. this.consume();
  13157. return this.next(this.parseTrue_u);
  13158. } else {
  13159. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13160. }
  13161. }
  13162. parseTrue_u() {
  13163. if (this.char === CHAR_u) {
  13164. this.consume();
  13165. return this.next(this.parseTrue_e);
  13166. } else {
  13167. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13168. }
  13169. }
  13170. parseTrue_e() {
  13171. if (this.char === CHAR_e) {
  13172. return this.return(true);
  13173. } else {
  13174. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13175. }
  13176. }
  13177. parseFalse_a() {
  13178. if (this.char === CHAR_a) {
  13179. this.consume();
  13180. return this.next(this.parseFalse_l);
  13181. } else {
  13182. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13183. }
  13184. }
  13185. parseFalse_l() {
  13186. if (this.char === CHAR_l) {
  13187. this.consume();
  13188. return this.next(this.parseFalse_s);
  13189. } else {
  13190. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13191. }
  13192. }
  13193. parseFalse_s() {
  13194. if (this.char === CHAR_s) {
  13195. this.consume();
  13196. return this.next(this.parseFalse_e);
  13197. } else {
  13198. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13199. }
  13200. }
  13201. parseFalse_e() {
  13202. if (this.char === CHAR_e) {
  13203. return this.return(false);
  13204. } else {
  13205. throw this.error(new TomlError("Invalid boolean, expected true or false"));
  13206. }
  13207. }
  13208. parseInlineList() {
  13209. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13210. return null;
  13211. } else if (this.char === Parser.END) {
  13212. throw this.error(new TomlError("Unterminated inline array"));
  13213. } else if (this.char === CHAR_NUM) {
  13214. return this.call(this.parseComment);
  13215. } else if (this.char === CHAR_RSQB) {
  13216. return this.return(this.state.resultArr || InlineList());
  13217. } else {
  13218. return this.callNow(this.parseValue, this.recordInlineListValue);
  13219. }
  13220. }
  13221. recordInlineListValue(value) {
  13222. if (this.state.resultArr) {
  13223. const listType = this.state.resultArr[_contentType];
  13224. const valueType = tomlType(value);
  13225. if (listType !== valueType) {
  13226. throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
  13227. }
  13228. } else {
  13229. this.state.resultArr = InlineList(tomlType(value));
  13230. }
  13231. if (isFloat(value) || isInteger(value)) {
  13232. this.state.resultArr.push(value.valueOf());
  13233. } else {
  13234. this.state.resultArr.push(value);
  13235. }
  13236. return this.goto(this.parseInlineListNext);
  13237. }
  13238. parseInlineListNext() {
  13239. if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
  13240. return null;
  13241. } else if (this.char === CHAR_NUM) {
  13242. return this.call(this.parseComment);
  13243. } else if (this.char === CHAR_COMMA) {
  13244. return this.next(this.parseInlineList);
  13245. } else if (this.char === CHAR_RSQB) {
  13246. return this.goto(this.parseInlineList);
  13247. } else {
  13248. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13249. }
  13250. }
  13251. parseInlineTable() {
  13252. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13253. return null;
  13254. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13255. throw this.error(new TomlError("Unterminated inline array"));
  13256. } else if (this.char === CHAR_RCUB) {
  13257. return this.return(this.state.resultTable || InlineTable());
  13258. } else {
  13259. if (!this.state.resultTable)
  13260. this.state.resultTable = InlineTable();
  13261. return this.callNow(this.parseAssign, this.recordInlineTableValue);
  13262. }
  13263. }
  13264. recordInlineTableValue(kv) {
  13265. let target = this.state.resultTable;
  13266. let finalKey = kv.key.pop();
  13267. for (let kw of kv.key) {
  13268. if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
  13269. throw this.error(new TomlError("Can't redefine existing key"));
  13270. }
  13271. target = target[kw] = target[kw] || Table();
  13272. }
  13273. if (hasKey(target, finalKey)) {
  13274. throw this.error(new TomlError("Can't redefine existing key"));
  13275. }
  13276. if (isInteger(kv.value) || isFloat(kv.value)) {
  13277. target[finalKey] = kv.value.valueOf();
  13278. } else {
  13279. target[finalKey] = kv.value;
  13280. }
  13281. return this.goto(this.parseInlineTableNext);
  13282. }
  13283. parseInlineTableNext() {
  13284. if (this.char === CHAR_SP || this.char === CTRL_I) {
  13285. return null;
  13286. } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
  13287. throw this.error(new TomlError("Unterminated inline array"));
  13288. } else if (this.char === CHAR_COMMA) {
  13289. return this.next(this.parseInlineTable);
  13290. } else if (this.char === CHAR_RCUB) {
  13291. return this.goto(this.parseInlineTable);
  13292. } else {
  13293. throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
  13294. }
  13295. }
  13296. }
  13297. return TOMLParser;
  13298. }
  13299. }
  13300. });
  13301. var require_parse_pretty_error = __commonJS2({
  13302. "node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
  13303. "use strict";
  13304. module2.exports = prettyError;
  13305. function prettyError(err, buf) {
  13306. if (err.pos == null || err.line == null)
  13307. return err;
  13308. let msg = err.message;
  13309. msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
  13310. `;
  13311. if (buf && buf.split) {
  13312. const lines = buf.split(/\n/);
  13313. const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
  13314. let linePadding = " ";
  13315. while (linePadding.length < lineNumWidth)
  13316. linePadding += " ";
  13317. for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
  13318. let lineNum = String(ii + 1);
  13319. if (lineNum.length < lineNumWidth)
  13320. lineNum = " " + lineNum;
  13321. if (err.line === ii) {
  13322. msg += lineNum + "> " + lines[ii] + "\n";
  13323. msg += linePadding + " ";
  13324. for (let hh = 0; hh < err.col; ++hh) {
  13325. msg += " ";
  13326. }
  13327. msg += "^\n";
  13328. } else {
  13329. msg += lineNum + ": " + lines[ii] + "\n";
  13330. }
  13331. }
  13332. }
  13333. err.message = msg + "\n";
  13334. return err;
  13335. }
  13336. }
  13337. });
  13338. var require_parse_string = __commonJS2({
  13339. "node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
  13340. "use strict";
  13341. module2.exports = parseString;
  13342. var TOMLParser = require_toml_parser();
  13343. var prettyError = require_parse_pretty_error();
  13344. function parseString(str) {
  13345. if (global.Buffer && global.Buffer.isBuffer(str)) {
  13346. str = str.toString("utf8");
  13347. }
  13348. const parser = new TOMLParser();
  13349. try {
  13350. parser.parse(str);
  13351. return parser.finish();
  13352. } catch (err) {
  13353. throw prettyError(err, str);
  13354. }
  13355. }
  13356. }
  13357. });
  13358. var require_load_toml = __commonJS2({
  13359. "src/utils/load-toml.js"(exports2, module2) {
  13360. "use strict";
  13361. var parse = require_parse_string();
  13362. module2.exports = function(filePath, content) {
  13363. try {
  13364. return parse(content);
  13365. } catch (error) {
  13366. error.message = `TOML Error in ${filePath}:
  13367. ${error.message}`;
  13368. throw error;
  13369. }
  13370. };
  13371. }
  13372. });
  13373. var require_unicode = __commonJS2({
  13374. "node_modules/json5/lib/unicode.js"(exports2, module2) {
  13375. module2.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  13376. module2.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  13377. module2.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  13378. }
  13379. });
  13380. var require_util2 = __commonJS2({
  13381. "node_modules/json5/lib/util.js"(exports2, module2) {
  13382. var unicode = require_unicode();
  13383. module2.exports = {
  13384. isSpaceSeparator(c) {
  13385. return typeof c === "string" && unicode.Space_Separator.test(c);
  13386. },
  13387. isIdStartChar(c) {
  13388. return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
  13389. },
  13390. isIdContinueChar(c) {
  13391. return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c));
  13392. },
  13393. isDigit(c) {
  13394. return typeof c === "string" && /[0-9]/.test(c);
  13395. },
  13396. isHexDigit(c) {
  13397. return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
  13398. }
  13399. };
  13400. }
  13401. });
  13402. var require_parse3 = __commonJS2({
  13403. "node_modules/json5/lib/parse.js"(exports2, module2) {
  13404. var util = require_util2();
  13405. var source;
  13406. var parseState;
  13407. var stack;
  13408. var pos;
  13409. var line;
  13410. var column;
  13411. var token;
  13412. var key;
  13413. var root;
  13414. module2.exports = function parse(text, reviver) {
  13415. source = String(text);
  13416. parseState = "start";
  13417. stack = [];
  13418. pos = 0;
  13419. line = 1;
  13420. column = 0;
  13421. token = void 0;
  13422. key = void 0;
  13423. root = void 0;
  13424. do {
  13425. token = lex();
  13426. parseStates[parseState]();
  13427. } while (token.type !== "eof");
  13428. if (typeof reviver === "function") {
  13429. return internalize({
  13430. "": root
  13431. }, "", reviver);
  13432. }
  13433. return root;
  13434. };
  13435. function internalize(holder, name, reviver) {
  13436. const value = holder[name];
  13437. if (value != null && typeof value === "object") {
  13438. for (const key2 in value) {
  13439. const replacement = internalize(value, key2, reviver);
  13440. if (replacement === void 0) {
  13441. delete value[key2];
  13442. } else {
  13443. value[key2] = replacement;
  13444. }
  13445. }
  13446. }
  13447. return reviver.call(holder, name, value);
  13448. }
  13449. var lexState;
  13450. var buffer;
  13451. var doubleQuote;
  13452. var sign;
  13453. var c;
  13454. function lex() {
  13455. lexState = "default";
  13456. buffer = "";
  13457. doubleQuote = false;
  13458. sign = 1;
  13459. for (; ; ) {
  13460. c = peek();
  13461. const token2 = lexStates[lexState]();
  13462. if (token2) {
  13463. return token2;
  13464. }
  13465. }
  13466. }
  13467. function peek() {
  13468. if (source[pos]) {
  13469. return String.fromCodePoint(source.codePointAt(pos));
  13470. }
  13471. }
  13472. function read() {
  13473. const c2 = peek();
  13474. if (c2 === "\n") {
  13475. line++;
  13476. column = 0;
  13477. } else if (c2) {
  13478. column += c2.length;
  13479. } else {
  13480. column++;
  13481. }
  13482. if (c2) {
  13483. pos += c2.length;
  13484. }
  13485. return c2;
  13486. }
  13487. var lexStates = {
  13488. default() {
  13489. switch (c) {
  13490. case " ":
  13491. case "\v":
  13492. case "\f":
  13493. case " ":
  13494. case "\xA0":
  13495. case "\uFEFF":
  13496. case "\n":
  13497. case "\r":
  13498. case "\u2028":
  13499. case "\u2029":
  13500. read();
  13501. return;
  13502. case "/":
  13503. read();
  13504. lexState = "comment";
  13505. return;
  13506. case void 0:
  13507. read();
  13508. return newToken("eof");
  13509. }
  13510. if (util.isSpaceSeparator(c)) {
  13511. read();
  13512. return;
  13513. }
  13514. return lexStates[parseState]();
  13515. },
  13516. comment() {
  13517. switch (c) {
  13518. case "*":
  13519. read();
  13520. lexState = "multiLineComment";
  13521. return;
  13522. case "/":
  13523. read();
  13524. lexState = "singleLineComment";
  13525. return;
  13526. }
  13527. throw invalidChar(read());
  13528. },
  13529. multiLineComment() {
  13530. switch (c) {
  13531. case "*":
  13532. read();
  13533. lexState = "multiLineCommentAsterisk";
  13534. return;
  13535. case void 0:
  13536. throw invalidChar(read());
  13537. }
  13538. read();
  13539. },
  13540. multiLineCommentAsterisk() {
  13541. switch (c) {
  13542. case "*":
  13543. read();
  13544. return;
  13545. case "/":
  13546. read();
  13547. lexState = "default";
  13548. return;
  13549. case void 0:
  13550. throw invalidChar(read());
  13551. }
  13552. read();
  13553. lexState = "multiLineComment";
  13554. },
  13555. singleLineComment() {
  13556. switch (c) {
  13557. case "\n":
  13558. case "\r":
  13559. case "\u2028":
  13560. case "\u2029":
  13561. read();
  13562. lexState = "default";
  13563. return;
  13564. case void 0:
  13565. read();
  13566. return newToken("eof");
  13567. }
  13568. read();
  13569. },
  13570. value() {
  13571. switch (c) {
  13572. case "{":
  13573. case "[":
  13574. return newToken("punctuator", read());
  13575. case "n":
  13576. read();
  13577. literal("ull");
  13578. return newToken("null", null);
  13579. case "t":
  13580. read();
  13581. literal("rue");
  13582. return newToken("boolean", true);
  13583. case "f":
  13584. read();
  13585. literal("alse");
  13586. return newToken("boolean", false);
  13587. case "-":
  13588. case "+":
  13589. if (read() === "-") {
  13590. sign = -1;
  13591. }
  13592. lexState = "sign";
  13593. return;
  13594. case ".":
  13595. buffer = read();
  13596. lexState = "decimalPointLeading";
  13597. return;
  13598. case "0":
  13599. buffer = read();
  13600. lexState = "zero";
  13601. return;
  13602. case "1":
  13603. case "2":
  13604. case "3":
  13605. case "4":
  13606. case "5":
  13607. case "6":
  13608. case "7":
  13609. case "8":
  13610. case "9":
  13611. buffer = read();
  13612. lexState = "decimalInteger";
  13613. return;
  13614. case "I":
  13615. read();
  13616. literal("nfinity");
  13617. return newToken("numeric", Infinity);
  13618. case "N":
  13619. read();
  13620. literal("aN");
  13621. return newToken("numeric", NaN);
  13622. case '"':
  13623. case "'":
  13624. doubleQuote = read() === '"';
  13625. buffer = "";
  13626. lexState = "string";
  13627. return;
  13628. }
  13629. throw invalidChar(read());
  13630. },
  13631. identifierNameStartEscape() {
  13632. if (c !== "u") {
  13633. throw invalidChar(read());
  13634. }
  13635. read();
  13636. const u = unicodeEscape();
  13637. switch (u) {
  13638. case "$":
  13639. case "_":
  13640. break;
  13641. default:
  13642. if (!util.isIdStartChar(u)) {
  13643. throw invalidIdentifier();
  13644. }
  13645. break;
  13646. }
  13647. buffer += u;
  13648. lexState = "identifierName";
  13649. },
  13650. identifierName() {
  13651. switch (c) {
  13652. case "$":
  13653. case "_":
  13654. case "\u200C":
  13655. case "\u200D":
  13656. buffer += read();
  13657. return;
  13658. case "\\":
  13659. read();
  13660. lexState = "identifierNameEscape";
  13661. return;
  13662. }
  13663. if (util.isIdContinueChar(c)) {
  13664. buffer += read();
  13665. return;
  13666. }
  13667. return newToken("identifier", buffer);
  13668. },
  13669. identifierNameEscape() {
  13670. if (c !== "u") {
  13671. throw invalidChar(read());
  13672. }
  13673. read();
  13674. const u = unicodeEscape();
  13675. switch (u) {
  13676. case "$":
  13677. case "_":
  13678. case "\u200C":
  13679. case "\u200D":
  13680. break;
  13681. default:
  13682. if (!util.isIdContinueChar(u)) {
  13683. throw invalidIdentifier();
  13684. }
  13685. break;
  13686. }
  13687. buffer += u;
  13688. lexState = "identifierName";
  13689. },
  13690. sign() {
  13691. switch (c) {
  13692. case ".":
  13693. buffer = read();
  13694. lexState = "decimalPointLeading";
  13695. return;
  13696. case "0":
  13697. buffer = read();
  13698. lexState = "zero";
  13699. return;
  13700. case "1":
  13701. case "2":
  13702. case "3":
  13703. case "4":
  13704. case "5":
  13705. case "6":
  13706. case "7":
  13707. case "8":
  13708. case "9":
  13709. buffer = read();
  13710. lexState = "decimalInteger";
  13711. return;
  13712. case "I":
  13713. read();
  13714. literal("nfinity");
  13715. return newToken("numeric", sign * Infinity);
  13716. case "N":
  13717. read();
  13718. literal("aN");
  13719. return newToken("numeric", NaN);
  13720. }
  13721. throw invalidChar(read());
  13722. },
  13723. zero() {
  13724. switch (c) {
  13725. case ".":
  13726. buffer += read();
  13727. lexState = "decimalPoint";
  13728. return;
  13729. case "e":
  13730. case "E":
  13731. buffer += read();
  13732. lexState = "decimalExponent";
  13733. return;
  13734. case "x":
  13735. case "X":
  13736. buffer += read();
  13737. lexState = "hexadecimal";
  13738. return;
  13739. }
  13740. return newToken("numeric", sign * 0);
  13741. },
  13742. decimalInteger() {
  13743. switch (c) {
  13744. case ".":
  13745. buffer += read();
  13746. lexState = "decimalPoint";
  13747. return;
  13748. case "e":
  13749. case "E":
  13750. buffer += read();
  13751. lexState = "decimalExponent";
  13752. return;
  13753. }
  13754. if (util.isDigit(c)) {
  13755. buffer += read();
  13756. return;
  13757. }
  13758. return newToken("numeric", sign * Number(buffer));
  13759. },
  13760. decimalPointLeading() {
  13761. if (util.isDigit(c)) {
  13762. buffer += read();
  13763. lexState = "decimalFraction";
  13764. return;
  13765. }
  13766. throw invalidChar(read());
  13767. },
  13768. decimalPoint() {
  13769. switch (c) {
  13770. case "e":
  13771. case "E":
  13772. buffer += read();
  13773. lexState = "decimalExponent";
  13774. return;
  13775. }
  13776. if (util.isDigit(c)) {
  13777. buffer += read();
  13778. lexState = "decimalFraction";
  13779. return;
  13780. }
  13781. return newToken("numeric", sign * Number(buffer));
  13782. },
  13783. decimalFraction() {
  13784. switch (c) {
  13785. case "e":
  13786. case "E":
  13787. buffer += read();
  13788. lexState = "decimalExponent";
  13789. return;
  13790. }
  13791. if (util.isDigit(c)) {
  13792. buffer += read();
  13793. return;
  13794. }
  13795. return newToken("numeric", sign * Number(buffer));
  13796. },
  13797. decimalExponent() {
  13798. switch (c) {
  13799. case "+":
  13800. case "-":
  13801. buffer += read();
  13802. lexState = "decimalExponentSign";
  13803. return;
  13804. }
  13805. if (util.isDigit(c)) {
  13806. buffer += read();
  13807. lexState = "decimalExponentInteger";
  13808. return;
  13809. }
  13810. throw invalidChar(read());
  13811. },
  13812. decimalExponentSign() {
  13813. if (util.isDigit(c)) {
  13814. buffer += read();
  13815. lexState = "decimalExponentInteger";
  13816. return;
  13817. }
  13818. throw invalidChar(read());
  13819. },
  13820. decimalExponentInteger() {
  13821. if (util.isDigit(c)) {
  13822. buffer += read();
  13823. return;
  13824. }
  13825. return newToken("numeric", sign * Number(buffer));
  13826. },
  13827. hexadecimal() {
  13828. if (util.isHexDigit(c)) {
  13829. buffer += read();
  13830. lexState = "hexadecimalInteger";
  13831. return;
  13832. }
  13833. throw invalidChar(read());
  13834. },
  13835. hexadecimalInteger() {
  13836. if (util.isHexDigit(c)) {
  13837. buffer += read();
  13838. return;
  13839. }
  13840. return newToken("numeric", sign * Number(buffer));
  13841. },
  13842. string() {
  13843. switch (c) {
  13844. case "\\":
  13845. read();
  13846. buffer += escape();
  13847. return;
  13848. case '"':
  13849. if (doubleQuote) {
  13850. read();
  13851. return newToken("string", buffer);
  13852. }
  13853. buffer += read();
  13854. return;
  13855. case "'":
  13856. if (!doubleQuote) {
  13857. read();
  13858. return newToken("string", buffer);
  13859. }
  13860. buffer += read();
  13861. return;
  13862. case "\n":
  13863. case "\r":
  13864. throw invalidChar(read());
  13865. case "\u2028":
  13866. case "\u2029":
  13867. separatorChar(c);
  13868. break;
  13869. case void 0:
  13870. throw invalidChar(read());
  13871. }
  13872. buffer += read();
  13873. },
  13874. start() {
  13875. switch (c) {
  13876. case "{":
  13877. case "[":
  13878. return newToken("punctuator", read());
  13879. }
  13880. lexState = "value";
  13881. },
  13882. beforePropertyName() {
  13883. switch (c) {
  13884. case "$":
  13885. case "_":
  13886. buffer = read();
  13887. lexState = "identifierName";
  13888. return;
  13889. case "\\":
  13890. read();
  13891. lexState = "identifierNameStartEscape";
  13892. return;
  13893. case "}":
  13894. return newToken("punctuator", read());
  13895. case '"':
  13896. case "'":
  13897. doubleQuote = read() === '"';
  13898. lexState = "string";
  13899. return;
  13900. }
  13901. if (util.isIdStartChar(c)) {
  13902. buffer += read();
  13903. lexState = "identifierName";
  13904. return;
  13905. }
  13906. throw invalidChar(read());
  13907. },
  13908. afterPropertyName() {
  13909. if (c === ":") {
  13910. return newToken("punctuator", read());
  13911. }
  13912. throw invalidChar(read());
  13913. },
  13914. beforePropertyValue() {
  13915. lexState = "value";
  13916. },
  13917. afterPropertyValue() {
  13918. switch (c) {
  13919. case ",":
  13920. case "}":
  13921. return newToken("punctuator", read());
  13922. }
  13923. throw invalidChar(read());
  13924. },
  13925. beforeArrayValue() {
  13926. if (c === "]") {
  13927. return newToken("punctuator", read());
  13928. }
  13929. lexState = "value";
  13930. },
  13931. afterArrayValue() {
  13932. switch (c) {
  13933. case ",":
  13934. case "]":
  13935. return newToken("punctuator", read());
  13936. }
  13937. throw invalidChar(read());
  13938. },
  13939. end() {
  13940. throw invalidChar(read());
  13941. }
  13942. };
  13943. function newToken(type, value) {
  13944. return {
  13945. type,
  13946. value,
  13947. line,
  13948. column
  13949. };
  13950. }
  13951. function literal(s) {
  13952. for (const c2 of s) {
  13953. const p = peek();
  13954. if (p !== c2) {
  13955. throw invalidChar(read());
  13956. }
  13957. read();
  13958. }
  13959. }
  13960. function escape() {
  13961. const c2 = peek();
  13962. switch (c2) {
  13963. case "b":
  13964. read();
  13965. return "\b";
  13966. case "f":
  13967. read();
  13968. return "\f";
  13969. case "n":
  13970. read();
  13971. return "\n";
  13972. case "r":
  13973. read();
  13974. return "\r";
  13975. case "t":
  13976. read();
  13977. return " ";
  13978. case "v":
  13979. read();
  13980. return "\v";
  13981. case "0":
  13982. read();
  13983. if (util.isDigit(peek())) {
  13984. throw invalidChar(read());
  13985. }
  13986. return "\0";
  13987. case "x":
  13988. read();
  13989. return hexEscape();
  13990. case "u":
  13991. read();
  13992. return unicodeEscape();
  13993. case "\n":
  13994. case "\u2028":
  13995. case "\u2029":
  13996. read();
  13997. return "";
  13998. case "\r":
  13999. read();
  14000. if (peek() === "\n") {
  14001. read();
  14002. }
  14003. return "";
  14004. case "1":
  14005. case "2":
  14006. case "3":
  14007. case "4":
  14008. case "5":
  14009. case "6":
  14010. case "7":
  14011. case "8":
  14012. case "9":
  14013. throw invalidChar(read());
  14014. case void 0:
  14015. throw invalidChar(read());
  14016. }
  14017. return read();
  14018. }
  14019. function hexEscape() {
  14020. let buffer2 = "";
  14021. let c2 = peek();
  14022. if (!util.isHexDigit(c2)) {
  14023. throw invalidChar(read());
  14024. }
  14025. buffer2 += read();
  14026. c2 = peek();
  14027. if (!util.isHexDigit(c2)) {
  14028. throw invalidChar(read());
  14029. }
  14030. buffer2 += read();
  14031. return String.fromCodePoint(parseInt(buffer2, 16));
  14032. }
  14033. function unicodeEscape() {
  14034. let buffer2 = "";
  14035. let count = 4;
  14036. while (count-- > 0) {
  14037. const c2 = peek();
  14038. if (!util.isHexDigit(c2)) {
  14039. throw invalidChar(read());
  14040. }
  14041. buffer2 += read();
  14042. }
  14043. return String.fromCodePoint(parseInt(buffer2, 16));
  14044. }
  14045. var parseStates = {
  14046. start() {
  14047. if (token.type === "eof") {
  14048. throw invalidEOF();
  14049. }
  14050. push();
  14051. },
  14052. beforePropertyName() {
  14053. switch (token.type) {
  14054. case "identifier":
  14055. case "string":
  14056. key = token.value;
  14057. parseState = "afterPropertyName";
  14058. return;
  14059. case "punctuator":
  14060. pop();
  14061. return;
  14062. case "eof":
  14063. throw invalidEOF();
  14064. }
  14065. },
  14066. afterPropertyName() {
  14067. if (token.type === "eof") {
  14068. throw invalidEOF();
  14069. }
  14070. parseState = "beforePropertyValue";
  14071. },
  14072. beforePropertyValue() {
  14073. if (token.type === "eof") {
  14074. throw invalidEOF();
  14075. }
  14076. push();
  14077. },
  14078. beforeArrayValue() {
  14079. if (token.type === "eof") {
  14080. throw invalidEOF();
  14081. }
  14082. if (token.type === "punctuator" && token.value === "]") {
  14083. pop();
  14084. return;
  14085. }
  14086. push();
  14087. },
  14088. afterPropertyValue() {
  14089. if (token.type === "eof") {
  14090. throw invalidEOF();
  14091. }
  14092. switch (token.value) {
  14093. case ",":
  14094. parseState = "beforePropertyName";
  14095. return;
  14096. case "}":
  14097. pop();
  14098. }
  14099. },
  14100. afterArrayValue() {
  14101. if (token.type === "eof") {
  14102. throw invalidEOF();
  14103. }
  14104. switch (token.value) {
  14105. case ",":
  14106. parseState = "beforeArrayValue";
  14107. return;
  14108. case "]":
  14109. pop();
  14110. }
  14111. },
  14112. end() {
  14113. }
  14114. };
  14115. function push() {
  14116. let value;
  14117. switch (token.type) {
  14118. case "punctuator":
  14119. switch (token.value) {
  14120. case "{":
  14121. value = {};
  14122. break;
  14123. case "[":
  14124. value = [];
  14125. break;
  14126. }
  14127. break;
  14128. case "null":
  14129. case "boolean":
  14130. case "numeric":
  14131. case "string":
  14132. value = token.value;
  14133. break;
  14134. }
  14135. if (root === void 0) {
  14136. root = value;
  14137. } else {
  14138. const parent = stack[stack.length - 1];
  14139. if (Array.isArray(parent)) {
  14140. parent.push(value);
  14141. } else {
  14142. parent[key] = value;
  14143. }
  14144. }
  14145. if (value !== null && typeof value === "object") {
  14146. stack.push(value);
  14147. if (Array.isArray(value)) {
  14148. parseState = "beforeArrayValue";
  14149. } else {
  14150. parseState = "beforePropertyName";
  14151. }
  14152. } else {
  14153. const current = stack[stack.length - 1];
  14154. if (current == null) {
  14155. parseState = "end";
  14156. } else if (Array.isArray(current)) {
  14157. parseState = "afterArrayValue";
  14158. } else {
  14159. parseState = "afterPropertyValue";
  14160. }
  14161. }
  14162. }
  14163. function pop() {
  14164. stack.pop();
  14165. const current = stack[stack.length - 1];
  14166. if (current == null) {
  14167. parseState = "end";
  14168. } else if (Array.isArray(current)) {
  14169. parseState = "afterArrayValue";
  14170. } else {
  14171. parseState = "afterPropertyValue";
  14172. }
  14173. }
  14174. function invalidChar(c2) {
  14175. if (c2 === void 0) {
  14176. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14177. }
  14178. return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
  14179. }
  14180. function invalidEOF() {
  14181. return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
  14182. }
  14183. function invalidIdentifier() {
  14184. column -= 5;
  14185. return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
  14186. }
  14187. function separatorChar(c2) {
  14188. console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
  14189. }
  14190. function formatChar(c2) {
  14191. const replacements = {
  14192. "'": "\\'",
  14193. '"': '\\"',
  14194. "\\": "\\\\",
  14195. "\b": "\\b",
  14196. "\f": "\\f",
  14197. "\n": "\\n",
  14198. "\r": "\\r",
  14199. " ": "\\t",
  14200. "\v": "\\v",
  14201. "\0": "\\0",
  14202. "\u2028": "\\u2028",
  14203. "\u2029": "\\u2029"
  14204. };
  14205. if (replacements[c2]) {
  14206. return replacements[c2];
  14207. }
  14208. if (c2 < " ") {
  14209. const hexString = c2.charCodeAt(0).toString(16);
  14210. return "\\x" + ("00" + hexString).substring(hexString.length);
  14211. }
  14212. return c2;
  14213. }
  14214. function syntaxError(message) {
  14215. const err = new SyntaxError(message);
  14216. err.lineNumber = line;
  14217. err.columnNumber = column;
  14218. return err;
  14219. }
  14220. }
  14221. });
  14222. var require_stringify2 = __commonJS2({
  14223. "node_modules/json5/lib/stringify.js"(exports2, module2) {
  14224. var util = require_util2();
  14225. module2.exports = function stringify(value, replacer, space) {
  14226. const stack = [];
  14227. let indent = "";
  14228. let propertyList;
  14229. let replacerFunc;
  14230. let gap = "";
  14231. let quote;
  14232. if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
  14233. space = replacer.space;
  14234. quote = replacer.quote;
  14235. replacer = replacer.replacer;
  14236. }
  14237. if (typeof replacer === "function") {
  14238. replacerFunc = replacer;
  14239. } else if (Array.isArray(replacer)) {
  14240. propertyList = [];
  14241. for (const v of replacer) {
  14242. let item;
  14243. if (typeof v === "string") {
  14244. item = v;
  14245. } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
  14246. item = String(v);
  14247. }
  14248. if (item !== void 0 && propertyList.indexOf(item) < 0) {
  14249. propertyList.push(item);
  14250. }
  14251. }
  14252. }
  14253. if (space instanceof Number) {
  14254. space = Number(space);
  14255. } else if (space instanceof String) {
  14256. space = String(space);
  14257. }
  14258. if (typeof space === "number") {
  14259. if (space > 0) {
  14260. space = Math.min(10, Math.floor(space));
  14261. gap = " ".substr(0, space);
  14262. }
  14263. } else if (typeof space === "string") {
  14264. gap = space.substr(0, 10);
  14265. }
  14266. return serializeProperty("", {
  14267. "": value
  14268. });
  14269. function serializeProperty(key, holder) {
  14270. let value2 = holder[key];
  14271. if (value2 != null) {
  14272. if (typeof value2.toJSON5 === "function") {
  14273. value2 = value2.toJSON5(key);
  14274. } else if (typeof value2.toJSON === "function") {
  14275. value2 = value2.toJSON(key);
  14276. }
  14277. }
  14278. if (replacerFunc) {
  14279. value2 = replacerFunc.call(holder, key, value2);
  14280. }
  14281. if (value2 instanceof Number) {
  14282. value2 = Number(value2);
  14283. } else if (value2 instanceof String) {
  14284. value2 = String(value2);
  14285. } else if (value2 instanceof Boolean) {
  14286. value2 = value2.valueOf();
  14287. }
  14288. switch (value2) {
  14289. case null:
  14290. return "null";
  14291. case true:
  14292. return "true";
  14293. case false:
  14294. return "false";
  14295. }
  14296. if (typeof value2 === "string") {
  14297. return quoteString(value2, false);
  14298. }
  14299. if (typeof value2 === "number") {
  14300. return String(value2);
  14301. }
  14302. if (typeof value2 === "object") {
  14303. return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
  14304. }
  14305. return void 0;
  14306. }
  14307. function quoteString(value2) {
  14308. const quotes = {
  14309. "'": 0.1,
  14310. '"': 0.2
  14311. };
  14312. const replacements = {
  14313. "'": "\\'",
  14314. '"': '\\"',
  14315. "\\": "\\\\",
  14316. "\b": "\\b",
  14317. "\f": "\\f",
  14318. "\n": "\\n",
  14319. "\r": "\\r",
  14320. " ": "\\t",
  14321. "\v": "\\v",
  14322. "\0": "\\0",
  14323. "\u2028": "\\u2028",
  14324. "\u2029": "\\u2029"
  14325. };
  14326. let product = "";
  14327. for (let i = 0; i < value2.length; i++) {
  14328. const c = value2[i];
  14329. switch (c) {
  14330. case "'":
  14331. case '"':
  14332. quotes[c]++;
  14333. product += c;
  14334. continue;
  14335. case "\0":
  14336. if (util.isDigit(value2[i + 1])) {
  14337. product += "\\x00";
  14338. continue;
  14339. }
  14340. }
  14341. if (replacements[c]) {
  14342. product += replacements[c];
  14343. continue;
  14344. }
  14345. if (c < " ") {
  14346. let hexString = c.charCodeAt(0).toString(16);
  14347. product += "\\x" + ("00" + hexString).substring(hexString.length);
  14348. continue;
  14349. }
  14350. product += c;
  14351. }
  14352. const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
  14353. product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
  14354. return quoteChar + product + quoteChar;
  14355. }
  14356. function serializeObject(value2) {
  14357. if (stack.indexOf(value2) >= 0) {
  14358. throw TypeError("Converting circular structure to JSON5");
  14359. }
  14360. stack.push(value2);
  14361. let stepback = indent;
  14362. indent = indent + gap;
  14363. let keys = propertyList || Object.keys(value2);
  14364. let partial = [];
  14365. for (const key of keys) {
  14366. const propertyString = serializeProperty(key, value2);
  14367. if (propertyString !== void 0) {
  14368. let member = serializeKey(key) + ":";
  14369. if (gap !== "") {
  14370. member += " ";
  14371. }
  14372. member += propertyString;
  14373. partial.push(member);
  14374. }
  14375. }
  14376. let final;
  14377. if (partial.length === 0) {
  14378. final = "{}";
  14379. } else {
  14380. let properties;
  14381. if (gap === "") {
  14382. properties = partial.join(",");
  14383. final = "{" + properties + "}";
  14384. } else {
  14385. let separator = ",\n" + indent;
  14386. properties = partial.join(separator);
  14387. final = "{\n" + indent + properties + ",\n" + stepback + "}";
  14388. }
  14389. }
  14390. stack.pop();
  14391. indent = stepback;
  14392. return final;
  14393. }
  14394. function serializeKey(key) {
  14395. if (key.length === 0) {
  14396. return quoteString(key, true);
  14397. }
  14398. const firstChar = String.fromCodePoint(key.codePointAt(0));
  14399. if (!util.isIdStartChar(firstChar)) {
  14400. return quoteString(key, true);
  14401. }
  14402. for (let i = firstChar.length; i < key.length; i++) {
  14403. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  14404. return quoteString(key, true);
  14405. }
  14406. }
  14407. return key;
  14408. }
  14409. function serializeArray(value2) {
  14410. if (stack.indexOf(value2) >= 0) {
  14411. throw TypeError("Converting circular structure to JSON5");
  14412. }
  14413. stack.push(value2);
  14414. let stepback = indent;
  14415. indent = indent + gap;
  14416. let partial = [];
  14417. for (let i = 0; i < value2.length; i++) {
  14418. const propertyString = serializeProperty(String(i), value2);
  14419. partial.push(propertyString !== void 0 ? propertyString : "null");
  14420. }
  14421. let final;
  14422. if (partial.length === 0) {
  14423. final = "[]";
  14424. } else {
  14425. if (gap === "") {
  14426. let properties = partial.join(",");
  14427. final = "[" + properties + "]";
  14428. } else {
  14429. let separator = ",\n" + indent;
  14430. let properties = partial.join(separator);
  14431. final = "[\n" + indent + properties + ",\n" + stepback + "]";
  14432. }
  14433. }
  14434. stack.pop();
  14435. indent = stepback;
  14436. return final;
  14437. }
  14438. };
  14439. }
  14440. });
  14441. var require_lib6 = __commonJS2({
  14442. "node_modules/json5/lib/index.js"(exports2, module2) {
  14443. var parse = require_parse3();
  14444. var stringify = require_stringify2();
  14445. var JSON5 = {
  14446. parse,
  14447. stringify
  14448. };
  14449. module2.exports = JSON5;
  14450. }
  14451. });
  14452. var require_load_json5 = __commonJS2({
  14453. "src/utils/load-json5.js"(exports2, module2) {
  14454. "use strict";
  14455. var {
  14456. parse
  14457. } = require_lib6();
  14458. module2.exports = function(filePath, content) {
  14459. try {
  14460. return parse(content);
  14461. } catch (error) {
  14462. error.message = `JSON5 Error in ${filePath}:
  14463. ${error.message}`;
  14464. throw error;
  14465. }
  14466. };
  14467. }
  14468. });
  14469. var require_partition = __commonJS2({
  14470. "src/utils/partition.js"(exports2, module2) {
  14471. "use strict";
  14472. function partition(array, predicate) {
  14473. const result = [[], []];
  14474. for (const value of array) {
  14475. result[predicate(value) ? 0 : 1].push(value);
  14476. }
  14477. return result;
  14478. }
  14479. module2.exports = partition;
  14480. }
  14481. });
  14482. var require_homedir = __commonJS2({
  14483. "node_modules/resolve/lib/homedir.js"(exports2, module2) {
  14484. "use strict";
  14485. var os = require("os");
  14486. module2.exports = os.homedir || function homedir() {
  14487. var home = process.env.HOME;
  14488. var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
  14489. if (process.platform === "win32") {
  14490. return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
  14491. }
  14492. if (process.platform === "darwin") {
  14493. return home || (user ? "/Users/" + user : null);
  14494. }
  14495. if (process.platform === "linux") {
  14496. return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
  14497. }
  14498. return home || null;
  14499. };
  14500. }
  14501. });
  14502. var require_caller = __commonJS2({
  14503. "node_modules/resolve/lib/caller.js"(exports2, module2) {
  14504. module2.exports = function() {
  14505. var origPrepareStackTrace = Error.prepareStackTrace;
  14506. Error.prepareStackTrace = function(_, stack2) {
  14507. return stack2;
  14508. };
  14509. var stack = new Error().stack;
  14510. Error.prepareStackTrace = origPrepareStackTrace;
  14511. return stack[2].getFileName();
  14512. };
  14513. }
  14514. });
  14515. var require_path_parse = __commonJS2({
  14516. "node_modules/path-parse/index.js"(exports2, module2) {
  14517. "use strict";
  14518. var isWindows = process.platform === "win32";
  14519. var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
  14520. var win32 = {};
  14521. function win32SplitPath(filename) {
  14522. return splitWindowsRe.exec(filename).slice(1);
  14523. }
  14524. win32.parse = function(pathString) {
  14525. if (typeof pathString !== "string") {
  14526. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14527. }
  14528. var allParts = win32SplitPath(pathString);
  14529. if (!allParts || allParts.length !== 5) {
  14530. throw new TypeError("Invalid path '" + pathString + "'");
  14531. }
  14532. return {
  14533. root: allParts[1],
  14534. dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
  14535. base: allParts[2],
  14536. ext: allParts[4],
  14537. name: allParts[3]
  14538. };
  14539. };
  14540. var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
  14541. var posix = {};
  14542. function posixSplitPath(filename) {
  14543. return splitPathRe.exec(filename).slice(1);
  14544. }
  14545. posix.parse = function(pathString) {
  14546. if (typeof pathString !== "string") {
  14547. throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
  14548. }
  14549. var allParts = posixSplitPath(pathString);
  14550. if (!allParts || allParts.length !== 5) {
  14551. throw new TypeError("Invalid path '" + pathString + "'");
  14552. }
  14553. return {
  14554. root: allParts[1],
  14555. dir: allParts[0].slice(0, -1),
  14556. base: allParts[2],
  14557. ext: allParts[4],
  14558. name: allParts[3]
  14559. };
  14560. };
  14561. if (isWindows)
  14562. module2.exports = win32.parse;
  14563. else
  14564. module2.exports = posix.parse;
  14565. module2.exports.posix = posix.parse;
  14566. module2.exports.win32 = win32.parse;
  14567. }
  14568. });
  14569. var require_node_modules_paths = __commonJS2({
  14570. "node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
  14571. var path = require("path");
  14572. var parse = path.parse || require_path_parse();
  14573. var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
  14574. var prefix = "/";
  14575. if (/^([A-Za-z]:)/.test(absoluteStart)) {
  14576. prefix = "";
  14577. } else if (/^\\\\/.test(absoluteStart)) {
  14578. prefix = "\\\\";
  14579. }
  14580. var paths = [absoluteStart];
  14581. var parsed = parse(absoluteStart);
  14582. while (parsed.dir !== paths[paths.length - 1]) {
  14583. paths.push(parsed.dir);
  14584. parsed = parse(parsed.dir);
  14585. }
  14586. return paths.reduce(function(dirs, aPath) {
  14587. return dirs.concat(modules.map(function(moduleDir) {
  14588. return path.resolve(prefix, aPath, moduleDir);
  14589. }));
  14590. }, []);
  14591. };
  14592. module2.exports = function nodeModulesPaths(start, opts, request) {
  14593. var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
  14594. if (opts && typeof opts.paths === "function") {
  14595. return opts.paths(request, start, function() {
  14596. return getNodeModulesDirs(start, modules);
  14597. }, opts);
  14598. }
  14599. var dirs = getNodeModulesDirs(start, modules);
  14600. return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
  14601. };
  14602. }
  14603. });
  14604. var require_normalize_options = __commonJS2({
  14605. "node_modules/resolve/lib/normalize-options.js"(exports2, module2) {
  14606. module2.exports = function(x, opts) {
  14607. return opts || {};
  14608. };
  14609. }
  14610. });
  14611. var require_implementation = __commonJS2({
  14612. "node_modules/function-bind/implementation.js"(exports2, module2) {
  14613. "use strict";
  14614. var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
  14615. var slice = Array.prototype.slice;
  14616. var toStr = Object.prototype.toString;
  14617. var funcType = "[object Function]";
  14618. module2.exports = function bind(that) {
  14619. var target = this;
  14620. if (typeof target !== "function" || toStr.call(target) !== funcType) {
  14621. throw new TypeError(ERROR_MESSAGE + target);
  14622. }
  14623. var args = slice.call(arguments, 1);
  14624. var bound;
  14625. var binder = function() {
  14626. if (this instanceof bound) {
  14627. var result = target.apply(this, args.concat(slice.call(arguments)));
  14628. if (Object(result) === result) {
  14629. return result;
  14630. }
  14631. return this;
  14632. } else {
  14633. return target.apply(that, args.concat(slice.call(arguments)));
  14634. }
  14635. };
  14636. var boundLength = Math.max(0, target.length - args.length);
  14637. var boundArgs = [];
  14638. for (var i = 0; i < boundLength; i++) {
  14639. boundArgs.push("$" + i);
  14640. }
  14641. bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
  14642. if (target.prototype) {
  14643. var Empty = function Empty2() {
  14644. };
  14645. Empty.prototype = target.prototype;
  14646. bound.prototype = new Empty();
  14647. Empty.prototype = null;
  14648. }
  14649. return bound;
  14650. };
  14651. }
  14652. });
  14653. var require_function_bind = __commonJS2({
  14654. "node_modules/function-bind/index.js"(exports2, module2) {
  14655. "use strict";
  14656. var implementation = require_implementation();
  14657. module2.exports = Function.prototype.bind || implementation;
  14658. }
  14659. });
  14660. var require_src = __commonJS2({
  14661. "node_modules/has/src/index.js"(exports2, module2) {
  14662. "use strict";
  14663. var bind = require_function_bind();
  14664. module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  14665. }
  14666. });
  14667. var require_core2 = __commonJS2({
  14668. "node_modules/is-core-module/core.json"(exports2, module2) {
  14669. module2.exports = {
  14670. assert: true,
  14671. "node:assert": [">= 14.18 && < 15", ">= 16"],
  14672. "assert/strict": ">= 15",
  14673. "node:assert/strict": ">= 16",
  14674. async_hooks: ">= 8",
  14675. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  14676. buffer_ieee754: ">= 0.5 && < 0.9.7",
  14677. buffer: true,
  14678. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  14679. child_process: true,
  14680. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  14681. cluster: ">= 0.5",
  14682. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  14683. console: true,
  14684. "node:console": [">= 14.18 && < 15", ">= 16"],
  14685. constants: true,
  14686. "node:constants": [">= 14.18 && < 15", ">= 16"],
  14687. crypto: true,
  14688. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  14689. _debug_agent: ">= 1 && < 8",
  14690. _debugger: "< 8",
  14691. dgram: true,
  14692. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  14693. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  14694. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  14695. dns: true,
  14696. "node:dns": [">= 14.18 && < 15", ">= 16"],
  14697. "dns/promises": ">= 15",
  14698. "node:dns/promises": ">= 16",
  14699. domain: ">= 0.7.12",
  14700. "node:domain": [">= 14.18 && < 15", ">= 16"],
  14701. events: true,
  14702. "node:events": [">= 14.18 && < 15", ">= 16"],
  14703. freelist: "< 6",
  14704. fs: true,
  14705. "node:fs": [">= 14.18 && < 15", ">= 16"],
  14706. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  14707. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  14708. _http_agent: ">= 0.11.1",
  14709. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  14710. _http_client: ">= 0.11.1",
  14711. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  14712. _http_common: ">= 0.11.1",
  14713. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  14714. _http_incoming: ">= 0.11.1",
  14715. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  14716. _http_outgoing: ">= 0.11.1",
  14717. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  14718. _http_server: ">= 0.11.1",
  14719. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  14720. http: true,
  14721. "node:http": [">= 14.18 && < 15", ">= 16"],
  14722. http2: ">= 8.8",
  14723. "node:http2": [">= 14.18 && < 15", ">= 16"],
  14724. https: true,
  14725. "node:https": [">= 14.18 && < 15", ">= 16"],
  14726. inspector: ">= 8",
  14727. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  14728. _linklist: "< 8",
  14729. module: true,
  14730. "node:module": [">= 14.18 && < 15", ">= 16"],
  14731. net: true,
  14732. "node:net": [">= 14.18 && < 15", ">= 16"],
  14733. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  14734. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  14735. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  14736. os: true,
  14737. "node:os": [">= 14.18 && < 15", ">= 16"],
  14738. path: true,
  14739. "node:path": [">= 14.18 && < 15", ">= 16"],
  14740. "path/posix": ">= 15.3",
  14741. "node:path/posix": ">= 16",
  14742. "path/win32": ">= 15.3",
  14743. "node:path/win32": ">= 16",
  14744. perf_hooks: ">= 8.5",
  14745. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  14746. process: ">= 1",
  14747. "node:process": [">= 14.18 && < 15", ">= 16"],
  14748. punycode: ">= 0.5",
  14749. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  14750. querystring: true,
  14751. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  14752. readline: true,
  14753. "node:readline": [">= 14.18 && < 15", ">= 16"],
  14754. "readline/promises": ">= 17",
  14755. "node:readline/promises": ">= 17",
  14756. repl: true,
  14757. "node:repl": [">= 14.18 && < 15", ">= 16"],
  14758. smalloc: ">= 0.11.5 && < 3",
  14759. _stream_duplex: ">= 0.9.4",
  14760. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  14761. _stream_transform: ">= 0.9.4",
  14762. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  14763. _stream_wrap: ">= 1.4.1",
  14764. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  14765. _stream_passthrough: ">= 0.9.4",
  14766. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  14767. _stream_readable: ">= 0.9.4",
  14768. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  14769. _stream_writable: ">= 0.9.4",
  14770. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  14771. stream: true,
  14772. "node:stream": [">= 14.18 && < 15", ">= 16"],
  14773. "stream/consumers": ">= 16.7",
  14774. "node:stream/consumers": ">= 16.7",
  14775. "stream/promises": ">= 15",
  14776. "node:stream/promises": ">= 16",
  14777. "stream/web": ">= 16.5",
  14778. "node:stream/web": ">= 16.5",
  14779. string_decoder: true,
  14780. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  14781. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  14782. "node:sys": [">= 14.18 && < 15", ">= 16"],
  14783. timers: true,
  14784. "node:timers": [">= 14.18 && < 15", ">= 16"],
  14785. "timers/promises": ">= 15",
  14786. "node:timers/promises": ">= 16",
  14787. _tls_common: ">= 0.11.13",
  14788. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  14789. _tls_legacy: ">= 0.11.3 && < 10",
  14790. _tls_wrap: ">= 0.11.3",
  14791. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  14792. tls: true,
  14793. "node:tls": [">= 14.18 && < 15", ">= 16"],
  14794. trace_events: ">= 10",
  14795. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  14796. tty: true,
  14797. "node:tty": [">= 14.18 && < 15", ">= 16"],
  14798. url: true,
  14799. "node:url": [">= 14.18 && < 15", ">= 16"],
  14800. util: true,
  14801. "node:util": [">= 14.18 && < 15", ">= 16"],
  14802. "util/types": ">= 15.3",
  14803. "node:util/types": ">= 16",
  14804. "v8/tools/arguments": ">= 10 && < 12",
  14805. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14806. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14807. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14808. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14809. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14810. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  14811. v8: ">= 1",
  14812. "node:v8": [">= 14.18 && < 15", ">= 16"],
  14813. vm: true,
  14814. "node:vm": [">= 14.18 && < 15", ">= 16"],
  14815. wasi: ">= 13.4 && < 13.5",
  14816. worker_threads: ">= 11.7",
  14817. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  14818. zlib: ">= 0.5",
  14819. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  14820. };
  14821. }
  14822. });
  14823. var require_is_core_module = __commonJS2({
  14824. "node_modules/is-core-module/index.js"(exports2, module2) {
  14825. "use strict";
  14826. var has = require_src();
  14827. function specifierIncluded(current, specifier) {
  14828. var nodeParts = current.split(".");
  14829. var parts = specifier.split(" ");
  14830. var op = parts.length > 1 ? parts[0] : "=";
  14831. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  14832. for (var i = 0; i < 3; ++i) {
  14833. var cur = parseInt(nodeParts[i] || 0, 10);
  14834. var ver = parseInt(versionParts[i] || 0, 10);
  14835. if (cur === ver) {
  14836. continue;
  14837. }
  14838. if (op === "<") {
  14839. return cur < ver;
  14840. }
  14841. if (op === ">=") {
  14842. return cur >= ver;
  14843. }
  14844. return false;
  14845. }
  14846. return op === ">=";
  14847. }
  14848. function matchesRange(current, range) {
  14849. var specifiers = range.split(/ ?&& ?/);
  14850. if (specifiers.length === 0) {
  14851. return false;
  14852. }
  14853. for (var i = 0; i < specifiers.length; ++i) {
  14854. if (!specifierIncluded(current, specifiers[i])) {
  14855. return false;
  14856. }
  14857. }
  14858. return true;
  14859. }
  14860. function versionIncluded(nodeVersion, specifierValue) {
  14861. if (typeof specifierValue === "boolean") {
  14862. return specifierValue;
  14863. }
  14864. var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
  14865. if (typeof current !== "string") {
  14866. throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
  14867. }
  14868. if (specifierValue && typeof specifierValue === "object") {
  14869. for (var i = 0; i < specifierValue.length; ++i) {
  14870. if (matchesRange(current, specifierValue[i])) {
  14871. return true;
  14872. }
  14873. }
  14874. return false;
  14875. }
  14876. return matchesRange(current, specifierValue);
  14877. }
  14878. var data = require_core2();
  14879. module2.exports = function isCore(x, nodeVersion) {
  14880. return has(data, x) && versionIncluded(nodeVersion, data[x]);
  14881. };
  14882. }
  14883. });
  14884. var require_async = __commonJS2({
  14885. "node_modules/resolve/lib/async.js"(exports2, module2) {
  14886. var fs = require("fs");
  14887. var getHomedir = require_homedir();
  14888. var path = require("path");
  14889. var caller = require_caller();
  14890. var nodeModulesPaths = require_node_modules_paths();
  14891. var normalizeOptions = require_normalize_options();
  14892. var isCore = require_is_core_module();
  14893. var realpathFS = fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
  14894. var homedir = getHomedir();
  14895. var defaultPaths = function() {
  14896. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  14897. };
  14898. var defaultIsFile = function isFile(file, cb) {
  14899. fs.stat(file, function(err, stat) {
  14900. if (!err) {
  14901. return cb(null, stat.isFile() || stat.isFIFO());
  14902. }
  14903. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  14904. return cb(null, false);
  14905. return cb(err);
  14906. });
  14907. };
  14908. var defaultIsDir = function isDirectory(dir, cb) {
  14909. fs.stat(dir, function(err, stat) {
  14910. if (!err) {
  14911. return cb(null, stat.isDirectory());
  14912. }
  14913. if (err.code === "ENOENT" || err.code === "ENOTDIR")
  14914. return cb(null, false);
  14915. return cb(err);
  14916. });
  14917. };
  14918. var defaultRealpath = function realpath(x, cb) {
  14919. realpathFS(x, function(realpathErr, realPath) {
  14920. if (realpathErr && realpathErr.code !== "ENOENT")
  14921. cb(realpathErr);
  14922. else
  14923. cb(null, realpathErr ? x : realPath);
  14924. });
  14925. };
  14926. var maybeRealpath = function maybeRealpath2(realpath, x, opts, cb) {
  14927. if (opts && opts.preserveSymlinks === false) {
  14928. realpath(x, cb);
  14929. } else {
  14930. cb(null, x);
  14931. }
  14932. };
  14933. var defaultReadPackage = function defaultReadPackage2(readFile, pkgfile, cb) {
  14934. readFile(pkgfile, function(readFileErr, body) {
  14935. if (readFileErr)
  14936. cb(readFileErr);
  14937. else {
  14938. try {
  14939. var pkg = JSON.parse(body);
  14940. cb(null, pkg);
  14941. } catch (jsonErr) {
  14942. cb(null);
  14943. }
  14944. }
  14945. });
  14946. };
  14947. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  14948. var dirs = nodeModulesPaths(start, opts, x);
  14949. for (var i = 0; i < dirs.length; i++) {
  14950. dirs[i] = path.join(dirs[i], x);
  14951. }
  14952. return dirs;
  14953. };
  14954. module2.exports = function resolve(x, options, callback) {
  14955. var cb = callback;
  14956. var opts = options;
  14957. if (typeof options === "function") {
  14958. cb = opts;
  14959. opts = {};
  14960. }
  14961. if (typeof x !== "string") {
  14962. var err = new TypeError("Path must be a string.");
  14963. return process.nextTick(function() {
  14964. cb(err);
  14965. });
  14966. }
  14967. opts = normalizeOptions(x, opts);
  14968. var isFile = opts.isFile || defaultIsFile;
  14969. var isDirectory = opts.isDirectory || defaultIsDir;
  14970. var readFile = opts.readFile || fs.readFile;
  14971. var realpath = opts.realpath || defaultRealpath;
  14972. var readPackage = opts.readPackage || defaultReadPackage;
  14973. if (opts.readFile && opts.readPackage) {
  14974. var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
  14975. return process.nextTick(function() {
  14976. cb(conflictErr);
  14977. });
  14978. }
  14979. var packageIterator = opts.packageIterator;
  14980. var extensions = opts.extensions || [".js"];
  14981. var includeCoreModules = opts.includeCoreModules !== false;
  14982. var basedir = opts.basedir || path.dirname(caller());
  14983. var parent = opts.filename || basedir;
  14984. opts.paths = opts.paths || defaultPaths();
  14985. var absoluteStart = path.resolve(basedir);
  14986. maybeRealpath(realpath, absoluteStart, opts, function(err2, realStart) {
  14987. if (err2)
  14988. cb(err2);
  14989. else
  14990. init(realStart);
  14991. });
  14992. var res;
  14993. function init(basedir2) {
  14994. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  14995. res = path.resolve(basedir2, x);
  14996. if (x === "." || x === ".." || x.slice(-1) === "/")
  14997. res += "/";
  14998. if (/\/$/.test(x) && res === basedir2) {
  14999. loadAsDirectory(res, opts.package, onfile);
  15000. } else
  15001. loadAsFile(res, opts.package, onfile);
  15002. } else if (includeCoreModules && isCore(x)) {
  15003. return cb(null, x);
  15004. } else
  15005. loadNodeModules(x, basedir2, function(err2, n, pkg) {
  15006. if (err2)
  15007. cb(err2);
  15008. else if (n) {
  15009. return maybeRealpath(realpath, n, opts, function(err3, realN) {
  15010. if (err3) {
  15011. cb(err3);
  15012. } else {
  15013. cb(null, realN, pkg);
  15014. }
  15015. });
  15016. } else {
  15017. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15018. moduleError.code = "MODULE_NOT_FOUND";
  15019. cb(moduleError);
  15020. }
  15021. });
  15022. }
  15023. function onfile(err2, m, pkg) {
  15024. if (err2)
  15025. cb(err2);
  15026. else if (m)
  15027. cb(null, m, pkg);
  15028. else
  15029. loadAsDirectory(res, function(err3, d, pkg2) {
  15030. if (err3)
  15031. cb(err3);
  15032. else if (d) {
  15033. maybeRealpath(realpath, d, opts, function(err4, realD) {
  15034. if (err4) {
  15035. cb(err4);
  15036. } else {
  15037. cb(null, realD, pkg2);
  15038. }
  15039. });
  15040. } else {
  15041. var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15042. moduleError.code = "MODULE_NOT_FOUND";
  15043. cb(moduleError);
  15044. }
  15045. });
  15046. }
  15047. function loadAsFile(x2, thePackage, callback2) {
  15048. var loadAsFilePackage = thePackage;
  15049. var cb2 = callback2;
  15050. if (typeof loadAsFilePackage === "function") {
  15051. cb2 = loadAsFilePackage;
  15052. loadAsFilePackage = void 0;
  15053. }
  15054. var exts = [""].concat(extensions);
  15055. load(exts, x2, loadAsFilePackage);
  15056. function load(exts2, x3, loadPackage) {
  15057. if (exts2.length === 0)
  15058. return cb2(null, void 0, loadPackage);
  15059. var file = x3 + exts2[0];
  15060. var pkg = loadPackage;
  15061. if (pkg)
  15062. onpkg(null, pkg);
  15063. else
  15064. loadpkg(path.dirname(file), onpkg);
  15065. function onpkg(err2, pkg_, dir) {
  15066. pkg = pkg_;
  15067. if (err2)
  15068. return cb2(err2);
  15069. if (dir && pkg && opts.pathFilter) {
  15070. var rfile = path.relative(dir, file);
  15071. var rel = rfile.slice(0, rfile.length - exts2[0].length);
  15072. var r = opts.pathFilter(pkg, x3, rel);
  15073. if (r)
  15074. return load([""].concat(extensions.slice()), path.resolve(dir, r), pkg);
  15075. }
  15076. isFile(file, onex);
  15077. }
  15078. function onex(err2, ex) {
  15079. if (err2)
  15080. return cb2(err2);
  15081. if (ex)
  15082. return cb2(null, file, pkg);
  15083. load(exts2.slice(1), x3, pkg);
  15084. }
  15085. }
  15086. }
  15087. function loadpkg(dir, cb2) {
  15088. if (dir === "" || dir === "/")
  15089. return cb2(null);
  15090. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15091. return cb2(null);
  15092. }
  15093. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15094. return cb2(null);
  15095. maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
  15096. if (unwrapErr)
  15097. return loadpkg(path.dirname(dir), cb2);
  15098. var pkgfile = path.join(pkgdir, "package.json");
  15099. isFile(pkgfile, function(err2, ex) {
  15100. if (!ex)
  15101. return loadpkg(path.dirname(dir), cb2);
  15102. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15103. if (err3)
  15104. cb2(err3);
  15105. var pkg = pkgParam;
  15106. if (pkg && opts.packageFilter) {
  15107. pkg = opts.packageFilter(pkg, pkgfile);
  15108. }
  15109. cb2(null, pkg, dir);
  15110. });
  15111. });
  15112. });
  15113. }
  15114. function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
  15115. var cb2 = callback2;
  15116. var fpkg = loadAsDirectoryPackage;
  15117. if (typeof fpkg === "function") {
  15118. cb2 = fpkg;
  15119. fpkg = opts.package;
  15120. }
  15121. maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
  15122. if (unwrapErr)
  15123. return cb2(unwrapErr);
  15124. var pkgfile = path.join(pkgdir, "package.json");
  15125. isFile(pkgfile, function(err2, ex) {
  15126. if (err2)
  15127. return cb2(err2);
  15128. if (!ex)
  15129. return loadAsFile(path.join(x2, "index"), fpkg, cb2);
  15130. readPackage(readFile, pkgfile, function(err3, pkgParam) {
  15131. if (err3)
  15132. return cb2(err3);
  15133. var pkg = pkgParam;
  15134. if (pkg && opts.packageFilter) {
  15135. pkg = opts.packageFilter(pkg, pkgfile);
  15136. }
  15137. if (pkg && pkg.main) {
  15138. if (typeof pkg.main !== "string") {
  15139. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15140. mainError.code = "INVALID_PACKAGE_MAIN";
  15141. return cb2(mainError);
  15142. }
  15143. if (pkg.main === "." || pkg.main === "./") {
  15144. pkg.main = "index";
  15145. }
  15146. loadAsFile(path.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
  15147. if (err4)
  15148. return cb2(err4);
  15149. if (m)
  15150. return cb2(null, m, pkg2);
  15151. if (!pkg2)
  15152. return loadAsFile(path.join(x2, "index"), pkg2, cb2);
  15153. var dir = path.resolve(x2, pkg2.main);
  15154. loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
  15155. if (err5)
  15156. return cb2(err5);
  15157. if (n)
  15158. return cb2(null, n, pkg3);
  15159. loadAsFile(path.join(x2, "index"), pkg3, cb2);
  15160. });
  15161. });
  15162. return;
  15163. }
  15164. loadAsFile(path.join(x2, "/index"), pkg, cb2);
  15165. });
  15166. });
  15167. });
  15168. }
  15169. function processDirs(cb2, dirs) {
  15170. if (dirs.length === 0)
  15171. return cb2(null, void 0);
  15172. var dir = dirs[0];
  15173. isDirectory(path.dirname(dir), isdir);
  15174. function isdir(err2, isdir2) {
  15175. if (err2)
  15176. return cb2(err2);
  15177. if (!isdir2)
  15178. return processDirs(cb2, dirs.slice(1));
  15179. loadAsFile(dir, opts.package, onfile2);
  15180. }
  15181. function onfile2(err2, m, pkg) {
  15182. if (err2)
  15183. return cb2(err2);
  15184. if (m)
  15185. return cb2(null, m, pkg);
  15186. loadAsDirectory(dir, opts.package, ondir);
  15187. }
  15188. function ondir(err2, n, pkg) {
  15189. if (err2)
  15190. return cb2(err2);
  15191. if (n)
  15192. return cb2(null, n, pkg);
  15193. processDirs(cb2, dirs.slice(1));
  15194. }
  15195. }
  15196. function loadNodeModules(x2, start, cb2) {
  15197. var thunk = function() {
  15198. return getPackageCandidates(x2, start, opts);
  15199. };
  15200. processDirs(cb2, packageIterator ? packageIterator(x2, start, thunk, opts) : thunk());
  15201. }
  15202. };
  15203. }
  15204. });
  15205. var require_core3 = __commonJS2({
  15206. "node_modules/resolve/lib/core.json"(exports2, module2) {
  15207. module2.exports = {
  15208. assert: true,
  15209. "node:assert": [">= 14.18 && < 15", ">= 16"],
  15210. "assert/strict": ">= 15",
  15211. "node:assert/strict": ">= 16",
  15212. async_hooks: ">= 8",
  15213. "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
  15214. buffer_ieee754: ">= 0.5 && < 0.9.7",
  15215. buffer: true,
  15216. "node:buffer": [">= 14.18 && < 15", ">= 16"],
  15217. child_process: true,
  15218. "node:child_process": [">= 14.18 && < 15", ">= 16"],
  15219. cluster: ">= 0.5",
  15220. "node:cluster": [">= 14.18 && < 15", ">= 16"],
  15221. console: true,
  15222. "node:console": [">= 14.18 && < 15", ">= 16"],
  15223. constants: true,
  15224. "node:constants": [">= 14.18 && < 15", ">= 16"],
  15225. crypto: true,
  15226. "node:crypto": [">= 14.18 && < 15", ">= 16"],
  15227. _debug_agent: ">= 1 && < 8",
  15228. _debugger: "< 8",
  15229. dgram: true,
  15230. "node:dgram": [">= 14.18 && < 15", ">= 16"],
  15231. diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
  15232. "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
  15233. dns: true,
  15234. "node:dns": [">= 14.18 && < 15", ">= 16"],
  15235. "dns/promises": ">= 15",
  15236. "node:dns/promises": ">= 16",
  15237. domain: ">= 0.7.12",
  15238. "node:domain": [">= 14.18 && < 15", ">= 16"],
  15239. events: true,
  15240. "node:events": [">= 14.18 && < 15", ">= 16"],
  15241. freelist: "< 6",
  15242. fs: true,
  15243. "node:fs": [">= 14.18 && < 15", ">= 16"],
  15244. "fs/promises": [">= 10 && < 10.1", ">= 14"],
  15245. "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
  15246. _http_agent: ">= 0.11.1",
  15247. "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
  15248. _http_client: ">= 0.11.1",
  15249. "node:_http_client": [">= 14.18 && < 15", ">= 16"],
  15250. _http_common: ">= 0.11.1",
  15251. "node:_http_common": [">= 14.18 && < 15", ">= 16"],
  15252. _http_incoming: ">= 0.11.1",
  15253. "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
  15254. _http_outgoing: ">= 0.11.1",
  15255. "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
  15256. _http_server: ">= 0.11.1",
  15257. "node:_http_server": [">= 14.18 && < 15", ">= 16"],
  15258. http: true,
  15259. "node:http": [">= 14.18 && < 15", ">= 16"],
  15260. http2: ">= 8.8",
  15261. "node:http2": [">= 14.18 && < 15", ">= 16"],
  15262. https: true,
  15263. "node:https": [">= 14.18 && < 15", ">= 16"],
  15264. inspector: ">= 8",
  15265. "node:inspector": [">= 14.18 && < 15", ">= 16"],
  15266. _linklist: "< 8",
  15267. module: true,
  15268. "node:module": [">= 14.18 && < 15", ">= 16"],
  15269. net: true,
  15270. "node:net": [">= 14.18 && < 15", ">= 16"],
  15271. "node-inspect/lib/_inspect": ">= 7.6 && < 12",
  15272. "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
  15273. "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
  15274. os: true,
  15275. "node:os": [">= 14.18 && < 15", ">= 16"],
  15276. path: true,
  15277. "node:path": [">= 14.18 && < 15", ">= 16"],
  15278. "path/posix": ">= 15.3",
  15279. "node:path/posix": ">= 16",
  15280. "path/win32": ">= 15.3",
  15281. "node:path/win32": ">= 16",
  15282. perf_hooks: ">= 8.5",
  15283. "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
  15284. process: ">= 1",
  15285. "node:process": [">= 14.18 && < 15", ">= 16"],
  15286. punycode: ">= 0.5",
  15287. "node:punycode": [">= 14.18 && < 15", ">= 16"],
  15288. querystring: true,
  15289. "node:querystring": [">= 14.18 && < 15", ">= 16"],
  15290. readline: true,
  15291. "node:readline": [">= 14.18 && < 15", ">= 16"],
  15292. "readline/promises": ">= 17",
  15293. "node:readline/promises": ">= 17",
  15294. repl: true,
  15295. "node:repl": [">= 14.18 && < 15", ">= 16"],
  15296. smalloc: ">= 0.11.5 && < 3",
  15297. _stream_duplex: ">= 0.9.4",
  15298. "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
  15299. _stream_transform: ">= 0.9.4",
  15300. "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
  15301. _stream_wrap: ">= 1.4.1",
  15302. "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
  15303. _stream_passthrough: ">= 0.9.4",
  15304. "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
  15305. _stream_readable: ">= 0.9.4",
  15306. "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
  15307. _stream_writable: ">= 0.9.4",
  15308. "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
  15309. stream: true,
  15310. "node:stream": [">= 14.18 && < 15", ">= 16"],
  15311. "stream/consumers": ">= 16.7",
  15312. "node:stream/consumers": ">= 16.7",
  15313. "stream/promises": ">= 15",
  15314. "node:stream/promises": ">= 16",
  15315. "stream/web": ">= 16.5",
  15316. "node:stream/web": ">= 16.5",
  15317. string_decoder: true,
  15318. "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
  15319. sys: [">= 0.4 && < 0.7", ">= 0.8"],
  15320. "node:sys": [">= 14.18 && < 15", ">= 16"],
  15321. timers: true,
  15322. "node:timers": [">= 14.18 && < 15", ">= 16"],
  15323. "timers/promises": ">= 15",
  15324. "node:timers/promises": ">= 16",
  15325. _tls_common: ">= 0.11.13",
  15326. "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
  15327. _tls_legacy: ">= 0.11.3 && < 10",
  15328. _tls_wrap: ">= 0.11.3",
  15329. "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
  15330. tls: true,
  15331. "node:tls": [">= 14.18 && < 15", ">= 16"],
  15332. trace_events: ">= 10",
  15333. "node:trace_events": [">= 14.18 && < 15", ">= 16"],
  15334. tty: true,
  15335. "node:tty": [">= 14.18 && < 15", ">= 16"],
  15336. url: true,
  15337. "node:url": [">= 14.18 && < 15", ">= 16"],
  15338. util: true,
  15339. "node:util": [">= 14.18 && < 15", ">= 16"],
  15340. "util/types": ">= 15.3",
  15341. "node:util/types": ">= 16",
  15342. "v8/tools/arguments": ">= 10 && < 12",
  15343. "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15344. "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15345. "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15346. "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15347. "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15348. "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
  15349. v8: ">= 1",
  15350. "node:v8": [">= 14.18 && < 15", ">= 16"],
  15351. vm: true,
  15352. "node:vm": [">= 14.18 && < 15", ">= 16"],
  15353. wasi: ">= 13.4 && < 13.5",
  15354. worker_threads: ">= 11.7",
  15355. "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
  15356. zlib: ">= 0.5",
  15357. "node:zlib": [">= 14.18 && < 15", ">= 16"]
  15358. };
  15359. }
  15360. });
  15361. var require_core4 = __commonJS2({
  15362. "node_modules/resolve/lib/core.js"(exports2, module2) {
  15363. var current = process.versions && process.versions.node && process.versions.node.split(".") || [];
  15364. function specifierIncluded(specifier) {
  15365. var parts = specifier.split(" ");
  15366. var op = parts.length > 1 ? parts[0] : "=";
  15367. var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
  15368. for (var i = 0; i < 3; ++i) {
  15369. var cur = parseInt(current[i] || 0, 10);
  15370. var ver = parseInt(versionParts[i] || 0, 10);
  15371. if (cur === ver) {
  15372. continue;
  15373. }
  15374. if (op === "<") {
  15375. return cur < ver;
  15376. } else if (op === ">=") {
  15377. return cur >= ver;
  15378. }
  15379. return false;
  15380. }
  15381. return op === ">=";
  15382. }
  15383. function matchesRange(range) {
  15384. var specifiers = range.split(/ ?&& ?/);
  15385. if (specifiers.length === 0) {
  15386. return false;
  15387. }
  15388. for (var i = 0; i < specifiers.length; ++i) {
  15389. if (!specifierIncluded(specifiers[i])) {
  15390. return false;
  15391. }
  15392. }
  15393. return true;
  15394. }
  15395. function versionIncluded(specifierValue) {
  15396. if (typeof specifierValue === "boolean") {
  15397. return specifierValue;
  15398. }
  15399. if (specifierValue && typeof specifierValue === "object") {
  15400. for (var i = 0; i < specifierValue.length; ++i) {
  15401. if (matchesRange(specifierValue[i])) {
  15402. return true;
  15403. }
  15404. }
  15405. return false;
  15406. }
  15407. return matchesRange(specifierValue);
  15408. }
  15409. var data = require_core3();
  15410. var core2 = {};
  15411. for (mod in data) {
  15412. if (Object.prototype.hasOwnProperty.call(data, mod)) {
  15413. core2[mod] = versionIncluded(data[mod]);
  15414. }
  15415. }
  15416. var mod;
  15417. module2.exports = core2;
  15418. }
  15419. });
  15420. var require_is_core = __commonJS2({
  15421. "node_modules/resolve/lib/is-core.js"(exports2, module2) {
  15422. var isCoreModule = require_is_core_module();
  15423. module2.exports = function isCore(x) {
  15424. return isCoreModule(x);
  15425. };
  15426. }
  15427. });
  15428. var require_sync = __commonJS2({
  15429. "node_modules/resolve/lib/sync.js"(exports2, module2) {
  15430. var isCore = require_is_core_module();
  15431. var fs = require("fs");
  15432. var path = require("path");
  15433. var getHomedir = require_homedir();
  15434. var caller = require_caller();
  15435. var nodeModulesPaths = require_node_modules_paths();
  15436. var normalizeOptions = require_normalize_options();
  15437. var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
  15438. var homedir = getHomedir();
  15439. var defaultPaths = function() {
  15440. return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
  15441. };
  15442. var defaultIsFile = function isFile(file) {
  15443. try {
  15444. var stat = fs.statSync(file, {
  15445. throwIfNoEntry: false
  15446. });
  15447. } catch (e) {
  15448. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15449. return false;
  15450. throw e;
  15451. }
  15452. return !!stat && (stat.isFile() || stat.isFIFO());
  15453. };
  15454. var defaultIsDir = function isDirectory(dir) {
  15455. try {
  15456. var stat = fs.statSync(dir, {
  15457. throwIfNoEntry: false
  15458. });
  15459. } catch (e) {
  15460. if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
  15461. return false;
  15462. throw e;
  15463. }
  15464. return !!stat && stat.isDirectory();
  15465. };
  15466. var defaultRealpathSync = function realpathSync(x) {
  15467. try {
  15468. return realpathFS(x);
  15469. } catch (realpathErr) {
  15470. if (realpathErr.code !== "ENOENT") {
  15471. throw realpathErr;
  15472. }
  15473. }
  15474. return x;
  15475. };
  15476. var maybeRealpathSync = function maybeRealpathSync2(realpathSync, x, opts) {
  15477. if (opts && opts.preserveSymlinks === false) {
  15478. return realpathSync(x);
  15479. }
  15480. return x;
  15481. };
  15482. var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync, pkgfile) {
  15483. var body = readFileSync(pkgfile);
  15484. try {
  15485. var pkg = JSON.parse(body);
  15486. return pkg;
  15487. } catch (jsonErr) {
  15488. }
  15489. };
  15490. var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
  15491. var dirs = nodeModulesPaths(start, opts, x);
  15492. for (var i = 0; i < dirs.length; i++) {
  15493. dirs[i] = path.join(dirs[i], x);
  15494. }
  15495. return dirs;
  15496. };
  15497. module2.exports = function resolveSync(x, options) {
  15498. if (typeof x !== "string") {
  15499. throw new TypeError("Path must be a string.");
  15500. }
  15501. var opts = normalizeOptions(x, options);
  15502. var isFile = opts.isFile || defaultIsFile;
  15503. var readFileSync = opts.readFileSync || fs.readFileSync;
  15504. var isDirectory = opts.isDirectory || defaultIsDir;
  15505. var realpathSync = opts.realpathSync || defaultRealpathSync;
  15506. var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
  15507. if (opts.readFileSync && opts.readPackageSync) {
  15508. throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
  15509. }
  15510. var packageIterator = opts.packageIterator;
  15511. var extensions = opts.extensions || [".js"];
  15512. var includeCoreModules = opts.includeCoreModules !== false;
  15513. var basedir = opts.basedir || path.dirname(caller());
  15514. var parent = opts.filename || basedir;
  15515. opts.paths = opts.paths || defaultPaths();
  15516. var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
  15517. if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
  15518. var res = path.resolve(absoluteStart, x);
  15519. if (x === "." || x === ".." || x.slice(-1) === "/")
  15520. res += "/";
  15521. var m = loadAsFileSync(res) || loadAsDirectorySync(res);
  15522. if (m)
  15523. return maybeRealpathSync(realpathSync, m, opts);
  15524. } else if (includeCoreModules && isCore(x)) {
  15525. return x;
  15526. } else {
  15527. var n = loadNodeModulesSync(x, absoluteStart);
  15528. if (n)
  15529. return maybeRealpathSync(realpathSync, n, opts);
  15530. }
  15531. var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
  15532. err.code = "MODULE_NOT_FOUND";
  15533. throw err;
  15534. function loadAsFileSync(x2) {
  15535. var pkg = loadpkg(path.dirname(x2));
  15536. if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
  15537. var rfile = path.relative(pkg.dir, x2);
  15538. var r = opts.pathFilter(pkg.pkg, x2, rfile);
  15539. if (r) {
  15540. x2 = path.resolve(pkg.dir, r);
  15541. }
  15542. }
  15543. if (isFile(x2)) {
  15544. return x2;
  15545. }
  15546. for (var i = 0; i < extensions.length; i++) {
  15547. var file = x2 + extensions[i];
  15548. if (isFile(file)) {
  15549. return file;
  15550. }
  15551. }
  15552. }
  15553. function loadpkg(dir) {
  15554. if (dir === "" || dir === "/")
  15555. return;
  15556. if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
  15557. return;
  15558. }
  15559. if (/[/\\]node_modules[/\\]*$/.test(dir))
  15560. return;
  15561. var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
  15562. if (!isFile(pkgfile)) {
  15563. return loadpkg(path.dirname(dir));
  15564. }
  15565. var pkg = readPackageSync(readFileSync, pkgfile);
  15566. if (pkg && opts.packageFilter) {
  15567. pkg = opts.packageFilter(pkg, dir);
  15568. }
  15569. return {
  15570. pkg,
  15571. dir
  15572. };
  15573. }
  15574. function loadAsDirectorySync(x2) {
  15575. var pkgfile = path.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
  15576. if (isFile(pkgfile)) {
  15577. try {
  15578. var pkg = readPackageSync(readFileSync, pkgfile);
  15579. } catch (e) {
  15580. }
  15581. if (pkg && opts.packageFilter) {
  15582. pkg = opts.packageFilter(pkg, x2);
  15583. }
  15584. if (pkg && pkg.main) {
  15585. if (typeof pkg.main !== "string") {
  15586. var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
  15587. mainError.code = "INVALID_PACKAGE_MAIN";
  15588. throw mainError;
  15589. }
  15590. if (pkg.main === "." || pkg.main === "./") {
  15591. pkg.main = "index";
  15592. }
  15593. try {
  15594. var m2 = loadAsFileSync(path.resolve(x2, pkg.main));
  15595. if (m2)
  15596. return m2;
  15597. var n2 = loadAsDirectorySync(path.resolve(x2, pkg.main));
  15598. if (n2)
  15599. return n2;
  15600. } catch (e) {
  15601. }
  15602. }
  15603. }
  15604. return loadAsFileSync(path.join(x2, "/index"));
  15605. }
  15606. function loadNodeModulesSync(x2, start) {
  15607. var thunk = function() {
  15608. return getPackageCandidates(x2, start, opts);
  15609. };
  15610. var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
  15611. for (var i = 0; i < dirs.length; i++) {
  15612. var dir = dirs[i];
  15613. if (isDirectory(path.dirname(dir))) {
  15614. var m2 = loadAsFileSync(dir);
  15615. if (m2)
  15616. return m2;
  15617. var n2 = loadAsDirectorySync(dir);
  15618. if (n2)
  15619. return n2;
  15620. }
  15621. }
  15622. }
  15623. };
  15624. }
  15625. });
  15626. var require_resolve = __commonJS2({
  15627. "node_modules/resolve/index.js"(exports2, module2) {
  15628. var async = require_async();
  15629. async.core = require_core4();
  15630. async.isCore = require_is_core();
  15631. async.sync = require_sync();
  15632. module2.exports = async;
  15633. }
  15634. });
  15635. var require_resolve2 = __commonJS2({
  15636. "src/common/resolve.js"(exports2, module2) {
  15637. "use strict";
  15638. var {
  15639. resolve
  15640. } = require;
  15641. if (resolve.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) {
  15642. resolve = (id, options) => {
  15643. let basedir;
  15644. if (options && options.paths && options.paths.length === 1) {
  15645. basedir = options.paths[0];
  15646. }
  15647. return require_resolve().sync(id, {
  15648. basedir
  15649. });
  15650. };
  15651. }
  15652. module2.exports = resolve;
  15653. }
  15654. });
  15655. function mimicFunction(to, from, {
  15656. ignoreNonConfigurable = false
  15657. } = {}) {
  15658. const {
  15659. name
  15660. } = to;
  15661. for (const property of Reflect.ownKeys(from)) {
  15662. copyProperty(to, from, property, ignoreNonConfigurable);
  15663. }
  15664. changePrototype(to, from);
  15665. changeToString(to, from, name);
  15666. return to;
  15667. }
  15668. var copyProperty;
  15669. var canCopyProperty;
  15670. var changePrototype;
  15671. var wrappedToString;
  15672. var toStringDescriptor;
  15673. var toStringName;
  15674. var changeToString;
  15675. var init_mimic_fn = __esm({
  15676. "node_modules/mimic-fn/index.js"() {
  15677. copyProperty = (to, from, property, ignoreNonConfigurable) => {
  15678. if (property === "length" || property === "prototype") {
  15679. return;
  15680. }
  15681. if (property === "arguments" || property === "caller") {
  15682. return;
  15683. }
  15684. const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
  15685. const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
  15686. if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
  15687. return;
  15688. }
  15689. Object.defineProperty(to, property, fromDescriptor);
  15690. };
  15691. canCopyProperty = function(toDescriptor, fromDescriptor) {
  15692. return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
  15693. };
  15694. changePrototype = (to, from) => {
  15695. const fromPrototype = Object.getPrototypeOf(from);
  15696. if (fromPrototype === Object.getPrototypeOf(to)) {
  15697. return;
  15698. }
  15699. Object.setPrototypeOf(to, fromPrototype);
  15700. };
  15701. wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
  15702. ${fromBody}`;
  15703. toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
  15704. toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
  15705. changeToString = (to, from, name) => {
  15706. const withName = name === "" ? "" : `with ${name.trim()}() `;
  15707. const newToString = wrappedToString.bind(null, withName, from.toString());
  15708. Object.defineProperty(newToString, "name", toStringName);
  15709. Object.defineProperty(to, "toString", Object.assign(Object.assign({}, toStringDescriptor), {}, {
  15710. value: newToString
  15711. }));
  15712. };
  15713. }
  15714. });
  15715. var require_p_defer = __commonJS2({
  15716. "node_modules/p-defer/index.js"(exports2, module2) {
  15717. "use strict";
  15718. module2.exports = () => {
  15719. const ret = {};
  15720. ret.promise = new Promise((resolve, reject) => {
  15721. ret.resolve = resolve;
  15722. ret.reject = reject;
  15723. });
  15724. return ret;
  15725. };
  15726. }
  15727. });
  15728. var require_dist = __commonJS2({
  15729. "node_modules/map-age-cleaner/dist/index.js"(exports2, module2) {
  15730. "use strict";
  15731. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  15732. return new (P || (P = Promise))(function(resolve, reject) {
  15733. function fulfilled(value) {
  15734. try {
  15735. step(generator.next(value));
  15736. } catch (e) {
  15737. reject(e);
  15738. }
  15739. }
  15740. function rejected(value) {
  15741. try {
  15742. step(generator["throw"](value));
  15743. } catch (e) {
  15744. reject(e);
  15745. }
  15746. }
  15747. function step(result) {
  15748. result.done ? resolve(result.value) : new P(function(resolve2) {
  15749. resolve2(result.value);
  15750. }).then(fulfilled, rejected);
  15751. }
  15752. step((generator = generator.apply(thisArg, _arguments || [])).next());
  15753. });
  15754. };
  15755. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  15756. return mod && mod.__esModule ? mod : {
  15757. "default": mod
  15758. };
  15759. };
  15760. Object.defineProperty(exports2, "__esModule", {
  15761. value: true
  15762. });
  15763. var p_defer_1 = __importDefault2(require_p_defer());
  15764. function mapAgeCleaner2(map, property = "maxAge") {
  15765. let processingKey;
  15766. let processingTimer;
  15767. let processingDeferred;
  15768. const cleanup = () => __awaiter2(this, void 0, void 0, function* () {
  15769. if (processingKey !== void 0) {
  15770. return;
  15771. }
  15772. const setupTimer = (item) => __awaiter2(this, void 0, void 0, function* () {
  15773. processingDeferred = p_defer_1.default();
  15774. const delay = item[1][property] - Date.now();
  15775. if (delay <= 0) {
  15776. map.delete(item[0]);
  15777. processingDeferred.resolve();
  15778. return;
  15779. }
  15780. processingKey = item[0];
  15781. processingTimer = setTimeout(() => {
  15782. map.delete(item[0]);
  15783. if (processingDeferred) {
  15784. processingDeferred.resolve();
  15785. }
  15786. }, delay);
  15787. if (typeof processingTimer.unref === "function") {
  15788. processingTimer.unref();
  15789. }
  15790. return processingDeferred.promise;
  15791. });
  15792. try {
  15793. for (const entry of map) {
  15794. yield setupTimer(entry);
  15795. }
  15796. } catch (_a) {
  15797. }
  15798. processingKey = void 0;
  15799. });
  15800. const reset = () => {
  15801. processingKey = void 0;
  15802. if (processingTimer !== void 0) {
  15803. clearTimeout(processingTimer);
  15804. processingTimer = void 0;
  15805. }
  15806. if (processingDeferred !== void 0) {
  15807. processingDeferred.reject(void 0);
  15808. processingDeferred = void 0;
  15809. }
  15810. };
  15811. const originalSet = map.set.bind(map);
  15812. map.set = (key, value) => {
  15813. if (map.has(key)) {
  15814. map.delete(key);
  15815. }
  15816. const result = originalSet(key, value);
  15817. if (processingKey && processingKey === key) {
  15818. reset();
  15819. }
  15820. cleanup();
  15821. return result;
  15822. };
  15823. cleanup();
  15824. return map;
  15825. }
  15826. exports2.default = mapAgeCleaner2;
  15827. module2.exports = mapAgeCleaner2;
  15828. module2.exports.default = mapAgeCleaner2;
  15829. }
  15830. });
  15831. var dist_exports = {};
  15832. __export(dist_exports, {
  15833. default: () => mem,
  15834. memClear: () => memClear,
  15835. memDecorator: () => memDecorator
  15836. });
  15837. function mem(fn, {
  15838. cacheKey,
  15839. cache = /* @__PURE__ */ new Map(),
  15840. maxAge
  15841. } = {}) {
  15842. if (typeof maxAge === "number") {
  15843. (0, import_map_age_cleaner.default)(cache);
  15844. }
  15845. const memoized = function(...arguments_) {
  15846. const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
  15847. const cacheItem = cache.get(key);
  15848. if (cacheItem) {
  15849. return cacheItem.data;
  15850. }
  15851. const result = fn.apply(this, arguments_);
  15852. cache.set(key, {
  15853. data: result,
  15854. maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
  15855. });
  15856. return result;
  15857. };
  15858. mimicFunction(memoized, fn, {
  15859. ignoreNonConfigurable: true
  15860. });
  15861. cacheStore.set(memoized, cache);
  15862. return memoized;
  15863. }
  15864. function memDecorator(options = {}) {
  15865. const instanceMap = /* @__PURE__ */ new WeakMap();
  15866. return (target, propertyKey, descriptor) => {
  15867. const input = target[propertyKey];
  15868. if (typeof input !== "function") {
  15869. throw new TypeError("The decorated value must be a function");
  15870. }
  15871. delete descriptor.value;
  15872. delete descriptor.writable;
  15873. descriptor.get = function() {
  15874. if (!instanceMap.has(this)) {
  15875. const value = mem(input, options);
  15876. instanceMap.set(this, value);
  15877. return value;
  15878. }
  15879. return instanceMap.get(this);
  15880. };
  15881. };
  15882. }
  15883. function memClear(fn) {
  15884. const cache = cacheStore.get(fn);
  15885. if (!cache) {
  15886. throw new TypeError("Can't clear a function that was not memoized!");
  15887. }
  15888. if (typeof cache.clear !== "function") {
  15889. throw new TypeError("The cache Map can't be cleared!");
  15890. }
  15891. cache.clear();
  15892. }
  15893. var import_map_age_cleaner;
  15894. var cacheStore;
  15895. var init_dist = __esm({
  15896. "node_modules/mem/dist/index.js"() {
  15897. init_mimic_fn();
  15898. import_map_age_cleaner = __toESM(require_dist());
  15899. cacheStore = /* @__PURE__ */ new WeakMap();
  15900. }
  15901. });
  15902. var require_pseudomap = __commonJS2({
  15903. "node_modules/pseudomap/pseudomap.js"(exports2, module2) {
  15904. var hasOwnProperty = Object.prototype.hasOwnProperty;
  15905. module2.exports = PseudoMap;
  15906. function PseudoMap(set2) {
  15907. if (!(this instanceof PseudoMap))
  15908. throw new TypeError("Constructor PseudoMap requires 'new'");
  15909. this.clear();
  15910. if (set2) {
  15911. if (set2 instanceof PseudoMap || typeof Map === "function" && set2 instanceof Map)
  15912. set2.forEach(function(value, key) {
  15913. this.set(key, value);
  15914. }, this);
  15915. else if (Array.isArray(set2))
  15916. set2.forEach(function(kv) {
  15917. this.set(kv[0], kv[1]);
  15918. }, this);
  15919. else
  15920. throw new TypeError("invalid argument");
  15921. }
  15922. }
  15923. PseudoMap.prototype.forEach = function(fn, thisp) {
  15924. thisp = thisp || this;
  15925. Object.keys(this._data).forEach(function(k) {
  15926. if (k !== "size")
  15927. fn.call(thisp, this._data[k].value, this._data[k].key);
  15928. }, this);
  15929. };
  15930. PseudoMap.prototype.has = function(k) {
  15931. return !!find(this._data, k);
  15932. };
  15933. PseudoMap.prototype.get = function(k) {
  15934. var res = find(this._data, k);
  15935. return res && res.value;
  15936. };
  15937. PseudoMap.prototype.set = function(k, v) {
  15938. set(this._data, k, v);
  15939. };
  15940. PseudoMap.prototype.delete = function(k) {
  15941. var res = find(this._data, k);
  15942. if (res) {
  15943. delete this._data[res._index];
  15944. this._data.size--;
  15945. }
  15946. };
  15947. PseudoMap.prototype.clear = function() {
  15948. var data = /* @__PURE__ */ Object.create(null);
  15949. data.size = 0;
  15950. Object.defineProperty(this, "_data", {
  15951. value: data,
  15952. enumerable: false,
  15953. configurable: true,
  15954. writable: false
  15955. });
  15956. };
  15957. Object.defineProperty(PseudoMap.prototype, "size", {
  15958. get: function() {
  15959. return this._data.size;
  15960. },
  15961. set: function(n) {
  15962. },
  15963. enumerable: true,
  15964. configurable: true
  15965. });
  15966. PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
  15967. throw new Error("iterators are not implemented in this version");
  15968. };
  15969. function same(a, b) {
  15970. return a === b || a !== a && b !== b;
  15971. }
  15972. function Entry(k, v, i) {
  15973. this.key = k;
  15974. this.value = v;
  15975. this._index = i;
  15976. }
  15977. function find(data, k) {
  15978. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  15979. if (same(data[key].key, k))
  15980. return data[key];
  15981. }
  15982. }
  15983. function set(data, k, v) {
  15984. for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
  15985. if (same(data[key].key, k)) {
  15986. data[key].value = v;
  15987. return;
  15988. }
  15989. }
  15990. data.size++;
  15991. data[key] = new Entry(k, v, key);
  15992. }
  15993. }
  15994. });
  15995. var require_map = __commonJS2({
  15996. "node_modules/pseudomap/map.js"(exports2, module2) {
  15997. if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
  15998. process.env.TEST_PSEUDOMAP = "true";
  15999. if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
  16000. module2.exports = Map;
  16001. } else {
  16002. module2.exports = require_pseudomap();
  16003. }
  16004. }
  16005. });
  16006. var require_yallist = __commonJS2({
  16007. "node_modules/editorconfig/node_modules/yallist/yallist.js"(exports2, module2) {
  16008. module2.exports = Yallist;
  16009. Yallist.Node = Node;
  16010. Yallist.create = Yallist;
  16011. function Yallist(list) {
  16012. var self2 = this;
  16013. if (!(self2 instanceof Yallist)) {
  16014. self2 = new Yallist();
  16015. }
  16016. self2.tail = null;
  16017. self2.head = null;
  16018. self2.length = 0;
  16019. if (list && typeof list.forEach === "function") {
  16020. list.forEach(function(item) {
  16021. self2.push(item);
  16022. });
  16023. } else if (arguments.length > 0) {
  16024. for (var i = 0, l = arguments.length; i < l; i++) {
  16025. self2.push(arguments[i]);
  16026. }
  16027. }
  16028. return self2;
  16029. }
  16030. Yallist.prototype.removeNode = function(node) {
  16031. if (node.list !== this) {
  16032. throw new Error("removing node which does not belong to this list");
  16033. }
  16034. var next = node.next;
  16035. var prev = node.prev;
  16036. if (next) {
  16037. next.prev = prev;
  16038. }
  16039. if (prev) {
  16040. prev.next = next;
  16041. }
  16042. if (node === this.head) {
  16043. this.head = next;
  16044. }
  16045. if (node === this.tail) {
  16046. this.tail = prev;
  16047. }
  16048. node.list.length--;
  16049. node.next = null;
  16050. node.prev = null;
  16051. node.list = null;
  16052. };
  16053. Yallist.prototype.unshiftNode = function(node) {
  16054. if (node === this.head) {
  16055. return;
  16056. }
  16057. if (node.list) {
  16058. node.list.removeNode(node);
  16059. }
  16060. var head = this.head;
  16061. node.list = this;
  16062. node.next = head;
  16063. if (head) {
  16064. head.prev = node;
  16065. }
  16066. this.head = node;
  16067. if (!this.tail) {
  16068. this.tail = node;
  16069. }
  16070. this.length++;
  16071. };
  16072. Yallist.prototype.pushNode = function(node) {
  16073. if (node === this.tail) {
  16074. return;
  16075. }
  16076. if (node.list) {
  16077. node.list.removeNode(node);
  16078. }
  16079. var tail = this.tail;
  16080. node.list = this;
  16081. node.prev = tail;
  16082. if (tail) {
  16083. tail.next = node;
  16084. }
  16085. this.tail = node;
  16086. if (!this.head) {
  16087. this.head = node;
  16088. }
  16089. this.length++;
  16090. };
  16091. Yallist.prototype.push = function() {
  16092. for (var i = 0, l = arguments.length; i < l; i++) {
  16093. push(this, arguments[i]);
  16094. }
  16095. return this.length;
  16096. };
  16097. Yallist.prototype.unshift = function() {
  16098. for (var i = 0, l = arguments.length; i < l; i++) {
  16099. unshift(this, arguments[i]);
  16100. }
  16101. return this.length;
  16102. };
  16103. Yallist.prototype.pop = function() {
  16104. if (!this.tail) {
  16105. return void 0;
  16106. }
  16107. var res = this.tail.value;
  16108. this.tail = this.tail.prev;
  16109. if (this.tail) {
  16110. this.tail.next = null;
  16111. } else {
  16112. this.head = null;
  16113. }
  16114. this.length--;
  16115. return res;
  16116. };
  16117. Yallist.prototype.shift = function() {
  16118. if (!this.head) {
  16119. return void 0;
  16120. }
  16121. var res = this.head.value;
  16122. this.head = this.head.next;
  16123. if (this.head) {
  16124. this.head.prev = null;
  16125. } else {
  16126. this.tail = null;
  16127. }
  16128. this.length--;
  16129. return res;
  16130. };
  16131. Yallist.prototype.forEach = function(fn, thisp) {
  16132. thisp = thisp || this;
  16133. for (var walker = this.head, i = 0; walker !== null; i++) {
  16134. fn.call(thisp, walker.value, i, this);
  16135. walker = walker.next;
  16136. }
  16137. };
  16138. Yallist.prototype.forEachReverse = function(fn, thisp) {
  16139. thisp = thisp || this;
  16140. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  16141. fn.call(thisp, walker.value, i, this);
  16142. walker = walker.prev;
  16143. }
  16144. };
  16145. Yallist.prototype.get = function(n) {
  16146. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  16147. walker = walker.next;
  16148. }
  16149. if (i === n && walker !== null) {
  16150. return walker.value;
  16151. }
  16152. };
  16153. Yallist.prototype.getReverse = function(n) {
  16154. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  16155. walker = walker.prev;
  16156. }
  16157. if (i === n && walker !== null) {
  16158. return walker.value;
  16159. }
  16160. };
  16161. Yallist.prototype.map = function(fn, thisp) {
  16162. thisp = thisp || this;
  16163. var res = new Yallist();
  16164. for (var walker = this.head; walker !== null; ) {
  16165. res.push(fn.call(thisp, walker.value, this));
  16166. walker = walker.next;
  16167. }
  16168. return res;
  16169. };
  16170. Yallist.prototype.mapReverse = function(fn, thisp) {
  16171. thisp = thisp || this;
  16172. var res = new Yallist();
  16173. for (var walker = this.tail; walker !== null; ) {
  16174. res.push(fn.call(thisp, walker.value, this));
  16175. walker = walker.prev;
  16176. }
  16177. return res;
  16178. };
  16179. Yallist.prototype.reduce = function(fn, initial) {
  16180. var acc;
  16181. var walker = this.head;
  16182. if (arguments.length > 1) {
  16183. acc = initial;
  16184. } else if (this.head) {
  16185. walker = this.head.next;
  16186. acc = this.head.value;
  16187. } else {
  16188. throw new TypeError("Reduce of empty list with no initial value");
  16189. }
  16190. for (var i = 0; walker !== null; i++) {
  16191. acc = fn(acc, walker.value, i);
  16192. walker = walker.next;
  16193. }
  16194. return acc;
  16195. };
  16196. Yallist.prototype.reduceReverse = function(fn, initial) {
  16197. var acc;
  16198. var walker = this.tail;
  16199. if (arguments.length > 1) {
  16200. acc = initial;
  16201. } else if (this.tail) {
  16202. walker = this.tail.prev;
  16203. acc = this.tail.value;
  16204. } else {
  16205. throw new TypeError("Reduce of empty list with no initial value");
  16206. }
  16207. for (var i = this.length - 1; walker !== null; i--) {
  16208. acc = fn(acc, walker.value, i);
  16209. walker = walker.prev;
  16210. }
  16211. return acc;
  16212. };
  16213. Yallist.prototype.toArray = function() {
  16214. var arr = new Array(this.length);
  16215. for (var i = 0, walker = this.head; walker !== null; i++) {
  16216. arr[i] = walker.value;
  16217. walker = walker.next;
  16218. }
  16219. return arr;
  16220. };
  16221. Yallist.prototype.toArrayReverse = function() {
  16222. var arr = new Array(this.length);
  16223. for (var i = 0, walker = this.tail; walker !== null; i++) {
  16224. arr[i] = walker.value;
  16225. walker = walker.prev;
  16226. }
  16227. return arr;
  16228. };
  16229. Yallist.prototype.slice = function(from, to) {
  16230. to = to || this.length;
  16231. if (to < 0) {
  16232. to += this.length;
  16233. }
  16234. from = from || 0;
  16235. if (from < 0) {
  16236. from += this.length;
  16237. }
  16238. var ret = new Yallist();
  16239. if (to < from || to < 0) {
  16240. return ret;
  16241. }
  16242. if (from < 0) {
  16243. from = 0;
  16244. }
  16245. if (to > this.length) {
  16246. to = this.length;
  16247. }
  16248. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  16249. walker = walker.next;
  16250. }
  16251. for (; walker !== null && i < to; i++, walker = walker.next) {
  16252. ret.push(walker.value);
  16253. }
  16254. return ret;
  16255. };
  16256. Yallist.prototype.sliceReverse = function(from, to) {
  16257. to = to || this.length;
  16258. if (to < 0) {
  16259. to += this.length;
  16260. }
  16261. from = from || 0;
  16262. if (from < 0) {
  16263. from += this.length;
  16264. }
  16265. var ret = new Yallist();
  16266. if (to < from || to < 0) {
  16267. return ret;
  16268. }
  16269. if (from < 0) {
  16270. from = 0;
  16271. }
  16272. if (to > this.length) {
  16273. to = this.length;
  16274. }
  16275. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  16276. walker = walker.prev;
  16277. }
  16278. for (; walker !== null && i > from; i--, walker = walker.prev) {
  16279. ret.push(walker.value);
  16280. }
  16281. return ret;
  16282. };
  16283. Yallist.prototype.reverse = function() {
  16284. var head = this.head;
  16285. var tail = this.tail;
  16286. for (var walker = head; walker !== null; walker = walker.prev) {
  16287. var p = walker.prev;
  16288. walker.prev = walker.next;
  16289. walker.next = p;
  16290. }
  16291. this.head = tail;
  16292. this.tail = head;
  16293. return this;
  16294. };
  16295. function push(self2, item) {
  16296. self2.tail = new Node(item, self2.tail, null, self2);
  16297. if (!self2.head) {
  16298. self2.head = self2.tail;
  16299. }
  16300. self2.length++;
  16301. }
  16302. function unshift(self2, item) {
  16303. self2.head = new Node(item, null, self2.head, self2);
  16304. if (!self2.tail) {
  16305. self2.tail = self2.head;
  16306. }
  16307. self2.length++;
  16308. }
  16309. function Node(value, prev, next, list) {
  16310. if (!(this instanceof Node)) {
  16311. return new Node(value, prev, next, list);
  16312. }
  16313. this.list = list;
  16314. this.value = value;
  16315. if (prev) {
  16316. prev.next = this;
  16317. this.prev = prev;
  16318. } else {
  16319. this.prev = null;
  16320. }
  16321. if (next) {
  16322. next.prev = this;
  16323. this.next = next;
  16324. } else {
  16325. this.next = null;
  16326. }
  16327. }
  16328. }
  16329. });
  16330. var require_lru_cache = __commonJS2({
  16331. "node_modules/editorconfig/node_modules/lru-cache/index.js"(exports2, module2) {
  16332. "use strict";
  16333. module2.exports = LRUCache;
  16334. var Map2 = require_map();
  16335. var util = require("util");
  16336. var Yallist = require_yallist();
  16337. var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
  16338. var makeSymbol;
  16339. if (hasSymbol) {
  16340. makeSymbol = function(key) {
  16341. return Symbol(key);
  16342. };
  16343. } else {
  16344. makeSymbol = function(key) {
  16345. return "_" + key;
  16346. };
  16347. }
  16348. var MAX = makeSymbol("max");
  16349. var LENGTH = makeSymbol("length");
  16350. var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
  16351. var ALLOW_STALE = makeSymbol("allowStale");
  16352. var MAX_AGE = makeSymbol("maxAge");
  16353. var DISPOSE = makeSymbol("dispose");
  16354. var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
  16355. var LRU_LIST = makeSymbol("lruList");
  16356. var CACHE = makeSymbol("cache");
  16357. function naiveLength() {
  16358. return 1;
  16359. }
  16360. function LRUCache(options) {
  16361. if (!(this instanceof LRUCache)) {
  16362. return new LRUCache(options);
  16363. }
  16364. if (typeof options === "number") {
  16365. options = {
  16366. max: options
  16367. };
  16368. }
  16369. if (!options) {
  16370. options = {};
  16371. }
  16372. var max = this[MAX] = options.max;
  16373. if (!max || !(typeof max === "number") || max <= 0) {
  16374. this[MAX] = Infinity;
  16375. }
  16376. var lc = options.length || naiveLength;
  16377. if (typeof lc !== "function") {
  16378. lc = naiveLength;
  16379. }
  16380. this[LENGTH_CALCULATOR] = lc;
  16381. this[ALLOW_STALE] = options.stale || false;
  16382. this[MAX_AGE] = options.maxAge || 0;
  16383. this[DISPOSE] = options.dispose;
  16384. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
  16385. this.reset();
  16386. }
  16387. Object.defineProperty(LRUCache.prototype, "max", {
  16388. set: function(mL) {
  16389. if (!mL || !(typeof mL === "number") || mL <= 0) {
  16390. mL = Infinity;
  16391. }
  16392. this[MAX] = mL;
  16393. trim(this);
  16394. },
  16395. get: function() {
  16396. return this[MAX];
  16397. },
  16398. enumerable: true
  16399. });
  16400. Object.defineProperty(LRUCache.prototype, "allowStale", {
  16401. set: function(allowStale) {
  16402. this[ALLOW_STALE] = !!allowStale;
  16403. },
  16404. get: function() {
  16405. return this[ALLOW_STALE];
  16406. },
  16407. enumerable: true
  16408. });
  16409. Object.defineProperty(LRUCache.prototype, "maxAge", {
  16410. set: function(mA) {
  16411. if (!mA || !(typeof mA === "number") || mA < 0) {
  16412. mA = 0;
  16413. }
  16414. this[MAX_AGE] = mA;
  16415. trim(this);
  16416. },
  16417. get: function() {
  16418. return this[MAX_AGE];
  16419. },
  16420. enumerable: true
  16421. });
  16422. Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
  16423. set: function(lC) {
  16424. if (typeof lC !== "function") {
  16425. lC = naiveLength;
  16426. }
  16427. if (lC !== this[LENGTH_CALCULATOR]) {
  16428. this[LENGTH_CALCULATOR] = lC;
  16429. this[LENGTH] = 0;
  16430. this[LRU_LIST].forEach(function(hit) {
  16431. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
  16432. this[LENGTH] += hit.length;
  16433. }, this);
  16434. }
  16435. trim(this);
  16436. },
  16437. get: function() {
  16438. return this[LENGTH_CALCULATOR];
  16439. },
  16440. enumerable: true
  16441. });
  16442. Object.defineProperty(LRUCache.prototype, "length", {
  16443. get: function() {
  16444. return this[LENGTH];
  16445. },
  16446. enumerable: true
  16447. });
  16448. Object.defineProperty(LRUCache.prototype, "itemCount", {
  16449. get: function() {
  16450. return this[LRU_LIST].length;
  16451. },
  16452. enumerable: true
  16453. });
  16454. LRUCache.prototype.rforEach = function(fn, thisp) {
  16455. thisp = thisp || this;
  16456. for (var walker = this[LRU_LIST].tail; walker !== null; ) {
  16457. var prev = walker.prev;
  16458. forEachStep(this, fn, walker, thisp);
  16459. walker = prev;
  16460. }
  16461. };
  16462. function forEachStep(self2, fn, node, thisp) {
  16463. var hit = node.value;
  16464. if (isStale(self2, hit)) {
  16465. del(self2, node);
  16466. if (!self2[ALLOW_STALE]) {
  16467. hit = void 0;
  16468. }
  16469. }
  16470. if (hit) {
  16471. fn.call(thisp, hit.value, hit.key, self2);
  16472. }
  16473. }
  16474. LRUCache.prototype.forEach = function(fn, thisp) {
  16475. thisp = thisp || this;
  16476. for (var walker = this[LRU_LIST].head; walker !== null; ) {
  16477. var next = walker.next;
  16478. forEachStep(this, fn, walker, thisp);
  16479. walker = next;
  16480. }
  16481. };
  16482. LRUCache.prototype.keys = function() {
  16483. return this[LRU_LIST].toArray().map(function(k) {
  16484. return k.key;
  16485. }, this);
  16486. };
  16487. LRUCache.prototype.values = function() {
  16488. return this[LRU_LIST].toArray().map(function(k) {
  16489. return k.value;
  16490. }, this);
  16491. };
  16492. LRUCache.prototype.reset = function() {
  16493. if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
  16494. this[LRU_LIST].forEach(function(hit) {
  16495. this[DISPOSE](hit.key, hit.value);
  16496. }, this);
  16497. }
  16498. this[CACHE] = new Map2();
  16499. this[LRU_LIST] = new Yallist();
  16500. this[LENGTH] = 0;
  16501. };
  16502. LRUCache.prototype.dump = function() {
  16503. return this[LRU_LIST].map(function(hit) {
  16504. if (!isStale(this, hit)) {
  16505. return {
  16506. k: hit.key,
  16507. v: hit.value,
  16508. e: hit.now + (hit.maxAge || 0)
  16509. };
  16510. }
  16511. }, this).toArray().filter(function(h) {
  16512. return h;
  16513. });
  16514. };
  16515. LRUCache.prototype.dumpLru = function() {
  16516. return this[LRU_LIST];
  16517. };
  16518. LRUCache.prototype.inspect = function(n, opts) {
  16519. var str = "LRUCache {";
  16520. var extras = false;
  16521. var as = this[ALLOW_STALE];
  16522. if (as) {
  16523. str += "\n allowStale: true";
  16524. extras = true;
  16525. }
  16526. var max = this[MAX];
  16527. if (max && max !== Infinity) {
  16528. if (extras) {
  16529. str += ",";
  16530. }
  16531. str += "\n max: " + util.inspect(max, opts);
  16532. extras = true;
  16533. }
  16534. var maxAge = this[MAX_AGE];
  16535. if (maxAge) {
  16536. if (extras) {
  16537. str += ",";
  16538. }
  16539. str += "\n maxAge: " + util.inspect(maxAge, opts);
  16540. extras = true;
  16541. }
  16542. var lc = this[LENGTH_CALCULATOR];
  16543. if (lc && lc !== naiveLength) {
  16544. if (extras) {
  16545. str += ",";
  16546. }
  16547. str += "\n length: " + util.inspect(this[LENGTH], opts);
  16548. extras = true;
  16549. }
  16550. var didFirst = false;
  16551. this[LRU_LIST].forEach(function(item) {
  16552. if (didFirst) {
  16553. str += ",\n ";
  16554. } else {
  16555. if (extras) {
  16556. str += ",\n";
  16557. }
  16558. didFirst = true;
  16559. str += "\n ";
  16560. }
  16561. var key = util.inspect(item.key).split("\n").join("\n ");
  16562. var val = {
  16563. value: item.value
  16564. };
  16565. if (item.maxAge !== maxAge) {
  16566. val.maxAge = item.maxAge;
  16567. }
  16568. if (lc !== naiveLength) {
  16569. val.length = item.length;
  16570. }
  16571. if (isStale(this, item)) {
  16572. val.stale = true;
  16573. }
  16574. val = util.inspect(val, opts).split("\n").join("\n ");
  16575. str += key + " => " + val;
  16576. });
  16577. if (didFirst || extras) {
  16578. str += "\n";
  16579. }
  16580. str += "}";
  16581. return str;
  16582. };
  16583. LRUCache.prototype.set = function(key, value, maxAge) {
  16584. maxAge = maxAge || this[MAX_AGE];
  16585. var now = maxAge ? Date.now() : 0;
  16586. var len = this[LENGTH_CALCULATOR](value, key);
  16587. if (this[CACHE].has(key)) {
  16588. if (len > this[MAX]) {
  16589. del(this, this[CACHE].get(key));
  16590. return false;
  16591. }
  16592. var node = this[CACHE].get(key);
  16593. var item = node.value;
  16594. if (this[DISPOSE]) {
  16595. if (!this[NO_DISPOSE_ON_SET]) {
  16596. this[DISPOSE](key, item.value);
  16597. }
  16598. }
  16599. item.now = now;
  16600. item.maxAge = maxAge;
  16601. item.value = value;
  16602. this[LENGTH] += len - item.length;
  16603. item.length = len;
  16604. this.get(key);
  16605. trim(this);
  16606. return true;
  16607. }
  16608. var hit = new Entry(key, value, len, now, maxAge);
  16609. if (hit.length > this[MAX]) {
  16610. if (this[DISPOSE]) {
  16611. this[DISPOSE](key, value);
  16612. }
  16613. return false;
  16614. }
  16615. this[LENGTH] += hit.length;
  16616. this[LRU_LIST].unshift(hit);
  16617. this[CACHE].set(key, this[LRU_LIST].head);
  16618. trim(this);
  16619. return true;
  16620. };
  16621. LRUCache.prototype.has = function(key) {
  16622. if (!this[CACHE].has(key))
  16623. return false;
  16624. var hit = this[CACHE].get(key).value;
  16625. if (isStale(this, hit)) {
  16626. return false;
  16627. }
  16628. return true;
  16629. };
  16630. LRUCache.prototype.get = function(key) {
  16631. return get(this, key, true);
  16632. };
  16633. LRUCache.prototype.peek = function(key) {
  16634. return get(this, key, false);
  16635. };
  16636. LRUCache.prototype.pop = function() {
  16637. var node = this[LRU_LIST].tail;
  16638. if (!node)
  16639. return null;
  16640. del(this, node);
  16641. return node.value;
  16642. };
  16643. LRUCache.prototype.del = function(key) {
  16644. del(this, this[CACHE].get(key));
  16645. };
  16646. LRUCache.prototype.load = function(arr) {
  16647. this.reset();
  16648. var now = Date.now();
  16649. for (var l = arr.length - 1; l >= 0; l--) {
  16650. var hit = arr[l];
  16651. var expiresAt = hit.e || 0;
  16652. if (expiresAt === 0) {
  16653. this.set(hit.k, hit.v);
  16654. } else {
  16655. var maxAge = expiresAt - now;
  16656. if (maxAge > 0) {
  16657. this.set(hit.k, hit.v, maxAge);
  16658. }
  16659. }
  16660. }
  16661. };
  16662. LRUCache.prototype.prune = function() {
  16663. var self2 = this;
  16664. this[CACHE].forEach(function(value, key) {
  16665. get(self2, key, false);
  16666. });
  16667. };
  16668. function get(self2, key, doUse) {
  16669. var node = self2[CACHE].get(key);
  16670. if (node) {
  16671. var hit = node.value;
  16672. if (isStale(self2, hit)) {
  16673. del(self2, node);
  16674. if (!self2[ALLOW_STALE])
  16675. hit = void 0;
  16676. } else {
  16677. if (doUse) {
  16678. self2[LRU_LIST].unshiftNode(node);
  16679. }
  16680. }
  16681. if (hit)
  16682. hit = hit.value;
  16683. }
  16684. return hit;
  16685. }
  16686. function isStale(self2, hit) {
  16687. if (!hit || !hit.maxAge && !self2[MAX_AGE]) {
  16688. return false;
  16689. }
  16690. var stale = false;
  16691. var diff = Date.now() - hit.now;
  16692. if (hit.maxAge) {
  16693. stale = diff > hit.maxAge;
  16694. } else {
  16695. stale = self2[MAX_AGE] && diff > self2[MAX_AGE];
  16696. }
  16697. return stale;
  16698. }
  16699. function trim(self2) {
  16700. if (self2[LENGTH] > self2[MAX]) {
  16701. for (var walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
  16702. var prev = walker.prev;
  16703. del(self2, walker);
  16704. walker = prev;
  16705. }
  16706. }
  16707. }
  16708. function del(self2, node) {
  16709. if (node) {
  16710. var hit = node.value;
  16711. if (self2[DISPOSE]) {
  16712. self2[DISPOSE](hit.key, hit.value);
  16713. }
  16714. self2[LENGTH] -= hit.length;
  16715. self2[CACHE].delete(hit.key);
  16716. self2[LRU_LIST].removeNode(node);
  16717. }
  16718. }
  16719. function Entry(key, value, length, now, maxAge) {
  16720. this.key = key;
  16721. this.value = value;
  16722. this.length = length;
  16723. this.now = now;
  16724. this.maxAge = maxAge || 0;
  16725. }
  16726. }
  16727. });
  16728. var require_sigmund = __commonJS2({
  16729. "node_modules/sigmund/sigmund.js"(exports2, module2) {
  16730. module2.exports = sigmund;
  16731. function sigmund(subject, maxSessions) {
  16732. maxSessions = maxSessions || 10;
  16733. var notes = [];
  16734. var analysis = "";
  16735. var RE = RegExp;
  16736. function psychoAnalyze(subject2, session) {
  16737. if (session > maxSessions)
  16738. return;
  16739. if (typeof subject2 === "function" || typeof subject2 === "undefined") {
  16740. return;
  16741. }
  16742. if (typeof subject2 !== "object" || !subject2 || subject2 instanceof RE) {
  16743. analysis += subject2;
  16744. return;
  16745. }
  16746. if (notes.indexOf(subject2) !== -1 || session === maxSessions)
  16747. return;
  16748. notes.push(subject2);
  16749. analysis += "{";
  16750. Object.keys(subject2).forEach(function(issue, _, __) {
  16751. if (issue.charAt(0) === "_")
  16752. return;
  16753. var to = typeof subject2[issue];
  16754. if (to === "function" || to === "undefined")
  16755. return;
  16756. analysis += issue;
  16757. psychoAnalyze(subject2[issue], session + 1);
  16758. });
  16759. }
  16760. psychoAnalyze(subject, 0);
  16761. return analysis;
  16762. }
  16763. }
  16764. });
  16765. var require_fnmatch = __commonJS2({
  16766. "node_modules/editorconfig/src/lib/fnmatch.js"(exports2, module2) {
  16767. var platform = typeof process === "object" ? process.platform : "win32";
  16768. if (module2)
  16769. module2.exports = minimatch;
  16770. else
  16771. exports2.minimatch = minimatch;
  16772. minimatch.Minimatch = Minimatch;
  16773. var LRU = require_lru_cache();
  16774. var cache = minimatch.cache = new LRU({
  16775. max: 100
  16776. });
  16777. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
  16778. var sigmund = require_sigmund();
  16779. var path = require("path");
  16780. var qmark = "[^/]";
  16781. var star = qmark + "*?";
  16782. var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
  16783. var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
  16784. var reSpecials = charSet("().*{}+?[]^$\\!");
  16785. function charSet(s) {
  16786. return s.split("").reduce(function(set, c) {
  16787. set[c] = true;
  16788. return set;
  16789. }, {});
  16790. }
  16791. var slashSplit = /\/+/;
  16792. minimatch.monkeyPatch = monkeyPatch;
  16793. function monkeyPatch() {
  16794. var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
  16795. var orig = desc.value;
  16796. desc.value = function(p) {
  16797. if (p instanceof Minimatch)
  16798. return p.match(this);
  16799. return orig.call(this, p);
  16800. };
  16801. Object.defineProperty(String.prototype, desc);
  16802. }
  16803. minimatch.filter = filter;
  16804. function filter(pattern, options) {
  16805. options = options || {};
  16806. return function(p, i, list) {
  16807. return minimatch(p, pattern, options);
  16808. };
  16809. }
  16810. function ext(a, b) {
  16811. a = a || {};
  16812. b = b || {};
  16813. var t = {};
  16814. Object.keys(b).forEach(function(k) {
  16815. t[k] = b[k];
  16816. });
  16817. Object.keys(a).forEach(function(k) {
  16818. t[k] = a[k];
  16819. });
  16820. return t;
  16821. }
  16822. minimatch.defaults = function(def) {
  16823. if (!def || !Object.keys(def).length)
  16824. return minimatch;
  16825. var orig = minimatch;
  16826. var m = function minimatch2(p, pattern, options) {
  16827. return orig.minimatch(p, pattern, ext(def, options));
  16828. };
  16829. m.Minimatch = function Minimatch2(pattern, options) {
  16830. return new orig.Minimatch(pattern, ext(def, options));
  16831. };
  16832. return m;
  16833. };
  16834. Minimatch.defaults = function(def) {
  16835. if (!def || !Object.keys(def).length)
  16836. return Minimatch;
  16837. return minimatch.defaults(def).Minimatch;
  16838. };
  16839. function minimatch(p, pattern, options) {
  16840. if (typeof pattern !== "string") {
  16841. throw new TypeError("glob pattern string required");
  16842. }
  16843. if (!options)
  16844. options = {};
  16845. if (!options.nocomment && pattern.charAt(0) === "#") {
  16846. return false;
  16847. }
  16848. if (pattern.trim() === "")
  16849. return p === "";
  16850. return new Minimatch(pattern, options).match(p);
  16851. }
  16852. function Minimatch(pattern, options) {
  16853. if (!(this instanceof Minimatch)) {
  16854. return new Minimatch(pattern, options, cache);
  16855. }
  16856. if (typeof pattern !== "string") {
  16857. throw new TypeError("glob pattern string required");
  16858. }
  16859. if (!options)
  16860. options = {};
  16861. if (platform === "win32") {
  16862. pattern = pattern.split("\\").join("/");
  16863. }
  16864. var cacheKey = pattern + "\n" + sigmund(options);
  16865. var cached = minimatch.cache.get(cacheKey);
  16866. if (cached)
  16867. return cached;
  16868. minimatch.cache.set(cacheKey, this);
  16869. this.options = options;
  16870. this.set = [];
  16871. this.pattern = pattern;
  16872. this.regexp = null;
  16873. this.negate = false;
  16874. this.comment = false;
  16875. this.empty = false;
  16876. this.make();
  16877. }
  16878. Minimatch.prototype.make = make;
  16879. function make() {
  16880. if (this._made)
  16881. return;
  16882. var pattern = this.pattern;
  16883. var options = this.options;
  16884. if (!options.nocomment && pattern.charAt(0) === "#") {
  16885. this.comment = true;
  16886. return;
  16887. }
  16888. if (!pattern) {
  16889. this.empty = true;
  16890. return;
  16891. }
  16892. this.parseNegate();
  16893. var set = this.globSet = this.braceExpand();
  16894. if (options.debug)
  16895. console.error(this.pattern, set);
  16896. set = this.globParts = set.map(function(s) {
  16897. return s.split(slashSplit);
  16898. });
  16899. if (options.debug)
  16900. console.error(this.pattern, set);
  16901. set = set.map(function(s, si, set2) {
  16902. return s.map(this.parse, this);
  16903. }, this);
  16904. if (options.debug)
  16905. console.error(this.pattern, set);
  16906. set = set.filter(function(s) {
  16907. return s.indexOf(false) === -1;
  16908. });
  16909. if (options.debug)
  16910. console.error(this.pattern, set);
  16911. this.set = set;
  16912. }
  16913. Minimatch.prototype.parseNegate = parseNegate;
  16914. function parseNegate() {
  16915. var pattern = this.pattern, negate = false, options = this.options, negateOffset = 0;
  16916. if (options.nonegate)
  16917. return;
  16918. for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
  16919. negate = !negate;
  16920. negateOffset++;
  16921. }
  16922. if (negateOffset)
  16923. this.pattern = pattern.substr(negateOffset);
  16924. this.negate = negate;
  16925. }
  16926. minimatch.braceExpand = function(pattern, options) {
  16927. return new Minimatch(pattern, options).braceExpand();
  16928. };
  16929. Minimatch.prototype.braceExpand = braceExpand;
  16930. function braceExpand(pattern, options) {
  16931. options = options || this.options;
  16932. pattern = typeof pattern === "undefined" ? this.pattern : pattern;
  16933. if (typeof pattern === "undefined") {
  16934. throw new Error("undefined pattern");
  16935. }
  16936. if (options.nobrace || !pattern.match(/\{.*\}/)) {
  16937. return [pattern];
  16938. }
  16939. var escaping = false;
  16940. if (pattern.charAt(0) !== "{") {
  16941. var prefix = null;
  16942. for (var i = 0, l = pattern.length; i < l; i++) {
  16943. var c = pattern.charAt(i);
  16944. if (c === "\\") {
  16945. escaping = !escaping;
  16946. } else if (c === "{" && !escaping) {
  16947. prefix = pattern.substr(0, i);
  16948. break;
  16949. }
  16950. }
  16951. if (prefix === null) {
  16952. return [pattern];
  16953. }
  16954. var tail = braceExpand(pattern.substr(i), options);
  16955. return tail.map(function(t) {
  16956. return prefix + t;
  16957. });
  16958. }
  16959. var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
  16960. if (numset) {
  16961. var suf = braceExpand(pattern.substr(numset[0].length), options), start = +numset[1], end = +numset[2], inc = start > end ? -1 : 1, set = [];
  16962. for (var i = start; i != end + inc; i += inc) {
  16963. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  16964. set.push(i + suf[ii]);
  16965. }
  16966. }
  16967. return set;
  16968. }
  16969. var i = 1, depth = 1, set = [], member = "", sawEnd = false, escaping = false;
  16970. function addMember() {
  16971. set.push(member);
  16972. member = "";
  16973. }
  16974. FOR:
  16975. for (i = 1, l = pattern.length; i < l; i++) {
  16976. var c = pattern.charAt(i);
  16977. if (escaping) {
  16978. escaping = false;
  16979. member += "\\" + c;
  16980. } else {
  16981. switch (c) {
  16982. case "\\":
  16983. escaping = true;
  16984. continue;
  16985. case "{":
  16986. depth++;
  16987. member += "{";
  16988. continue;
  16989. case "}":
  16990. depth--;
  16991. if (depth === 0) {
  16992. addMember();
  16993. i++;
  16994. break FOR;
  16995. } else {
  16996. member += c;
  16997. continue;
  16998. }
  16999. case ",":
  17000. if (depth === 1) {
  17001. addMember();
  17002. } else {
  17003. member += c;
  17004. }
  17005. continue;
  17006. default:
  17007. member += c;
  17008. continue;
  17009. }
  17010. }
  17011. }
  17012. if (depth !== 0) {
  17013. return braceExpand("\\" + pattern, options);
  17014. }
  17015. var suf = braceExpand(pattern.substr(i), options);
  17016. var addBraces = set.length === 1;
  17017. set = set.map(function(p) {
  17018. return braceExpand(p, options);
  17019. });
  17020. set = set.reduce(function(l2, r) {
  17021. return l2.concat(r);
  17022. });
  17023. if (addBraces) {
  17024. set = set.map(function(s) {
  17025. return "{" + s + "}";
  17026. });
  17027. }
  17028. var ret = [];
  17029. for (var i = 0, l = set.length; i < l; i++) {
  17030. for (var ii = 0, ll = suf.length; ii < ll; ii++) {
  17031. ret.push(set[i] + suf[ii]);
  17032. }
  17033. }
  17034. return ret;
  17035. }
  17036. Minimatch.prototype.parse = parse;
  17037. var SUBPARSE = {};
  17038. function parse(pattern, isSub) {
  17039. var options = this.options;
  17040. if (!options.noglobstar && pattern === "**")
  17041. return GLOBSTAR;
  17042. if (pattern === "")
  17043. return "";
  17044. var re = "", hasMagic = !!options.nocase, escaping = false, patternListStack = [], plType, stateChar, inClass = false, reClassStart = -1, classStart = -1, patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
  17045. function clearStateChar() {
  17046. if (stateChar) {
  17047. switch (stateChar) {
  17048. case "*":
  17049. re += star;
  17050. hasMagic = true;
  17051. break;
  17052. case "?":
  17053. re += qmark;
  17054. hasMagic = true;
  17055. break;
  17056. default:
  17057. re += "\\" + stateChar;
  17058. break;
  17059. }
  17060. stateChar = false;
  17061. }
  17062. }
  17063. for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
  17064. if (options.debug) {
  17065. console.error("%s %s %s %j", pattern, i, re, c);
  17066. }
  17067. if (escaping && reSpecials[c]) {
  17068. re += "\\" + c;
  17069. escaping = false;
  17070. continue;
  17071. }
  17072. SWITCH:
  17073. switch (c) {
  17074. case "/":
  17075. return false;
  17076. case "\\":
  17077. clearStateChar();
  17078. escaping = true;
  17079. continue;
  17080. case "?":
  17081. case "*":
  17082. case "+":
  17083. case "@":
  17084. case "!":
  17085. if (options.debug) {
  17086. console.error("%s %s %s %j <-- stateChar", pattern, i, re, c);
  17087. }
  17088. if (inClass) {
  17089. if (c === "!" && i === classStart + 1)
  17090. c = "^";
  17091. re += c;
  17092. continue;
  17093. }
  17094. clearStateChar();
  17095. stateChar = c;
  17096. if (options.noext)
  17097. clearStateChar();
  17098. continue;
  17099. case "(":
  17100. if (inClass) {
  17101. re += "(";
  17102. continue;
  17103. }
  17104. if (!stateChar) {
  17105. re += "\\(";
  17106. continue;
  17107. }
  17108. plType = stateChar;
  17109. patternListStack.push({
  17110. type: plType,
  17111. start: i - 1,
  17112. reStart: re.length
  17113. });
  17114. re += stateChar === "!" ? "(?:(?!" : "(?:";
  17115. stateChar = false;
  17116. continue;
  17117. case ")":
  17118. if (inClass || !patternListStack.length) {
  17119. re += "\\)";
  17120. continue;
  17121. }
  17122. hasMagic = true;
  17123. re += ")";
  17124. plType = patternListStack.pop().type;
  17125. switch (plType) {
  17126. case "!":
  17127. re += "[^/]*?)";
  17128. break;
  17129. case "?":
  17130. case "+":
  17131. case "*":
  17132. re += plType;
  17133. case "@":
  17134. break;
  17135. }
  17136. continue;
  17137. case "|":
  17138. if (inClass || !patternListStack.length || escaping) {
  17139. re += "\\|";
  17140. escaping = false;
  17141. continue;
  17142. }
  17143. re += "|";
  17144. continue;
  17145. case "[":
  17146. clearStateChar();
  17147. if (inClass) {
  17148. re += "\\" + c;
  17149. continue;
  17150. }
  17151. inClass = true;
  17152. classStart = i;
  17153. reClassStart = re.length;
  17154. re += c;
  17155. continue;
  17156. case "]":
  17157. if (i === classStart + 1 || !inClass) {
  17158. re += "\\" + c;
  17159. escaping = false;
  17160. continue;
  17161. }
  17162. hasMagic = true;
  17163. inClass = false;
  17164. re += c;
  17165. continue;
  17166. default:
  17167. clearStateChar();
  17168. if (escaping) {
  17169. escaping = false;
  17170. } else if (reSpecials[c] && !(c === "^" && inClass)) {
  17171. re += "\\";
  17172. }
  17173. re += c;
  17174. }
  17175. }
  17176. if (inClass) {
  17177. var cs = pattern.substr(classStart + 1), sp = this.parse(cs, SUBPARSE);
  17178. re = re.substr(0, reClassStart) + "\\[" + sp[0];
  17179. hasMagic = hasMagic || sp[1];
  17180. }
  17181. var pl;
  17182. while (pl = patternListStack.pop()) {
  17183. var tail = re.slice(pl.reStart + 3);
  17184. tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function(_, $1, $2) {
  17185. if (!$2) {
  17186. $2 = "\\";
  17187. }
  17188. return $1 + $1 + $2 + "|";
  17189. });
  17190. var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
  17191. hasMagic = true;
  17192. re = re.slice(0, pl.reStart) + t + "\\(" + tail;
  17193. }
  17194. clearStateChar();
  17195. if (escaping) {
  17196. re += "\\\\";
  17197. }
  17198. var addPatternStart = false;
  17199. switch (re.charAt(0)) {
  17200. case ".":
  17201. case "[":
  17202. case "(":
  17203. addPatternStart = true;
  17204. }
  17205. if (re !== "" && hasMagic)
  17206. re = "(?=.)" + re;
  17207. if (addPatternStart)
  17208. re = patternStart + re;
  17209. if (isSub === SUBPARSE) {
  17210. return [re, hasMagic];
  17211. }
  17212. if (!hasMagic) {
  17213. return globUnescape(pattern);
  17214. }
  17215. var flags = options.nocase ? "i" : "", regExp = new RegExp("^" + re + "$", flags);
  17216. regExp._glob = pattern;
  17217. regExp._src = re;
  17218. return regExp;
  17219. }
  17220. minimatch.makeRe = function(pattern, options) {
  17221. return new Minimatch(pattern, options || {}).makeRe();
  17222. };
  17223. Minimatch.prototype.makeRe = makeRe;
  17224. function makeRe() {
  17225. if (this.regexp || this.regexp === false)
  17226. return this.regexp;
  17227. var set = this.set;
  17228. if (!set.length)
  17229. return this.regexp = false;
  17230. var options = this.options;
  17231. var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot, flags = options.nocase ? "i" : "";
  17232. var re = set.map(function(pattern) {
  17233. return pattern.map(function(p) {
  17234. return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
  17235. }).join("\\/");
  17236. }).join("|");
  17237. re = "^(?:" + re + ")$";
  17238. if (this.negate)
  17239. re = "^(?!" + re + ").*$";
  17240. try {
  17241. return this.regexp = new RegExp(re, flags);
  17242. } catch (ex) {
  17243. return this.regexp = false;
  17244. }
  17245. }
  17246. minimatch.match = function(list, pattern, options) {
  17247. var mm = new Minimatch(pattern, options);
  17248. list = list.filter(function(f) {
  17249. return mm.match(f);
  17250. });
  17251. if (options.nonull && !list.length) {
  17252. list.push(pattern);
  17253. }
  17254. return list;
  17255. };
  17256. Minimatch.prototype.match = match;
  17257. function match(f, partial) {
  17258. if (this.comment)
  17259. return false;
  17260. if (this.empty)
  17261. return f === "";
  17262. if (f === "/" && partial)
  17263. return true;
  17264. var options = this.options;
  17265. if (platform === "win32") {
  17266. f = f.split("\\").join("/");
  17267. }
  17268. f = f.split(slashSplit);
  17269. if (options.debug) {
  17270. console.error(this.pattern, "split", f);
  17271. }
  17272. var set = this.set;
  17273. for (var i = 0, l = set.length; i < l; i++) {
  17274. var pattern = set[i];
  17275. var hit = this.matchOne(f, pattern, partial);
  17276. if (hit) {
  17277. if (options.flipNegate)
  17278. return true;
  17279. return !this.negate;
  17280. }
  17281. }
  17282. if (options.flipNegate)
  17283. return false;
  17284. return this.negate;
  17285. }
  17286. Minimatch.prototype.matchOne = function(file, pattern, partial) {
  17287. var options = this.options;
  17288. if (options.debug) {
  17289. console.error("matchOne", {
  17290. "this": this,
  17291. file,
  17292. pattern
  17293. });
  17294. }
  17295. if (options.matchBase && pattern.length === 1) {
  17296. file = path.basename(file.join("/")).split("/");
  17297. }
  17298. if (options.debug) {
  17299. console.error("matchOne", file.length, pattern.length);
  17300. }
  17301. for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
  17302. if (options.debug) {
  17303. console.error("matchOne loop");
  17304. }
  17305. var p = pattern[pi], f = file[fi];
  17306. if (options.debug) {
  17307. console.error(pattern, p, f);
  17308. }
  17309. if (p === false)
  17310. return false;
  17311. if (p === GLOBSTAR) {
  17312. if (options.debug)
  17313. console.error("GLOBSTAR", [pattern, p, f]);
  17314. var fr = fi, pr = pi + 1;
  17315. if (pr === pl) {
  17316. if (options.debug)
  17317. console.error("** at the end");
  17318. for (; fi < fl; fi++) {
  17319. if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
  17320. return false;
  17321. }
  17322. return true;
  17323. }
  17324. WHILE:
  17325. while (fr < fl) {
  17326. var swallowee = file[fr];
  17327. if (options.debug) {
  17328. console.error("\nglobstar while", file, fr, pattern, pr, swallowee);
  17329. }
  17330. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  17331. if (options.debug)
  17332. console.error("globstar found match!", fr, fl, swallowee);
  17333. return true;
  17334. } else {
  17335. if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
  17336. if (options.debug)
  17337. console.error("dot detected!", file, fr, pattern, pr);
  17338. break WHILE;
  17339. }
  17340. if (options.debug)
  17341. console.error("globstar swallow a segment, and continue");
  17342. fr++;
  17343. }
  17344. }
  17345. if (partial) {
  17346. if (fr === fl)
  17347. return true;
  17348. }
  17349. return false;
  17350. }
  17351. var hit;
  17352. if (typeof p === "string") {
  17353. if (options.nocase) {
  17354. hit = f.toLowerCase() === p.toLowerCase();
  17355. } else {
  17356. hit = f === p;
  17357. }
  17358. if (options.debug) {
  17359. console.error("string match", p, f, hit);
  17360. }
  17361. } else {
  17362. hit = f.match(p);
  17363. if (options.debug) {
  17364. console.error("pattern match", p, f, hit);
  17365. }
  17366. }
  17367. if (!hit)
  17368. return false;
  17369. }
  17370. if (fi === fl && pi === pl) {
  17371. return true;
  17372. } else if (fi === fl) {
  17373. return partial;
  17374. } else if (pi === pl) {
  17375. var emptyFileEnd = fi === fl - 1 && file[fi] === "";
  17376. return emptyFileEnd;
  17377. }
  17378. throw new Error("wtf?");
  17379. };
  17380. function globUnescape(s) {
  17381. return s.replace(/\\(.)/g, "$1");
  17382. }
  17383. function regExpEscape(s) {
  17384. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
  17385. }
  17386. }
  17387. });
  17388. var require_ini = __commonJS2({
  17389. "node_modules/editorconfig/src/lib/ini.js"(exports2) {
  17390. "use strict";
  17391. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17392. return new (P || (P = Promise))(function(resolve, reject) {
  17393. function fulfilled(value) {
  17394. try {
  17395. step(generator.next(value));
  17396. } catch (e) {
  17397. reject(e);
  17398. }
  17399. }
  17400. function rejected(value) {
  17401. try {
  17402. step(generator["throw"](value));
  17403. } catch (e) {
  17404. reject(e);
  17405. }
  17406. }
  17407. function step(result) {
  17408. result.done ? resolve(result.value) : new P(function(resolve2) {
  17409. resolve2(result.value);
  17410. }).then(fulfilled, rejected);
  17411. }
  17412. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17413. });
  17414. };
  17415. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17416. var _ = {
  17417. label: 0,
  17418. sent: function() {
  17419. if (t[0] & 1)
  17420. throw t[1];
  17421. return t[1];
  17422. },
  17423. trys: [],
  17424. ops: []
  17425. }, f, y, t, g;
  17426. return g = {
  17427. next: verb(0),
  17428. "throw": verb(1),
  17429. "return": verb(2)
  17430. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17431. return this;
  17432. }), g;
  17433. function verb(n) {
  17434. return function(v) {
  17435. return step([n, v]);
  17436. };
  17437. }
  17438. function step(op) {
  17439. if (f)
  17440. throw new TypeError("Generator is already executing.");
  17441. while (_)
  17442. try {
  17443. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
  17444. return t;
  17445. if (y = 0, t)
  17446. op = [op[0] & 2, t.value];
  17447. switch (op[0]) {
  17448. case 0:
  17449. case 1:
  17450. t = op;
  17451. break;
  17452. case 4:
  17453. _.label++;
  17454. return {
  17455. value: op[1],
  17456. done: false
  17457. };
  17458. case 5:
  17459. _.label++;
  17460. y = op[1];
  17461. op = [0];
  17462. continue;
  17463. case 7:
  17464. op = _.ops.pop();
  17465. _.trys.pop();
  17466. continue;
  17467. default:
  17468. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17469. _ = 0;
  17470. continue;
  17471. }
  17472. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17473. _.label = op[1];
  17474. break;
  17475. }
  17476. if (op[0] === 6 && _.label < t[1]) {
  17477. _.label = t[1];
  17478. t = op;
  17479. break;
  17480. }
  17481. if (t && _.label < t[2]) {
  17482. _.label = t[2];
  17483. _.ops.push(op);
  17484. break;
  17485. }
  17486. if (t[2])
  17487. _.ops.pop();
  17488. _.trys.pop();
  17489. continue;
  17490. }
  17491. op = body.call(thisArg, _);
  17492. } catch (e) {
  17493. op = [6, e];
  17494. y = 0;
  17495. } finally {
  17496. f = t = 0;
  17497. }
  17498. if (op[0] & 5)
  17499. throw op[1];
  17500. return {
  17501. value: op[0] ? op[1] : void 0,
  17502. done: true
  17503. };
  17504. }
  17505. };
  17506. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17507. if (mod && mod.__esModule)
  17508. return mod;
  17509. var result = {};
  17510. if (mod != null) {
  17511. for (var k in mod)
  17512. if (Object.hasOwnProperty.call(mod, k))
  17513. result[k] = mod[k];
  17514. }
  17515. result["default"] = mod;
  17516. return result;
  17517. };
  17518. Object.defineProperty(exports2, "__esModule", {
  17519. value: true
  17520. });
  17521. var fs = __importStar2(require("fs"));
  17522. var regex = {
  17523. section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
  17524. param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
  17525. comment: /^\s*[#;].*$/
  17526. };
  17527. function parse(file) {
  17528. return __awaiter2(this, void 0, void 0, function() {
  17529. return __generator2(this, function(_a) {
  17530. return [2, new Promise(function(resolve, reject) {
  17531. fs.readFile(file, "utf8", function(err, data) {
  17532. if (err) {
  17533. reject(err);
  17534. return;
  17535. }
  17536. resolve(parseString(data));
  17537. });
  17538. })];
  17539. });
  17540. });
  17541. }
  17542. exports2.parse = parse;
  17543. function parseSync(file) {
  17544. return parseString(fs.readFileSync(file, "utf8"));
  17545. }
  17546. exports2.parseSync = parseSync;
  17547. function parseString(data) {
  17548. var sectionBody = {};
  17549. var sectionName = null;
  17550. var value = [[sectionName, sectionBody]];
  17551. var lines = data.split(/\r\n|\r|\n/);
  17552. lines.forEach(function(line) {
  17553. var match;
  17554. if (regex.comment.test(line)) {
  17555. return;
  17556. }
  17557. if (regex.param.test(line)) {
  17558. match = line.match(regex.param);
  17559. sectionBody[match[1]] = match[2];
  17560. } else if (regex.section.test(line)) {
  17561. match = line.match(regex.section);
  17562. sectionName = match[1];
  17563. sectionBody = {};
  17564. value.push([sectionName, sectionBody]);
  17565. }
  17566. });
  17567. return value;
  17568. }
  17569. exports2.parseString = parseString;
  17570. }
  17571. });
  17572. var require_package = __commonJS2({
  17573. "node_modules/editorconfig/package.json"(exports2, module2) {
  17574. module2.exports = {
  17575. name: "editorconfig",
  17576. version: "0.15.3",
  17577. description: "EditorConfig File Locator and Interpreter for Node.js",
  17578. keywords: ["editorconfig", "core"],
  17579. main: "src/index.js",
  17580. contributors: ["Hong Xu (topbug.net)", "Jed Mao (https://github.com/jedmao/)", "Trey Hunner (http://treyhunner.com)"],
  17581. directories: {
  17582. bin: "./bin",
  17583. lib: "./lib"
  17584. },
  17585. scripts: {
  17586. clean: "rimraf dist",
  17587. prebuild: "npm run clean",
  17588. build: "tsc",
  17589. pretest: "npm run lint && npm run build && npm run copy && cmake .",
  17590. test: "ctest .",
  17591. "pretest:ci": "npm run pretest",
  17592. "test:ci": "ctest -VV --output-on-failure .",
  17593. lint: "npm run eclint && npm run tslint",
  17594. eclint: 'eclint check --indent_size ignore "src/**"',
  17595. tslint: "tslint --project tsconfig.json --exclude package.json",
  17596. copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
  17597. prepub: "npm run lint && npm run build && npm run copy",
  17598. pub: "npm publish ./dist"
  17599. },
  17600. repository: {
  17601. type: "git",
  17602. url: "git://github.com/editorconfig/editorconfig-core-js.git"
  17603. },
  17604. bugs: "https://github.com/editorconfig/editorconfig-core-js/issues",
  17605. author: "EditorConfig Team",
  17606. license: "MIT",
  17607. dependencies: {
  17608. commander: "^2.19.0",
  17609. "lru-cache": "^4.1.5",
  17610. semver: "^5.6.0",
  17611. sigmund: "^1.0.1"
  17612. },
  17613. devDependencies: {
  17614. "@types/mocha": "^5.2.6",
  17615. "@types/node": "^10.12.29",
  17616. "@types/semver": "^5.5.0",
  17617. "cpy-cli": "^2.0.0",
  17618. eclint: "^2.8.1",
  17619. mocha: "^5.2.0",
  17620. rimraf: "^2.6.3",
  17621. should: "^13.2.3",
  17622. tslint: "^5.13.1",
  17623. typescript: "^3.3.3333"
  17624. }
  17625. };
  17626. }
  17627. });
  17628. var require_src2 = __commonJS2({
  17629. "node_modules/editorconfig/src/index.js"(exports2) {
  17630. "use strict";
  17631. var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
  17632. return new (P || (P = Promise))(function(resolve, reject) {
  17633. function fulfilled(value) {
  17634. try {
  17635. step(generator.next(value));
  17636. } catch (e) {
  17637. reject(e);
  17638. }
  17639. }
  17640. function rejected(value) {
  17641. try {
  17642. step(generator["throw"](value));
  17643. } catch (e) {
  17644. reject(e);
  17645. }
  17646. }
  17647. function step(result) {
  17648. result.done ? resolve(result.value) : new P(function(resolve2) {
  17649. resolve2(result.value);
  17650. }).then(fulfilled, rejected);
  17651. }
  17652. step((generator = generator.apply(thisArg, _arguments || [])).next());
  17653. });
  17654. };
  17655. var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
  17656. var _ = {
  17657. label: 0,
  17658. sent: function() {
  17659. if (t[0] & 1)
  17660. throw t[1];
  17661. return t[1];
  17662. },
  17663. trys: [],
  17664. ops: []
  17665. }, f, y, t, g;
  17666. return g = {
  17667. next: verb(0),
  17668. "throw": verb(1),
  17669. "return": verb(2)
  17670. }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
  17671. return this;
  17672. }), g;
  17673. function verb(n) {
  17674. return function(v) {
  17675. return step([n, v]);
  17676. };
  17677. }
  17678. function step(op) {
  17679. if (f)
  17680. throw new TypeError("Generator is already executing.");
  17681. while (_)
  17682. try {
  17683. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
  17684. return t;
  17685. if (y = 0, t)
  17686. op = [op[0] & 2, t.value];
  17687. switch (op[0]) {
  17688. case 0:
  17689. case 1:
  17690. t = op;
  17691. break;
  17692. case 4:
  17693. _.label++;
  17694. return {
  17695. value: op[1],
  17696. done: false
  17697. };
  17698. case 5:
  17699. _.label++;
  17700. y = op[1];
  17701. op = [0];
  17702. continue;
  17703. case 7:
  17704. op = _.ops.pop();
  17705. _.trys.pop();
  17706. continue;
  17707. default:
  17708. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
  17709. _ = 0;
  17710. continue;
  17711. }
  17712. if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
  17713. _.label = op[1];
  17714. break;
  17715. }
  17716. if (op[0] === 6 && _.label < t[1]) {
  17717. _.label = t[1];
  17718. t = op;
  17719. break;
  17720. }
  17721. if (t && _.label < t[2]) {
  17722. _.label = t[2];
  17723. _.ops.push(op);
  17724. break;
  17725. }
  17726. if (t[2])
  17727. _.ops.pop();
  17728. _.trys.pop();
  17729. continue;
  17730. }
  17731. op = body.call(thisArg, _);
  17732. } catch (e) {
  17733. op = [6, e];
  17734. y = 0;
  17735. } finally {
  17736. f = t = 0;
  17737. }
  17738. if (op[0] & 5)
  17739. throw op[1];
  17740. return {
  17741. value: op[0] ? op[1] : void 0,
  17742. done: true
  17743. };
  17744. }
  17745. };
  17746. var __importStar2 = exports2 && exports2.__importStar || function(mod) {
  17747. if (mod && mod.__esModule)
  17748. return mod;
  17749. var result = {};
  17750. if (mod != null) {
  17751. for (var k in mod)
  17752. if (Object.hasOwnProperty.call(mod, k))
  17753. result[k] = mod[k];
  17754. }
  17755. result["default"] = mod;
  17756. return result;
  17757. };
  17758. var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
  17759. return mod && mod.__esModule ? mod : {
  17760. "default": mod
  17761. };
  17762. };
  17763. Object.defineProperty(exports2, "__esModule", {
  17764. value: true
  17765. });
  17766. var fs = __importStar2(require("fs"));
  17767. var path = __importStar2(require("path"));
  17768. var semver = {
  17769. gte: require_gte()
  17770. };
  17771. var fnmatch_1 = __importDefault2(require_fnmatch());
  17772. var ini_1 = require_ini();
  17773. exports2.parseString = ini_1.parseString;
  17774. var package_json_1 = __importDefault2(require_package());
  17775. var knownProps = {
  17776. end_of_line: true,
  17777. indent_style: true,
  17778. indent_size: true,
  17779. insert_final_newline: true,
  17780. trim_trailing_whitespace: true,
  17781. charset: true
  17782. };
  17783. function fnmatch(filepath, glob) {
  17784. var matchOptions = {
  17785. matchBase: true,
  17786. dot: true,
  17787. noext: true
  17788. };
  17789. glob = glob.replace(/\*\*/g, "{*,**/**/**}");
  17790. return fnmatch_1.default(filepath, glob, matchOptions);
  17791. }
  17792. function getConfigFileNames(filepath, options) {
  17793. var paths = [];
  17794. do {
  17795. filepath = path.dirname(filepath);
  17796. paths.push(path.join(filepath, options.config));
  17797. } while (filepath !== options.root);
  17798. return paths;
  17799. }
  17800. function processMatches(matches, version2) {
  17801. if ("indent_style" in matches && matches.indent_style === "tab" && !("indent_size" in matches) && semver.gte(version2, "0.10.0")) {
  17802. matches.indent_size = "tab";
  17803. }
  17804. if ("indent_size" in matches && !("tab_width" in matches) && matches.indent_size !== "tab") {
  17805. matches.tab_width = matches.indent_size;
  17806. }
  17807. if ("indent_size" in matches && "tab_width" in matches && matches.indent_size === "tab") {
  17808. matches.indent_size = matches.tab_width;
  17809. }
  17810. return matches;
  17811. }
  17812. function processOptions(options, filepath) {
  17813. if (options === void 0) {
  17814. options = {};
  17815. }
  17816. return {
  17817. config: options.config || ".editorconfig",
  17818. version: options.version || package_json_1.default.version,
  17819. root: path.resolve(options.root || path.parse(filepath).root)
  17820. };
  17821. }
  17822. function buildFullGlob(pathPrefix, glob) {
  17823. switch (glob.indexOf("/")) {
  17824. case -1:
  17825. glob = "**/" + glob;
  17826. break;
  17827. case 0:
  17828. glob = glob.substring(1);
  17829. break;
  17830. default:
  17831. break;
  17832. }
  17833. return path.join(pathPrefix, glob);
  17834. }
  17835. function extendProps(props, options) {
  17836. if (props === void 0) {
  17837. props = {};
  17838. }
  17839. if (options === void 0) {
  17840. options = {};
  17841. }
  17842. for (var key in options) {
  17843. if (options.hasOwnProperty(key)) {
  17844. var value = options[key];
  17845. var key2 = key.toLowerCase();
  17846. var value2 = value;
  17847. if (knownProps[key2]) {
  17848. value2 = value.toLowerCase();
  17849. }
  17850. try {
  17851. value2 = JSON.parse(value);
  17852. } catch (e) {
  17853. }
  17854. if (typeof value === "undefined" || value === null) {
  17855. value2 = String(value);
  17856. }
  17857. props[key2] = value2;
  17858. }
  17859. }
  17860. return props;
  17861. }
  17862. function parseFromConfigs(configs, filepath, options) {
  17863. return processMatches(configs.reverse().reduce(function(matches, file) {
  17864. var pathPrefix = path.dirname(file.name);
  17865. file.contents.forEach(function(section) {
  17866. var glob = section[0];
  17867. var options2 = section[1];
  17868. if (!glob) {
  17869. return;
  17870. }
  17871. var fullGlob = buildFullGlob(pathPrefix, glob);
  17872. if (!fnmatch(filepath, fullGlob)) {
  17873. return;
  17874. }
  17875. matches = extendProps(matches, options2);
  17876. });
  17877. return matches;
  17878. }, {}), options.version);
  17879. }
  17880. function getConfigsForFiles(files) {
  17881. var configs = [];
  17882. for (var i in files) {
  17883. if (files.hasOwnProperty(i)) {
  17884. var file = files[i];
  17885. var contents = ini_1.parseString(file.contents);
  17886. configs.push({
  17887. name: file.name,
  17888. contents
  17889. });
  17890. if ((contents[0][1].root || "").toLowerCase() === "true") {
  17891. break;
  17892. }
  17893. }
  17894. }
  17895. return configs;
  17896. }
  17897. function readConfigFiles(filepaths) {
  17898. return __awaiter2(this, void 0, void 0, function() {
  17899. return __generator2(this, function(_a) {
  17900. return [2, Promise.all(filepaths.map(function(name) {
  17901. return new Promise(function(resolve) {
  17902. fs.readFile(name, "utf8", function(err, data) {
  17903. resolve({
  17904. name,
  17905. contents: err ? "" : data
  17906. });
  17907. });
  17908. });
  17909. }))];
  17910. });
  17911. });
  17912. }
  17913. function readConfigFilesSync(filepaths) {
  17914. var files = [];
  17915. var file;
  17916. filepaths.forEach(function(filepath) {
  17917. try {
  17918. file = fs.readFileSync(filepath, "utf8");
  17919. } catch (e) {
  17920. file = "";
  17921. }
  17922. files.push({
  17923. name: filepath,
  17924. contents: file
  17925. });
  17926. });
  17927. return files;
  17928. }
  17929. function opts(filepath, options) {
  17930. if (options === void 0) {
  17931. options = {};
  17932. }
  17933. var resolvedFilePath = path.resolve(filepath);
  17934. return [resolvedFilePath, processOptions(options, resolvedFilePath)];
  17935. }
  17936. function parseFromFiles(filepath, files, options) {
  17937. if (options === void 0) {
  17938. options = {};
  17939. }
  17940. return __awaiter2(this, void 0, void 0, function() {
  17941. var _a, resolvedFilePath, processedOptions;
  17942. return __generator2(this, function(_b) {
  17943. _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17944. return [2, files.then(getConfigsForFiles).then(function(configs) {
  17945. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  17946. })];
  17947. });
  17948. });
  17949. }
  17950. exports2.parseFromFiles = parseFromFiles;
  17951. function parseFromFilesSync(filepath, files, options) {
  17952. if (options === void 0) {
  17953. options = {};
  17954. }
  17955. var _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17956. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  17957. }
  17958. exports2.parseFromFilesSync = parseFromFilesSync;
  17959. function parse(_filepath, _options) {
  17960. if (_options === void 0) {
  17961. _options = {};
  17962. }
  17963. return __awaiter2(this, void 0, void 0, function() {
  17964. var _a, resolvedFilePath, processedOptions, filepaths;
  17965. return __generator2(this, function(_b) {
  17966. _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17967. filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  17968. return [2, readConfigFiles(filepaths).then(getConfigsForFiles).then(function(configs) {
  17969. return parseFromConfigs(configs, resolvedFilePath, processedOptions);
  17970. })];
  17971. });
  17972. });
  17973. }
  17974. exports2.parse = parse;
  17975. function parseSync(_filepath, _options) {
  17976. if (_options === void 0) {
  17977. _options = {};
  17978. }
  17979. var _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
  17980. var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
  17981. var files = readConfigFilesSync(filepaths);
  17982. return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
  17983. }
  17984. exports2.parseSync = parseSync;
  17985. }
  17986. });
  17987. var require_editorconfig_to_prettier = __commonJS2({
  17988. "node_modules/editorconfig-to-prettier/index.js"(exports2, module2) {
  17989. module2.exports = editorConfigToPrettier;
  17990. function removeUnset(editorConfig) {
  17991. const result = {};
  17992. const keys = Object.keys(editorConfig);
  17993. for (let i = 0; i < keys.length; i++) {
  17994. const key = keys[i];
  17995. if (editorConfig[key] === "unset") {
  17996. continue;
  17997. }
  17998. result[key] = editorConfig[key];
  17999. }
  18000. return result;
  18001. }
  18002. function editorConfigToPrettier(editorConfig) {
  18003. if (!editorConfig) {
  18004. return null;
  18005. }
  18006. editorConfig = removeUnset(editorConfig);
  18007. if (Object.keys(editorConfig).length === 0) {
  18008. return null;
  18009. }
  18010. const result = {};
  18011. if (editorConfig.indent_style) {
  18012. result.useTabs = editorConfig.indent_style === "tab";
  18013. }
  18014. if (editorConfig.indent_size === "tab") {
  18015. result.useTabs = true;
  18016. }
  18017. if (result.useTabs && editorConfig.tab_width) {
  18018. result.tabWidth = editorConfig.tab_width;
  18019. } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
  18020. result.tabWidth = editorConfig.indent_size;
  18021. } else if (editorConfig.tab_width !== void 0) {
  18022. result.tabWidth = editorConfig.tab_width;
  18023. }
  18024. if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") {
  18025. result.printWidth = editorConfig.max_line_length;
  18026. }
  18027. if (editorConfig.quote_type === "single") {
  18028. result.singleQuote = true;
  18029. } else if (editorConfig.quote_type === "double") {
  18030. result.singleQuote = false;
  18031. }
  18032. if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) {
  18033. result.endOfLine = editorConfig.end_of_line;
  18034. }
  18035. if (editorConfig.insert_final_newline === false || editorConfig.insert_final_newline === true) {
  18036. result.insertFinalNewline = editorConfig.insert_final_newline;
  18037. }
  18038. return result;
  18039. }
  18040. }
  18041. });
  18042. var require_find_project_root = __commonJS2({
  18043. "src/config/find-project-root.js"(exports2, module2) {
  18044. "use strict";
  18045. var fs = require("fs");
  18046. var path = require("path");
  18047. var MARKERS = [".git", ".hg"];
  18048. var markerExists = (directory) => MARKERS.some((mark) => fs.existsSync(path.join(directory, mark)));
  18049. function findProjectRoot(directory) {
  18050. while (!markerExists(directory)) {
  18051. const parentDirectory = path.resolve(directory, "..");
  18052. if (parentDirectory === directory) {
  18053. break;
  18054. }
  18055. directory = parentDirectory;
  18056. }
  18057. return directory;
  18058. }
  18059. module2.exports = findProjectRoot;
  18060. }
  18061. });
  18062. var require_resolve_config_editorconfig = __commonJS2({
  18063. "src/config/resolve-config-editorconfig.js"(exports2, module2) {
  18064. "use strict";
  18065. var path = require("path");
  18066. var editorconfig = require_src2();
  18067. var editorConfigToPrettier = require_editorconfig_to_prettier();
  18068. var {
  18069. default: mem2,
  18070. memClear: memClear2
  18071. } = (init_dist(), __toCommonJS(dist_exports));
  18072. var findProjectRoot = require_find_project_root();
  18073. var jsonStringifyMem = (fn) => mem2(fn, {
  18074. cacheKey: JSON.stringify
  18075. });
  18076. var maybeParse = (filePath, parse) => filePath && parse(filePath, {
  18077. root: findProjectRoot(path.dirname(path.resolve(filePath)))
  18078. });
  18079. var editorconfigAsyncNoCache = async (filePath) => editorConfigToPrettier(await maybeParse(filePath, editorconfig.parse));
  18080. var editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache);
  18081. var editorconfigSyncNoCache = (filePath) => editorConfigToPrettier(maybeParse(filePath, editorconfig.parseSync));
  18082. var editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache);
  18083. function getLoadFunction(opts) {
  18084. if (!opts.editorconfig) {
  18085. return () => null;
  18086. }
  18087. if (opts.sync) {
  18088. return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache;
  18089. }
  18090. return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache;
  18091. }
  18092. function clearCache() {
  18093. memClear2(editorconfigSyncWithCache);
  18094. memClear2(editorconfigAsyncWithCache);
  18095. }
  18096. module2.exports = {
  18097. getLoadFunction,
  18098. clearCache
  18099. };
  18100. }
  18101. });
  18102. var require_resolve_config = __commonJS2({
  18103. "src/config/resolve-config.js"(exports2, module2) {
  18104. "use strict";
  18105. var path = require("path");
  18106. var micromatch = require_micromatch();
  18107. var thirdParty = require("./third-party.js");
  18108. var loadToml = require_load_toml();
  18109. var loadJson5 = require_load_json5();
  18110. var partition = require_partition();
  18111. var resolve = require_resolve2();
  18112. var {
  18113. default: mem2,
  18114. memClear: memClear2
  18115. } = (init_dist(), __toCommonJS(dist_exports));
  18116. var resolveEditorConfig = require_resolve_config_editorconfig();
  18117. var getExplorerMemoized = mem2((opts) => {
  18118. const cosmiconfig = thirdParty["cosmiconfig" + (opts.sync ? "Sync" : "")];
  18119. const explorer = cosmiconfig("prettier", {
  18120. cache: opts.cache,
  18121. transform: (result) => {
  18122. if (result && result.config) {
  18123. if (typeof result.config === "string") {
  18124. const dir = path.dirname(result.filepath);
  18125. const modulePath = resolve(result.config, {
  18126. paths: [dir]
  18127. });
  18128. result.config = require(modulePath);
  18129. }
  18130. if (typeof result.config !== "object") {
  18131. throw new TypeError(`Config is only allowed to be an object, but received ${typeof result.config} in "${result.filepath}"`);
  18132. }
  18133. delete result.config.$schema;
  18134. }
  18135. return result;
  18136. },
  18137. searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.json5", ".prettierrc.js", ".prettierrc.cjs", "prettier.config.js", "prettier.config.cjs", ".prettierrc.toml"],
  18138. loaders: {
  18139. ".toml": loadToml,
  18140. ".json5": loadJson5
  18141. }
  18142. });
  18143. return explorer;
  18144. }, {
  18145. cacheKey: JSON.stringify
  18146. });
  18147. function getExplorer(opts) {
  18148. opts = Object.assign({
  18149. sync: false,
  18150. cache: false
  18151. }, opts);
  18152. return getExplorerMemoized(opts);
  18153. }
  18154. function _resolveConfig(filePath, opts, sync) {
  18155. opts = Object.assign({
  18156. useCache: true
  18157. }, opts);
  18158. const loadOpts = {
  18159. cache: Boolean(opts.useCache),
  18160. sync: Boolean(sync),
  18161. editorconfig: Boolean(opts.editorconfig)
  18162. };
  18163. const {
  18164. load,
  18165. search
  18166. } = getExplorer(loadOpts);
  18167. const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
  18168. const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)];
  18169. const unwrapAndMerge = ([result, editorConfigured]) => {
  18170. const merged = Object.assign(Object.assign({}, editorConfigured), mergeOverrides(result, filePath));
  18171. for (const optionName of ["plugins", "pluginSearchDirs"]) {
  18172. if (Array.isArray(merged[optionName])) {
  18173. merged[optionName] = merged[optionName].map((value) => typeof value === "string" && value.startsWith(".") ? path.resolve(path.dirname(result.filepath), value) : value);
  18174. }
  18175. }
  18176. if (!result && !editorConfigured) {
  18177. return null;
  18178. }
  18179. delete merged.insertFinalNewline;
  18180. return merged;
  18181. };
  18182. if (loadOpts.sync) {
  18183. return unwrapAndMerge(arr);
  18184. }
  18185. return Promise.all(arr).then(unwrapAndMerge);
  18186. }
  18187. var resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false);
  18188. resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true);
  18189. function clearCache() {
  18190. memClear2(getExplorerMemoized);
  18191. resolveEditorConfig.clearCache();
  18192. }
  18193. async function resolveConfigFile(filePath) {
  18194. const {
  18195. search
  18196. } = getExplorer({
  18197. sync: false
  18198. });
  18199. const result = await search(filePath);
  18200. return result ? result.filepath : null;
  18201. }
  18202. resolveConfigFile.sync = (filePath) => {
  18203. const {
  18204. search
  18205. } = getExplorer({
  18206. sync: true
  18207. });
  18208. const result = search(filePath);
  18209. return result ? result.filepath : null;
  18210. };
  18211. function mergeOverrides(configResult, filePath) {
  18212. const {
  18213. config: config2,
  18214. filepath: configPath
  18215. } = configResult || {};
  18216. const _ref = config2 || {}, {
  18217. overrides
  18218. } = _ref, options = _objectWithoutProperties(_ref, _excluded3);
  18219. if (filePath && overrides) {
  18220. const relativeFilePath = path.relative(path.dirname(configPath), filePath);
  18221. for (const override of overrides) {
  18222. if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) {
  18223. Object.assign(options, override.options);
  18224. }
  18225. }
  18226. }
  18227. return options;
  18228. }
  18229. function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
  18230. const patternList = Array.isArray(patterns) ? patterns : [patterns];
  18231. const [withSlashes, withoutSlashes] = partition(patternList, (pattern) => pattern.includes("/"));
  18232. return micromatch.isMatch(filePath, withoutSlashes, {
  18233. ignore: excludedPatterns,
  18234. basename: true,
  18235. dot: true
  18236. }) || micromatch.isMatch(filePath, withSlashes, {
  18237. ignore: excludedPatterns,
  18238. basename: false,
  18239. dot: true
  18240. });
  18241. }
  18242. module2.exports = {
  18243. resolveConfig,
  18244. resolveConfigFile,
  18245. clearCache
  18246. };
  18247. }
  18248. });
  18249. var require_ignore = __commonJS2({
  18250. "node_modules/ignore/index.js"(exports2, module2) {
  18251. function makeArray(subject) {
  18252. return Array.isArray(subject) ? subject : [subject];
  18253. }
  18254. var EMPTY = "";
  18255. var SPACE = " ";
  18256. var ESCAPE = "\\";
  18257. var REGEX_TEST_BLANK_LINE = /^\s+$/;
  18258. var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
  18259. var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
  18260. var REGEX_SPLITALL_CRLF = /\r?\n/g;
  18261. var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
  18262. var SLASH = "/";
  18263. var KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("node-ignore") : "node-ignore";
  18264. var define2 = (object, key, value) => Object.defineProperty(object, key, {
  18265. value
  18266. });
  18267. var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
  18268. var RETURN_FALSE = () => false;
  18269. var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
  18270. var cleanRangeBackSlash = (slashes) => {
  18271. const {
  18272. length
  18273. } = slashes;
  18274. return slashes.slice(0, length - length % 2);
  18275. };
  18276. var REPLACERS = [[/\\?\s+$/, (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY], [/\\\s/g, () => SPACE], [/[\\$.|*+(){^]/g, (match) => `\\${match}`], [/(?!\\)\?/g, () => "[^/]"], [/^\//, () => "^"], [/\//g, () => "\\/"], [/^\^*\\\*\\\*\\\//, () => "^(?:.*\\/)?"], [/^(?=[^^])/, function startingReplacer() {
  18277. return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
  18278. }], [/\\\/\\\*\\\*(?=\\\/|$)/g, (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"], [/(^|[^\\]+)\\\*(?=.+)/g, (_, p1) => `${p1}[^\\/]*`], [/\\\\\\(?=[$.|*+(){^])/g, () => ESCAPE], [/\\\\/g, () => ESCAPE], [/(\\)?\[([^\]/]*?)(\\*)($|\])/g, (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"], [/(?:[^*])$/, (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`], [/(\^|\\\/)?\\\*$/, (_, p1) => {
  18279. const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
  18280. return `${prefix}(?=$|\\/$)`;
  18281. }]];
  18282. var regexCache = /* @__PURE__ */ Object.create(null);
  18283. var makeRegex = (pattern, ignoreCase) => {
  18284. let source = regexCache[pattern];
  18285. if (!source) {
  18286. source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
  18287. regexCache[pattern] = source;
  18288. }
  18289. return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
  18290. };
  18291. var isString = (subject) => typeof subject === "string";
  18292. var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && pattern.indexOf("#") !== 0;
  18293. var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
  18294. var IgnoreRule = class {
  18295. constructor(origin, pattern, negative, regex) {
  18296. this.origin = origin;
  18297. this.pattern = pattern;
  18298. this.negative = negative;
  18299. this.regex = regex;
  18300. }
  18301. };
  18302. var createRule = (pattern, ignoreCase) => {
  18303. const origin = pattern;
  18304. let negative = false;
  18305. if (pattern.indexOf("!") === 0) {
  18306. negative = true;
  18307. pattern = pattern.substr(1);
  18308. }
  18309. pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
  18310. const regex = makeRegex(pattern, ignoreCase);
  18311. return new IgnoreRule(origin, pattern, negative, regex);
  18312. };
  18313. var throwError = (message, Ctor) => {
  18314. throw new Ctor(message);
  18315. };
  18316. var checkPath = (path, originalPath, doThrow) => {
  18317. if (!isString(path)) {
  18318. return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
  18319. }
  18320. if (!path) {
  18321. return doThrow(`path must not be empty`, TypeError);
  18322. }
  18323. if (checkPath.isNotRelative(path)) {
  18324. const r = "`path.relative()`d";
  18325. return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
  18326. }
  18327. return true;
  18328. };
  18329. var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
  18330. checkPath.isNotRelative = isNotRelative;
  18331. checkPath.convert = (p) => p;
  18332. var Ignore = class {
  18333. constructor({
  18334. ignorecase = true,
  18335. ignoreCase = ignorecase,
  18336. allowRelativePaths = false
  18337. } = {}) {
  18338. define2(this, KEY_IGNORE, true);
  18339. this._rules = [];
  18340. this._ignoreCase = ignoreCase;
  18341. this._allowRelativePaths = allowRelativePaths;
  18342. this._initCache();
  18343. }
  18344. _initCache() {
  18345. this._ignoreCache = /* @__PURE__ */ Object.create(null);
  18346. this._testCache = /* @__PURE__ */ Object.create(null);
  18347. }
  18348. _addPattern(pattern) {
  18349. if (pattern && pattern[KEY_IGNORE]) {
  18350. this._rules = this._rules.concat(pattern._rules);
  18351. this._added = true;
  18352. return;
  18353. }
  18354. if (checkPattern(pattern)) {
  18355. const rule = createRule(pattern, this._ignoreCase);
  18356. this._added = true;
  18357. this._rules.push(rule);
  18358. }
  18359. }
  18360. add(pattern) {
  18361. this._added = false;
  18362. makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
  18363. if (this._added) {
  18364. this._initCache();
  18365. }
  18366. return this;
  18367. }
  18368. addPattern(pattern) {
  18369. return this.add(pattern);
  18370. }
  18371. _testOne(path, checkUnignored) {
  18372. let ignored = false;
  18373. let unignored = false;
  18374. this._rules.forEach((rule) => {
  18375. const {
  18376. negative
  18377. } = rule;
  18378. if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
  18379. return;
  18380. }
  18381. const matched = rule.regex.test(path);
  18382. if (matched) {
  18383. ignored = !negative;
  18384. unignored = negative;
  18385. }
  18386. });
  18387. return {
  18388. ignored,
  18389. unignored
  18390. };
  18391. }
  18392. _test(originalPath, cache, checkUnignored, slices) {
  18393. const path = originalPath && checkPath.convert(originalPath);
  18394. checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
  18395. return this._t(path, cache, checkUnignored, slices);
  18396. }
  18397. _t(path, cache, checkUnignored, slices) {
  18398. if (path in cache) {
  18399. return cache[path];
  18400. }
  18401. if (!slices) {
  18402. slices = path.split(SLASH);
  18403. }
  18404. slices.pop();
  18405. if (!slices.length) {
  18406. return cache[path] = this._testOne(path, checkUnignored);
  18407. }
  18408. const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
  18409. return cache[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
  18410. }
  18411. ignores(path) {
  18412. return this._test(path, this._ignoreCache, false).ignored;
  18413. }
  18414. createFilter() {
  18415. return (path) => !this.ignores(path);
  18416. }
  18417. filter(paths) {
  18418. return makeArray(paths).filter(this.createFilter());
  18419. }
  18420. test(path) {
  18421. return this._test(path, this._testCache, true);
  18422. }
  18423. };
  18424. var factory = (options) => new Ignore(options);
  18425. var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
  18426. factory.isPathValid = isPathValid;
  18427. factory.default = factory;
  18428. module2.exports = factory;
  18429. if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
  18430. const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
  18431. checkPath.convert = makePosix;
  18432. const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
  18433. checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
  18434. }
  18435. }
  18436. });
  18437. var require_get_file_content_or_null = __commonJS2({
  18438. "src/utils/get-file-content-or-null.js"(exports2, module2) {
  18439. "use strict";
  18440. var fs = require("fs");
  18441. var fsAsync = fs.promises;
  18442. async function getFileContentOrNull(filename) {
  18443. try {
  18444. return await fsAsync.readFile(filename, "utf8");
  18445. } catch (error) {
  18446. return handleError(filename, error);
  18447. }
  18448. }
  18449. getFileContentOrNull.sync = function(filename) {
  18450. try {
  18451. return fs.readFileSync(filename, "utf8");
  18452. } catch (error) {
  18453. return handleError(filename, error);
  18454. }
  18455. };
  18456. function handleError(filename, error) {
  18457. if (error && error.code === "ENOENT") {
  18458. return null;
  18459. }
  18460. throw new Error(`Unable to read ${filename}: ${error.message}`);
  18461. }
  18462. module2.exports = getFileContentOrNull;
  18463. }
  18464. });
  18465. var require_create_ignorer = __commonJS2({
  18466. "src/common/create-ignorer.js"(exports2, module2) {
  18467. "use strict";
  18468. var path = require("path");
  18469. var ignore = require_ignore().default;
  18470. var getFileContentOrNull = require_get_file_content_or_null();
  18471. async function createIgnorer(ignorePath, withNodeModules) {
  18472. const ignoreContent = ignorePath ? await getFileContentOrNull(path.resolve(ignorePath)) : null;
  18473. return _createIgnorer(ignoreContent, withNodeModules);
  18474. }
  18475. createIgnorer.sync = function(ignorePath, withNodeModules) {
  18476. const ignoreContent = !ignorePath ? null : getFileContentOrNull.sync(path.resolve(ignorePath));
  18477. return _createIgnorer(ignoreContent, withNodeModules);
  18478. };
  18479. function _createIgnorer(ignoreContent, withNodeModules) {
  18480. const ignorer = ignore({
  18481. allowRelativePaths: true
  18482. }).add(ignoreContent || "");
  18483. if (!withNodeModules) {
  18484. ignorer.add("node_modules");
  18485. }
  18486. return ignorer;
  18487. }
  18488. module2.exports = createIgnorer;
  18489. }
  18490. });
  18491. var require_get_file_info = __commonJS2({
  18492. "src/common/get-file-info.js"(exports2, module2) {
  18493. "use strict";
  18494. var path = require("path");
  18495. var options = require_options();
  18496. var config2 = require_resolve_config();
  18497. var createIgnorer = require_create_ignorer();
  18498. async function getFileInfo2(filePath, opts) {
  18499. if (typeof filePath !== "string") {
  18500. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18501. }
  18502. const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
  18503. return _getFileInfo({
  18504. ignorer,
  18505. filePath,
  18506. plugins: opts.plugins,
  18507. resolveConfig: opts.resolveConfig,
  18508. ignorePath: opts.ignorePath,
  18509. sync: false
  18510. });
  18511. }
  18512. getFileInfo2.sync = function(filePath, opts) {
  18513. if (typeof filePath !== "string") {
  18514. throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
  18515. }
  18516. const ignorer = createIgnorer.sync(opts.ignorePath, opts.withNodeModules);
  18517. return _getFileInfo({
  18518. ignorer,
  18519. filePath,
  18520. plugins: opts.plugins,
  18521. resolveConfig: opts.resolveConfig,
  18522. ignorePath: opts.ignorePath,
  18523. sync: true
  18524. });
  18525. };
  18526. function getFileParser(resolvedConfig, filePath, plugins2) {
  18527. if (resolvedConfig && resolvedConfig.parser) {
  18528. return resolvedConfig.parser;
  18529. }
  18530. const inferredParser = options.inferParser(filePath, plugins2);
  18531. if (inferredParser) {
  18532. return inferredParser;
  18533. }
  18534. return null;
  18535. }
  18536. function _getFileInfo({
  18537. ignorer,
  18538. filePath,
  18539. plugins: plugins2,
  18540. resolveConfig = false,
  18541. ignorePath,
  18542. sync = false
  18543. }) {
  18544. const normalizedFilePath = normalizeFilePath(filePath, ignorePath);
  18545. const fileInfo = {
  18546. ignored: ignorer.ignores(normalizedFilePath),
  18547. inferredParser: null
  18548. };
  18549. if (fileInfo.ignored) {
  18550. return fileInfo;
  18551. }
  18552. let resolvedConfig;
  18553. if (resolveConfig) {
  18554. if (sync) {
  18555. resolvedConfig = config2.resolveConfig.sync(filePath);
  18556. } else {
  18557. return config2.resolveConfig(filePath).then((resolvedConfig2) => {
  18558. fileInfo.inferredParser = getFileParser(resolvedConfig2, filePath, plugins2);
  18559. return fileInfo;
  18560. });
  18561. }
  18562. }
  18563. fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins2);
  18564. return fileInfo;
  18565. }
  18566. function normalizeFilePath(filePath, ignorePath) {
  18567. return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
  18568. }
  18569. module2.exports = getFileInfo2;
  18570. }
  18571. });
  18572. var require_util_shared = __commonJS2({
  18573. "src/common/util-shared.js"(exports2, module2) {
  18574. "use strict";
  18575. var {
  18576. getMaxContinuousCount,
  18577. getStringWidth,
  18578. getAlignmentSize,
  18579. getIndentSize,
  18580. skip,
  18581. skipWhitespace,
  18582. skipSpaces,
  18583. skipNewline,
  18584. skipToLineEnd,
  18585. skipEverythingButNewLine,
  18586. skipInlineComment,
  18587. skipTrailingComment,
  18588. hasNewline,
  18589. hasNewlineInRange,
  18590. hasSpaces,
  18591. isNextLineEmpty,
  18592. isNextLineEmptyAfterIndex,
  18593. isPreviousLineEmpty,
  18594. getNextNonSpaceNonCommentCharacterIndex,
  18595. makeString,
  18596. addLeadingComment,
  18597. addDanglingComment,
  18598. addTrailingComment
  18599. } = require_util();
  18600. module2.exports = {
  18601. getMaxContinuousCount,
  18602. getStringWidth,
  18603. getAlignmentSize,
  18604. getIndentSize,
  18605. skip,
  18606. skipWhitespace,
  18607. skipSpaces,
  18608. skipNewline,
  18609. skipToLineEnd,
  18610. skipEverythingButNewLine,
  18611. skipInlineComment,
  18612. skipTrailingComment,
  18613. hasNewline,
  18614. hasNewlineInRange,
  18615. hasSpaces,
  18616. isNextLineEmpty,
  18617. isNextLineEmptyAfterIndex,
  18618. isPreviousLineEmpty,
  18619. getNextNonSpaceNonCommentCharacterIndex,
  18620. makeString,
  18621. addLeadingComment,
  18622. addDanglingComment,
  18623. addTrailingComment
  18624. };
  18625. }
  18626. });
  18627. var require_array3 = __commonJS2({
  18628. "node_modules/fast-glob/out/utils/array.js"(exports2) {
  18629. "use strict";
  18630. Object.defineProperty(exports2, "__esModule", {
  18631. value: true
  18632. });
  18633. exports2.splitWhen = exports2.flatten = void 0;
  18634. function flatten(items) {
  18635. return items.reduce((collection, item) => [].concat(collection, item), []);
  18636. }
  18637. exports2.flatten = flatten;
  18638. function splitWhen(items, predicate) {
  18639. const result = [[]];
  18640. let groupIndex = 0;
  18641. for (const item of items) {
  18642. if (predicate(item)) {
  18643. groupIndex++;
  18644. result[groupIndex] = [];
  18645. } else {
  18646. result[groupIndex].push(item);
  18647. }
  18648. }
  18649. return result;
  18650. }
  18651. exports2.splitWhen = splitWhen;
  18652. }
  18653. });
  18654. var require_errno = __commonJS2({
  18655. "node_modules/fast-glob/out/utils/errno.js"(exports2) {
  18656. "use strict";
  18657. Object.defineProperty(exports2, "__esModule", {
  18658. value: true
  18659. });
  18660. exports2.isEnoentCodeError = void 0;
  18661. function isEnoentCodeError(error) {
  18662. return error.code === "ENOENT";
  18663. }
  18664. exports2.isEnoentCodeError = isEnoentCodeError;
  18665. }
  18666. });
  18667. var require_fs = __commonJS2({
  18668. "node_modules/fast-glob/out/utils/fs.js"(exports2) {
  18669. "use strict";
  18670. Object.defineProperty(exports2, "__esModule", {
  18671. value: true
  18672. });
  18673. exports2.createDirentFromStats = void 0;
  18674. var DirentFromStats = class {
  18675. constructor(name, stats) {
  18676. this.name = name;
  18677. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  18678. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  18679. this.isDirectory = stats.isDirectory.bind(stats);
  18680. this.isFIFO = stats.isFIFO.bind(stats);
  18681. this.isFile = stats.isFile.bind(stats);
  18682. this.isSocket = stats.isSocket.bind(stats);
  18683. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  18684. }
  18685. };
  18686. function createDirentFromStats(name, stats) {
  18687. return new DirentFromStats(name, stats);
  18688. }
  18689. exports2.createDirentFromStats = createDirentFromStats;
  18690. }
  18691. });
  18692. var require_path = __commonJS2({
  18693. "node_modules/fast-glob/out/utils/path.js"(exports2) {
  18694. "use strict";
  18695. Object.defineProperty(exports2, "__esModule", {
  18696. value: true
  18697. });
  18698. exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
  18699. var path = require("path");
  18700. var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
  18701. var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
  18702. function unixify(filepath) {
  18703. return filepath.replace(/\\/g, "/");
  18704. }
  18705. exports2.unixify = unixify;
  18706. function makeAbsolute(cwd, filepath) {
  18707. return path.resolve(cwd, filepath);
  18708. }
  18709. exports2.makeAbsolute = makeAbsolute;
  18710. function escape(pattern) {
  18711. return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
  18712. }
  18713. exports2.escape = escape;
  18714. function removeLeadingDotSegment(entry) {
  18715. if (entry.charAt(0) === ".") {
  18716. const secondCharactery = entry.charAt(1);
  18717. if (secondCharactery === "/" || secondCharactery === "\\") {
  18718. return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
  18719. }
  18720. }
  18721. return entry;
  18722. }
  18723. exports2.removeLeadingDotSegment = removeLeadingDotSegment;
  18724. }
  18725. });
  18726. var require_is_extglob = __commonJS2({
  18727. "node_modules/is-extglob/index.js"(exports2, module2) {
  18728. module2.exports = function isExtglob(str) {
  18729. if (typeof str !== "string" || str === "") {
  18730. return false;
  18731. }
  18732. var match;
  18733. while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
  18734. if (match[2])
  18735. return true;
  18736. str = str.slice(match.index + match[0].length);
  18737. }
  18738. return false;
  18739. };
  18740. }
  18741. });
  18742. var require_is_glob = __commonJS2({
  18743. "node_modules/is-glob/index.js"(exports2, module2) {
  18744. var isExtglob = require_is_extglob();
  18745. var chars = {
  18746. "{": "}",
  18747. "(": ")",
  18748. "[": "]"
  18749. };
  18750. var strictCheck = function(str) {
  18751. if (str[0] === "!") {
  18752. return true;
  18753. }
  18754. var index = 0;
  18755. var pipeIndex = -2;
  18756. var closeSquareIndex = -2;
  18757. var closeCurlyIndex = -2;
  18758. var closeParenIndex = -2;
  18759. var backSlashIndex = -2;
  18760. while (index < str.length) {
  18761. if (str[index] === "*") {
  18762. return true;
  18763. }
  18764. if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
  18765. return true;
  18766. }
  18767. if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
  18768. if (closeSquareIndex < index) {
  18769. closeSquareIndex = str.indexOf("]", index);
  18770. }
  18771. if (closeSquareIndex > index) {
  18772. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18773. return true;
  18774. }
  18775. backSlashIndex = str.indexOf("\\", index);
  18776. if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
  18777. return true;
  18778. }
  18779. }
  18780. }
  18781. if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
  18782. closeCurlyIndex = str.indexOf("}", index);
  18783. if (closeCurlyIndex > index) {
  18784. backSlashIndex = str.indexOf("\\", index);
  18785. if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
  18786. return true;
  18787. }
  18788. }
  18789. }
  18790. if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
  18791. closeParenIndex = str.indexOf(")", index);
  18792. if (closeParenIndex > index) {
  18793. backSlashIndex = str.indexOf("\\", index);
  18794. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  18795. return true;
  18796. }
  18797. }
  18798. }
  18799. if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
  18800. if (pipeIndex < index) {
  18801. pipeIndex = str.indexOf("|", index);
  18802. }
  18803. if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
  18804. closeParenIndex = str.indexOf(")", pipeIndex);
  18805. if (closeParenIndex > pipeIndex) {
  18806. backSlashIndex = str.indexOf("\\", pipeIndex);
  18807. if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
  18808. return true;
  18809. }
  18810. }
  18811. }
  18812. }
  18813. if (str[index] === "\\") {
  18814. var open = str[index + 1];
  18815. index += 2;
  18816. var close = chars[open];
  18817. if (close) {
  18818. var n = str.indexOf(close, index);
  18819. if (n !== -1) {
  18820. index = n + 1;
  18821. }
  18822. }
  18823. if (str[index] === "!") {
  18824. return true;
  18825. }
  18826. } else {
  18827. index++;
  18828. }
  18829. }
  18830. return false;
  18831. };
  18832. var relaxedCheck = function(str) {
  18833. if (str[0] === "!") {
  18834. return true;
  18835. }
  18836. var index = 0;
  18837. while (index < str.length) {
  18838. if (/[*?{}()[\]]/.test(str[index])) {
  18839. return true;
  18840. }
  18841. if (str[index] === "\\") {
  18842. var open = str[index + 1];
  18843. index += 2;
  18844. var close = chars[open];
  18845. if (close) {
  18846. var n = str.indexOf(close, index);
  18847. if (n !== -1) {
  18848. index = n + 1;
  18849. }
  18850. }
  18851. if (str[index] === "!") {
  18852. return true;
  18853. }
  18854. } else {
  18855. index++;
  18856. }
  18857. }
  18858. return false;
  18859. };
  18860. module2.exports = function isGlob(str, options) {
  18861. if (typeof str !== "string" || str === "") {
  18862. return false;
  18863. }
  18864. if (isExtglob(str)) {
  18865. return true;
  18866. }
  18867. var check = strictCheck;
  18868. if (options && options.strict === false) {
  18869. check = relaxedCheck;
  18870. }
  18871. return check(str);
  18872. };
  18873. }
  18874. });
  18875. var require_glob_parent = __commonJS2({
  18876. "node_modules/glob-parent/index.js"(exports2, module2) {
  18877. "use strict";
  18878. var isGlob = require_is_glob();
  18879. var pathPosixDirname = require("path").posix.dirname;
  18880. var isWin32 = require("os").platform() === "win32";
  18881. var slash = "/";
  18882. var backslash = /\\/g;
  18883. var enclosure = /[\{\[].*[\}\]]$/;
  18884. var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
  18885. var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
  18886. module2.exports = function globParent(str, opts) {
  18887. var options = Object.assign({
  18888. flipBackslashes: true
  18889. }, opts);
  18890. if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
  18891. str = str.replace(backslash, slash);
  18892. }
  18893. if (enclosure.test(str)) {
  18894. str += slash;
  18895. }
  18896. str += "a";
  18897. do {
  18898. str = pathPosixDirname(str);
  18899. } while (isGlob(str) || globby.test(str));
  18900. return str.replace(escaped, "$1");
  18901. };
  18902. }
  18903. });
  18904. var require_pattern = __commonJS2({
  18905. "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
  18906. "use strict";
  18907. Object.defineProperty(exports2, "__esModule", {
  18908. value: true
  18909. });
  18910. exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
  18911. var path = require("path");
  18912. var globParent = require_glob_parent();
  18913. var micromatch = require_micromatch();
  18914. var GLOBSTAR = "**";
  18915. var ESCAPE_SYMBOL = "\\";
  18916. var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
  18917. var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
  18918. var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
  18919. var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
  18920. var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
  18921. function isStaticPattern(pattern, options = {}) {
  18922. return !isDynamicPattern(pattern, options);
  18923. }
  18924. exports2.isStaticPattern = isStaticPattern;
  18925. function isDynamicPattern(pattern, options = {}) {
  18926. if (pattern === "") {
  18927. return false;
  18928. }
  18929. if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
  18930. return true;
  18931. }
  18932. if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
  18933. return true;
  18934. }
  18935. if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
  18936. return true;
  18937. }
  18938. if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
  18939. return true;
  18940. }
  18941. return false;
  18942. }
  18943. exports2.isDynamicPattern = isDynamicPattern;
  18944. function hasBraceExpansion(pattern) {
  18945. const openingBraceIndex = pattern.indexOf("{");
  18946. if (openingBraceIndex === -1) {
  18947. return false;
  18948. }
  18949. const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
  18950. if (closingBraceIndex === -1) {
  18951. return false;
  18952. }
  18953. const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
  18954. return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
  18955. }
  18956. function convertToPositivePattern(pattern) {
  18957. return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
  18958. }
  18959. exports2.convertToPositivePattern = convertToPositivePattern;
  18960. function convertToNegativePattern(pattern) {
  18961. return "!" + pattern;
  18962. }
  18963. exports2.convertToNegativePattern = convertToNegativePattern;
  18964. function isNegativePattern(pattern) {
  18965. return pattern.startsWith("!") && pattern[1] !== "(";
  18966. }
  18967. exports2.isNegativePattern = isNegativePattern;
  18968. function isPositivePattern(pattern) {
  18969. return !isNegativePattern(pattern);
  18970. }
  18971. exports2.isPositivePattern = isPositivePattern;
  18972. function getNegativePatterns(patterns) {
  18973. return patterns.filter(isNegativePattern);
  18974. }
  18975. exports2.getNegativePatterns = getNegativePatterns;
  18976. function getPositivePatterns(patterns) {
  18977. return patterns.filter(isPositivePattern);
  18978. }
  18979. exports2.getPositivePatterns = getPositivePatterns;
  18980. function getPatternsInsideCurrentDirectory(patterns) {
  18981. return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
  18982. }
  18983. exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
  18984. function getPatternsOutsideCurrentDirectory(patterns) {
  18985. return patterns.filter(isPatternRelatedToParentDirectory);
  18986. }
  18987. exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
  18988. function isPatternRelatedToParentDirectory(pattern) {
  18989. return pattern.startsWith("..") || pattern.startsWith("./..");
  18990. }
  18991. exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
  18992. function getBaseDirectory(pattern) {
  18993. return globParent(pattern, {
  18994. flipBackslashes: false
  18995. });
  18996. }
  18997. exports2.getBaseDirectory = getBaseDirectory;
  18998. function hasGlobStar(pattern) {
  18999. return pattern.includes(GLOBSTAR);
  19000. }
  19001. exports2.hasGlobStar = hasGlobStar;
  19002. function endsWithSlashGlobStar(pattern) {
  19003. return pattern.endsWith("/" + GLOBSTAR);
  19004. }
  19005. exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
  19006. function isAffectDepthOfReadingPattern(pattern) {
  19007. const basename = path.basename(pattern);
  19008. return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
  19009. }
  19010. exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
  19011. function expandPatternsWithBraceExpansion(patterns) {
  19012. return patterns.reduce((collection, pattern) => {
  19013. return collection.concat(expandBraceExpansion(pattern));
  19014. }, []);
  19015. }
  19016. exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
  19017. function expandBraceExpansion(pattern) {
  19018. return micromatch.braces(pattern, {
  19019. expand: true,
  19020. nodupes: true
  19021. });
  19022. }
  19023. exports2.expandBraceExpansion = expandBraceExpansion;
  19024. function getPatternParts(pattern, options) {
  19025. let {
  19026. parts
  19027. } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
  19028. parts: true
  19029. }));
  19030. if (parts.length === 0) {
  19031. parts = [pattern];
  19032. }
  19033. if (parts[0].startsWith("/")) {
  19034. parts[0] = parts[0].slice(1);
  19035. parts.unshift("");
  19036. }
  19037. return parts;
  19038. }
  19039. exports2.getPatternParts = getPatternParts;
  19040. function makeRe(pattern, options) {
  19041. return micromatch.makeRe(pattern, options);
  19042. }
  19043. exports2.makeRe = makeRe;
  19044. function convertPatternsToRe(patterns, options) {
  19045. return patterns.map((pattern) => makeRe(pattern, options));
  19046. }
  19047. exports2.convertPatternsToRe = convertPatternsToRe;
  19048. function matchAny(entry, patternsRe) {
  19049. return patternsRe.some((patternRe) => patternRe.test(entry));
  19050. }
  19051. exports2.matchAny = matchAny;
  19052. }
  19053. });
  19054. var require_merge2 = __commonJS2({
  19055. "node_modules/merge2/index.js"(exports2, module2) {
  19056. "use strict";
  19057. var Stream = require("stream");
  19058. var PassThrough = Stream.PassThrough;
  19059. var slice = Array.prototype.slice;
  19060. module2.exports = merge2;
  19061. function merge2() {
  19062. const streamsQueue = [];
  19063. const args = slice.call(arguments);
  19064. let merging = false;
  19065. let options = args[args.length - 1];
  19066. if (options && !Array.isArray(options) && options.pipe == null) {
  19067. args.pop();
  19068. } else {
  19069. options = {};
  19070. }
  19071. const doEnd = options.end !== false;
  19072. const doPipeError = options.pipeError === true;
  19073. if (options.objectMode == null) {
  19074. options.objectMode = true;
  19075. }
  19076. if (options.highWaterMark == null) {
  19077. options.highWaterMark = 64 * 1024;
  19078. }
  19079. const mergedStream = PassThrough(options);
  19080. function addStream() {
  19081. for (let i = 0, len = arguments.length; i < len; i++) {
  19082. streamsQueue.push(pauseStreams(arguments[i], options));
  19083. }
  19084. mergeStream();
  19085. return this;
  19086. }
  19087. function mergeStream() {
  19088. if (merging) {
  19089. return;
  19090. }
  19091. merging = true;
  19092. let streams = streamsQueue.shift();
  19093. if (!streams) {
  19094. process.nextTick(endStream);
  19095. return;
  19096. }
  19097. if (!Array.isArray(streams)) {
  19098. streams = [streams];
  19099. }
  19100. let pipesCount = streams.length + 1;
  19101. function next() {
  19102. if (--pipesCount > 0) {
  19103. return;
  19104. }
  19105. merging = false;
  19106. mergeStream();
  19107. }
  19108. function pipe(stream) {
  19109. function onend() {
  19110. stream.removeListener("merge2UnpipeEnd", onend);
  19111. stream.removeListener("end", onend);
  19112. if (doPipeError) {
  19113. stream.removeListener("error", onerror);
  19114. }
  19115. next();
  19116. }
  19117. function onerror(err) {
  19118. mergedStream.emit("error", err);
  19119. }
  19120. if (stream._readableState.endEmitted) {
  19121. return next();
  19122. }
  19123. stream.on("merge2UnpipeEnd", onend);
  19124. stream.on("end", onend);
  19125. if (doPipeError) {
  19126. stream.on("error", onerror);
  19127. }
  19128. stream.pipe(mergedStream, {
  19129. end: false
  19130. });
  19131. stream.resume();
  19132. }
  19133. for (let i = 0; i < streams.length; i++) {
  19134. pipe(streams[i]);
  19135. }
  19136. next();
  19137. }
  19138. function endStream() {
  19139. merging = false;
  19140. mergedStream.emit("queueDrain");
  19141. if (doEnd) {
  19142. mergedStream.end();
  19143. }
  19144. }
  19145. mergedStream.setMaxListeners(0);
  19146. mergedStream.add = addStream;
  19147. mergedStream.on("unpipe", function(stream) {
  19148. stream.emit("merge2UnpipeEnd");
  19149. });
  19150. if (args.length) {
  19151. addStream.apply(null, args);
  19152. }
  19153. return mergedStream;
  19154. }
  19155. function pauseStreams(streams, options) {
  19156. if (!Array.isArray(streams)) {
  19157. if (!streams._readableState && streams.pipe) {
  19158. streams = streams.pipe(PassThrough(options));
  19159. }
  19160. if (!streams._readableState || !streams.pause || !streams.pipe) {
  19161. throw new Error("Only readable stream can be merged.");
  19162. }
  19163. streams.pause();
  19164. } else {
  19165. for (let i = 0, len = streams.length; i < len; i++) {
  19166. streams[i] = pauseStreams(streams[i], options);
  19167. }
  19168. }
  19169. return streams;
  19170. }
  19171. }
  19172. });
  19173. var require_stream = __commonJS2({
  19174. "node_modules/fast-glob/out/utils/stream.js"(exports2) {
  19175. "use strict";
  19176. Object.defineProperty(exports2, "__esModule", {
  19177. value: true
  19178. });
  19179. exports2.merge = void 0;
  19180. var merge2 = require_merge2();
  19181. function merge(streams) {
  19182. const mergedStream = merge2(streams);
  19183. streams.forEach((stream) => {
  19184. stream.once("error", (error) => mergedStream.emit("error", error));
  19185. });
  19186. mergedStream.once("close", () => propagateCloseEventToSources(streams));
  19187. mergedStream.once("end", () => propagateCloseEventToSources(streams));
  19188. return mergedStream;
  19189. }
  19190. exports2.merge = merge;
  19191. function propagateCloseEventToSources(streams) {
  19192. streams.forEach((stream) => stream.emit("close"));
  19193. }
  19194. }
  19195. });
  19196. var require_string2 = __commonJS2({
  19197. "node_modules/fast-glob/out/utils/string.js"(exports2) {
  19198. "use strict";
  19199. Object.defineProperty(exports2, "__esModule", {
  19200. value: true
  19201. });
  19202. exports2.isEmpty = exports2.isString = void 0;
  19203. function isString(input) {
  19204. return typeof input === "string";
  19205. }
  19206. exports2.isString = isString;
  19207. function isEmpty(input) {
  19208. return input === "";
  19209. }
  19210. exports2.isEmpty = isEmpty;
  19211. }
  19212. });
  19213. var require_utils4 = __commonJS2({
  19214. "node_modules/fast-glob/out/utils/index.js"(exports2) {
  19215. "use strict";
  19216. Object.defineProperty(exports2, "__esModule", {
  19217. value: true
  19218. });
  19219. exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
  19220. var array = require_array3();
  19221. exports2.array = array;
  19222. var errno = require_errno();
  19223. exports2.errno = errno;
  19224. var fs = require_fs();
  19225. exports2.fs = fs;
  19226. var path = require_path();
  19227. exports2.path = path;
  19228. var pattern = require_pattern();
  19229. exports2.pattern = pattern;
  19230. var stream = require_stream();
  19231. exports2.stream = stream;
  19232. var string = require_string2();
  19233. exports2.string = string;
  19234. }
  19235. });
  19236. var require_tasks = __commonJS2({
  19237. "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
  19238. "use strict";
  19239. Object.defineProperty(exports2, "__esModule", {
  19240. value: true
  19241. });
  19242. exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
  19243. var utils = require_utils4();
  19244. function generate(patterns, settings) {
  19245. const positivePatterns = getPositivePatterns(patterns);
  19246. const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
  19247. const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
  19248. const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
  19249. const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
  19250. const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
  19251. return staticTasks.concat(dynamicTasks);
  19252. }
  19253. exports2.generate = generate;
  19254. function convertPatternsToTasks(positive, negative, dynamic) {
  19255. const tasks = [];
  19256. const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
  19257. const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
  19258. const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
  19259. const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
  19260. tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
  19261. if ("." in insideCurrentDirectoryGroup) {
  19262. tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
  19263. } else {
  19264. tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
  19265. }
  19266. return tasks;
  19267. }
  19268. exports2.convertPatternsToTasks = convertPatternsToTasks;
  19269. function getPositivePatterns(patterns) {
  19270. return utils.pattern.getPositivePatterns(patterns);
  19271. }
  19272. exports2.getPositivePatterns = getPositivePatterns;
  19273. function getNegativePatternsAsPositive(patterns, ignore) {
  19274. const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
  19275. const positive = negative.map(utils.pattern.convertToPositivePattern);
  19276. return positive;
  19277. }
  19278. exports2.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
  19279. function groupPatternsByBaseDirectory(patterns) {
  19280. const group = {};
  19281. return patterns.reduce((collection, pattern) => {
  19282. const base = utils.pattern.getBaseDirectory(pattern);
  19283. if (base in collection) {
  19284. collection[base].push(pattern);
  19285. } else {
  19286. collection[base] = [pattern];
  19287. }
  19288. return collection;
  19289. }, group);
  19290. }
  19291. exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
  19292. function convertPatternGroupsToTasks(positive, negative, dynamic) {
  19293. return Object.keys(positive).map((base) => {
  19294. return convertPatternGroupToTask(base, positive[base], negative, dynamic);
  19295. });
  19296. }
  19297. exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
  19298. function convertPatternGroupToTask(base, positive, negative, dynamic) {
  19299. return {
  19300. dynamic,
  19301. positive,
  19302. negative,
  19303. base,
  19304. patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
  19305. };
  19306. }
  19307. exports2.convertPatternGroupToTask = convertPatternGroupToTask;
  19308. }
  19309. });
  19310. var require_patterns = __commonJS2({
  19311. "node_modules/fast-glob/out/managers/patterns.js"(exports2) {
  19312. "use strict";
  19313. Object.defineProperty(exports2, "__esModule", {
  19314. value: true
  19315. });
  19316. exports2.removeDuplicateSlashes = exports2.transform = void 0;
  19317. var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
  19318. function transform(patterns) {
  19319. return patterns.map((pattern) => removeDuplicateSlashes(pattern));
  19320. }
  19321. exports2.transform = transform;
  19322. function removeDuplicateSlashes(pattern) {
  19323. return pattern.replace(DOUBLE_SLASH_RE, "/");
  19324. }
  19325. exports2.removeDuplicateSlashes = removeDuplicateSlashes;
  19326. }
  19327. });
  19328. var require_async2 = __commonJS2({
  19329. "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
  19330. "use strict";
  19331. Object.defineProperty(exports2, "__esModule", {
  19332. value: true
  19333. });
  19334. exports2.read = void 0;
  19335. function read(path, settings, callback) {
  19336. settings.fs.lstat(path, (lstatError, lstat) => {
  19337. if (lstatError !== null) {
  19338. callFailureCallback(callback, lstatError);
  19339. return;
  19340. }
  19341. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19342. callSuccessCallback(callback, lstat);
  19343. return;
  19344. }
  19345. settings.fs.stat(path, (statError, stat) => {
  19346. if (statError !== null) {
  19347. if (settings.throwErrorOnBrokenSymbolicLink) {
  19348. callFailureCallback(callback, statError);
  19349. return;
  19350. }
  19351. callSuccessCallback(callback, lstat);
  19352. return;
  19353. }
  19354. if (settings.markSymbolicLink) {
  19355. stat.isSymbolicLink = () => true;
  19356. }
  19357. callSuccessCallback(callback, stat);
  19358. });
  19359. });
  19360. }
  19361. exports2.read = read;
  19362. function callFailureCallback(callback, error) {
  19363. callback(error);
  19364. }
  19365. function callSuccessCallback(callback, result) {
  19366. callback(null, result);
  19367. }
  19368. }
  19369. });
  19370. var require_sync2 = __commonJS2({
  19371. "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
  19372. "use strict";
  19373. Object.defineProperty(exports2, "__esModule", {
  19374. value: true
  19375. });
  19376. exports2.read = void 0;
  19377. function read(path, settings) {
  19378. const lstat = settings.fs.lstatSync(path);
  19379. if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
  19380. return lstat;
  19381. }
  19382. try {
  19383. const stat = settings.fs.statSync(path);
  19384. if (settings.markSymbolicLink) {
  19385. stat.isSymbolicLink = () => true;
  19386. }
  19387. return stat;
  19388. } catch (error) {
  19389. if (!settings.throwErrorOnBrokenSymbolicLink) {
  19390. return lstat;
  19391. }
  19392. throw error;
  19393. }
  19394. }
  19395. exports2.read = read;
  19396. }
  19397. });
  19398. var require_fs2 = __commonJS2({
  19399. "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
  19400. "use strict";
  19401. Object.defineProperty(exports2, "__esModule", {
  19402. value: true
  19403. });
  19404. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19405. var fs = require("fs");
  19406. exports2.FILE_SYSTEM_ADAPTER = {
  19407. lstat: fs.lstat,
  19408. stat: fs.stat,
  19409. lstatSync: fs.lstatSync,
  19410. statSync: fs.statSync
  19411. };
  19412. function createFileSystemAdapter(fsMethods) {
  19413. if (fsMethods === void 0) {
  19414. return exports2.FILE_SYSTEM_ADAPTER;
  19415. }
  19416. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  19417. }
  19418. exports2.createFileSystemAdapter = createFileSystemAdapter;
  19419. }
  19420. });
  19421. var require_settings = __commonJS2({
  19422. "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
  19423. "use strict";
  19424. Object.defineProperty(exports2, "__esModule", {
  19425. value: true
  19426. });
  19427. var fs = require_fs2();
  19428. var Settings = class {
  19429. constructor(_options = {}) {
  19430. this._options = _options;
  19431. this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
  19432. this.fs = fs.createFileSystemAdapter(this._options.fs);
  19433. this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
  19434. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  19435. }
  19436. _getValue(option, value) {
  19437. return option !== null && option !== void 0 ? option : value;
  19438. }
  19439. };
  19440. exports2.default = Settings;
  19441. }
  19442. });
  19443. var require_out = __commonJS2({
  19444. "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
  19445. "use strict";
  19446. Object.defineProperty(exports2, "__esModule", {
  19447. value: true
  19448. });
  19449. exports2.statSync = exports2.stat = exports2.Settings = void 0;
  19450. var async = require_async2();
  19451. var sync = require_sync2();
  19452. var settings_1 = require_settings();
  19453. exports2.Settings = settings_1.default;
  19454. function stat(path, optionsOrSettingsOrCallback, callback) {
  19455. if (typeof optionsOrSettingsOrCallback === "function") {
  19456. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  19457. return;
  19458. }
  19459. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  19460. }
  19461. exports2.stat = stat;
  19462. function statSync(path, optionsOrSettings) {
  19463. const settings = getSettings(optionsOrSettings);
  19464. return sync.read(path, settings);
  19465. }
  19466. exports2.statSync = statSync;
  19467. function getSettings(settingsOrOptions = {}) {
  19468. if (settingsOrOptions instanceof settings_1.default) {
  19469. return settingsOrOptions;
  19470. }
  19471. return new settings_1.default(settingsOrOptions);
  19472. }
  19473. }
  19474. });
  19475. var require_queue_microtask = __commonJS2({
  19476. "node_modules/queue-microtask/index.js"(exports2, module2) {
  19477. var promise;
  19478. module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
  19479. throw err;
  19480. }, 0));
  19481. }
  19482. });
  19483. var require_run_parallel = __commonJS2({
  19484. "node_modules/run-parallel/index.js"(exports2, module2) {
  19485. module2.exports = runParallel;
  19486. var queueMicrotask2 = require_queue_microtask();
  19487. function runParallel(tasks, cb) {
  19488. let results, pending, keys;
  19489. let isSync = true;
  19490. if (Array.isArray(tasks)) {
  19491. results = [];
  19492. pending = tasks.length;
  19493. } else {
  19494. keys = Object.keys(tasks);
  19495. results = {};
  19496. pending = keys.length;
  19497. }
  19498. function done(err) {
  19499. function end() {
  19500. if (cb)
  19501. cb(err, results);
  19502. cb = null;
  19503. }
  19504. if (isSync)
  19505. queueMicrotask2(end);
  19506. else
  19507. end();
  19508. }
  19509. function each(i, err, result) {
  19510. results[i] = result;
  19511. if (--pending === 0 || err) {
  19512. done(err);
  19513. }
  19514. }
  19515. if (!pending) {
  19516. done(null);
  19517. } else if (keys) {
  19518. keys.forEach(function(key) {
  19519. tasks[key](function(err, result) {
  19520. each(key, err, result);
  19521. });
  19522. });
  19523. } else {
  19524. tasks.forEach(function(task, i) {
  19525. task(function(err, result) {
  19526. each(i, err, result);
  19527. });
  19528. });
  19529. }
  19530. isSync = false;
  19531. }
  19532. }
  19533. });
  19534. var require_constants4 = __commonJS2({
  19535. "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
  19536. "use strict";
  19537. Object.defineProperty(exports2, "__esModule", {
  19538. value: true
  19539. });
  19540. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
  19541. var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
  19542. if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
  19543. throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
  19544. }
  19545. var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
  19546. var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
  19547. var SUPPORTED_MAJOR_VERSION = 10;
  19548. var SUPPORTED_MINOR_VERSION = 10;
  19549. var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
  19550. var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
  19551. exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
  19552. }
  19553. });
  19554. var require_fs3 = __commonJS2({
  19555. "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
  19556. "use strict";
  19557. Object.defineProperty(exports2, "__esModule", {
  19558. value: true
  19559. });
  19560. exports2.createDirentFromStats = void 0;
  19561. var DirentFromStats = class {
  19562. constructor(name, stats) {
  19563. this.name = name;
  19564. this.isBlockDevice = stats.isBlockDevice.bind(stats);
  19565. this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
  19566. this.isDirectory = stats.isDirectory.bind(stats);
  19567. this.isFIFO = stats.isFIFO.bind(stats);
  19568. this.isFile = stats.isFile.bind(stats);
  19569. this.isSocket = stats.isSocket.bind(stats);
  19570. this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
  19571. }
  19572. };
  19573. function createDirentFromStats(name, stats) {
  19574. return new DirentFromStats(name, stats);
  19575. }
  19576. exports2.createDirentFromStats = createDirentFromStats;
  19577. }
  19578. });
  19579. var require_utils5 = __commonJS2({
  19580. "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
  19581. "use strict";
  19582. Object.defineProperty(exports2, "__esModule", {
  19583. value: true
  19584. });
  19585. exports2.fs = void 0;
  19586. var fs = require_fs3();
  19587. exports2.fs = fs;
  19588. }
  19589. });
  19590. var require_common3 = __commonJS2({
  19591. "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
  19592. "use strict";
  19593. Object.defineProperty(exports2, "__esModule", {
  19594. value: true
  19595. });
  19596. exports2.joinPathSegments = void 0;
  19597. function joinPathSegments(a, b, separator) {
  19598. if (a.endsWith(separator)) {
  19599. return a + b;
  19600. }
  19601. return a + separator + b;
  19602. }
  19603. exports2.joinPathSegments = joinPathSegments;
  19604. }
  19605. });
  19606. var require_async3 = __commonJS2({
  19607. "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
  19608. "use strict";
  19609. Object.defineProperty(exports2, "__esModule", {
  19610. value: true
  19611. });
  19612. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19613. var fsStat = require_out();
  19614. var rpl = require_run_parallel();
  19615. var constants_1 = require_constants4();
  19616. var utils = require_utils5();
  19617. var common = require_common3();
  19618. function read(directory, settings, callback) {
  19619. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19620. readdirWithFileTypes(directory, settings, callback);
  19621. return;
  19622. }
  19623. readdir(directory, settings, callback);
  19624. }
  19625. exports2.read = read;
  19626. function readdirWithFileTypes(directory, settings, callback) {
  19627. settings.fs.readdir(directory, {
  19628. withFileTypes: true
  19629. }, (readdirError, dirents) => {
  19630. if (readdirError !== null) {
  19631. callFailureCallback(callback, readdirError);
  19632. return;
  19633. }
  19634. const entries = dirents.map((dirent) => ({
  19635. dirent,
  19636. name: dirent.name,
  19637. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19638. }));
  19639. if (!settings.followSymbolicLinks) {
  19640. callSuccessCallback(callback, entries);
  19641. return;
  19642. }
  19643. const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
  19644. rpl(tasks, (rplError, rplEntries) => {
  19645. if (rplError !== null) {
  19646. callFailureCallback(callback, rplError);
  19647. return;
  19648. }
  19649. callSuccessCallback(callback, rplEntries);
  19650. });
  19651. });
  19652. }
  19653. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19654. function makeRplTaskEntry(entry, settings) {
  19655. return (done) => {
  19656. if (!entry.dirent.isSymbolicLink()) {
  19657. done(null, entry);
  19658. return;
  19659. }
  19660. settings.fs.stat(entry.path, (statError, stats) => {
  19661. if (statError !== null) {
  19662. if (settings.throwErrorOnBrokenSymbolicLink) {
  19663. done(statError);
  19664. return;
  19665. }
  19666. done(null, entry);
  19667. return;
  19668. }
  19669. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19670. done(null, entry);
  19671. });
  19672. };
  19673. }
  19674. function readdir(directory, settings, callback) {
  19675. settings.fs.readdir(directory, (readdirError, names) => {
  19676. if (readdirError !== null) {
  19677. callFailureCallback(callback, readdirError);
  19678. return;
  19679. }
  19680. const tasks = names.map((name) => {
  19681. const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19682. return (done) => {
  19683. fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
  19684. if (error !== null) {
  19685. done(error);
  19686. return;
  19687. }
  19688. const entry = {
  19689. name,
  19690. path,
  19691. dirent: utils.fs.createDirentFromStats(name, stats)
  19692. };
  19693. if (settings.stats) {
  19694. entry.stats = stats;
  19695. }
  19696. done(null, entry);
  19697. });
  19698. };
  19699. });
  19700. rpl(tasks, (rplError, entries) => {
  19701. if (rplError !== null) {
  19702. callFailureCallback(callback, rplError);
  19703. return;
  19704. }
  19705. callSuccessCallback(callback, entries);
  19706. });
  19707. });
  19708. }
  19709. exports2.readdir = readdir;
  19710. function callFailureCallback(callback, error) {
  19711. callback(error);
  19712. }
  19713. function callSuccessCallback(callback, result) {
  19714. callback(null, result);
  19715. }
  19716. }
  19717. });
  19718. var require_sync3 = __commonJS2({
  19719. "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
  19720. "use strict";
  19721. Object.defineProperty(exports2, "__esModule", {
  19722. value: true
  19723. });
  19724. exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
  19725. var fsStat = require_out();
  19726. var constants_1 = require_constants4();
  19727. var utils = require_utils5();
  19728. var common = require_common3();
  19729. function read(directory, settings) {
  19730. if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
  19731. return readdirWithFileTypes(directory, settings);
  19732. }
  19733. return readdir(directory, settings);
  19734. }
  19735. exports2.read = read;
  19736. function readdirWithFileTypes(directory, settings) {
  19737. const dirents = settings.fs.readdirSync(directory, {
  19738. withFileTypes: true
  19739. });
  19740. return dirents.map((dirent) => {
  19741. const entry = {
  19742. dirent,
  19743. name: dirent.name,
  19744. path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
  19745. };
  19746. if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
  19747. try {
  19748. const stats = settings.fs.statSync(entry.path);
  19749. entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
  19750. } catch (error) {
  19751. if (settings.throwErrorOnBrokenSymbolicLink) {
  19752. throw error;
  19753. }
  19754. }
  19755. }
  19756. return entry;
  19757. });
  19758. }
  19759. exports2.readdirWithFileTypes = readdirWithFileTypes;
  19760. function readdir(directory, settings) {
  19761. const names = settings.fs.readdirSync(directory);
  19762. return names.map((name) => {
  19763. const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
  19764. const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
  19765. const entry = {
  19766. name,
  19767. path: entryPath,
  19768. dirent: utils.fs.createDirentFromStats(name, stats)
  19769. };
  19770. if (settings.stats) {
  19771. entry.stats = stats;
  19772. }
  19773. return entry;
  19774. });
  19775. }
  19776. exports2.readdir = readdir;
  19777. }
  19778. });
  19779. var require_fs4 = __commonJS2({
  19780. "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
  19781. "use strict";
  19782. Object.defineProperty(exports2, "__esModule", {
  19783. value: true
  19784. });
  19785. exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
  19786. var fs = require("fs");
  19787. exports2.FILE_SYSTEM_ADAPTER = {
  19788. lstat: fs.lstat,
  19789. stat: fs.stat,
  19790. lstatSync: fs.lstatSync,
  19791. statSync: fs.statSync,
  19792. readdir: fs.readdir,
  19793. readdirSync: fs.readdirSync
  19794. };
  19795. function createFileSystemAdapter(fsMethods) {
  19796. if (fsMethods === void 0) {
  19797. return exports2.FILE_SYSTEM_ADAPTER;
  19798. }
  19799. return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
  19800. }
  19801. exports2.createFileSystemAdapter = createFileSystemAdapter;
  19802. }
  19803. });
  19804. var require_settings2 = __commonJS2({
  19805. "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
  19806. "use strict";
  19807. Object.defineProperty(exports2, "__esModule", {
  19808. value: true
  19809. });
  19810. var path = require("path");
  19811. var fsStat = require_out();
  19812. var fs = require_fs4();
  19813. var Settings = class {
  19814. constructor(_options = {}) {
  19815. this._options = _options;
  19816. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
  19817. this.fs = fs.createFileSystemAdapter(this._options.fs);
  19818. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  19819. this.stats = this._getValue(this._options.stats, false);
  19820. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
  19821. this.fsStatSettings = new fsStat.Settings({
  19822. followSymbolicLink: this.followSymbolicLinks,
  19823. fs: this.fs,
  19824. throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
  19825. });
  19826. }
  19827. _getValue(option, value) {
  19828. return option !== null && option !== void 0 ? option : value;
  19829. }
  19830. };
  19831. exports2.default = Settings;
  19832. }
  19833. });
  19834. var require_out2 = __commonJS2({
  19835. "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
  19836. "use strict";
  19837. Object.defineProperty(exports2, "__esModule", {
  19838. value: true
  19839. });
  19840. exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
  19841. var async = require_async3();
  19842. var sync = require_sync3();
  19843. var settings_1 = require_settings2();
  19844. exports2.Settings = settings_1.default;
  19845. function scandir(path, optionsOrSettingsOrCallback, callback) {
  19846. if (typeof optionsOrSettingsOrCallback === "function") {
  19847. async.read(path, getSettings(), optionsOrSettingsOrCallback);
  19848. return;
  19849. }
  19850. async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
  19851. }
  19852. exports2.scandir = scandir;
  19853. function scandirSync(path, optionsOrSettings) {
  19854. const settings = getSettings(optionsOrSettings);
  19855. return sync.read(path, settings);
  19856. }
  19857. exports2.scandirSync = scandirSync;
  19858. function getSettings(settingsOrOptions = {}) {
  19859. if (settingsOrOptions instanceof settings_1.default) {
  19860. return settingsOrOptions;
  19861. }
  19862. return new settings_1.default(settingsOrOptions);
  19863. }
  19864. }
  19865. });
  19866. var require_reusify = __commonJS2({
  19867. "node_modules/reusify/reusify.js"(exports2, module2) {
  19868. "use strict";
  19869. function reusify(Constructor) {
  19870. var head = new Constructor();
  19871. var tail = head;
  19872. function get() {
  19873. var current = head;
  19874. if (current.next) {
  19875. head = current.next;
  19876. } else {
  19877. head = new Constructor();
  19878. tail = head;
  19879. }
  19880. current.next = null;
  19881. return current;
  19882. }
  19883. function release(obj) {
  19884. tail.next = obj;
  19885. tail = obj;
  19886. }
  19887. return {
  19888. get,
  19889. release
  19890. };
  19891. }
  19892. module2.exports = reusify;
  19893. }
  19894. });
  19895. var require_queue = __commonJS2({
  19896. "node_modules/fastq/queue.js"(exports2, module2) {
  19897. "use strict";
  19898. var reusify = require_reusify();
  19899. function fastqueue(context, worker, concurrency) {
  19900. if (typeof context === "function") {
  19901. concurrency = worker;
  19902. worker = context;
  19903. context = null;
  19904. }
  19905. if (concurrency < 1) {
  19906. throw new Error("fastqueue concurrency must be greater than 1");
  19907. }
  19908. var cache = reusify(Task);
  19909. var queueHead = null;
  19910. var queueTail = null;
  19911. var _running = 0;
  19912. var errorHandler = null;
  19913. var self2 = {
  19914. push,
  19915. drain: noop,
  19916. saturated: noop,
  19917. pause,
  19918. paused: false,
  19919. concurrency,
  19920. running,
  19921. resume,
  19922. idle,
  19923. length,
  19924. getQueue,
  19925. unshift,
  19926. empty: noop,
  19927. kill,
  19928. killAndDrain,
  19929. error
  19930. };
  19931. return self2;
  19932. function running() {
  19933. return _running;
  19934. }
  19935. function pause() {
  19936. self2.paused = true;
  19937. }
  19938. function length() {
  19939. var current = queueHead;
  19940. var counter = 0;
  19941. while (current) {
  19942. current = current.next;
  19943. counter++;
  19944. }
  19945. return counter;
  19946. }
  19947. function getQueue() {
  19948. var current = queueHead;
  19949. var tasks = [];
  19950. while (current) {
  19951. tasks.push(current.value);
  19952. current = current.next;
  19953. }
  19954. return tasks;
  19955. }
  19956. function resume() {
  19957. if (!self2.paused)
  19958. return;
  19959. self2.paused = false;
  19960. for (var i = 0; i < self2.concurrency; i++) {
  19961. _running++;
  19962. release();
  19963. }
  19964. }
  19965. function idle() {
  19966. return _running === 0 && self2.length() === 0;
  19967. }
  19968. function push(value, done) {
  19969. var current = cache.get();
  19970. current.context = context;
  19971. current.release = release;
  19972. current.value = value;
  19973. current.callback = done || noop;
  19974. current.errorHandler = errorHandler;
  19975. if (_running === self2.concurrency || self2.paused) {
  19976. if (queueTail) {
  19977. queueTail.next = current;
  19978. queueTail = current;
  19979. } else {
  19980. queueHead = current;
  19981. queueTail = current;
  19982. self2.saturated();
  19983. }
  19984. } else {
  19985. _running++;
  19986. worker.call(context, current.value, current.worked);
  19987. }
  19988. }
  19989. function unshift(value, done) {
  19990. var current = cache.get();
  19991. current.context = context;
  19992. current.release = release;
  19993. current.value = value;
  19994. current.callback = done || noop;
  19995. if (_running === self2.concurrency || self2.paused) {
  19996. if (queueHead) {
  19997. current.next = queueHead;
  19998. queueHead = current;
  19999. } else {
  20000. queueHead = current;
  20001. queueTail = current;
  20002. self2.saturated();
  20003. }
  20004. } else {
  20005. _running++;
  20006. worker.call(context, current.value, current.worked);
  20007. }
  20008. }
  20009. function release(holder) {
  20010. if (holder) {
  20011. cache.release(holder);
  20012. }
  20013. var next = queueHead;
  20014. if (next) {
  20015. if (!self2.paused) {
  20016. if (queueTail === queueHead) {
  20017. queueTail = null;
  20018. }
  20019. queueHead = next.next;
  20020. next.next = null;
  20021. worker.call(context, next.value, next.worked);
  20022. if (queueTail === null) {
  20023. self2.empty();
  20024. }
  20025. } else {
  20026. _running--;
  20027. }
  20028. } else if (--_running === 0) {
  20029. self2.drain();
  20030. }
  20031. }
  20032. function kill() {
  20033. queueHead = null;
  20034. queueTail = null;
  20035. self2.drain = noop;
  20036. }
  20037. function killAndDrain() {
  20038. queueHead = null;
  20039. queueTail = null;
  20040. self2.drain();
  20041. self2.drain = noop;
  20042. }
  20043. function error(handler) {
  20044. errorHandler = handler;
  20045. }
  20046. }
  20047. function noop() {
  20048. }
  20049. function Task() {
  20050. this.value = null;
  20051. this.callback = noop;
  20052. this.next = null;
  20053. this.release = noop;
  20054. this.context = null;
  20055. this.errorHandler = null;
  20056. var self2 = this;
  20057. this.worked = function worked(err, result) {
  20058. var callback = self2.callback;
  20059. var errorHandler = self2.errorHandler;
  20060. var val = self2.value;
  20061. self2.value = null;
  20062. self2.callback = noop;
  20063. if (self2.errorHandler) {
  20064. errorHandler(err, val);
  20065. }
  20066. callback.call(self2.context, err, result);
  20067. self2.release(self2);
  20068. };
  20069. }
  20070. function queueAsPromised(context, worker, concurrency) {
  20071. if (typeof context === "function") {
  20072. concurrency = worker;
  20073. worker = context;
  20074. context = null;
  20075. }
  20076. function asyncWrapper(arg, cb) {
  20077. worker.call(this, arg).then(function(res) {
  20078. cb(null, res);
  20079. }, cb);
  20080. }
  20081. var queue = fastqueue(context, asyncWrapper, concurrency);
  20082. var pushCb = queue.push;
  20083. var unshiftCb = queue.unshift;
  20084. queue.push = push;
  20085. queue.unshift = unshift;
  20086. queue.drained = drained;
  20087. return queue;
  20088. function push(value) {
  20089. var p = new Promise(function(resolve, reject) {
  20090. pushCb(value, function(err, result) {
  20091. if (err) {
  20092. reject(err);
  20093. return;
  20094. }
  20095. resolve(result);
  20096. });
  20097. });
  20098. p.catch(noop);
  20099. return p;
  20100. }
  20101. function unshift(value) {
  20102. var p = new Promise(function(resolve, reject) {
  20103. unshiftCb(value, function(err, result) {
  20104. if (err) {
  20105. reject(err);
  20106. return;
  20107. }
  20108. resolve(result);
  20109. });
  20110. });
  20111. p.catch(noop);
  20112. return p;
  20113. }
  20114. function drained() {
  20115. var previousDrain = queue.drain;
  20116. var p = new Promise(function(resolve) {
  20117. queue.drain = function() {
  20118. previousDrain();
  20119. resolve();
  20120. };
  20121. });
  20122. return p;
  20123. }
  20124. }
  20125. module2.exports = fastqueue;
  20126. module2.exports.promise = queueAsPromised;
  20127. }
  20128. });
  20129. var require_common4 = __commonJS2({
  20130. "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
  20131. "use strict";
  20132. Object.defineProperty(exports2, "__esModule", {
  20133. value: true
  20134. });
  20135. exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
  20136. function isFatalError(settings, error) {
  20137. if (settings.errorFilter === null) {
  20138. return true;
  20139. }
  20140. return !settings.errorFilter(error);
  20141. }
  20142. exports2.isFatalError = isFatalError;
  20143. function isAppliedFilter(filter, value) {
  20144. return filter === null || filter(value);
  20145. }
  20146. exports2.isAppliedFilter = isAppliedFilter;
  20147. function replacePathSegmentSeparator(filepath, separator) {
  20148. return filepath.split(/[/\\]/).join(separator);
  20149. }
  20150. exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
  20151. function joinPathSegments(a, b, separator) {
  20152. if (a === "") {
  20153. return b;
  20154. }
  20155. if (a.endsWith(separator)) {
  20156. return a + b;
  20157. }
  20158. return a + separator + b;
  20159. }
  20160. exports2.joinPathSegments = joinPathSegments;
  20161. }
  20162. });
  20163. var require_reader = __commonJS2({
  20164. "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
  20165. "use strict";
  20166. Object.defineProperty(exports2, "__esModule", {
  20167. value: true
  20168. });
  20169. var common = require_common4();
  20170. var Reader = class {
  20171. constructor(_root, _settings) {
  20172. this._root = _root;
  20173. this._settings = _settings;
  20174. this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
  20175. }
  20176. };
  20177. exports2.default = Reader;
  20178. }
  20179. });
  20180. var require_async4 = __commonJS2({
  20181. "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
  20182. "use strict";
  20183. Object.defineProperty(exports2, "__esModule", {
  20184. value: true
  20185. });
  20186. var events_1 = require("events");
  20187. var fsScandir = require_out2();
  20188. var fastq = require_queue();
  20189. var common = require_common4();
  20190. var reader_1 = require_reader();
  20191. var AsyncReader = class extends reader_1.default {
  20192. constructor(_root, _settings) {
  20193. super(_root, _settings);
  20194. this._settings = _settings;
  20195. this._scandir = fsScandir.scandir;
  20196. this._emitter = new events_1.EventEmitter();
  20197. this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
  20198. this._isFatalError = false;
  20199. this._isDestroyed = false;
  20200. this._queue.drain = () => {
  20201. if (!this._isFatalError) {
  20202. this._emitter.emit("end");
  20203. }
  20204. };
  20205. }
  20206. read() {
  20207. this._isFatalError = false;
  20208. this._isDestroyed = false;
  20209. setImmediate(() => {
  20210. this._pushToQueue(this._root, this._settings.basePath);
  20211. });
  20212. return this._emitter;
  20213. }
  20214. get isDestroyed() {
  20215. return this._isDestroyed;
  20216. }
  20217. destroy() {
  20218. if (this._isDestroyed) {
  20219. throw new Error("The reader is already destroyed");
  20220. }
  20221. this._isDestroyed = true;
  20222. this._queue.killAndDrain();
  20223. }
  20224. onEntry(callback) {
  20225. this._emitter.on("entry", callback);
  20226. }
  20227. onError(callback) {
  20228. this._emitter.once("error", callback);
  20229. }
  20230. onEnd(callback) {
  20231. this._emitter.once("end", callback);
  20232. }
  20233. _pushToQueue(directory, base) {
  20234. const queueItem = {
  20235. directory,
  20236. base
  20237. };
  20238. this._queue.push(queueItem, (error) => {
  20239. if (error !== null) {
  20240. this._handleError(error);
  20241. }
  20242. });
  20243. }
  20244. _worker(item, done) {
  20245. this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
  20246. if (error !== null) {
  20247. done(error, void 0);
  20248. return;
  20249. }
  20250. for (const entry of entries) {
  20251. this._handleEntry(entry, item.base);
  20252. }
  20253. done(null, void 0);
  20254. });
  20255. }
  20256. _handleError(error) {
  20257. if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
  20258. return;
  20259. }
  20260. this._isFatalError = true;
  20261. this._isDestroyed = true;
  20262. this._emitter.emit("error", error);
  20263. }
  20264. _handleEntry(entry, base) {
  20265. if (this._isDestroyed || this._isFatalError) {
  20266. return;
  20267. }
  20268. const fullpath = entry.path;
  20269. if (base !== void 0) {
  20270. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20271. }
  20272. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20273. this._emitEntry(entry);
  20274. }
  20275. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20276. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20277. }
  20278. }
  20279. _emitEntry(entry) {
  20280. this._emitter.emit("entry", entry);
  20281. }
  20282. };
  20283. exports2.default = AsyncReader;
  20284. }
  20285. });
  20286. var require_async5 = __commonJS2({
  20287. "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
  20288. "use strict";
  20289. Object.defineProperty(exports2, "__esModule", {
  20290. value: true
  20291. });
  20292. var async_1 = require_async4();
  20293. var AsyncProvider = class {
  20294. constructor(_root, _settings) {
  20295. this._root = _root;
  20296. this._settings = _settings;
  20297. this._reader = new async_1.default(this._root, this._settings);
  20298. this._storage = [];
  20299. }
  20300. read(callback) {
  20301. this._reader.onError((error) => {
  20302. callFailureCallback(callback, error);
  20303. });
  20304. this._reader.onEntry((entry) => {
  20305. this._storage.push(entry);
  20306. });
  20307. this._reader.onEnd(() => {
  20308. callSuccessCallback(callback, this._storage);
  20309. });
  20310. this._reader.read();
  20311. }
  20312. };
  20313. exports2.default = AsyncProvider;
  20314. function callFailureCallback(callback, error) {
  20315. callback(error);
  20316. }
  20317. function callSuccessCallback(callback, entries) {
  20318. callback(null, entries);
  20319. }
  20320. }
  20321. });
  20322. var require_stream2 = __commonJS2({
  20323. "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
  20324. "use strict";
  20325. Object.defineProperty(exports2, "__esModule", {
  20326. value: true
  20327. });
  20328. var stream_1 = require("stream");
  20329. var async_1 = require_async4();
  20330. var StreamProvider = class {
  20331. constructor(_root, _settings) {
  20332. this._root = _root;
  20333. this._settings = _settings;
  20334. this._reader = new async_1.default(this._root, this._settings);
  20335. this._stream = new stream_1.Readable({
  20336. objectMode: true,
  20337. read: () => {
  20338. },
  20339. destroy: () => {
  20340. if (!this._reader.isDestroyed) {
  20341. this._reader.destroy();
  20342. }
  20343. }
  20344. });
  20345. }
  20346. read() {
  20347. this._reader.onError((error) => {
  20348. this._stream.emit("error", error);
  20349. });
  20350. this._reader.onEntry((entry) => {
  20351. this._stream.push(entry);
  20352. });
  20353. this._reader.onEnd(() => {
  20354. this._stream.push(null);
  20355. });
  20356. this._reader.read();
  20357. return this._stream;
  20358. }
  20359. };
  20360. exports2.default = StreamProvider;
  20361. }
  20362. });
  20363. var require_sync4 = __commonJS2({
  20364. "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
  20365. "use strict";
  20366. Object.defineProperty(exports2, "__esModule", {
  20367. value: true
  20368. });
  20369. var fsScandir = require_out2();
  20370. var common = require_common4();
  20371. var reader_1 = require_reader();
  20372. var SyncReader = class extends reader_1.default {
  20373. constructor() {
  20374. super(...arguments);
  20375. this._scandir = fsScandir.scandirSync;
  20376. this._storage = [];
  20377. this._queue = /* @__PURE__ */ new Set();
  20378. }
  20379. read() {
  20380. this._pushToQueue(this._root, this._settings.basePath);
  20381. this._handleQueue();
  20382. return this._storage;
  20383. }
  20384. _pushToQueue(directory, base) {
  20385. this._queue.add({
  20386. directory,
  20387. base
  20388. });
  20389. }
  20390. _handleQueue() {
  20391. for (const item of this._queue.values()) {
  20392. this._handleDirectory(item.directory, item.base);
  20393. }
  20394. }
  20395. _handleDirectory(directory, base) {
  20396. try {
  20397. const entries = this._scandir(directory, this._settings.fsScandirSettings);
  20398. for (const entry of entries) {
  20399. this._handleEntry(entry, base);
  20400. }
  20401. } catch (error) {
  20402. this._handleError(error);
  20403. }
  20404. }
  20405. _handleError(error) {
  20406. if (!common.isFatalError(this._settings, error)) {
  20407. return;
  20408. }
  20409. throw error;
  20410. }
  20411. _handleEntry(entry, base) {
  20412. const fullpath = entry.path;
  20413. if (base !== void 0) {
  20414. entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
  20415. }
  20416. if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
  20417. this._pushToStorage(entry);
  20418. }
  20419. if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
  20420. this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
  20421. }
  20422. }
  20423. _pushToStorage(entry) {
  20424. this._storage.push(entry);
  20425. }
  20426. };
  20427. exports2.default = SyncReader;
  20428. }
  20429. });
  20430. var require_sync5 = __commonJS2({
  20431. "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
  20432. "use strict";
  20433. Object.defineProperty(exports2, "__esModule", {
  20434. value: true
  20435. });
  20436. var sync_1 = require_sync4();
  20437. var SyncProvider = class {
  20438. constructor(_root, _settings) {
  20439. this._root = _root;
  20440. this._settings = _settings;
  20441. this._reader = new sync_1.default(this._root, this._settings);
  20442. }
  20443. read() {
  20444. return this._reader.read();
  20445. }
  20446. };
  20447. exports2.default = SyncProvider;
  20448. }
  20449. });
  20450. var require_settings3 = __commonJS2({
  20451. "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
  20452. "use strict";
  20453. Object.defineProperty(exports2, "__esModule", {
  20454. value: true
  20455. });
  20456. var path = require("path");
  20457. var fsScandir = require_out2();
  20458. var Settings = class {
  20459. constructor(_options = {}) {
  20460. this._options = _options;
  20461. this.basePath = this._getValue(this._options.basePath, void 0);
  20462. this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
  20463. this.deepFilter = this._getValue(this._options.deepFilter, null);
  20464. this.entryFilter = this._getValue(this._options.entryFilter, null);
  20465. this.errorFilter = this._getValue(this._options.errorFilter, null);
  20466. this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
  20467. this.fsScandirSettings = new fsScandir.Settings({
  20468. followSymbolicLinks: this._options.followSymbolicLinks,
  20469. fs: this._options.fs,
  20470. pathSegmentSeparator: this._options.pathSegmentSeparator,
  20471. stats: this._options.stats,
  20472. throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
  20473. });
  20474. }
  20475. _getValue(option, value) {
  20476. return option !== null && option !== void 0 ? option : value;
  20477. }
  20478. };
  20479. exports2.default = Settings;
  20480. }
  20481. });
  20482. var require_out3 = __commonJS2({
  20483. "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
  20484. "use strict";
  20485. Object.defineProperty(exports2, "__esModule", {
  20486. value: true
  20487. });
  20488. exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
  20489. var async_1 = require_async5();
  20490. var stream_1 = require_stream2();
  20491. var sync_1 = require_sync5();
  20492. var settings_1 = require_settings3();
  20493. exports2.Settings = settings_1.default;
  20494. function walk(directory, optionsOrSettingsOrCallback, callback) {
  20495. if (typeof optionsOrSettingsOrCallback === "function") {
  20496. new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
  20497. return;
  20498. }
  20499. new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
  20500. }
  20501. exports2.walk = walk;
  20502. function walkSync(directory, optionsOrSettings) {
  20503. const settings = getSettings(optionsOrSettings);
  20504. const provider = new sync_1.default(directory, settings);
  20505. return provider.read();
  20506. }
  20507. exports2.walkSync = walkSync;
  20508. function walkStream(directory, optionsOrSettings) {
  20509. const settings = getSettings(optionsOrSettings);
  20510. const provider = new stream_1.default(directory, settings);
  20511. return provider.read();
  20512. }
  20513. exports2.walkStream = walkStream;
  20514. function getSettings(settingsOrOptions = {}) {
  20515. if (settingsOrOptions instanceof settings_1.default) {
  20516. return settingsOrOptions;
  20517. }
  20518. return new settings_1.default(settingsOrOptions);
  20519. }
  20520. }
  20521. });
  20522. var require_reader2 = __commonJS2({
  20523. "node_modules/fast-glob/out/readers/reader.js"(exports2) {
  20524. "use strict";
  20525. Object.defineProperty(exports2, "__esModule", {
  20526. value: true
  20527. });
  20528. var path = require("path");
  20529. var fsStat = require_out();
  20530. var utils = require_utils4();
  20531. var Reader = class {
  20532. constructor(_settings) {
  20533. this._settings = _settings;
  20534. this._fsStatSettings = new fsStat.Settings({
  20535. followSymbolicLink: this._settings.followSymbolicLinks,
  20536. fs: this._settings.fs,
  20537. throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
  20538. });
  20539. }
  20540. _getFullEntryPath(filepath) {
  20541. return path.resolve(this._settings.cwd, filepath);
  20542. }
  20543. _makeEntry(stats, pattern) {
  20544. const entry = {
  20545. name: pattern,
  20546. path: pattern,
  20547. dirent: utils.fs.createDirentFromStats(pattern, stats)
  20548. };
  20549. if (this._settings.stats) {
  20550. entry.stats = stats;
  20551. }
  20552. return entry;
  20553. }
  20554. _isFatalError(error) {
  20555. return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
  20556. }
  20557. };
  20558. exports2.default = Reader;
  20559. }
  20560. });
  20561. var require_stream3 = __commonJS2({
  20562. "node_modules/fast-glob/out/readers/stream.js"(exports2) {
  20563. "use strict";
  20564. Object.defineProperty(exports2, "__esModule", {
  20565. value: true
  20566. });
  20567. var stream_1 = require("stream");
  20568. var fsStat = require_out();
  20569. var fsWalk = require_out3();
  20570. var reader_1 = require_reader2();
  20571. var ReaderStream = class extends reader_1.default {
  20572. constructor() {
  20573. super(...arguments);
  20574. this._walkStream = fsWalk.walkStream;
  20575. this._stat = fsStat.stat;
  20576. }
  20577. dynamic(root, options) {
  20578. return this._walkStream(root, options);
  20579. }
  20580. static(patterns, options) {
  20581. const filepaths = patterns.map(this._getFullEntryPath, this);
  20582. const stream = new stream_1.PassThrough({
  20583. objectMode: true
  20584. });
  20585. stream._write = (index, _enc, done) => {
  20586. return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
  20587. if (entry !== null && options.entryFilter(entry)) {
  20588. stream.push(entry);
  20589. }
  20590. if (index === filepaths.length - 1) {
  20591. stream.end();
  20592. }
  20593. done();
  20594. }).catch(done);
  20595. };
  20596. for (let i = 0; i < filepaths.length; i++) {
  20597. stream.write(i);
  20598. }
  20599. return stream;
  20600. }
  20601. _getEntry(filepath, pattern, options) {
  20602. return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
  20603. if (options.errorFilter(error)) {
  20604. return null;
  20605. }
  20606. throw error;
  20607. });
  20608. }
  20609. _getStat(filepath) {
  20610. return new Promise((resolve, reject) => {
  20611. this._stat(filepath, this._fsStatSettings, (error, stats) => {
  20612. return error === null ? resolve(stats) : reject(error);
  20613. });
  20614. });
  20615. }
  20616. };
  20617. exports2.default = ReaderStream;
  20618. }
  20619. });
  20620. var require_matcher = __commonJS2({
  20621. "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
  20622. "use strict";
  20623. Object.defineProperty(exports2, "__esModule", {
  20624. value: true
  20625. });
  20626. var utils = require_utils4();
  20627. var Matcher = class {
  20628. constructor(_patterns, _settings, _micromatchOptions) {
  20629. this._patterns = _patterns;
  20630. this._settings = _settings;
  20631. this._micromatchOptions = _micromatchOptions;
  20632. this._storage = [];
  20633. this._fillStorage();
  20634. }
  20635. _fillStorage() {
  20636. const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
  20637. for (const pattern of patterns) {
  20638. const segments = this._getPatternSegments(pattern);
  20639. const sections = this._splitSegmentsIntoSections(segments);
  20640. this._storage.push({
  20641. complete: sections.length <= 1,
  20642. pattern,
  20643. segments,
  20644. sections
  20645. });
  20646. }
  20647. }
  20648. _getPatternSegments(pattern) {
  20649. const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
  20650. return parts.map((part) => {
  20651. const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
  20652. if (!dynamic) {
  20653. return {
  20654. dynamic: false,
  20655. pattern: part
  20656. };
  20657. }
  20658. return {
  20659. dynamic: true,
  20660. pattern: part,
  20661. patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
  20662. };
  20663. });
  20664. }
  20665. _splitSegmentsIntoSections(segments) {
  20666. return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
  20667. }
  20668. };
  20669. exports2.default = Matcher;
  20670. }
  20671. });
  20672. var require_partial = __commonJS2({
  20673. "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
  20674. "use strict";
  20675. Object.defineProperty(exports2, "__esModule", {
  20676. value: true
  20677. });
  20678. var matcher_1 = require_matcher();
  20679. var PartialMatcher = class extends matcher_1.default {
  20680. match(filepath) {
  20681. const parts = filepath.split("/");
  20682. const levels = parts.length;
  20683. const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
  20684. for (const pattern of patterns) {
  20685. const section = pattern.sections[0];
  20686. if (!pattern.complete && levels > section.length) {
  20687. return true;
  20688. }
  20689. const match = parts.every((part, index) => {
  20690. const segment = pattern.segments[index];
  20691. if (segment.dynamic && segment.patternRe.test(part)) {
  20692. return true;
  20693. }
  20694. if (!segment.dynamic && segment.pattern === part) {
  20695. return true;
  20696. }
  20697. return false;
  20698. });
  20699. if (match) {
  20700. return true;
  20701. }
  20702. }
  20703. return false;
  20704. }
  20705. };
  20706. exports2.default = PartialMatcher;
  20707. }
  20708. });
  20709. var require_deep = __commonJS2({
  20710. "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
  20711. "use strict";
  20712. Object.defineProperty(exports2, "__esModule", {
  20713. value: true
  20714. });
  20715. var utils = require_utils4();
  20716. var partial_1 = require_partial();
  20717. var DeepFilter = class {
  20718. constructor(_settings, _micromatchOptions) {
  20719. this._settings = _settings;
  20720. this._micromatchOptions = _micromatchOptions;
  20721. }
  20722. getFilter(basePath, positive, negative) {
  20723. const matcher = this._getMatcher(positive);
  20724. const negativeRe = this._getNegativePatternsRe(negative);
  20725. return (entry) => this._filter(basePath, entry, matcher, negativeRe);
  20726. }
  20727. _getMatcher(patterns) {
  20728. return new partial_1.default(patterns, this._settings, this._micromatchOptions);
  20729. }
  20730. _getNegativePatternsRe(patterns) {
  20731. const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
  20732. return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
  20733. }
  20734. _filter(basePath, entry, matcher, negativeRe) {
  20735. if (this._isSkippedByDeep(basePath, entry.path)) {
  20736. return false;
  20737. }
  20738. if (this._isSkippedSymbolicLink(entry)) {
  20739. return false;
  20740. }
  20741. const filepath = utils.path.removeLeadingDotSegment(entry.path);
  20742. if (this._isSkippedByPositivePatterns(filepath, matcher)) {
  20743. return false;
  20744. }
  20745. return this._isSkippedByNegativePatterns(filepath, negativeRe);
  20746. }
  20747. _isSkippedByDeep(basePath, entryPath) {
  20748. if (this._settings.deep === Infinity) {
  20749. return false;
  20750. }
  20751. return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
  20752. }
  20753. _getEntryLevel(basePath, entryPath) {
  20754. const entryPathDepth = entryPath.split("/").length;
  20755. if (basePath === "") {
  20756. return entryPathDepth;
  20757. }
  20758. const basePathDepth = basePath.split("/").length;
  20759. return entryPathDepth - basePathDepth;
  20760. }
  20761. _isSkippedSymbolicLink(entry) {
  20762. return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
  20763. }
  20764. _isSkippedByPositivePatterns(entryPath, matcher) {
  20765. return !this._settings.baseNameMatch && !matcher.match(entryPath);
  20766. }
  20767. _isSkippedByNegativePatterns(entryPath, patternsRe) {
  20768. return !utils.pattern.matchAny(entryPath, patternsRe);
  20769. }
  20770. };
  20771. exports2.default = DeepFilter;
  20772. }
  20773. });
  20774. var require_entry = __commonJS2({
  20775. "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
  20776. "use strict";
  20777. Object.defineProperty(exports2, "__esModule", {
  20778. value: true
  20779. });
  20780. var utils = require_utils4();
  20781. var EntryFilter = class {
  20782. constructor(_settings, _micromatchOptions) {
  20783. this._settings = _settings;
  20784. this._micromatchOptions = _micromatchOptions;
  20785. this.index = /* @__PURE__ */ new Map();
  20786. }
  20787. getFilter(positive, negative) {
  20788. const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
  20789. const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
  20790. return (entry) => this._filter(entry, positiveRe, negativeRe);
  20791. }
  20792. _filter(entry, positiveRe, negativeRe) {
  20793. if (this._settings.unique && this._isDuplicateEntry(entry)) {
  20794. return false;
  20795. }
  20796. if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
  20797. return false;
  20798. }
  20799. if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
  20800. return false;
  20801. }
  20802. const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
  20803. const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
  20804. if (this._settings.unique && isMatched) {
  20805. this._createIndexRecord(entry);
  20806. }
  20807. return isMatched;
  20808. }
  20809. _isDuplicateEntry(entry) {
  20810. return this.index.has(entry.path);
  20811. }
  20812. _createIndexRecord(entry) {
  20813. this.index.set(entry.path, void 0);
  20814. }
  20815. _onlyFileFilter(entry) {
  20816. return this._settings.onlyFiles && !entry.dirent.isFile();
  20817. }
  20818. _onlyDirectoryFilter(entry) {
  20819. return this._settings.onlyDirectories && !entry.dirent.isDirectory();
  20820. }
  20821. _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
  20822. if (!this._settings.absolute) {
  20823. return false;
  20824. }
  20825. const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
  20826. return utils.pattern.matchAny(fullpath, patternsRe);
  20827. }
  20828. _isMatchToPatterns(entryPath, patternsRe) {
  20829. const filepath = utils.path.removeLeadingDotSegment(entryPath);
  20830. return utils.pattern.matchAny(filepath, patternsRe) || utils.pattern.matchAny(filepath + "/", patternsRe);
  20831. }
  20832. };
  20833. exports2.default = EntryFilter;
  20834. }
  20835. });
  20836. var require_error = __commonJS2({
  20837. "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
  20838. "use strict";
  20839. Object.defineProperty(exports2, "__esModule", {
  20840. value: true
  20841. });
  20842. var utils = require_utils4();
  20843. var ErrorFilter = class {
  20844. constructor(_settings) {
  20845. this._settings = _settings;
  20846. }
  20847. getFilter() {
  20848. return (error) => this._isNonFatalError(error);
  20849. }
  20850. _isNonFatalError(error) {
  20851. return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
  20852. }
  20853. };
  20854. exports2.default = ErrorFilter;
  20855. }
  20856. });
  20857. var require_entry2 = __commonJS2({
  20858. "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
  20859. "use strict";
  20860. Object.defineProperty(exports2, "__esModule", {
  20861. value: true
  20862. });
  20863. var utils = require_utils4();
  20864. var EntryTransformer = class {
  20865. constructor(_settings) {
  20866. this._settings = _settings;
  20867. }
  20868. getTransformer() {
  20869. return (entry) => this._transform(entry);
  20870. }
  20871. _transform(entry) {
  20872. let filepath = entry.path;
  20873. if (this._settings.absolute) {
  20874. filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
  20875. filepath = utils.path.unixify(filepath);
  20876. }
  20877. if (this._settings.markDirectories && entry.dirent.isDirectory()) {
  20878. filepath += "/";
  20879. }
  20880. if (!this._settings.objectMode) {
  20881. return filepath;
  20882. }
  20883. return Object.assign(Object.assign({}, entry), {
  20884. path: filepath
  20885. });
  20886. }
  20887. };
  20888. exports2.default = EntryTransformer;
  20889. }
  20890. });
  20891. var require_provider = __commonJS2({
  20892. "node_modules/fast-glob/out/providers/provider.js"(exports2) {
  20893. "use strict";
  20894. Object.defineProperty(exports2, "__esModule", {
  20895. value: true
  20896. });
  20897. var path = require("path");
  20898. var deep_1 = require_deep();
  20899. var entry_1 = require_entry();
  20900. var error_1 = require_error();
  20901. var entry_2 = require_entry2();
  20902. var Provider = class {
  20903. constructor(_settings) {
  20904. this._settings = _settings;
  20905. this.errorFilter = new error_1.default(this._settings);
  20906. this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
  20907. this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
  20908. this.entryTransformer = new entry_2.default(this._settings);
  20909. }
  20910. _getRootDirectory(task) {
  20911. return path.resolve(this._settings.cwd, task.base);
  20912. }
  20913. _getReaderOptions(task) {
  20914. const basePath = task.base === "." ? "" : task.base;
  20915. return {
  20916. basePath,
  20917. pathSegmentSeparator: "/",
  20918. concurrency: this._settings.concurrency,
  20919. deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
  20920. entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
  20921. errorFilter: this.errorFilter.getFilter(),
  20922. followSymbolicLinks: this._settings.followSymbolicLinks,
  20923. fs: this._settings.fs,
  20924. stats: this._settings.stats,
  20925. throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
  20926. transform: this.entryTransformer.getTransformer()
  20927. };
  20928. }
  20929. _getMicromatchOptions() {
  20930. return {
  20931. dot: this._settings.dot,
  20932. matchBase: this._settings.baseNameMatch,
  20933. nobrace: !this._settings.braceExpansion,
  20934. nocase: !this._settings.caseSensitiveMatch,
  20935. noext: !this._settings.extglob,
  20936. noglobstar: !this._settings.globstar,
  20937. posix: true,
  20938. strictSlashes: false
  20939. };
  20940. }
  20941. };
  20942. exports2.default = Provider;
  20943. }
  20944. });
  20945. var require_async6 = __commonJS2({
  20946. "node_modules/fast-glob/out/providers/async.js"(exports2) {
  20947. "use strict";
  20948. Object.defineProperty(exports2, "__esModule", {
  20949. value: true
  20950. });
  20951. var stream_1 = require_stream3();
  20952. var provider_1 = require_provider();
  20953. var ProviderAsync = class extends provider_1.default {
  20954. constructor() {
  20955. super(...arguments);
  20956. this._reader = new stream_1.default(this._settings);
  20957. }
  20958. read(task) {
  20959. const root = this._getRootDirectory(task);
  20960. const options = this._getReaderOptions(task);
  20961. const entries = [];
  20962. return new Promise((resolve, reject) => {
  20963. const stream = this.api(root, task, options);
  20964. stream.once("error", reject);
  20965. stream.on("data", (entry) => entries.push(options.transform(entry)));
  20966. stream.once("end", () => resolve(entries));
  20967. });
  20968. }
  20969. api(root, task, options) {
  20970. if (task.dynamic) {
  20971. return this._reader.dynamic(root, options);
  20972. }
  20973. return this._reader.static(task.patterns, options);
  20974. }
  20975. };
  20976. exports2.default = ProviderAsync;
  20977. }
  20978. });
  20979. var require_stream4 = __commonJS2({
  20980. "node_modules/fast-glob/out/providers/stream.js"(exports2) {
  20981. "use strict";
  20982. Object.defineProperty(exports2, "__esModule", {
  20983. value: true
  20984. });
  20985. var stream_1 = require("stream");
  20986. var stream_2 = require_stream3();
  20987. var provider_1 = require_provider();
  20988. var ProviderStream = class extends provider_1.default {
  20989. constructor() {
  20990. super(...arguments);
  20991. this._reader = new stream_2.default(this._settings);
  20992. }
  20993. read(task) {
  20994. const root = this._getRootDirectory(task);
  20995. const options = this._getReaderOptions(task);
  20996. const source = this.api(root, task, options);
  20997. const destination = new stream_1.Readable({
  20998. objectMode: true,
  20999. read: () => {
  21000. }
  21001. });
  21002. source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
  21003. destination.once("close", () => source.destroy());
  21004. return destination;
  21005. }
  21006. api(root, task, options) {
  21007. if (task.dynamic) {
  21008. return this._reader.dynamic(root, options);
  21009. }
  21010. return this._reader.static(task.patterns, options);
  21011. }
  21012. };
  21013. exports2.default = ProviderStream;
  21014. }
  21015. });
  21016. var require_sync6 = __commonJS2({
  21017. "node_modules/fast-glob/out/readers/sync.js"(exports2) {
  21018. "use strict";
  21019. Object.defineProperty(exports2, "__esModule", {
  21020. value: true
  21021. });
  21022. var fsStat = require_out();
  21023. var fsWalk = require_out3();
  21024. var reader_1 = require_reader2();
  21025. var ReaderSync = class extends reader_1.default {
  21026. constructor() {
  21027. super(...arguments);
  21028. this._walkSync = fsWalk.walkSync;
  21029. this._statSync = fsStat.statSync;
  21030. }
  21031. dynamic(root, options) {
  21032. return this._walkSync(root, options);
  21033. }
  21034. static(patterns, options) {
  21035. const entries = [];
  21036. for (const pattern of patterns) {
  21037. const filepath = this._getFullEntryPath(pattern);
  21038. const entry = this._getEntry(filepath, pattern, options);
  21039. if (entry === null || !options.entryFilter(entry)) {
  21040. continue;
  21041. }
  21042. entries.push(entry);
  21043. }
  21044. return entries;
  21045. }
  21046. _getEntry(filepath, pattern, options) {
  21047. try {
  21048. const stats = this._getStat(filepath);
  21049. return this._makeEntry(stats, pattern);
  21050. } catch (error) {
  21051. if (options.errorFilter(error)) {
  21052. return null;
  21053. }
  21054. throw error;
  21055. }
  21056. }
  21057. _getStat(filepath) {
  21058. return this._statSync(filepath, this._fsStatSettings);
  21059. }
  21060. };
  21061. exports2.default = ReaderSync;
  21062. }
  21063. });
  21064. var require_sync7 = __commonJS2({
  21065. "node_modules/fast-glob/out/providers/sync.js"(exports2) {
  21066. "use strict";
  21067. Object.defineProperty(exports2, "__esModule", {
  21068. value: true
  21069. });
  21070. var sync_1 = require_sync6();
  21071. var provider_1 = require_provider();
  21072. var ProviderSync = class extends provider_1.default {
  21073. constructor() {
  21074. super(...arguments);
  21075. this._reader = new sync_1.default(this._settings);
  21076. }
  21077. read(task) {
  21078. const root = this._getRootDirectory(task);
  21079. const options = this._getReaderOptions(task);
  21080. const entries = this.api(root, task, options);
  21081. return entries.map(options.transform);
  21082. }
  21083. api(root, task, options) {
  21084. if (task.dynamic) {
  21085. return this._reader.dynamic(root, options);
  21086. }
  21087. return this._reader.static(task.patterns, options);
  21088. }
  21089. };
  21090. exports2.default = ProviderSync;
  21091. }
  21092. });
  21093. var require_settings4 = __commonJS2({
  21094. "node_modules/fast-glob/out/settings.js"(exports2) {
  21095. "use strict";
  21096. Object.defineProperty(exports2, "__esModule", {
  21097. value: true
  21098. });
  21099. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
  21100. var fs = require("fs");
  21101. var os = require("os");
  21102. var CPU_COUNT = Math.max(os.cpus().length, 1);
  21103. exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
  21104. lstat: fs.lstat,
  21105. lstatSync: fs.lstatSync,
  21106. stat: fs.stat,
  21107. statSync: fs.statSync,
  21108. readdir: fs.readdir,
  21109. readdirSync: fs.readdirSync
  21110. };
  21111. var Settings = class {
  21112. constructor(_options = {}) {
  21113. this._options = _options;
  21114. this.absolute = this._getValue(this._options.absolute, false);
  21115. this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
  21116. this.braceExpansion = this._getValue(this._options.braceExpansion, true);
  21117. this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
  21118. this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
  21119. this.cwd = this._getValue(this._options.cwd, process.cwd());
  21120. this.deep = this._getValue(this._options.deep, Infinity);
  21121. this.dot = this._getValue(this._options.dot, false);
  21122. this.extglob = this._getValue(this._options.extglob, true);
  21123. this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
  21124. this.fs = this._getFileSystemMethods(this._options.fs);
  21125. this.globstar = this._getValue(this._options.globstar, true);
  21126. this.ignore = this._getValue(this._options.ignore, []);
  21127. this.markDirectories = this._getValue(this._options.markDirectories, false);
  21128. this.objectMode = this._getValue(this._options.objectMode, false);
  21129. this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
  21130. this.onlyFiles = this._getValue(this._options.onlyFiles, true);
  21131. this.stats = this._getValue(this._options.stats, false);
  21132. this.suppressErrors = this._getValue(this._options.suppressErrors, false);
  21133. this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
  21134. this.unique = this._getValue(this._options.unique, true);
  21135. if (this.onlyDirectories) {
  21136. this.onlyFiles = false;
  21137. }
  21138. if (this.stats) {
  21139. this.objectMode = true;
  21140. }
  21141. }
  21142. _getValue(option, value) {
  21143. return option === void 0 ? value : option;
  21144. }
  21145. _getFileSystemMethods(methods = {}) {
  21146. return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
  21147. }
  21148. };
  21149. exports2.default = Settings;
  21150. }
  21151. });
  21152. var require_out4 = __commonJS2({
  21153. "node_modules/fast-glob/out/index.js"(exports2, module2) {
  21154. "use strict";
  21155. var taskManager = require_tasks();
  21156. var patternManager = require_patterns();
  21157. var async_1 = require_async6();
  21158. var stream_1 = require_stream4();
  21159. var sync_1 = require_sync7();
  21160. var settings_1 = require_settings4();
  21161. var utils = require_utils4();
  21162. async function FastGlob(source, options) {
  21163. assertPatternsInput(source);
  21164. const works = getWorks(source, async_1.default, options);
  21165. const result = await Promise.all(works);
  21166. return utils.array.flatten(result);
  21167. }
  21168. (function(FastGlob2) {
  21169. function sync(source, options) {
  21170. assertPatternsInput(source);
  21171. const works = getWorks(source, sync_1.default, options);
  21172. return utils.array.flatten(works);
  21173. }
  21174. FastGlob2.sync = sync;
  21175. function stream(source, options) {
  21176. assertPatternsInput(source);
  21177. const works = getWorks(source, stream_1.default, options);
  21178. return utils.stream.merge(works);
  21179. }
  21180. FastGlob2.stream = stream;
  21181. function generateTasks(source, options) {
  21182. assertPatternsInput(source);
  21183. const patterns = patternManager.transform([].concat(source));
  21184. const settings = new settings_1.default(options);
  21185. return taskManager.generate(patterns, settings);
  21186. }
  21187. FastGlob2.generateTasks = generateTasks;
  21188. function isDynamicPattern(source, options) {
  21189. assertPatternsInput(source);
  21190. const settings = new settings_1.default(options);
  21191. return utils.pattern.isDynamicPattern(source, settings);
  21192. }
  21193. FastGlob2.isDynamicPattern = isDynamicPattern;
  21194. function escapePath(source) {
  21195. assertPatternsInput(source);
  21196. return utils.path.escape(source);
  21197. }
  21198. FastGlob2.escapePath = escapePath;
  21199. })(FastGlob || (FastGlob = {}));
  21200. function getWorks(source, _Provider, options) {
  21201. const patterns = patternManager.transform([].concat(source));
  21202. const settings = new settings_1.default(options);
  21203. const tasks = taskManager.generate(patterns, settings);
  21204. const provider = new _Provider(settings);
  21205. return tasks.map(provider.read, provider);
  21206. }
  21207. function assertPatternsInput(input) {
  21208. const source = [].concat(input);
  21209. const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
  21210. if (!isValidSource) {
  21211. throw new TypeError("Patterns must be a string (non empty) or an array of strings");
  21212. }
  21213. }
  21214. module2.exports = FastGlob;
  21215. }
  21216. });
  21217. var require_uniq_by_key = __commonJS2({
  21218. "src/utils/uniq-by-key.js"(exports2, module2) {
  21219. "use strict";
  21220. function uniqByKey(array, key) {
  21221. const result = [];
  21222. const seen = /* @__PURE__ */ new Set();
  21223. for (const element of array) {
  21224. const value = element[key];
  21225. if (!seen.has(value)) {
  21226. seen.add(value);
  21227. result.push(element);
  21228. }
  21229. }
  21230. return result;
  21231. }
  21232. module2.exports = uniqByKey;
  21233. }
  21234. });
  21235. var require_create_language = __commonJS2({
  21236. "src/utils/create-language.js"(exports2, module2) {
  21237. "use strict";
  21238. module2.exports = function(linguistData, override) {
  21239. const {
  21240. languageId
  21241. } = linguistData, rest = _objectWithoutProperties(linguistData, _excluded4);
  21242. return Object.assign(Object.assign({
  21243. linguistLanguageId: languageId
  21244. }, rest), override(linguistData));
  21245. };
  21246. }
  21247. });
  21248. var require_ast = __commonJS2({
  21249. "node_modules/esutils/lib/ast.js"(exports2, module2) {
  21250. (function() {
  21251. "use strict";
  21252. function isExpression(node) {
  21253. if (node == null) {
  21254. return false;
  21255. }
  21256. switch (node.type) {
  21257. case "ArrayExpression":
  21258. case "AssignmentExpression":
  21259. case "BinaryExpression":
  21260. case "CallExpression":
  21261. case "ConditionalExpression":
  21262. case "FunctionExpression":
  21263. case "Identifier":
  21264. case "Literal":
  21265. case "LogicalExpression":
  21266. case "MemberExpression":
  21267. case "NewExpression":
  21268. case "ObjectExpression":
  21269. case "SequenceExpression":
  21270. case "ThisExpression":
  21271. case "UnaryExpression":
  21272. case "UpdateExpression":
  21273. return true;
  21274. }
  21275. return false;
  21276. }
  21277. function isIterationStatement(node) {
  21278. if (node == null) {
  21279. return false;
  21280. }
  21281. switch (node.type) {
  21282. case "DoWhileStatement":
  21283. case "ForInStatement":
  21284. case "ForStatement":
  21285. case "WhileStatement":
  21286. return true;
  21287. }
  21288. return false;
  21289. }
  21290. function isStatement(node) {
  21291. if (node == null) {
  21292. return false;
  21293. }
  21294. switch (node.type) {
  21295. case "BlockStatement":
  21296. case "BreakStatement":
  21297. case "ContinueStatement":
  21298. case "DebuggerStatement":
  21299. case "DoWhileStatement":
  21300. case "EmptyStatement":
  21301. case "ExpressionStatement":
  21302. case "ForInStatement":
  21303. case "ForStatement":
  21304. case "IfStatement":
  21305. case "LabeledStatement":
  21306. case "ReturnStatement":
  21307. case "SwitchStatement":
  21308. case "ThrowStatement":
  21309. case "TryStatement":
  21310. case "VariableDeclaration":
  21311. case "WhileStatement":
  21312. case "WithStatement":
  21313. return true;
  21314. }
  21315. return false;
  21316. }
  21317. function isSourceElement(node) {
  21318. return isStatement(node) || node != null && node.type === "FunctionDeclaration";
  21319. }
  21320. function trailingStatement(node) {
  21321. switch (node.type) {
  21322. case "IfStatement":
  21323. if (node.alternate != null) {
  21324. return node.alternate;
  21325. }
  21326. return node.consequent;
  21327. case "LabeledStatement":
  21328. case "ForStatement":
  21329. case "ForInStatement":
  21330. case "WhileStatement":
  21331. case "WithStatement":
  21332. return node.body;
  21333. }
  21334. return null;
  21335. }
  21336. function isProblematicIfStatement(node) {
  21337. var current;
  21338. if (node.type !== "IfStatement") {
  21339. return false;
  21340. }
  21341. if (node.alternate == null) {
  21342. return false;
  21343. }
  21344. current = node.consequent;
  21345. do {
  21346. if (current.type === "IfStatement") {
  21347. if (current.alternate == null) {
  21348. return true;
  21349. }
  21350. }
  21351. current = trailingStatement(current);
  21352. } while (current);
  21353. return false;
  21354. }
  21355. module2.exports = {
  21356. isExpression,
  21357. isStatement,
  21358. isIterationStatement,
  21359. isSourceElement,
  21360. isProblematicIfStatement,
  21361. trailingStatement
  21362. };
  21363. })();
  21364. }
  21365. });
  21366. var require_code = __commonJS2({
  21367. "node_modules/esutils/lib/code.js"(exports2, module2) {
  21368. (function() {
  21369. "use strict";
  21370. var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
  21371. ES5Regex = {
  21372. NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
  21373. NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
  21374. };
  21375. ES6Regex = {
  21376. NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
  21377. NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
  21378. };
  21379. function isDecimalDigit(ch2) {
  21380. return 48 <= ch2 && ch2 <= 57;
  21381. }
  21382. function isHexDigit(ch2) {
  21383. return 48 <= ch2 && ch2 <= 57 || 97 <= ch2 && ch2 <= 102 || 65 <= ch2 && ch2 <= 70;
  21384. }
  21385. function isOctalDigit(ch2) {
  21386. return ch2 >= 48 && ch2 <= 55;
  21387. }
  21388. NON_ASCII_WHITESPACES = [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279];
  21389. function isWhiteSpace(ch2) {
  21390. return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && NON_ASCII_WHITESPACES.indexOf(ch2) >= 0;
  21391. }
  21392. function isLineTerminator(ch2) {
  21393. return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233;
  21394. }
  21395. function fromCodePoint(cp) {
  21396. if (cp <= 65535) {
  21397. return String.fromCharCode(cp);
  21398. }
  21399. var cu1 = String.fromCharCode(Math.floor((cp - 65536) / 1024) + 55296);
  21400. var cu2 = String.fromCharCode((cp - 65536) % 1024 + 56320);
  21401. return cu1 + cu2;
  21402. }
  21403. IDENTIFIER_START = new Array(128);
  21404. for (ch = 0; ch < 128; ++ch) {
  21405. IDENTIFIER_START[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch === 36 || ch === 95;
  21406. }
  21407. IDENTIFIER_PART = new Array(128);
  21408. for (ch = 0; ch < 128; ++ch) {
  21409. IDENTIFIER_PART[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95;
  21410. }
  21411. function isIdentifierStartES5(ch2) {
  21412. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21413. }
  21414. function isIdentifierPartES5(ch2) {
  21415. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21416. }
  21417. function isIdentifierStartES6(ch2) {
  21418. return ch2 < 128 ? IDENTIFIER_START[ch2] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
  21419. }
  21420. function isIdentifierPartES6(ch2) {
  21421. return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
  21422. }
  21423. module2.exports = {
  21424. isDecimalDigit,
  21425. isHexDigit,
  21426. isOctalDigit,
  21427. isWhiteSpace,
  21428. isLineTerminator,
  21429. isIdentifierStartES5,
  21430. isIdentifierPartES5,
  21431. isIdentifierStartES6,
  21432. isIdentifierPartES6
  21433. };
  21434. })();
  21435. }
  21436. });
  21437. var require_keyword2 = __commonJS2({
  21438. "node_modules/esutils/lib/keyword.js"(exports2, module2) {
  21439. (function() {
  21440. "use strict";
  21441. var code = require_code();
  21442. function isStrictModeReservedWordES6(id) {
  21443. switch (id) {
  21444. case "implements":
  21445. case "interface":
  21446. case "package":
  21447. case "private":
  21448. case "protected":
  21449. case "public":
  21450. case "static":
  21451. case "let":
  21452. return true;
  21453. default:
  21454. return false;
  21455. }
  21456. }
  21457. function isKeywordES5(id, strict) {
  21458. if (!strict && id === "yield") {
  21459. return false;
  21460. }
  21461. return isKeywordES6(id, strict);
  21462. }
  21463. function isKeywordES6(id, strict) {
  21464. if (strict && isStrictModeReservedWordES6(id)) {
  21465. return true;
  21466. }
  21467. switch (id.length) {
  21468. case 2:
  21469. return id === "if" || id === "in" || id === "do";
  21470. case 3:
  21471. return id === "var" || id === "for" || id === "new" || id === "try";
  21472. case 4:
  21473. return id === "this" || id === "else" || id === "case" || id === "void" || id === "with" || id === "enum";
  21474. case 5:
  21475. return id === "while" || id === "break" || id === "catch" || id === "throw" || id === "const" || id === "yield" || id === "class" || id === "super";
  21476. case 6:
  21477. return id === "return" || id === "typeof" || id === "delete" || id === "switch" || id === "export" || id === "import";
  21478. case 7:
  21479. return id === "default" || id === "finally" || id === "extends";
  21480. case 8:
  21481. return id === "function" || id === "continue" || id === "debugger";
  21482. case 10:
  21483. return id === "instanceof";
  21484. default:
  21485. return false;
  21486. }
  21487. }
  21488. function isReservedWordES5(id, strict) {
  21489. return id === "null" || id === "true" || id === "false" || isKeywordES5(id, strict);
  21490. }
  21491. function isReservedWordES6(id, strict) {
  21492. return id === "null" || id === "true" || id === "false" || isKeywordES6(id, strict);
  21493. }
  21494. function isRestrictedWord(id) {
  21495. return id === "eval" || id === "arguments";
  21496. }
  21497. function isIdentifierNameES5(id) {
  21498. var i, iz, ch;
  21499. if (id.length === 0) {
  21500. return false;
  21501. }
  21502. ch = id.charCodeAt(0);
  21503. if (!code.isIdentifierStartES5(ch)) {
  21504. return false;
  21505. }
  21506. for (i = 1, iz = id.length; i < iz; ++i) {
  21507. ch = id.charCodeAt(i);
  21508. if (!code.isIdentifierPartES5(ch)) {
  21509. return false;
  21510. }
  21511. }
  21512. return true;
  21513. }
  21514. function decodeUtf16(lead, trail) {
  21515. return (lead - 55296) * 1024 + (trail - 56320) + 65536;
  21516. }
  21517. function isIdentifierNameES6(id) {
  21518. var i, iz, ch, lowCh, check;
  21519. if (id.length === 0) {
  21520. return false;
  21521. }
  21522. check = code.isIdentifierStartES6;
  21523. for (i = 0, iz = id.length; i < iz; ++i) {
  21524. ch = id.charCodeAt(i);
  21525. if (55296 <= ch && ch <= 56319) {
  21526. ++i;
  21527. if (i >= iz) {
  21528. return false;
  21529. }
  21530. lowCh = id.charCodeAt(i);
  21531. if (!(56320 <= lowCh && lowCh <= 57343)) {
  21532. return false;
  21533. }
  21534. ch = decodeUtf16(ch, lowCh);
  21535. }
  21536. if (!check(ch)) {
  21537. return false;
  21538. }
  21539. check = code.isIdentifierPartES6;
  21540. }
  21541. return true;
  21542. }
  21543. function isIdentifierES5(id, strict) {
  21544. return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
  21545. }
  21546. function isIdentifierES6(id, strict) {
  21547. return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
  21548. }
  21549. module2.exports = {
  21550. isKeywordES5,
  21551. isKeywordES6,
  21552. isReservedWordES5,
  21553. isReservedWordES6,
  21554. isRestrictedWord,
  21555. isIdentifierNameES5,
  21556. isIdentifierNameES6,
  21557. isIdentifierES5,
  21558. isIdentifierES6
  21559. };
  21560. })();
  21561. }
  21562. });
  21563. var require_utils6 = __commonJS2({
  21564. "node_modules/esutils/lib/utils.js"(exports2) {
  21565. (function() {
  21566. "use strict";
  21567. exports2.ast = require_ast();
  21568. exports2.code = require_code();
  21569. exports2.keyword = require_keyword2();
  21570. })();
  21571. }
  21572. });
  21573. var require_is_block_comment = __commonJS2({
  21574. "src/language-js/utils/is-block-comment.js"(exports2, module2) {
  21575. "use strict";
  21576. var BLOCK_COMMENT_TYPES = /* @__PURE__ */ new Set(["Block", "CommentBlock", "MultiLine"]);
  21577. var isBlockComment = (comment) => BLOCK_COMMENT_TYPES.has(comment === null || comment === void 0 ? void 0 : comment.type);
  21578. module2.exports = isBlockComment;
  21579. }
  21580. });
  21581. var require_is_node_matches = __commonJS2({
  21582. "src/language-js/utils/is-node-matches.js"(exports2, module2) {
  21583. "use strict";
  21584. function isNodeMatchesNameOrPath(node, nameOrPath) {
  21585. const names = nameOrPath.split(".");
  21586. for (let index = names.length - 1; index >= 0; index--) {
  21587. const name = names[index];
  21588. if (index === 0) {
  21589. return node.type === "Identifier" && node.name === name;
  21590. }
  21591. if (node.type !== "MemberExpression" || node.optional || node.computed || node.property.type !== "Identifier" || node.property.name !== name) {
  21592. return false;
  21593. }
  21594. node = node.object;
  21595. }
  21596. }
  21597. function isNodeMatches(node, nameOrPaths) {
  21598. return nameOrPaths.some((nameOrPath) => isNodeMatchesNameOrPath(node, nameOrPath));
  21599. }
  21600. module2.exports = isNodeMatches;
  21601. }
  21602. });
  21603. var require_utils7 = __commonJS2({
  21604. "src/language-js/utils/index.js"(exports2, module2) {
  21605. "use strict";
  21606. var isIdentifierName = require_utils6().keyword.isIdentifierNameES5;
  21607. var {
  21608. getLast,
  21609. hasNewline,
  21610. skipWhitespace,
  21611. isNonEmptyArray,
  21612. isNextLineEmptyAfterIndex,
  21613. getStringWidth
  21614. } = require_util();
  21615. var {
  21616. locStart,
  21617. locEnd,
  21618. hasSameLocStart
  21619. } = require_loc();
  21620. var isBlockComment = require_is_block_comment();
  21621. var isNodeMatches = require_is_node_matches();
  21622. var NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
  21623. var FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`);
  21624. var FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`);
  21625. function hasFlowShorthandAnnotationComment(node) {
  21626. var _node$extra, _node$trailingComment;
  21627. return ((_node$extra = node.extra) === null || _node$extra === void 0 ? void 0 : _node$extra.parenthesized) && isBlockComment((_node$trailingComment = node.trailingComments) === null || _node$trailingComment === void 0 ? void 0 : _node$trailingComment[0]) && FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value);
  21628. }
  21629. function hasFlowAnnotationComment(comments) {
  21630. const firstComment = comments === null || comments === void 0 ? void 0 : comments[0];
  21631. return isBlockComment(firstComment) && FLOW_ANNOTATION.test(firstComment.value);
  21632. }
  21633. function hasNode(node, fn) {
  21634. if (!node || typeof node !== "object") {
  21635. return false;
  21636. }
  21637. if (Array.isArray(node)) {
  21638. return node.some((value) => hasNode(value, fn));
  21639. }
  21640. const result = fn(node);
  21641. return typeof result === "boolean" ? result : Object.values(node).some((value) => hasNode(value, fn));
  21642. }
  21643. function hasNakedLeftSide(node) {
  21644. return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || isCallExpression(node) || isMemberExpression(node) || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || node.type === "TSAsExpression" || node.type === "TSNonNullExpression";
  21645. }
  21646. function getLeftSide(node) {
  21647. var _ref2, _ref3, _ref4, _ref5, _ref6, _node$left;
  21648. if (node.expressions) {
  21649. return node.expressions[0];
  21650. }
  21651. return (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_node$left = node.left) !== null && _node$left !== void 0 ? _node$left : node.test) !== null && _ref6 !== void 0 ? _ref6 : node.callee) !== null && _ref5 !== void 0 ? _ref5 : node.object) !== null && _ref4 !== void 0 ? _ref4 : node.tag) !== null && _ref3 !== void 0 ? _ref3 : node.argument) !== null && _ref2 !== void 0 ? _ref2 : node.expression;
  21652. }
  21653. function getLeftSidePathName(path, node) {
  21654. if (node.expressions) {
  21655. return ["expressions", 0];
  21656. }
  21657. if (node.left) {
  21658. return ["left"];
  21659. }
  21660. if (node.test) {
  21661. return ["test"];
  21662. }
  21663. if (node.object) {
  21664. return ["object"];
  21665. }
  21666. if (node.callee) {
  21667. return ["callee"];
  21668. }
  21669. if (node.tag) {
  21670. return ["tag"];
  21671. }
  21672. if (node.argument) {
  21673. return ["argument"];
  21674. }
  21675. if (node.expression) {
  21676. return ["expression"];
  21677. }
  21678. throw new Error("Unexpected node has no left side.");
  21679. }
  21680. function createTypeCheckFunction(types) {
  21681. types = new Set(types);
  21682. return (node) => types.has(node === null || node === void 0 ? void 0 : node.type);
  21683. }
  21684. var isLineComment = createTypeCheckFunction(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose"]);
  21685. var isExportDeclaration = createTypeCheckFunction(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
  21686. function getParentExportDeclaration(path) {
  21687. const parentNode = path.getParentNode();
  21688. if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
  21689. return parentNode;
  21690. }
  21691. return null;
  21692. }
  21693. var isLiteral = createTypeCheckFunction(["BooleanLiteral", "DirectiveLiteral", "Literal", "NullLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "RegExpLiteral", "StringLiteral", "TemplateLiteral", "TSTypeLiteral", "JSXText"]);
  21694. function isNumericLiteral(node) {
  21695. return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
  21696. }
  21697. function isSignedNumericLiteral(node) {
  21698. return node.type === "UnaryExpression" && (node.operator === "+" || node.operator === "-") && isNumericLiteral(node.argument);
  21699. }
  21700. function isStringLiteral(node) {
  21701. return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
  21702. }
  21703. var isObjectType = createTypeCheckFunction(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]);
  21704. var isFunctionOrArrowExpression = createTypeCheckFunction(["FunctionExpression", "ArrowFunctionExpression"]);
  21705. function isFunctionOrArrowExpressionWithBody(node) {
  21706. return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
  21707. }
  21708. function isAngularTestWrapper(node) {
  21709. return isCallExpression(node) && node.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(node.callee.name);
  21710. }
  21711. var isJsxNode = createTypeCheckFunction(["JSXElement", "JSXFragment"]);
  21712. function isTheOnlyJsxElementInMarkdown(options, path) {
  21713. if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
  21714. return false;
  21715. }
  21716. const node = path.getNode();
  21717. if (!node.expression || !isJsxNode(node.expression)) {
  21718. return false;
  21719. }
  21720. const parent = path.getParentNode();
  21721. return parent.type === "Program" && parent.body.length === 1;
  21722. }
  21723. function isGetterOrSetter(node) {
  21724. return node.kind === "get" || node.kind === "set";
  21725. }
  21726. function isFunctionNotation(node) {
  21727. return isGetterOrSetter(node) || hasSameLocStart(node, node.value);
  21728. }
  21729. function isObjectTypePropertyAFunction(node) {
  21730. return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node);
  21731. }
  21732. function isTypeAnnotationAFunction(node) {
  21733. return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !hasSameLocStart(node, node.typeAnnotation);
  21734. }
  21735. var isBinaryish = createTypeCheckFunction(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
  21736. function isMemberish(node) {
  21737. return isMemberExpression(node) || node.type === "BindExpression" && Boolean(node.object);
  21738. }
  21739. var simpleTypeAnnotations = /* @__PURE__ */ new Set(["AnyTypeAnnotation", "TSAnyKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword", "ThisTypeAnnotation", "TSThisType", "NumberTypeAnnotation", "TSNumberKeyword", "VoidTypeAnnotation", "TSVoidKeyword", "BooleanTypeAnnotation", "TSBooleanKeyword", "BigIntTypeAnnotation", "TSBigIntKeyword", "SymbolTypeAnnotation", "TSSymbolKeyword", "StringTypeAnnotation", "TSStringKeyword", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType", "EmptyTypeAnnotation", "MixedTypeAnnotation", "TSNeverKeyword", "TSObjectKeyword", "TSUndefinedKeyword", "TSUnknownKeyword"]);
  21740. function isSimpleType(node) {
  21741. if (!node) {
  21742. return false;
  21743. }
  21744. if ((node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference") && !node.typeParameters) {
  21745. return true;
  21746. }
  21747. if (simpleTypeAnnotations.has(node.type)) {
  21748. return true;
  21749. }
  21750. return false;
  21751. }
  21752. function isUnitTestSetUp(node) {
  21753. const unitTestSetUpRe = /^(?:before|after)(?:Each|All)$/;
  21754. return node.callee.type === "Identifier" && unitTestSetUpRe.test(node.callee.name) && node.arguments.length === 1;
  21755. }
  21756. var testCallCalleePatterns = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.step", "test.describe", "test.describe.only", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"];
  21757. function isTestCallCallee(node) {
  21758. return isNodeMatches(node, testCallCalleePatterns);
  21759. }
  21760. function isTestCall(node, parent) {
  21761. if (node.type !== "CallExpression") {
  21762. return false;
  21763. }
  21764. if (node.arguments.length === 1) {
  21765. if (isAngularTestWrapper(node) && parent && isTestCall(parent)) {
  21766. return isFunctionOrArrowExpression(node.arguments[0]);
  21767. }
  21768. if (isUnitTestSetUp(node)) {
  21769. return isAngularTestWrapper(node.arguments[0]);
  21770. }
  21771. } else if (node.arguments.length === 2 || node.arguments.length === 3) {
  21772. if ((node.arguments[0].type === "TemplateLiteral" || isStringLiteral(node.arguments[0])) && isTestCallCallee(node.callee)) {
  21773. if (node.arguments[2] && !isNumericLiteral(node.arguments[2])) {
  21774. return false;
  21775. }
  21776. return (node.arguments.length === 2 ? isFunctionOrArrowExpression(node.arguments[1]) : isFunctionOrArrowExpressionWithBody(node.arguments[1]) && getFunctionParameters(node.arguments[1]).length <= 1) || isAngularTestWrapper(node.arguments[1]);
  21777. }
  21778. }
  21779. return false;
  21780. }
  21781. var isCallExpression = createTypeCheckFunction(["CallExpression", "OptionalCallExpression"]);
  21782. var isMemberExpression = createTypeCheckFunction(["MemberExpression", "OptionalMemberExpression"]);
  21783. function isSimpleTemplateLiteral(node) {
  21784. let expressionsKey = "expressions";
  21785. if (node.type === "TSTemplateLiteralType") {
  21786. expressionsKey = "types";
  21787. }
  21788. const expressions = node[expressionsKey];
  21789. if (expressions.length === 0) {
  21790. return false;
  21791. }
  21792. return expressions.every((expr) => {
  21793. if (hasComment(expr)) {
  21794. return false;
  21795. }
  21796. if (expr.type === "Identifier" || expr.type === "ThisExpression") {
  21797. return true;
  21798. }
  21799. if (isMemberExpression(expr)) {
  21800. let head = expr;
  21801. while (isMemberExpression(head)) {
  21802. if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
  21803. return false;
  21804. }
  21805. head = head.object;
  21806. if (hasComment(head)) {
  21807. return false;
  21808. }
  21809. }
  21810. if (head.type === "Identifier" || head.type === "ThisExpression") {
  21811. return true;
  21812. }
  21813. return false;
  21814. }
  21815. return false;
  21816. });
  21817. }
  21818. function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
  21819. if (tokenNode === "+" || tokenNode === "-") {
  21820. return tokenNode + keyword;
  21821. }
  21822. return keyword;
  21823. }
  21824. function isFlowAnnotationComment(text, typeAnnotation) {
  21825. const start = locStart(typeAnnotation);
  21826. const end = skipWhitespace(text, locEnd(typeAnnotation));
  21827. return end !== false && text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
  21828. }
  21829. function hasLeadingOwnLineComment(text, node) {
  21830. if (isJsxNode(node)) {
  21831. return hasNodeIgnoreComment(node);
  21832. }
  21833. return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(text, locEnd(comment)));
  21834. }
  21835. function isStringPropSafeToUnquote(node, options) {
  21836. return options.parser !== "json" && isStringLiteral(node.key) && rawText(node.key).slice(1, -1) === node.key.value && (isIdentifierName(node.key.value) && !(options.parser === "babel-ts" && node.type === "ClassProperty" || options.parser === "typescript" && node.type === "PropertyDefinition") || isSimpleNumber(node.key.value) && String(Number(node.key.value)) === node.key.value && (options.parser === "babel" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree"));
  21837. }
  21838. function isSimpleNumber(numberString) {
  21839. return /^(?:\d+|\d+\.\d+)$/.test(numberString);
  21840. }
  21841. function isJestEachTemplateLiteral(node, parentNode) {
  21842. const jestEachTriggerRegex = /^[fx]?(?:describe|it|test)$/;
  21843. return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
  21844. }
  21845. function templateLiteralHasNewLines(template) {
  21846. return template.quasis.some((quasi) => quasi.value.raw.includes("\n"));
  21847. }
  21848. function isTemplateOnItsOwnLine(node, text) {
  21849. return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(text, locStart(node), {
  21850. backwards: true
  21851. });
  21852. }
  21853. function needsHardlineAfterDanglingComment(node) {
  21854. if (!hasComment(node)) {
  21855. return false;
  21856. }
  21857. const lastDanglingComment = getLast(getComments(node, CommentCheckFlags.Dangling));
  21858. return lastDanglingComment && !isBlockComment(lastDanglingComment);
  21859. }
  21860. function isFunctionCompositionArgs(args) {
  21861. if (args.length <= 1) {
  21862. return false;
  21863. }
  21864. let count = 0;
  21865. for (const arg of args) {
  21866. if (isFunctionOrArrowExpression(arg)) {
  21867. count += 1;
  21868. if (count > 1) {
  21869. return true;
  21870. }
  21871. } else if (isCallExpression(arg)) {
  21872. for (const childArg of arg.arguments) {
  21873. if (isFunctionOrArrowExpression(childArg)) {
  21874. return true;
  21875. }
  21876. }
  21877. }
  21878. }
  21879. return false;
  21880. }
  21881. function isLongCurriedCallExpression(path) {
  21882. const node = path.getValue();
  21883. const parent = path.getParentNode();
  21884. return isCallExpression(node) && isCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
  21885. }
  21886. function isSimpleCallArgument(node, depth) {
  21887. if (depth >= 2) {
  21888. return false;
  21889. }
  21890. const isChildSimple = (child) => isSimpleCallArgument(child, depth + 1);
  21891. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  21892. if (regexpPattern && getStringWidth(regexpPattern) > 5) {
  21893. return false;
  21894. }
  21895. if (node.type === "Literal" || node.type === "BigIntLiteral" || node.type === "DecimalLiteral" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "PrivateName" || node.type === "PrivateIdentifier" || node.type === "ArgumentPlaceholder" || node.type === "Import") {
  21896. return true;
  21897. }
  21898. if (node.type === "TemplateLiteral") {
  21899. return node.quasis.every((element) => !element.value.raw.includes("\n")) && node.expressions.every(isChildSimple);
  21900. }
  21901. if (node.type === "ObjectExpression") {
  21902. return node.properties.every((p) => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
  21903. }
  21904. if (node.type === "ArrayExpression") {
  21905. return node.elements.every((x) => x === null || isChildSimple(x));
  21906. }
  21907. if (isCallLikeExpression(node)) {
  21908. return (node.type === "ImportExpression" || isSimpleCallArgument(node.callee, depth)) && getCallArguments(node).every(isChildSimple);
  21909. }
  21910. if (isMemberExpression(node)) {
  21911. return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
  21912. }
  21913. if (node.type === "UnaryExpression" && (node.operator === "!" || node.operator === "-")) {
  21914. return isSimpleCallArgument(node.argument, depth);
  21915. }
  21916. if (node.type === "TSNonNullExpression") {
  21917. return isSimpleCallArgument(node.expression, depth);
  21918. }
  21919. return false;
  21920. }
  21921. function rawText(node) {
  21922. var _node$extra$raw, _node$extra2;
  21923. 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;
  21924. }
  21925. function identity(x) {
  21926. return x;
  21927. }
  21928. function isTSXFile(options) {
  21929. return options.filepath && /\.tsx$/i.test(options.filepath);
  21930. }
  21931. function shouldPrintComma(options, level = "es5") {
  21932. return options.trailingComma === "es5" && level === "es5" || options.trailingComma === "all" && (level === "all" || level === "es5");
  21933. }
  21934. function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
  21935. node = getLeftMost(node);
  21936. switch (node.type) {
  21937. case "FunctionExpression":
  21938. case "ClassExpression":
  21939. case "DoExpression":
  21940. return forbidFunctionClassAndDoExpr;
  21941. case "ObjectExpression":
  21942. return true;
  21943. case "MemberExpression":
  21944. case "OptionalMemberExpression":
  21945. return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
  21946. case "TaggedTemplateExpression":
  21947. if (node.tag.type === "FunctionExpression") {
  21948. return false;
  21949. }
  21950. return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
  21951. case "CallExpression":
  21952. case "OptionalCallExpression":
  21953. if (node.callee.type === "FunctionExpression") {
  21954. return false;
  21955. }
  21956. return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
  21957. case "ConditionalExpression":
  21958. return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
  21959. case "UpdateExpression":
  21960. return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
  21961. case "BindExpression":
  21962. return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
  21963. case "SequenceExpression":
  21964. return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
  21965. case "TSAsExpression":
  21966. case "TSNonNullExpression":
  21967. return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
  21968. default:
  21969. return false;
  21970. }
  21971. }
  21972. var equalityOperators = {
  21973. "==": true,
  21974. "!=": true,
  21975. "===": true,
  21976. "!==": true
  21977. };
  21978. var multiplicativeOperators = {
  21979. "*": true,
  21980. "/": true,
  21981. "%": true
  21982. };
  21983. var bitshiftOperators = {
  21984. ">>": true,
  21985. ">>>": true,
  21986. "<<": true
  21987. };
  21988. function shouldFlatten(parentOp, nodeOp) {
  21989. if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
  21990. return false;
  21991. }
  21992. if (parentOp === "**") {
  21993. return false;
  21994. }
  21995. if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
  21996. return false;
  21997. }
  21998. if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
  21999. return false;
  22000. }
  22001. if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
  22002. return false;
  22003. }
  22004. if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
  22005. return false;
  22006. }
  22007. return true;
  22008. }
  22009. var PRECEDENCE = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((operators, index) => operators.map((operator) => [operator, index])));
  22010. function getPrecedence(operator) {
  22011. return PRECEDENCE.get(operator);
  22012. }
  22013. function getLeftMost(node) {
  22014. while (node.left) {
  22015. node = node.left;
  22016. }
  22017. return node;
  22018. }
  22019. function isBitwiseOperator(operator) {
  22020. return Boolean(bitshiftOperators[operator]) || operator === "|" || operator === "^" || operator === "&";
  22021. }
  22022. function hasRestParameter(node) {
  22023. var _getLast;
  22024. if (node.rest) {
  22025. return true;
  22026. }
  22027. const parameters = getFunctionParameters(node);
  22028. return ((_getLast = getLast(parameters)) === null || _getLast === void 0 ? void 0 : _getLast.type) === "RestElement";
  22029. }
  22030. var functionParametersCache = /* @__PURE__ */ new WeakMap();
  22031. function getFunctionParameters(node) {
  22032. if (functionParametersCache.has(node)) {
  22033. return functionParametersCache.get(node);
  22034. }
  22035. const parameters = [];
  22036. if (node.this) {
  22037. parameters.push(node.this);
  22038. }
  22039. if (Array.isArray(node.parameters)) {
  22040. parameters.push(...node.parameters);
  22041. } else if (Array.isArray(node.params)) {
  22042. parameters.push(...node.params);
  22043. }
  22044. if (node.rest) {
  22045. parameters.push(node.rest);
  22046. }
  22047. functionParametersCache.set(node, parameters);
  22048. return parameters;
  22049. }
  22050. function iterateFunctionParametersPath(path, iteratee) {
  22051. const node = path.getValue();
  22052. let index = 0;
  22053. const callback = (childPath) => iteratee(childPath, index++);
  22054. if (node.this) {
  22055. path.call(callback, "this");
  22056. }
  22057. if (Array.isArray(node.parameters)) {
  22058. path.each(callback, "parameters");
  22059. } else if (Array.isArray(node.params)) {
  22060. path.each(callback, "params");
  22061. }
  22062. if (node.rest) {
  22063. path.call(callback, "rest");
  22064. }
  22065. }
  22066. var callArgumentsCache = /* @__PURE__ */ new WeakMap();
  22067. function getCallArguments(node) {
  22068. if (callArgumentsCache.has(node)) {
  22069. return callArgumentsCache.get(node);
  22070. }
  22071. let args = node.arguments;
  22072. if (node.type === "ImportExpression") {
  22073. args = [node.source];
  22074. if (node.attributes) {
  22075. args.push(node.attributes);
  22076. }
  22077. }
  22078. callArgumentsCache.set(node, args);
  22079. return args;
  22080. }
  22081. function iterateCallArgumentsPath(path, iteratee) {
  22082. const node = path.getValue();
  22083. if (node.type === "ImportExpression") {
  22084. path.call((sourcePath) => iteratee(sourcePath, 0), "source");
  22085. if (node.attributes) {
  22086. path.call((sourcePath) => iteratee(sourcePath, 1), "attributes");
  22087. }
  22088. } else {
  22089. path.each(iteratee, "arguments");
  22090. }
  22091. }
  22092. function isPrettierIgnoreComment(comment) {
  22093. return comment.value.trim() === "prettier-ignore" && !comment.unignore;
  22094. }
  22095. function hasNodeIgnoreComment(node) {
  22096. return node && (node.prettierIgnore || hasComment(node, CommentCheckFlags.PrettierIgnore));
  22097. }
  22098. function hasIgnoreComment(path) {
  22099. const node = path.getValue();
  22100. return hasNodeIgnoreComment(node);
  22101. }
  22102. var CommentCheckFlags = {
  22103. Leading: 1 << 1,
  22104. Trailing: 1 << 2,
  22105. Dangling: 1 << 3,
  22106. Block: 1 << 4,
  22107. Line: 1 << 5,
  22108. PrettierIgnore: 1 << 6,
  22109. First: 1 << 7,
  22110. Last: 1 << 8
  22111. };
  22112. var getCommentTestFunction = (flags, fn) => {
  22113. if (typeof flags === "function") {
  22114. fn = flags;
  22115. flags = 0;
  22116. }
  22117. if (flags || fn) {
  22118. 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));
  22119. }
  22120. };
  22121. function hasComment(node, flags, fn) {
  22122. if (!isNonEmptyArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22123. return false;
  22124. }
  22125. const test = getCommentTestFunction(flags, fn);
  22126. return test ? node.comments.some(test) : true;
  22127. }
  22128. function getComments(node, flags, fn) {
  22129. if (!Array.isArray(node === null || node === void 0 ? void 0 : node.comments)) {
  22130. return [];
  22131. }
  22132. const test = getCommentTestFunction(flags, fn);
  22133. return test ? node.comments.filter(test) : node.comments;
  22134. }
  22135. var isNextLineEmpty = (node, {
  22136. originalText
  22137. }) => isNextLineEmptyAfterIndex(originalText, locEnd(node));
  22138. function isCallLikeExpression(node) {
  22139. return isCallExpression(node) || node.type === "NewExpression" || node.type === "ImportExpression";
  22140. }
  22141. function isObjectProperty(node) {
  22142. return node && (node.type === "ObjectProperty" || node.type === "Property" && !node.method && node.kind === "init");
  22143. }
  22144. function isEnabledHackPipeline(options) {
  22145. return Boolean(options.__isUsingHackPipeline);
  22146. }
  22147. var markerForIfWithoutBlockAndSameLineComment = Symbol("ifWithoutBlockAndSameLineComment");
  22148. module2.exports = {
  22149. getFunctionParameters,
  22150. iterateFunctionParametersPath,
  22151. getCallArguments,
  22152. iterateCallArgumentsPath,
  22153. hasRestParameter,
  22154. getLeftSide,
  22155. getLeftSidePathName,
  22156. getParentExportDeclaration,
  22157. getTypeScriptMappedTypeModifier,
  22158. hasFlowAnnotationComment,
  22159. hasFlowShorthandAnnotationComment,
  22160. hasLeadingOwnLineComment,
  22161. hasNakedLeftSide,
  22162. hasNode,
  22163. hasIgnoreComment,
  22164. hasNodeIgnoreComment,
  22165. identity,
  22166. isBinaryish,
  22167. isCallLikeExpression,
  22168. isEnabledHackPipeline,
  22169. isLineComment,
  22170. isPrettierIgnoreComment,
  22171. isCallExpression,
  22172. isMemberExpression,
  22173. isExportDeclaration,
  22174. isFlowAnnotationComment,
  22175. isFunctionCompositionArgs,
  22176. isFunctionNotation,
  22177. isFunctionOrArrowExpression,
  22178. isGetterOrSetter,
  22179. isJestEachTemplateLiteral,
  22180. isJsxNode,
  22181. isLiteral,
  22182. isLongCurriedCallExpression,
  22183. isSimpleCallArgument,
  22184. isMemberish,
  22185. isNumericLiteral,
  22186. isSignedNumericLiteral,
  22187. isObjectProperty,
  22188. isObjectType,
  22189. isObjectTypePropertyAFunction,
  22190. isSimpleType,
  22191. isSimpleNumber,
  22192. isSimpleTemplateLiteral,
  22193. isStringLiteral,
  22194. isStringPropSafeToUnquote,
  22195. isTemplateOnItsOwnLine,
  22196. isTestCall,
  22197. isTheOnlyJsxElementInMarkdown,
  22198. isTSXFile,
  22199. isTypeAnnotationAFunction,
  22200. isNextLineEmpty,
  22201. needsHardlineAfterDanglingComment,
  22202. rawText,
  22203. shouldPrintComma,
  22204. isBitwiseOperator,
  22205. shouldFlatten,
  22206. startsWithNoLookaheadToken,
  22207. getPrecedence,
  22208. hasComment,
  22209. getComments,
  22210. CommentCheckFlags,
  22211. markerForIfWithoutBlockAndSameLineComment
  22212. };
  22213. }
  22214. });
  22215. var require_template_literal = __commonJS2({
  22216. "src/language-js/print/template-literal.js"(exports2, module2) {
  22217. "use strict";
  22218. var getLast = require_get_last();
  22219. var {
  22220. getStringWidth,
  22221. getIndentSize
  22222. } = require_util();
  22223. var {
  22224. builders: {
  22225. join,
  22226. hardline,
  22227. softline,
  22228. group,
  22229. indent,
  22230. align,
  22231. lineSuffixBoundary,
  22232. addAlignmentToDoc
  22233. },
  22234. printer: {
  22235. printDocToString
  22236. },
  22237. utils: {
  22238. mapDoc
  22239. }
  22240. } = require("./doc.js");
  22241. var {
  22242. isBinaryish,
  22243. isJestEachTemplateLiteral,
  22244. isSimpleTemplateLiteral,
  22245. hasComment,
  22246. isMemberExpression
  22247. } = require_utils7();
  22248. function printTemplateLiteral(path, print, options) {
  22249. const node = path.getValue();
  22250. const isTemplateLiteral = node.type === "TemplateLiteral";
  22251. if (isTemplateLiteral && isJestEachTemplateLiteral(node, path.getParentNode())) {
  22252. const printed = printJestEachTemplateLiteral(path, options, print);
  22253. if (printed) {
  22254. return printed;
  22255. }
  22256. }
  22257. let expressionsKey = "expressions";
  22258. if (node.type === "TSTemplateLiteralType") {
  22259. expressionsKey = "types";
  22260. }
  22261. const parts = [];
  22262. let expressions = path.map(print, expressionsKey);
  22263. const isSimple = isSimpleTemplateLiteral(node);
  22264. if (isSimple) {
  22265. expressions = expressions.map((doc2) => printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22266. printWidth: Number.POSITIVE_INFINITY
  22267. })).formatted);
  22268. }
  22269. parts.push(lineSuffixBoundary, "`");
  22270. path.each((childPath) => {
  22271. const i = childPath.getName();
  22272. parts.push(print());
  22273. if (i < expressions.length) {
  22274. const {
  22275. tabWidth
  22276. } = options;
  22277. const quasi = childPath.getValue();
  22278. const indentSize = getIndentSize(quasi.value.raw, tabWidth);
  22279. let printed = expressions[i];
  22280. if (!isSimple) {
  22281. const expression = node[expressionsKey][i];
  22282. if (hasComment(expression) || isMemberExpression(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || expression.type === "TSAsExpression" || isBinaryish(expression)) {
  22283. printed = [indent([softline, printed]), softline];
  22284. }
  22285. }
  22286. const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align(Number.NEGATIVE_INFINITY, printed) : addAlignmentToDoc(printed, indentSize, tabWidth);
  22287. parts.push(group(["${", aligned, lineSuffixBoundary, "}"]));
  22288. }
  22289. }, "quasis");
  22290. parts.push("`");
  22291. return parts;
  22292. }
  22293. function printJestEachTemplateLiteral(path, options, print) {
  22294. const node = path.getNode();
  22295. const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
  22296. if (headerNames.length > 1 || headerNames.some((headerName) => headerName.length > 0)) {
  22297. options.__inJestEach = true;
  22298. const expressions = path.map(print, "expressions");
  22299. options.__inJestEach = false;
  22300. const parts = [];
  22301. const stringifiedExpressions = expressions.map((doc2) => "${" + printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
  22302. printWidth: Number.POSITIVE_INFINITY,
  22303. endOfLine: "lf"
  22304. })).formatted + "}");
  22305. const tableBody = [{
  22306. hasLineBreak: false,
  22307. cells: []
  22308. }];
  22309. for (let i = 1; i < node.quasis.length; i++) {
  22310. const row = getLast(tableBody);
  22311. const correspondingExpression = stringifiedExpressions[i - 1];
  22312. row.cells.push(correspondingExpression);
  22313. if (correspondingExpression.includes("\n")) {
  22314. row.hasLineBreak = true;
  22315. }
  22316. if (node.quasis[i].value.raw.includes("\n")) {
  22317. tableBody.push({
  22318. hasLineBreak: false,
  22319. cells: []
  22320. });
  22321. }
  22322. }
  22323. const maxColumnCount = Math.max(headerNames.length, ...tableBody.map((row) => row.cells.length));
  22324. const maxColumnWidths = Array.from({
  22325. length: maxColumnCount
  22326. }).fill(0);
  22327. const table = [{
  22328. cells: headerNames
  22329. }, ...tableBody.filter((row) => row.cells.length > 0)];
  22330. for (const {
  22331. cells
  22332. } of table.filter((row) => !row.hasLineBreak)) {
  22333. for (const [index, cell] of cells.entries()) {
  22334. maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth(cell));
  22335. }
  22336. }
  22337. 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, "`");
  22338. return parts;
  22339. }
  22340. }
  22341. function printTemplateExpression(path, print) {
  22342. const node = path.getValue();
  22343. let printed = print();
  22344. if (hasComment(node)) {
  22345. printed = group([indent([softline, printed]), softline]);
  22346. }
  22347. return ["${", printed, lineSuffixBoundary, "}"];
  22348. }
  22349. function printTemplateExpressions(path, print) {
  22350. return path.map((path2) => printTemplateExpression(path2, print), "expressions");
  22351. }
  22352. function escapeTemplateCharacters(doc2, raw) {
  22353. return mapDoc(doc2, (currentDoc) => {
  22354. if (typeof currentDoc === "string") {
  22355. return raw ? currentDoc.replace(/(\\*)`/g, "$1$1\\`") : uncookTemplateElementValue(currentDoc);
  22356. }
  22357. return currentDoc;
  22358. });
  22359. }
  22360. function uncookTemplateElementValue(cookedValue) {
  22361. return cookedValue.replace(/([\\`]|\${)/g, "\\$1");
  22362. }
  22363. module2.exports = {
  22364. printTemplateLiteral,
  22365. printTemplateExpressions,
  22366. escapeTemplateCharacters,
  22367. uncookTemplateElementValue
  22368. };
  22369. }
  22370. });
  22371. var require_markdown = __commonJS2({
  22372. "src/language-js/embed/markdown.js"(exports2, module2) {
  22373. "use strict";
  22374. var {
  22375. builders: {
  22376. indent,
  22377. softline,
  22378. literalline,
  22379. dedentToRoot
  22380. }
  22381. } = require("./doc.js");
  22382. var {
  22383. escapeTemplateCharacters
  22384. } = require_template_literal();
  22385. function format(path, print, textToDoc) {
  22386. const node = path.getValue();
  22387. let text = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
  22388. const indentation = getIndentation(text);
  22389. const hasIndent = indentation !== "";
  22390. if (hasIndent) {
  22391. text = text.replace(new RegExp(`^${indentation}`, "gm"), "");
  22392. }
  22393. const doc2 = escapeTemplateCharacters(textToDoc(text, {
  22394. parser: "markdown",
  22395. __inJsTemplate: true
  22396. }, {
  22397. stripTrailingHardline: true
  22398. }), true);
  22399. return ["`", hasIndent ? indent([softline, doc2]) : [literalline, dedentToRoot(doc2)], softline, "`"];
  22400. }
  22401. function getIndentation(str) {
  22402. const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
  22403. return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
  22404. }
  22405. module2.exports = format;
  22406. }
  22407. });
  22408. var require_css = __commonJS2({
  22409. "src/language-js/embed/css.js"(exports2, module2) {
  22410. "use strict";
  22411. var {
  22412. isNonEmptyArray
  22413. } = require_util();
  22414. var {
  22415. builders: {
  22416. indent,
  22417. hardline,
  22418. softline
  22419. },
  22420. utils: {
  22421. mapDoc,
  22422. replaceEndOfLine,
  22423. cleanDoc
  22424. }
  22425. } = require("./doc.js");
  22426. var {
  22427. printTemplateExpressions
  22428. } = require_template_literal();
  22429. function format(path, print, textToDoc) {
  22430. const node = path.getValue();
  22431. const rawQuasis = node.quasis.map((q) => q.value.raw);
  22432. let placeholderID = 0;
  22433. const text = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
  22434. const doc2 = textToDoc(text, {
  22435. parser: "scss"
  22436. }, {
  22437. stripTrailingHardline: true
  22438. });
  22439. const expressionDocs = printTemplateExpressions(path, print);
  22440. return transformCssDoc(doc2, node, expressionDocs);
  22441. }
  22442. function transformCssDoc(quasisDoc, parentNode, expressionDocs) {
  22443. const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
  22444. if (isEmpty) {
  22445. return "``";
  22446. }
  22447. const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
  22448. if (!newDoc) {
  22449. throw new Error("Couldn't insert all the expressions");
  22450. }
  22451. return ["`", indent([hardline, newDoc]), softline, "`"];
  22452. }
  22453. function replacePlaceholders(quasisDoc, expressionDocs) {
  22454. if (!isNonEmptyArray(expressionDocs)) {
  22455. return quasisDoc;
  22456. }
  22457. let replaceCounter = 0;
  22458. const newDoc = mapDoc(cleanDoc(quasisDoc), (doc2) => {
  22459. if (typeof doc2 !== "string" || !doc2.includes("@prettier-placeholder")) {
  22460. return doc2;
  22461. }
  22462. return doc2.split(/@prettier-placeholder-(\d+)-id/).map((component, idx) => {
  22463. if (idx % 2 === 0) {
  22464. return replaceEndOfLine(component);
  22465. }
  22466. replaceCounter++;
  22467. return expressionDocs[component];
  22468. });
  22469. });
  22470. return expressionDocs.length === replaceCounter ? newDoc : null;
  22471. }
  22472. module2.exports = format;
  22473. }
  22474. });
  22475. var require_graphql = __commonJS2({
  22476. "src/language-js/embed/graphql.js"(exports2, module2) {
  22477. "use strict";
  22478. var {
  22479. builders: {
  22480. indent,
  22481. join,
  22482. hardline
  22483. }
  22484. } = require("./doc.js");
  22485. var {
  22486. escapeTemplateCharacters,
  22487. printTemplateExpressions
  22488. } = require_template_literal();
  22489. function format(path, print, textToDoc) {
  22490. const node = path.getValue();
  22491. const numQuasis = node.quasis.length;
  22492. if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
  22493. return "``";
  22494. }
  22495. const expressionDocs = printTemplateExpressions(path, print);
  22496. const parts = [];
  22497. for (let i = 0; i < numQuasis; i++) {
  22498. const templateElement = node.quasis[i];
  22499. const isFirst = i === 0;
  22500. const isLast = i === numQuasis - 1;
  22501. const text = templateElement.value.cooked;
  22502. const lines = text.split("\n");
  22503. const numLines = lines.length;
  22504. const expressionDoc = expressionDocs[i];
  22505. const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
  22506. const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
  22507. const commentsAndWhitespaceOnly = lines.every((line) => /^\s*(?:#[^\n\r]*)?$/.test(line));
  22508. if (!isLast && /#[^\n\r]*$/.test(lines[numLines - 1])) {
  22509. return null;
  22510. }
  22511. let doc2 = null;
  22512. if (commentsAndWhitespaceOnly) {
  22513. doc2 = printGraphqlComments(lines);
  22514. } else {
  22515. doc2 = textToDoc(text, {
  22516. parser: "graphql"
  22517. }, {
  22518. stripTrailingHardline: true
  22519. });
  22520. }
  22521. if (doc2) {
  22522. doc2 = escapeTemplateCharacters(doc2, false);
  22523. if (!isFirst && startsWithBlankLine) {
  22524. parts.push("");
  22525. }
  22526. parts.push(doc2);
  22527. if (!isLast && endsWithBlankLine) {
  22528. parts.push("");
  22529. }
  22530. } else if (!isFirst && !isLast && startsWithBlankLine) {
  22531. parts.push("");
  22532. }
  22533. if (expressionDoc) {
  22534. parts.push(expressionDoc);
  22535. }
  22536. }
  22537. return ["`", indent([hardline, join(hardline, parts)]), hardline, "`"];
  22538. }
  22539. function printGraphqlComments(lines) {
  22540. const parts = [];
  22541. let seenComment = false;
  22542. const array = lines.map((textLine) => textLine.trim());
  22543. for (const [i, textLine] of array.entries()) {
  22544. if (textLine === "") {
  22545. continue;
  22546. }
  22547. if (array[i - 1] === "" && seenComment) {
  22548. parts.push([hardline, textLine]);
  22549. } else {
  22550. parts.push(textLine);
  22551. }
  22552. seenComment = true;
  22553. }
  22554. return parts.length === 0 ? null : join(hardline, parts);
  22555. }
  22556. module2.exports = format;
  22557. }
  22558. });
  22559. var require_html = __commonJS2({
  22560. "src/language-js/embed/html.js"(exports2, module2) {
  22561. "use strict";
  22562. var {
  22563. builders: {
  22564. indent,
  22565. line,
  22566. hardline,
  22567. group
  22568. },
  22569. utils: {
  22570. mapDoc
  22571. }
  22572. } = require("./doc.js");
  22573. var {
  22574. printTemplateExpressions,
  22575. uncookTemplateElementValue
  22576. } = require_template_literal();
  22577. var htmlTemplateLiteralCounter = 0;
  22578. function format(path, print, textToDoc, options, {
  22579. parser
  22580. }) {
  22581. const node = path.getValue();
  22582. const counter = htmlTemplateLiteralCounter;
  22583. htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
  22584. const composePlaceholder = (index) => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
  22585. const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
  22586. const expressionDocs = printTemplateExpressions(path, print);
  22587. if (expressionDocs.length === 0 && text.trim().length === 0) {
  22588. return "``";
  22589. }
  22590. const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
  22591. let topLevelCount = 0;
  22592. const doc2 = textToDoc(text, {
  22593. parser,
  22594. __onHtmlRoot(root) {
  22595. topLevelCount = root.children.length;
  22596. }
  22597. }, {
  22598. stripTrailingHardline: true
  22599. });
  22600. const contentDoc = mapDoc(doc2, (doc3) => {
  22601. if (typeof doc3 !== "string") {
  22602. return doc3;
  22603. }
  22604. const parts = [];
  22605. const components = doc3.split(placeholderRegex);
  22606. for (let i = 0; i < components.length; i++) {
  22607. let component = components[i];
  22608. if (i % 2 === 0) {
  22609. if (component) {
  22610. component = uncookTemplateElementValue(component);
  22611. if (options.__embeddedInHtml) {
  22612. component = component.replace(/<\/(script)\b/gi, "<\\/$1");
  22613. }
  22614. parts.push(component);
  22615. }
  22616. continue;
  22617. }
  22618. const placeholderIndex = Number(component);
  22619. parts.push(expressionDocs[placeholderIndex]);
  22620. }
  22621. return parts;
  22622. });
  22623. const leadingWhitespace = /^\s/.test(text) ? " " : "";
  22624. const trailingWhitespace = /\s$/.test(text) ? " " : "";
  22625. const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline : leadingWhitespace && trailingWhitespace ? line : null;
  22626. if (linebreak) {
  22627. return group(["`", indent([linebreak, group(contentDoc)]), linebreak, "`"]);
  22628. }
  22629. return group(["`", leadingWhitespace, topLevelCount > 1 ? indent(group(contentDoc)) : group(contentDoc), trailingWhitespace, "`"]);
  22630. }
  22631. module2.exports = format;
  22632. }
  22633. });
  22634. var require_embed = __commonJS2({
  22635. "src/language-js/embed.js"(exports2, module2) {
  22636. "use strict";
  22637. var {
  22638. hasComment,
  22639. CommentCheckFlags,
  22640. isObjectProperty
  22641. } = require_utils7();
  22642. var formatMarkdown = require_markdown();
  22643. var formatCss = require_css();
  22644. var formatGraphql = require_graphql();
  22645. var formatHtml = require_html();
  22646. function getLanguage(path) {
  22647. if (isStyledJsx(path) || isStyledComponents(path) || isCssProp(path) || isAngularComponentStyles(path)) {
  22648. return "css";
  22649. }
  22650. if (isGraphQL(path)) {
  22651. return "graphql";
  22652. }
  22653. if (isHtml(path)) {
  22654. return "html";
  22655. }
  22656. if (isAngularComponentTemplate(path)) {
  22657. return "angular";
  22658. }
  22659. if (isMarkdown(path)) {
  22660. return "markdown";
  22661. }
  22662. }
  22663. function embed(path, print, textToDoc, options) {
  22664. const node = path.getValue();
  22665. if (node.type !== "TemplateLiteral" || hasInvalidCookedValue(node)) {
  22666. return;
  22667. }
  22668. const language = getLanguage(path);
  22669. if (!language) {
  22670. return;
  22671. }
  22672. if (language === "markdown") {
  22673. return formatMarkdown(path, print, textToDoc);
  22674. }
  22675. if (language === "css") {
  22676. return formatCss(path, print, textToDoc);
  22677. }
  22678. if (language === "graphql") {
  22679. return formatGraphql(path, print, textToDoc);
  22680. }
  22681. if (language === "html" || language === "angular") {
  22682. return formatHtml(path, print, textToDoc, options, {
  22683. parser: language
  22684. });
  22685. }
  22686. }
  22687. function isMarkdown(path) {
  22688. const node = path.getValue();
  22689. const parent = path.getParentNode();
  22690. return parent && parent.type === "TaggedTemplateExpression" && node.quasis.length === 1 && parent.tag.type === "Identifier" && (parent.tag.name === "md" || parent.tag.name === "markdown");
  22691. }
  22692. function isStyledJsx(path) {
  22693. const node = path.getValue();
  22694. const parent = path.getParentNode();
  22695. const parentParent = path.getParentNode(1);
  22696. 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");
  22697. }
  22698. function isAngularComponentStyles(path) {
  22699. 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);
  22700. }
  22701. function isAngularComponentTemplate(path) {
  22702. return path.match((node) => node.type === "TemplateLiteral", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
  22703. }
  22704. 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"];
  22705. function isStyledComponents(path) {
  22706. const parent = path.getParentNode();
  22707. if (!parent || parent.type !== "TaggedTemplateExpression") {
  22708. return false;
  22709. }
  22710. const tag = parent.tag.type === "ParenthesizedExpression" ? parent.tag.expression : parent.tag;
  22711. switch (tag.type) {
  22712. case "MemberExpression":
  22713. return isStyledIdentifier(tag.object) || isStyledExtend(tag);
  22714. case "CallExpression":
  22715. 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));
  22716. case "Identifier":
  22717. return tag.name === "css";
  22718. default:
  22719. return false;
  22720. }
  22721. }
  22722. function isCssProp(path) {
  22723. const parent = path.getParentNode();
  22724. const parentParent = path.getParentNode(1);
  22725. return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
  22726. }
  22727. function isStyledIdentifier(node) {
  22728. return node.type === "Identifier" && node.name === "styled";
  22729. }
  22730. function isStyledExtend(node) {
  22731. return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
  22732. }
  22733. function isGraphQL(path) {
  22734. const node = path.getValue();
  22735. const parent = path.getParentNode();
  22736. 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");
  22737. }
  22738. function hasLanguageComment(node, languageName) {
  22739. return hasComment(node, CommentCheckFlags.Block | CommentCheckFlags.Leading, ({
  22740. value
  22741. }) => value === ` ${languageName} `);
  22742. }
  22743. function isHtml(path) {
  22744. 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");
  22745. }
  22746. function hasInvalidCookedValue({
  22747. quasis
  22748. }) {
  22749. return quasis.some(({
  22750. value: {
  22751. cooked
  22752. }
  22753. }) => cooked === null);
  22754. }
  22755. module2.exports = embed;
  22756. }
  22757. });
  22758. var require_clean = __commonJS2({
  22759. "src/language-js/clean.js"(exports2, module2) {
  22760. "use strict";
  22761. var isBlockComment = require_is_block_comment();
  22762. var ignoredProperties = /* @__PURE__ */ new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
  22763. var removeTemplateElementsValue = (node) => {
  22764. for (const templateElement of node.quasis) {
  22765. delete templateElement.value;
  22766. }
  22767. };
  22768. function clean(ast, newObj, parent) {
  22769. if (ast.type === "Program") {
  22770. delete newObj.sourceType;
  22771. }
  22772. if (ast.type === "BigIntLiteral" || ast.type === "BigIntLiteralTypeAnnotation") {
  22773. if (newObj.value) {
  22774. newObj.value = newObj.value.toLowerCase();
  22775. }
  22776. }
  22777. if (ast.type === "BigIntLiteral" || ast.type === "Literal") {
  22778. if (newObj.bigint) {
  22779. newObj.bigint = newObj.bigint.toLowerCase();
  22780. }
  22781. }
  22782. if (ast.type === "DecimalLiteral") {
  22783. newObj.value = Number(newObj.value);
  22784. }
  22785. if (ast.type === "Literal" && newObj.decimal) {
  22786. newObj.decimal = Number(newObj.decimal);
  22787. }
  22788. if (ast.type === "EmptyStatement") {
  22789. return null;
  22790. }
  22791. if (ast.type === "JSXText") {
  22792. return null;
  22793. }
  22794. if (ast.type === "JSXExpressionContainer" && (ast.expression.type === "Literal" || ast.expression.type === "StringLiteral") && ast.expression.value === " ") {
  22795. return null;
  22796. }
  22797. 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")) {
  22798. delete newObj.key;
  22799. }
  22800. if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some((attr) => attr.name.name === "jsx")) {
  22801. for (const {
  22802. type,
  22803. expression: expression2
  22804. } of newObj.children) {
  22805. if (type === "JSXExpressionContainer" && expression2.type === "TemplateLiteral") {
  22806. removeTemplateElementsValue(expression2);
  22807. }
  22808. }
  22809. }
  22810. if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
  22811. removeTemplateElementsValue(newObj.value.expression);
  22812. }
  22813. if (ast.type === "JSXAttribute" && ast.value && ast.value.type === "Literal" && /["']|&quot;|&apos;/.test(ast.value.value)) {
  22814. newObj.value.value = newObj.value.value.replace(/["']|&quot;|&apos;/g, '"');
  22815. }
  22816. const expression = ast.expression || ast.callee;
  22817. if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
  22818. const astProps = ast.expression.arguments[0].properties;
  22819. for (const [index, prop] of newObj.expression.arguments[0].properties.entries()) {
  22820. switch (astProps[index].key.name) {
  22821. case "styles":
  22822. if (prop.value.type === "ArrayExpression") {
  22823. removeTemplateElementsValue(prop.value.elements[0]);
  22824. }
  22825. break;
  22826. case "template":
  22827. if (prop.value.type === "TemplateLiteral") {
  22828. removeTemplateElementsValue(prop.value);
  22829. }
  22830. break;
  22831. }
  22832. }
  22833. }
  22834. 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")) {
  22835. removeTemplateElementsValue(newObj.quasi);
  22836. }
  22837. if (ast.type === "TemplateLiteral") {
  22838. var _ast$leadingComments;
  22839. 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} `));
  22840. if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql" || !ast.leadingComments) {
  22841. removeTemplateElementsValue(newObj);
  22842. }
  22843. }
  22844. if (ast.type === "InterpreterDirective") {
  22845. newObj.value = newObj.value.trimEnd();
  22846. }
  22847. if ((ast.type === "TSIntersectionType" || ast.type === "TSUnionType") && ast.types.length === 1) {
  22848. return newObj.types[0];
  22849. }
  22850. }
  22851. clean.ignoredProperties = ignoredProperties;
  22852. module2.exports = clean;
  22853. }
  22854. });
  22855. var require_detect_newline = __commonJS2({
  22856. "node_modules/detect-newline/index.js"(exports2, module2) {
  22857. "use strict";
  22858. var detectNewline = (string) => {
  22859. if (typeof string !== "string") {
  22860. throw new TypeError("Expected a string");
  22861. }
  22862. const newlines = string.match(/(?:\r?\n)/g) || [];
  22863. if (newlines.length === 0) {
  22864. return;
  22865. }
  22866. const crlf = newlines.filter((newline) => newline === "\r\n").length;
  22867. const lf = newlines.length - crlf;
  22868. return crlf > lf ? "\r\n" : "\n";
  22869. };
  22870. module2.exports = detectNewline;
  22871. module2.exports.graceful = (string) => typeof string === "string" && detectNewline(string) || "\n";
  22872. }
  22873. });
  22874. var require_build = __commonJS2({
  22875. "node_modules/jest-docblock/build/index.js"(exports2) {
  22876. "use strict";
  22877. Object.defineProperty(exports2, "__esModule", {
  22878. value: true
  22879. });
  22880. exports2.extract = extract;
  22881. exports2.parse = parse;
  22882. exports2.parseWithComments = parseWithComments;
  22883. exports2.print = print;
  22884. exports2.strip = strip;
  22885. function _os() {
  22886. const data = require("os");
  22887. _os = function() {
  22888. return data;
  22889. };
  22890. return data;
  22891. }
  22892. function _detectNewline() {
  22893. const data = _interopRequireDefault(require_detect_newline());
  22894. _detectNewline = function() {
  22895. return data;
  22896. };
  22897. return data;
  22898. }
  22899. function _interopRequireDefault(obj) {
  22900. return obj && obj.__esModule ? obj : {
  22901. default: obj
  22902. };
  22903. }
  22904. var commentEndRe = /\*\/$/;
  22905. var commentStartRe = /^\/\*\*/;
  22906. var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
  22907. var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
  22908. var ltrimNewlineRe = /^(\r?\n)+/;
  22909. var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
  22910. var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
  22911. var stringStartRe = /(\r?\n|^) *\* ?/g;
  22912. var STRING_ARRAY = [];
  22913. function extract(contents) {
  22914. const match = contents.match(docblockRe);
  22915. return match ? match[0].trimLeft() : "";
  22916. }
  22917. function strip(contents) {
  22918. const match = contents.match(docblockRe);
  22919. return match && match[0] ? contents.substring(match[0].length) : contents;
  22920. }
  22921. function parse(docblock) {
  22922. return parseWithComments(docblock).pragmas;
  22923. }
  22924. function parseWithComments(docblock) {
  22925. const line = (0, _detectNewline().default)(docblock) || _os().EOL;
  22926. docblock = docblock.replace(commentStartRe, "").replace(commentEndRe, "").replace(stringStartRe, "$1");
  22927. let prev = "";
  22928. while (prev !== docblock) {
  22929. prev = docblock;
  22930. docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`);
  22931. }
  22932. docblock = docblock.replace(ltrimNewlineRe, "").trimRight();
  22933. const result = /* @__PURE__ */ Object.create(null);
  22934. const comments = docblock.replace(propertyRe, "").replace(ltrimNewlineRe, "").trimRight();
  22935. let match;
  22936. while (match = propertyRe.exec(docblock)) {
  22937. const nextPragma = match[2].replace(lineCommentRe, "");
  22938. if (typeof result[match[1]] === "string" || Array.isArray(result[match[1]])) {
  22939. result[match[1]] = STRING_ARRAY.concat(result[match[1]], nextPragma);
  22940. } else {
  22941. result[match[1]] = nextPragma;
  22942. }
  22943. }
  22944. return {
  22945. comments,
  22946. pragmas: result
  22947. };
  22948. }
  22949. function print({
  22950. comments = "",
  22951. pragmas = {}
  22952. }) {
  22953. const line = (0, _detectNewline().default)(comments) || _os().EOL;
  22954. const head = "/**";
  22955. const start = " *";
  22956. const tail = " */";
  22957. const keys = Object.keys(pragmas);
  22958. const printedObject = keys.map((key) => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map((keyValue) => start + " " + keyValue + line).join("");
  22959. if (!comments) {
  22960. if (keys.length === 0) {
  22961. return "";
  22962. }
  22963. if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
  22964. const value = pragmas[keys[0]];
  22965. return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`;
  22966. }
  22967. }
  22968. const printedComments = comments.split(line).map((textLine) => `${start} ${textLine}`).join(line) + line;
  22969. return head + line + (comments ? printedComments : "") + (comments && keys.length ? start + line : "") + printedObject + tail;
  22970. }
  22971. function printKeyValues(key, valueOrArray) {
  22972. return STRING_ARRAY.concat(valueOrArray).map((value) => `@${key} ${value}`.trim());
  22973. }
  22974. }
  22975. });
  22976. var require_get_shebang = __commonJS2({
  22977. "src/language-js/utils/get-shebang.js"(exports2, module2) {
  22978. "use strict";
  22979. function getShebang(text) {
  22980. if (!text.startsWith("#!")) {
  22981. return "";
  22982. }
  22983. const index = text.indexOf("\n");
  22984. if (index === -1) {
  22985. return text;
  22986. }
  22987. return text.slice(0, index);
  22988. }
  22989. module2.exports = getShebang;
  22990. }
  22991. });
  22992. var require_pragma = __commonJS2({
  22993. "src/language-js/pragma.js"(exports2, module2) {
  22994. "use strict";
  22995. var {
  22996. parseWithComments,
  22997. strip,
  22998. extract,
  22999. print
  23000. } = require_build();
  23001. var {
  23002. normalizeEndOfLine
  23003. } = require_end_of_line();
  23004. var getShebang = require_get_shebang();
  23005. function parseDocBlock(text) {
  23006. const shebang = getShebang(text);
  23007. if (shebang) {
  23008. text = text.slice(shebang.length + 1);
  23009. }
  23010. const docBlock = extract(text);
  23011. const {
  23012. pragmas,
  23013. comments
  23014. } = parseWithComments(docBlock);
  23015. return {
  23016. shebang,
  23017. text,
  23018. pragmas,
  23019. comments
  23020. };
  23021. }
  23022. function hasPragma(text) {
  23023. const pragmas = Object.keys(parseDocBlock(text).pragmas);
  23024. return pragmas.includes("prettier") || pragmas.includes("format");
  23025. }
  23026. function insertPragma(originalText) {
  23027. const {
  23028. shebang,
  23029. text,
  23030. pragmas,
  23031. comments
  23032. } = parseDocBlock(originalText);
  23033. const strippedText = strip(text);
  23034. const docBlock = print({
  23035. pragmas: Object.assign({
  23036. format: ""
  23037. }, pragmas),
  23038. comments: comments.trimStart()
  23039. });
  23040. return (shebang ? `${shebang}
  23041. ` : "") + normalizeEndOfLine(docBlock) + (strippedText.startsWith("\n") ? "\n" : "\n\n") + strippedText;
  23042. }
  23043. module2.exports = {
  23044. hasPragma,
  23045. insertPragma
  23046. };
  23047. }
  23048. });
  23049. var require_comments2 = __commonJS2({
  23050. "src/language-js/comments.js"(exports2, module2) {
  23051. "use strict";
  23052. var {
  23053. getLast,
  23054. hasNewline,
  23055. getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
  23056. getNextNonSpaceNonCommentCharacter,
  23057. hasNewlineInRange,
  23058. addLeadingComment,
  23059. addTrailingComment,
  23060. addDanglingComment,
  23061. getNextNonSpaceNonCommentCharacterIndex,
  23062. isNonEmptyArray
  23063. } = require_util();
  23064. var {
  23065. getFunctionParameters,
  23066. isPrettierIgnoreComment,
  23067. isJsxNode,
  23068. hasFlowShorthandAnnotationComment,
  23069. hasFlowAnnotationComment,
  23070. hasIgnoreComment,
  23071. isCallLikeExpression,
  23072. getCallArguments,
  23073. isCallExpression,
  23074. isMemberExpression,
  23075. isObjectProperty,
  23076. isLineComment,
  23077. getComments,
  23078. CommentCheckFlags,
  23079. markerForIfWithoutBlockAndSameLineComment
  23080. } = require_utils7();
  23081. var {
  23082. locStart,
  23083. locEnd
  23084. } = require_loc();
  23085. var isBlockComment = require_is_block_comment();
  23086. function handleOwnLineComment(context) {
  23087. return [handleIgnoreComments, handleLastFunctionArgComments, handleMemberExpressionComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleForComments, handleUnionTypeComments, handleOnlyComments, handleModuleSpecifiersComments, handleAssignmentPatternComments, handleMethodNameComments, handleLabeledStatementComments, handleBreakAndContinueStatementComments].some((fn) => fn(context));
  23088. }
  23089. function handleEndOfLineComment(context) {
  23090. return [handleClosureTypeCastComments, handleLastFunctionArgComments, handleConditionalExpressionComments, handleModuleSpecifiersComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, handleOnlyComments, handleVariableDeclaratorComments, handleBreakAndContinueStatementComments, handleSwitchDefaultCaseComments].some((fn) => fn(context));
  23091. }
  23092. function handleRemainingComment(context) {
  23093. return [handleIgnoreComments, handleIfStatementComments, handleWhileComments, handleObjectPropertyAssignment, handleCommentInEmptyParens, handleMethodNameComments, handleOnlyComments, handleCommentAfterArrowParams, handleFunctionNameComments, handleTSMappedTypeComments, handleBreakAndContinueStatementComments, handleTSFunctionTrailingComments].some((fn) => fn(context));
  23094. }
  23095. function addBlockStatementFirstComment(node, comment) {
  23096. const firstNonEmptyNode = (node.body || node.properties).find(({
  23097. type
  23098. }) => type !== "EmptyStatement");
  23099. if (firstNonEmptyNode) {
  23100. addLeadingComment(firstNonEmptyNode, comment);
  23101. } else {
  23102. addDanglingComment(node, comment);
  23103. }
  23104. }
  23105. function addBlockOrNotComment(node, comment) {
  23106. if (node.type === "BlockStatement") {
  23107. addBlockStatementFirstComment(node, comment);
  23108. } else {
  23109. addLeadingComment(node, comment);
  23110. }
  23111. }
  23112. function handleClosureTypeCastComments({
  23113. comment,
  23114. followingNode
  23115. }) {
  23116. if (followingNode && isTypeCastComment(comment)) {
  23117. addLeadingComment(followingNode, comment);
  23118. return true;
  23119. }
  23120. return false;
  23121. }
  23122. function handleIfStatementComments({
  23123. comment,
  23124. precedingNode,
  23125. enclosingNode,
  23126. followingNode,
  23127. text
  23128. }) {
  23129. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "IfStatement" || !followingNode) {
  23130. return false;
  23131. }
  23132. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23133. if (nextCharacter === ")") {
  23134. addTrailingComment(precedingNode, comment);
  23135. return true;
  23136. }
  23137. if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
  23138. if (precedingNode.type === "BlockStatement") {
  23139. addTrailingComment(precedingNode, comment);
  23140. } else {
  23141. const isSingleLineComment = comment.type === "SingleLine" || comment.loc.start.line === comment.loc.end.line;
  23142. const isSameLineComment = comment.loc.start.line === precedingNode.loc.start.line;
  23143. if (isSingleLineComment && isSameLineComment) {
  23144. addDanglingComment(precedingNode, comment, markerForIfWithoutBlockAndSameLineComment);
  23145. } else {
  23146. addDanglingComment(enclosingNode, comment);
  23147. }
  23148. }
  23149. return true;
  23150. }
  23151. if (followingNode.type === "BlockStatement") {
  23152. addBlockStatementFirstComment(followingNode, comment);
  23153. return true;
  23154. }
  23155. if (followingNode.type === "IfStatement") {
  23156. addBlockOrNotComment(followingNode.consequent, comment);
  23157. return true;
  23158. }
  23159. if (enclosingNode.consequent === followingNode) {
  23160. addLeadingComment(followingNode, comment);
  23161. return true;
  23162. }
  23163. return false;
  23164. }
  23165. function handleWhileComments({
  23166. comment,
  23167. precedingNode,
  23168. enclosingNode,
  23169. followingNode,
  23170. text
  23171. }) {
  23172. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "WhileStatement" || !followingNode) {
  23173. return false;
  23174. }
  23175. const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
  23176. if (nextCharacter === ")") {
  23177. addTrailingComment(precedingNode, comment);
  23178. return true;
  23179. }
  23180. if (followingNode.type === "BlockStatement") {
  23181. addBlockStatementFirstComment(followingNode, comment);
  23182. return true;
  23183. }
  23184. if (enclosingNode.body === followingNode) {
  23185. addLeadingComment(followingNode, comment);
  23186. return true;
  23187. }
  23188. return false;
  23189. }
  23190. function handleTryStatementComments({
  23191. comment,
  23192. precedingNode,
  23193. enclosingNode,
  23194. followingNode
  23195. }) {
  23196. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TryStatement" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "CatchClause" || !followingNode) {
  23197. return false;
  23198. }
  23199. if (enclosingNode.type === "CatchClause" && precedingNode) {
  23200. addTrailingComment(precedingNode, comment);
  23201. return true;
  23202. }
  23203. if (followingNode.type === "BlockStatement") {
  23204. addBlockStatementFirstComment(followingNode, comment);
  23205. return true;
  23206. }
  23207. if (followingNode.type === "TryStatement") {
  23208. addBlockOrNotComment(followingNode.finalizer, comment);
  23209. return true;
  23210. }
  23211. if (followingNode.type === "CatchClause") {
  23212. addBlockOrNotComment(followingNode.body, comment);
  23213. return true;
  23214. }
  23215. return false;
  23216. }
  23217. function handleMemberExpressionComments({
  23218. comment,
  23219. enclosingNode,
  23220. followingNode
  23221. }) {
  23222. if (isMemberExpression(enclosingNode) && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Identifier") {
  23223. addLeadingComment(enclosingNode, comment);
  23224. return true;
  23225. }
  23226. return false;
  23227. }
  23228. function handleConditionalExpressionComments({
  23229. comment,
  23230. precedingNode,
  23231. enclosingNode,
  23232. followingNode,
  23233. text
  23234. }) {
  23235. const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment));
  23236. if ((!precedingNode || !isSameLineAsPrecedingNode) && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ConditionalExpression" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSConditionalType") && followingNode) {
  23237. addLeadingComment(followingNode, comment);
  23238. return true;
  23239. }
  23240. return false;
  23241. }
  23242. function handleObjectPropertyAssignment({
  23243. comment,
  23244. precedingNode,
  23245. enclosingNode
  23246. }) {
  23247. if (isObjectProperty(enclosingNode) && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
  23248. addTrailingComment(enclosingNode.value.left, comment);
  23249. return true;
  23250. }
  23251. return false;
  23252. }
  23253. var classLikeNodeTypes = /* @__PURE__ */ new Set(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
  23254. function handleClassComments({
  23255. comment,
  23256. precedingNode,
  23257. enclosingNode,
  23258. followingNode
  23259. }) {
  23260. if (classLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23261. if (isNonEmptyArray(enclosingNode.decorators) && !(followingNode && followingNode.type === "Decorator")) {
  23262. addTrailingComment(getLast(enclosingNode.decorators), comment);
  23263. return true;
  23264. }
  23265. if (enclosingNode.body && followingNode === enclosingNode.body) {
  23266. addBlockStatementFirstComment(enclosingNode.body, comment);
  23267. return true;
  23268. }
  23269. if (followingNode) {
  23270. if (enclosingNode.superClass && followingNode === enclosingNode.superClass && precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters)) {
  23271. addTrailingComment(precedingNode, comment);
  23272. return true;
  23273. }
  23274. for (const prop of ["implements", "extends", "mixins"]) {
  23275. if (enclosingNode[prop] && followingNode === enclosingNode[prop][0]) {
  23276. if (precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters || precedingNode === enclosingNode.superClass)) {
  23277. addTrailingComment(precedingNode, comment);
  23278. } else {
  23279. addDanglingComment(enclosingNode, comment, prop);
  23280. }
  23281. return true;
  23282. }
  23283. }
  23284. }
  23285. }
  23286. return false;
  23287. }
  23288. var propertyLikeNodeTypes = /* @__PURE__ */ new Set(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition"]);
  23289. function handleMethodNameComments({
  23290. comment,
  23291. precedingNode,
  23292. enclosingNode,
  23293. text
  23294. }) {
  23295. 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) !== ":") {
  23296. addTrailingComment(precedingNode, comment);
  23297. return true;
  23298. }
  23299. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Decorator" && propertyLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23300. addTrailingComment(precedingNode, comment);
  23301. return true;
  23302. }
  23303. return false;
  23304. }
  23305. var functionLikeNodeTypes = /* @__PURE__ */ new Set(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
  23306. function handleFunctionNameComments({
  23307. comment,
  23308. precedingNode,
  23309. enclosingNode,
  23310. text
  23311. }) {
  23312. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== "(") {
  23313. return false;
  23314. }
  23315. if (precedingNode && functionLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
  23316. addTrailingComment(precedingNode, comment);
  23317. return true;
  23318. }
  23319. return false;
  23320. }
  23321. function handleCommentAfterArrowParams({
  23322. comment,
  23323. enclosingNode,
  23324. text
  23325. }) {
  23326. if (!((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ArrowFunctionExpression")) {
  23327. return false;
  23328. }
  23329. const index = getNextNonSpaceNonCommentCharacterIndex(text, comment, locEnd);
  23330. if (index !== false && text.slice(index, index + 2) === "=>") {
  23331. addDanglingComment(enclosingNode, comment);
  23332. return true;
  23333. }
  23334. return false;
  23335. }
  23336. function handleCommentInEmptyParens({
  23337. comment,
  23338. enclosingNode,
  23339. text
  23340. }) {
  23341. if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== ")") {
  23342. return false;
  23343. }
  23344. if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters(enclosingNode).length === 0 || isCallLikeExpression(enclosingNode) && getCallArguments(enclosingNode).length === 0)) {
  23345. addDanglingComment(enclosingNode, comment);
  23346. return true;
  23347. }
  23348. 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) {
  23349. addDanglingComment(enclosingNode.value, comment);
  23350. return true;
  23351. }
  23352. return false;
  23353. }
  23354. function handleLastFunctionArgComments({
  23355. comment,
  23356. precedingNode,
  23357. enclosingNode,
  23358. followingNode,
  23359. text
  23360. }) {
  23361. 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") {
  23362. addTrailingComment(precedingNode, comment);
  23363. return true;
  23364. }
  23365. 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) === ")") {
  23366. addTrailingComment(precedingNode, comment);
  23367. return true;
  23368. }
  23369. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionDeclaration" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "BlockStatement") {
  23370. const functionParamRightParenIndex = (() => {
  23371. const parameters = getFunctionParameters(enclosingNode);
  23372. if (parameters.length > 0) {
  23373. return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(getLast(parameters)));
  23374. }
  23375. const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(enclosingNode.id));
  23376. return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
  23377. })();
  23378. if (locStart(comment) > functionParamRightParenIndex) {
  23379. addBlockStatementFirstComment(followingNode, comment);
  23380. return true;
  23381. }
  23382. }
  23383. return false;
  23384. }
  23385. function handleLabeledStatementComments({
  23386. comment,
  23387. enclosingNode
  23388. }) {
  23389. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "LabeledStatement") {
  23390. addLeadingComment(enclosingNode, comment);
  23391. return true;
  23392. }
  23393. return false;
  23394. }
  23395. function handleBreakAndContinueStatementComments({
  23396. comment,
  23397. enclosingNode
  23398. }) {
  23399. if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ContinueStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "BreakStatement") && !enclosingNode.label) {
  23400. addTrailingComment(enclosingNode, comment);
  23401. return true;
  23402. }
  23403. return false;
  23404. }
  23405. function handleCallExpressionComments({
  23406. comment,
  23407. precedingNode,
  23408. enclosingNode
  23409. }) {
  23410. if (isCallExpression(enclosingNode) && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
  23411. addLeadingComment(enclosingNode.arguments[0], comment);
  23412. return true;
  23413. }
  23414. return false;
  23415. }
  23416. function handleUnionTypeComments({
  23417. comment,
  23418. precedingNode,
  23419. enclosingNode,
  23420. followingNode
  23421. }) {
  23422. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "UnionTypeAnnotation" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSUnionType") {
  23423. if (isPrettierIgnoreComment(comment)) {
  23424. followingNode.prettierIgnore = true;
  23425. comment.unignore = true;
  23426. }
  23427. if (precedingNode) {
  23428. addTrailingComment(precedingNode, comment);
  23429. return true;
  23430. }
  23431. return false;
  23432. }
  23433. if (((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "UnionTypeAnnotation" || (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSUnionType") && isPrettierIgnoreComment(comment)) {
  23434. followingNode.types[0].prettierIgnore = true;
  23435. comment.unignore = true;
  23436. }
  23437. return false;
  23438. }
  23439. function handlePropertyComments({
  23440. comment,
  23441. enclosingNode
  23442. }) {
  23443. if (isObjectProperty(enclosingNode)) {
  23444. addLeadingComment(enclosingNode, comment);
  23445. return true;
  23446. }
  23447. return false;
  23448. }
  23449. function handleOnlyComments({
  23450. comment,
  23451. enclosingNode,
  23452. followingNode,
  23453. ast,
  23454. isLastComment
  23455. }) {
  23456. if (ast && ast.body && ast.body.length === 0) {
  23457. if (isLastComment) {
  23458. addDanglingComment(ast, comment);
  23459. } else {
  23460. addLeadingComment(ast, comment);
  23461. }
  23462. return true;
  23463. }
  23464. 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)) {
  23465. if (isLastComment) {
  23466. addDanglingComment(enclosingNode, comment);
  23467. } else {
  23468. addLeadingComment(enclosingNode, comment);
  23469. }
  23470. return true;
  23471. }
  23472. 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") {
  23473. addDanglingComment(followingNode, comment);
  23474. return true;
  23475. }
  23476. return false;
  23477. }
  23478. function handleForComments({
  23479. comment,
  23480. enclosingNode
  23481. }) {
  23482. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForInStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForOfStatement") {
  23483. addLeadingComment(enclosingNode, comment);
  23484. return true;
  23485. }
  23486. return false;
  23487. }
  23488. function handleModuleSpecifiersComments({
  23489. comment,
  23490. precedingNode,
  23491. enclosingNode,
  23492. text
  23493. }) {
  23494. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportSpecifier" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportSpecifier") {
  23495. addLeadingComment(enclosingNode, comment);
  23496. return true;
  23497. }
  23498. const isImportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ImportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportDeclaration";
  23499. const isExportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ExportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportNamedDeclaration";
  23500. if ((isImportDeclaration || isExportDeclaration) && hasNewline(text, locEnd(comment))) {
  23501. addTrailingComment(precedingNode, comment);
  23502. return true;
  23503. }
  23504. return false;
  23505. }
  23506. function handleAssignmentPatternComments({
  23507. comment,
  23508. enclosingNode
  23509. }) {
  23510. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "AssignmentPattern") {
  23511. addLeadingComment(enclosingNode, comment);
  23512. return true;
  23513. }
  23514. return false;
  23515. }
  23516. var assignmentLikeNodeTypes = /* @__PURE__ */ new Set(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]);
  23517. var complexExprNodeTypes = /* @__PURE__ */ new Set(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
  23518. function handleVariableDeclaratorComments({
  23519. comment,
  23520. enclosingNode,
  23521. followingNode
  23522. }) {
  23523. if (assignmentLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) && followingNode && (complexExprNodeTypes.has(followingNode.type) || isBlockComment(comment))) {
  23524. addLeadingComment(followingNode, comment);
  23525. return true;
  23526. }
  23527. return false;
  23528. }
  23529. function handleTSFunctionTrailingComments({
  23530. comment,
  23531. enclosingNode,
  23532. followingNode,
  23533. text
  23534. }) {
  23535. 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) === ";") {
  23536. addTrailingComment(enclosingNode, comment);
  23537. return true;
  23538. }
  23539. return false;
  23540. }
  23541. function handleIgnoreComments({
  23542. comment,
  23543. enclosingNode,
  23544. followingNode
  23545. }) {
  23546. 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) {
  23547. enclosingNode.prettierIgnore = true;
  23548. comment.unignore = true;
  23549. return true;
  23550. }
  23551. }
  23552. function handleTSMappedTypeComments({
  23553. comment,
  23554. precedingNode,
  23555. enclosingNode,
  23556. followingNode
  23557. }) {
  23558. if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TSMappedType") {
  23559. return false;
  23560. }
  23561. if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.name) {
  23562. addLeadingComment(followingNode.name, comment);
  23563. return true;
  23564. }
  23565. if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "TSTypeParameter" && precedingNode.constraint) {
  23566. addTrailingComment(precedingNode.constraint, comment);
  23567. return true;
  23568. }
  23569. return false;
  23570. }
  23571. function handleSwitchDefaultCaseComments({
  23572. comment,
  23573. enclosingNode,
  23574. followingNode
  23575. }) {
  23576. if (!enclosingNode || enclosingNode.type !== "SwitchCase" || enclosingNode.test) {
  23577. return false;
  23578. }
  23579. if (followingNode.type === "BlockStatement" && isLineComment(comment)) {
  23580. addBlockStatementFirstComment(followingNode, comment);
  23581. } else {
  23582. addDanglingComment(enclosingNode, comment);
  23583. }
  23584. return true;
  23585. }
  23586. function isRealFunctionLikeNode(node) {
  23587. 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";
  23588. }
  23589. function getCommentChildNodes(node, options) {
  23590. 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) {
  23591. return [...node.decorators || [], node.key, node.value.body];
  23592. }
  23593. }
  23594. function isTypeCastComment(comment) {
  23595. return isBlockComment(comment) && comment.value[0] === "*" && /@type\b/.test(comment.value);
  23596. }
  23597. function willPrintOwnComments(path) {
  23598. const node = path.getValue();
  23599. const parent = path.getParentNode();
  23600. const hasFlowAnnotations = (node2) => hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Leading)) || hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Trailing));
  23601. 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");
  23602. }
  23603. module2.exports = {
  23604. handleOwnLineComment,
  23605. handleEndOfLineComment,
  23606. handleRemainingComment,
  23607. isTypeCastComment,
  23608. getCommentChildNodes,
  23609. willPrintOwnComments
  23610. };
  23611. }
  23612. });
  23613. var require_needs_parens = __commonJS2({
  23614. "src/language-js/needs-parens.js"(exports2, module2) {
  23615. "use strict";
  23616. var getLast = require_get_last();
  23617. var isNonEmptyArray = require_is_non_empty_array();
  23618. var {
  23619. getFunctionParameters,
  23620. getLeftSidePathName,
  23621. hasFlowShorthandAnnotationComment,
  23622. hasNakedLeftSide,
  23623. hasNode,
  23624. isBitwiseOperator,
  23625. startsWithNoLookaheadToken,
  23626. shouldFlatten,
  23627. getPrecedence,
  23628. isCallExpression,
  23629. isMemberExpression,
  23630. isObjectProperty
  23631. } = require_utils7();
  23632. function needsParens(path, options) {
  23633. const parent = path.getParentNode();
  23634. if (!parent) {
  23635. return false;
  23636. }
  23637. const name = path.getName();
  23638. const node = path.getNode();
  23639. if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
  23640. return true;
  23641. }
  23642. if (isStatement(node)) {
  23643. return false;
  23644. }
  23645. if (options.parser !== "flow" && hasFlowShorthandAnnotationComment(path.getValue())) {
  23646. return true;
  23647. }
  23648. if (node.type === "Identifier") {
  23649. if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
  23650. return true;
  23651. }
  23652. if (name === "left" && node.name === "async" && parent.type === "ForOfStatement" && !parent.await) {
  23653. return true;
  23654. }
  23655. return false;
  23656. }
  23657. switch (parent.type) {
  23658. case "ParenthesizedExpression":
  23659. return false;
  23660. case "ClassDeclaration":
  23661. case "ClassExpression": {
  23662. 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")) {
  23663. return true;
  23664. }
  23665. break;
  23666. }
  23667. case "ExportDefaultDeclaration": {
  23668. return shouldWrapFunctionForExportDefault(path, options) || node.type === "SequenceExpression";
  23669. }
  23670. case "Decorator": {
  23671. if (name === "expression") {
  23672. let hasCallExpression = false;
  23673. let hasMemberExpression = false;
  23674. let current = node;
  23675. while (current) {
  23676. switch (current.type) {
  23677. case "MemberExpression":
  23678. hasMemberExpression = true;
  23679. current = current.object;
  23680. break;
  23681. case "CallExpression":
  23682. if (hasMemberExpression || hasCallExpression) {
  23683. return options.parser !== "typescript";
  23684. }
  23685. hasCallExpression = true;
  23686. current = current.callee;
  23687. break;
  23688. case "Identifier":
  23689. return false;
  23690. case "TaggedTemplateExpression":
  23691. return options.parser !== "typescript";
  23692. default:
  23693. return true;
  23694. }
  23695. }
  23696. return true;
  23697. }
  23698. break;
  23699. }
  23700. case "ExpressionStatement": {
  23701. if (startsWithNoLookaheadToken(node, true)) {
  23702. return true;
  23703. }
  23704. break;
  23705. }
  23706. case "ArrowFunctionExpression": {
  23707. if (name === "body" && node.type !== "SequenceExpression" && startsWithNoLookaheadToken(node, false)) {
  23708. return true;
  23709. }
  23710. break;
  23711. }
  23712. }
  23713. switch (node.type) {
  23714. case "UpdateExpression":
  23715. if (parent.type === "UnaryExpression") {
  23716. return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
  23717. }
  23718. case "UnaryExpression":
  23719. switch (parent.type) {
  23720. case "UnaryExpression":
  23721. return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
  23722. case "BindExpression":
  23723. return true;
  23724. case "MemberExpression":
  23725. case "OptionalMemberExpression":
  23726. return name === "object";
  23727. case "TaggedTemplateExpression":
  23728. return true;
  23729. case "NewExpression":
  23730. case "CallExpression":
  23731. case "OptionalCallExpression":
  23732. return name === "callee";
  23733. case "BinaryExpression":
  23734. return name === "left" && parent.operator === "**";
  23735. case "TSNonNullExpression":
  23736. return true;
  23737. default:
  23738. return false;
  23739. }
  23740. case "BinaryExpression": {
  23741. if (parent.type === "UpdateExpression") {
  23742. return true;
  23743. }
  23744. if (node.operator === "in" && isPathInForStatementInitializer(path)) {
  23745. return true;
  23746. }
  23747. if (node.operator === "|>" && node.extra && node.extra.parenthesized) {
  23748. const grandParent = path.getParentNode(1);
  23749. if (grandParent.type === "BinaryExpression" && grandParent.operator === "|>") {
  23750. return true;
  23751. }
  23752. }
  23753. }
  23754. case "TSTypeAssertion":
  23755. case "TSAsExpression":
  23756. case "LogicalExpression":
  23757. switch (parent.type) {
  23758. case "TSAsExpression":
  23759. return node.type !== "TSAsExpression";
  23760. case "ConditionalExpression":
  23761. return node.type === "TSAsExpression";
  23762. case "CallExpression":
  23763. case "NewExpression":
  23764. case "OptionalCallExpression":
  23765. return name === "callee";
  23766. case "ClassExpression":
  23767. case "ClassDeclaration":
  23768. return name === "superClass";
  23769. case "TSTypeAssertion":
  23770. case "TaggedTemplateExpression":
  23771. case "UnaryExpression":
  23772. case "JSXSpreadAttribute":
  23773. case "SpreadElement":
  23774. case "SpreadProperty":
  23775. case "BindExpression":
  23776. case "AwaitExpression":
  23777. case "TSNonNullExpression":
  23778. case "UpdateExpression":
  23779. return true;
  23780. case "MemberExpression":
  23781. case "OptionalMemberExpression":
  23782. return name === "object";
  23783. case "AssignmentExpression":
  23784. case "AssignmentPattern":
  23785. return name === "left" && (node.type === "TSTypeAssertion" || node.type === "TSAsExpression");
  23786. case "LogicalExpression":
  23787. if (node.type === "LogicalExpression") {
  23788. return parent.operator !== node.operator;
  23789. }
  23790. case "BinaryExpression": {
  23791. const {
  23792. operator,
  23793. type
  23794. } = node;
  23795. if (!operator && type !== "TSTypeAssertion") {
  23796. return true;
  23797. }
  23798. const precedence = getPrecedence(operator);
  23799. const parentOperator = parent.operator;
  23800. const parentPrecedence = getPrecedence(parentOperator);
  23801. if (parentPrecedence > precedence) {
  23802. return true;
  23803. }
  23804. if (name === "right" && parentPrecedence === precedence) {
  23805. return true;
  23806. }
  23807. if (parentPrecedence === precedence && !shouldFlatten(parentOperator, operator)) {
  23808. return true;
  23809. }
  23810. if (parentPrecedence < precedence && operator === "%") {
  23811. return parentOperator === "+" || parentOperator === "-";
  23812. }
  23813. if (isBitwiseOperator(parentOperator)) {
  23814. return true;
  23815. }
  23816. return false;
  23817. }
  23818. default:
  23819. return false;
  23820. }
  23821. case "SequenceExpression":
  23822. switch (parent.type) {
  23823. case "ReturnStatement":
  23824. return false;
  23825. case "ForStatement":
  23826. return false;
  23827. case "ExpressionStatement":
  23828. return name !== "expression";
  23829. case "ArrowFunctionExpression":
  23830. return name !== "body";
  23831. default:
  23832. return true;
  23833. }
  23834. case "YieldExpression":
  23835. if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || parent.type === "TSAsExpression" || parent.type === "TSNonNullExpression") {
  23836. return true;
  23837. }
  23838. case "AwaitExpression":
  23839. switch (parent.type) {
  23840. case "TaggedTemplateExpression":
  23841. case "UnaryExpression":
  23842. case "LogicalExpression":
  23843. case "SpreadElement":
  23844. case "SpreadProperty":
  23845. case "TSAsExpression":
  23846. case "TSNonNullExpression":
  23847. case "BindExpression":
  23848. return true;
  23849. case "MemberExpression":
  23850. case "OptionalMemberExpression":
  23851. return name === "object";
  23852. case "NewExpression":
  23853. case "CallExpression":
  23854. case "OptionalCallExpression":
  23855. return name === "callee";
  23856. case "ConditionalExpression":
  23857. return name === "test";
  23858. case "BinaryExpression": {
  23859. if (!node.argument && parent.operator === "|>") {
  23860. return false;
  23861. }
  23862. return true;
  23863. }
  23864. default:
  23865. return false;
  23866. }
  23867. case "TSConditionalType":
  23868. if (name === "extendsType" && parent.type === "TSConditionalType") {
  23869. return true;
  23870. }
  23871. case "TSFunctionType":
  23872. case "TSConstructorType":
  23873. if (name === "checkType" && parent.type === "TSConditionalType") {
  23874. return true;
  23875. }
  23876. case "TSUnionType":
  23877. case "TSIntersectionType":
  23878. if ((parent.type === "TSUnionType" || parent.type === "TSIntersectionType") && parent.types.length > 1 && (!node.types || node.types.length > 1)) {
  23879. return true;
  23880. }
  23881. case "TSInferType":
  23882. if (node.type === "TSInferType" && parent.type === "TSRestType") {
  23883. return false;
  23884. }
  23885. case "TSTypeOperator":
  23886. 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");
  23887. case "ArrayTypeAnnotation":
  23888. return parent.type === "NullableTypeAnnotation";
  23889. case "IntersectionTypeAnnotation":
  23890. case "UnionTypeAnnotation":
  23891. return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23892. case "NullableTypeAnnotation":
  23893. return parent.type === "ArrayTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23894. case "FunctionTypeAnnotation": {
  23895. const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
  23896. 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");
  23897. }
  23898. case "OptionalIndexedAccessType":
  23899. return name === "objectType" && parent.type === "IndexedAccessType";
  23900. case "TypeofTypeAnnotation":
  23901. return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
  23902. case "StringLiteral":
  23903. case "NumericLiteral":
  23904. case "Literal":
  23905. if (typeof node.value === "string" && parent.type === "ExpressionStatement" && !parent.directive) {
  23906. const grandParent = path.getParentNode(1);
  23907. return grandParent.type === "Program" || grandParent.type === "BlockStatement";
  23908. }
  23909. return name === "object" && parent.type === "MemberExpression" && typeof node.value === "number";
  23910. case "AssignmentExpression": {
  23911. const grandParent = path.getParentNode(1);
  23912. if (name === "body" && parent.type === "ArrowFunctionExpression") {
  23913. return true;
  23914. }
  23915. if (name === "key" && (parent.type === "ClassProperty" || parent.type === "PropertyDefinition") && parent.computed) {
  23916. return false;
  23917. }
  23918. if ((name === "init" || name === "update") && parent.type === "ForStatement") {
  23919. return false;
  23920. }
  23921. if (parent.type === "ExpressionStatement") {
  23922. return node.left.type === "ObjectPattern";
  23923. }
  23924. if (name === "key" && parent.type === "TSPropertySignature") {
  23925. return false;
  23926. }
  23927. if (parent.type === "AssignmentExpression") {
  23928. return false;
  23929. }
  23930. if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
  23931. return false;
  23932. }
  23933. if (name === "value" && parent.type === "Property" && grandParent && grandParent.type === "ObjectPattern" && grandParent.properties.includes(parent)) {
  23934. return false;
  23935. }
  23936. if (parent.type === "NGChainedExpression") {
  23937. return false;
  23938. }
  23939. return true;
  23940. }
  23941. case "ConditionalExpression":
  23942. switch (parent.type) {
  23943. case "TaggedTemplateExpression":
  23944. case "UnaryExpression":
  23945. case "SpreadElement":
  23946. case "SpreadProperty":
  23947. case "BinaryExpression":
  23948. case "LogicalExpression":
  23949. case "NGPipeExpression":
  23950. case "ExportDefaultDeclaration":
  23951. case "AwaitExpression":
  23952. case "JSXSpreadAttribute":
  23953. case "TSTypeAssertion":
  23954. case "TypeCastExpression":
  23955. case "TSAsExpression":
  23956. case "TSNonNullExpression":
  23957. return true;
  23958. case "NewExpression":
  23959. case "CallExpression":
  23960. case "OptionalCallExpression":
  23961. return name === "callee";
  23962. case "ConditionalExpression":
  23963. return name === "test";
  23964. case "MemberExpression":
  23965. case "OptionalMemberExpression":
  23966. return name === "object";
  23967. default:
  23968. return false;
  23969. }
  23970. case "FunctionExpression":
  23971. switch (parent.type) {
  23972. case "NewExpression":
  23973. case "CallExpression":
  23974. case "OptionalCallExpression":
  23975. return name === "callee";
  23976. case "TaggedTemplateExpression":
  23977. return true;
  23978. default:
  23979. return false;
  23980. }
  23981. case "ArrowFunctionExpression":
  23982. switch (parent.type) {
  23983. case "BinaryExpression":
  23984. return parent.operator !== "|>" || node.extra && node.extra.parenthesized;
  23985. case "NewExpression":
  23986. case "CallExpression":
  23987. case "OptionalCallExpression":
  23988. return name === "callee";
  23989. case "MemberExpression":
  23990. case "OptionalMemberExpression":
  23991. return name === "object";
  23992. case "TSAsExpression":
  23993. case "TSNonNullExpression":
  23994. case "BindExpression":
  23995. case "TaggedTemplateExpression":
  23996. case "UnaryExpression":
  23997. case "LogicalExpression":
  23998. case "AwaitExpression":
  23999. case "TSTypeAssertion":
  24000. return true;
  24001. case "ConditionalExpression":
  24002. return name === "test";
  24003. default:
  24004. return false;
  24005. }
  24006. case "ClassExpression":
  24007. if (isNonEmptyArray(node.decorators)) {
  24008. return true;
  24009. }
  24010. switch (parent.type) {
  24011. case "NewExpression":
  24012. return name === "callee";
  24013. default:
  24014. return false;
  24015. }
  24016. case "OptionalMemberExpression":
  24017. case "OptionalCallExpression": {
  24018. const parentParent = path.getParentNode(1);
  24019. if (name === "object" && parent.type === "MemberExpression" || name === "callee" && (parent.type === "CallExpression" || parent.type === "NewExpression") || parent.type === "TSNonNullExpression" && parentParent.type === "MemberExpression" && parentParent.object === parent) {
  24020. return true;
  24021. }
  24022. }
  24023. case "CallExpression":
  24024. case "MemberExpression":
  24025. case "TaggedTemplateExpression":
  24026. case "TSNonNullExpression":
  24027. if (name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression")) {
  24028. let object = node;
  24029. while (object) {
  24030. switch (object.type) {
  24031. case "CallExpression":
  24032. case "OptionalCallExpression":
  24033. return true;
  24034. case "MemberExpression":
  24035. case "OptionalMemberExpression":
  24036. case "BindExpression":
  24037. object = object.object;
  24038. break;
  24039. case "TaggedTemplateExpression":
  24040. object = object.tag;
  24041. break;
  24042. case "TSNonNullExpression":
  24043. object = object.expression;
  24044. break;
  24045. default:
  24046. return false;
  24047. }
  24048. }
  24049. }
  24050. return false;
  24051. case "BindExpression":
  24052. return name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression") || name === "object" && isMemberExpression(parent);
  24053. case "NGPipeExpression":
  24054. 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") {
  24055. return false;
  24056. }
  24057. return true;
  24058. case "JSXFragment":
  24059. case "JSXElement":
  24060. 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";
  24061. case "TypeAnnotation":
  24062. return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
  24063. }
  24064. return false;
  24065. }
  24066. function isStatement(node) {
  24067. 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";
  24068. }
  24069. function isPathInForStatementInitializer(path) {
  24070. let i = 0;
  24071. let node = path.getValue();
  24072. while (node) {
  24073. const parent = path.getParentNode(i++);
  24074. if (parent && parent.type === "ForStatement" && parent.init === node) {
  24075. return true;
  24076. }
  24077. node = parent;
  24078. }
  24079. return false;
  24080. }
  24081. function includesFunctionTypeInObjectType(node) {
  24082. return hasNode(node, (n1) => n1.type === "ObjectTypeAnnotation" && hasNode(n1, (n2) => n2.type === "FunctionTypeAnnotation" || void 0) || void 0);
  24083. }
  24084. function endsWithRightBracket(node) {
  24085. switch (node.type) {
  24086. case "ObjectExpression":
  24087. return true;
  24088. default:
  24089. return false;
  24090. }
  24091. }
  24092. function isFollowedByRightBracket(path) {
  24093. const node = path.getValue();
  24094. const parent = path.getParentNode();
  24095. const name = path.getName();
  24096. switch (parent.type) {
  24097. case "NGPipeExpression":
  24098. if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
  24099. return path.callParent(isFollowedByRightBracket);
  24100. }
  24101. break;
  24102. case "ObjectProperty":
  24103. if (name === "value") {
  24104. const parentParent = path.getParentNode(1);
  24105. return getLast(parentParent.properties) === parent;
  24106. }
  24107. break;
  24108. case "BinaryExpression":
  24109. case "LogicalExpression":
  24110. if (name === "right") {
  24111. return path.callParent(isFollowedByRightBracket);
  24112. }
  24113. break;
  24114. case "ConditionalExpression":
  24115. if (name === "alternate") {
  24116. return path.callParent(isFollowedByRightBracket);
  24117. }
  24118. break;
  24119. case "UnaryExpression":
  24120. if (parent.prefix) {
  24121. return path.callParent(isFollowedByRightBracket);
  24122. }
  24123. break;
  24124. }
  24125. return false;
  24126. }
  24127. function shouldWrapFunctionForExportDefault(path, options) {
  24128. const node = path.getValue();
  24129. const parent = path.getParentNode();
  24130. if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
  24131. return parent.type === "ExportDefaultDeclaration" || !needsParens(path, options);
  24132. }
  24133. if (!hasNakedLeftSide(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
  24134. return false;
  24135. }
  24136. return path.call((childPath) => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName(path, node));
  24137. }
  24138. module2.exports = needsParens;
  24139. }
  24140. });
  24141. var require_print_preprocess = __commonJS2({
  24142. "src/language-js/print-preprocess.js"(exports2, module2) {
  24143. "use strict";
  24144. function preprocess(ast, options) {
  24145. switch (options.parser) {
  24146. case "json":
  24147. case "json5":
  24148. case "json-stringify":
  24149. case "__js_expression":
  24150. case "__vue_expression":
  24151. case "__vue_ts_expression":
  24152. return Object.assign(Object.assign({}, ast), {}, {
  24153. type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
  24154. node: ast,
  24155. comments: [],
  24156. rootMarker: options.rootMarker
  24157. });
  24158. default:
  24159. return ast;
  24160. }
  24161. }
  24162. module2.exports = preprocess;
  24163. }
  24164. });
  24165. var require_html_binding = __commonJS2({
  24166. "src/language-js/print/html-binding.js"(exports2, module2) {
  24167. "use strict";
  24168. var {
  24169. builders: {
  24170. join,
  24171. line,
  24172. group,
  24173. softline,
  24174. indent
  24175. }
  24176. } = require("./doc.js");
  24177. function printHtmlBinding(path, options, print) {
  24178. const node = path.getValue();
  24179. if (options.__onHtmlBindingRoot && path.getName() === null) {
  24180. options.__onHtmlBindingRoot(node, options);
  24181. }
  24182. if (node.type !== "File") {
  24183. return;
  24184. }
  24185. if (options.__isVueForBindingLeft) {
  24186. return path.call((functionDeclarationPath) => {
  24187. const printed = join([",", line], functionDeclarationPath.map(print, "params"));
  24188. const {
  24189. params
  24190. } = functionDeclarationPath.getValue();
  24191. if (params.length === 1) {
  24192. return printed;
  24193. }
  24194. return ["(", indent([softline, group(printed)]), softline, ")"];
  24195. }, "program", "body", 0);
  24196. }
  24197. if (options.__isVueBindings) {
  24198. return path.call((functionDeclarationPath) => join([",", line], functionDeclarationPath.map(print, "params")), "program", "body", 0);
  24199. }
  24200. }
  24201. function isVueEventBindingExpression(node) {
  24202. switch (node.type) {
  24203. case "MemberExpression":
  24204. switch (node.property.type) {
  24205. case "Identifier":
  24206. case "NumericLiteral":
  24207. case "StringLiteral":
  24208. return isVueEventBindingExpression(node.object);
  24209. }
  24210. return false;
  24211. case "Identifier":
  24212. return true;
  24213. default:
  24214. return false;
  24215. }
  24216. }
  24217. module2.exports = {
  24218. isVueEventBindingExpression,
  24219. printHtmlBinding
  24220. };
  24221. }
  24222. });
  24223. var require_binaryish = __commonJS2({
  24224. "src/language-js/print/binaryish.js"(exports2, module2) {
  24225. "use strict";
  24226. var {
  24227. printComments
  24228. } = require_comments();
  24229. var {
  24230. getLast
  24231. } = require_util();
  24232. var {
  24233. builders: {
  24234. join,
  24235. line,
  24236. softline,
  24237. group,
  24238. indent,
  24239. align,
  24240. ifBreak,
  24241. indentIfBreak
  24242. },
  24243. utils: {
  24244. cleanDoc,
  24245. getDocParts,
  24246. isConcat
  24247. }
  24248. } = require("./doc.js");
  24249. var {
  24250. hasLeadingOwnLineComment,
  24251. isBinaryish,
  24252. isJsxNode,
  24253. shouldFlatten,
  24254. hasComment,
  24255. CommentCheckFlags,
  24256. isCallExpression,
  24257. isMemberExpression,
  24258. isObjectProperty,
  24259. isEnabledHackPipeline
  24260. } = require_utils7();
  24261. var uid = 0;
  24262. function printBinaryishExpression(path, options, print) {
  24263. const node = path.getValue();
  24264. const parent = path.getParentNode();
  24265. const parentParent = path.getParentNode(1);
  24266. const isInsideParenthesis = node !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
  24267. const isHackPipeline = isEnabledHackPipeline(options) && node.operator === "|>";
  24268. const parts = printBinaryishExpressions(path, print, options, false, isInsideParenthesis);
  24269. if (isInsideParenthesis) {
  24270. return parts;
  24271. }
  24272. if (isHackPipeline) {
  24273. return group(parts);
  24274. }
  24275. if (isCallExpression(parent) && parent.callee === node || parent.type === "UnaryExpression" || isMemberExpression(parent) && !parent.computed) {
  24276. return group([indent([softline, ...parts]), softline]);
  24277. }
  24278. 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";
  24279. const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "PropertyDefinition" || parent.type === "TSAbstractPropertyDefinition" || parent.type === "ClassPrivateProperty" || isObjectProperty(parent);
  24280. const samePrecedenceSubExpression = isBinaryish(node.left) && shouldFlatten(node.operator, node.left.operator);
  24281. if (shouldNotIndent || shouldInlineLogicalExpression(node) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(node) && shouldIndentIfInlining) {
  24282. return group(parts);
  24283. }
  24284. if (parts.length === 0) {
  24285. return "";
  24286. }
  24287. const hasJsx = isJsxNode(node.right);
  24288. const firstGroupIndex = parts.findIndex((part) => typeof part !== "string" && !Array.isArray(part) && part.type === "group");
  24289. const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
  24290. const rest = parts.slice(headParts.length, hasJsx ? -1 : void 0);
  24291. const groupId = Symbol("logicalChain-" + ++uid);
  24292. const chain = group([...headParts, indent(rest)], {
  24293. id: groupId
  24294. });
  24295. if (!hasJsx) {
  24296. return chain;
  24297. }
  24298. const jsxPart = getLast(parts);
  24299. return group([chain, indentIfBreak(jsxPart, {
  24300. groupId
  24301. })]);
  24302. }
  24303. function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
  24304. const node = path.getValue();
  24305. if (!isBinaryish(node)) {
  24306. return [group(print())];
  24307. }
  24308. let parts = [];
  24309. if (shouldFlatten(node.operator, node.left.operator)) {
  24310. parts = path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "left");
  24311. } else {
  24312. parts.push(group(print("left")));
  24313. }
  24314. const shouldInline = shouldInlineLogicalExpression(node);
  24315. const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment(options.originalText, node.right);
  24316. const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
  24317. const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length > 0 ? group(indent([softline, ": ", join([softline, ":", ifBreak(" ")], path.map(print, "arguments").map((arg) => align(2, group(arg))))])) : "";
  24318. let right;
  24319. if (shouldInline) {
  24320. right = [operator, " ", print("right"), rightSuffix];
  24321. } else {
  24322. const isHackPipeline = isEnabledHackPipeline(options) && operator === "|>";
  24323. const rightContent = isHackPipeline ? path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "right") : print("right");
  24324. right = [lineBeforeOperator ? line : "", operator, lineBeforeOperator ? " " : line, rightContent, rightSuffix];
  24325. }
  24326. const parent = path.getParentNode();
  24327. const shouldBreak = hasComment(node.left, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  24328. const shouldGroup = shouldBreak || !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
  24329. parts.push(lineBeforeOperator ? "" : " ", shouldGroup ? group(right, {
  24330. shouldBreak
  24331. }) : right);
  24332. if (isNested && hasComment(node)) {
  24333. const printed = cleanDoc(printComments(path, parts, options));
  24334. if (isConcat(printed) || printed.type === "fill") {
  24335. return getDocParts(printed);
  24336. }
  24337. return [printed];
  24338. }
  24339. return parts;
  24340. }
  24341. function shouldInlineLogicalExpression(node) {
  24342. if (node.type !== "LogicalExpression") {
  24343. return false;
  24344. }
  24345. if (node.right.type === "ObjectExpression" && node.right.properties.length > 0) {
  24346. return true;
  24347. }
  24348. if (node.right.type === "ArrayExpression" && node.right.elements.length > 0) {
  24349. return true;
  24350. }
  24351. if (isJsxNode(node.right)) {
  24352. return true;
  24353. }
  24354. return false;
  24355. }
  24356. module2.exports = {
  24357. printBinaryishExpression,
  24358. shouldInlineLogicalExpression
  24359. };
  24360. }
  24361. });
  24362. var require_angular = __commonJS2({
  24363. "src/language-js/print/angular.js"(exports2, module2) {
  24364. "use strict";
  24365. var {
  24366. builders: {
  24367. join,
  24368. line,
  24369. group
  24370. }
  24371. } = require("./doc.js");
  24372. var {
  24373. hasNode,
  24374. hasComment,
  24375. getComments
  24376. } = require_utils7();
  24377. var {
  24378. printBinaryishExpression
  24379. } = require_binaryish();
  24380. function printAngular(path, options, print) {
  24381. const node = path.getValue();
  24382. if (!node.type.startsWith("NG")) {
  24383. return;
  24384. }
  24385. switch (node.type) {
  24386. case "NGRoot":
  24387. return [print("node"), !hasComment(node.node) ? "" : " //" + getComments(node.node)[0].value.trimEnd()];
  24388. case "NGPipeExpression":
  24389. return printBinaryishExpression(path, options, print);
  24390. case "NGChainedExpression":
  24391. return group(join([";", line], path.map((childPath) => hasNgSideEffect(childPath) ? print() : ["(", print(), ")"], "expressions")));
  24392. case "NGEmptyExpression":
  24393. return "";
  24394. case "NGQuotedExpression":
  24395. return [node.prefix, ": ", node.value.trim()];
  24396. case "NGMicrosyntax":
  24397. return path.map((childPath, index) => [index === 0 ? "" : isNgForOf(childPath.getValue(), index, node) ? " " : [";", line], print()], "body");
  24398. case "NGMicrosyntaxKey":
  24399. return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/i.test(node.name) ? node.name : JSON.stringify(node.name);
  24400. case "NGMicrosyntaxExpression":
  24401. return [print("expression"), node.alias === null ? "" : [" as ", print("alias")]];
  24402. case "NGMicrosyntaxKeyedExpression": {
  24403. const index = path.getName();
  24404. const parentNode = path.getParentNode();
  24405. 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";
  24406. return [print("key"), shouldNotPrintColon ? " " : ": ", print("expression")];
  24407. }
  24408. case "NGMicrosyntaxLet":
  24409. return ["let ", print("key"), node.value === null ? "" : [" = ", print("value")]];
  24410. case "NGMicrosyntaxAs":
  24411. return [print("key"), " as ", print("alias")];
  24412. default:
  24413. throw new Error(`Unknown Angular node type: ${JSON.stringify(node.type)}.`);
  24414. }
  24415. }
  24416. function isNgForOf(node, index, parentNode) {
  24417. return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
  24418. }
  24419. function hasNgSideEffect(path) {
  24420. return hasNode(path.getValue(), (node) => {
  24421. switch (node.type) {
  24422. case void 0:
  24423. return false;
  24424. case "CallExpression":
  24425. case "OptionalCallExpression":
  24426. case "AssignmentExpression":
  24427. return true;
  24428. }
  24429. });
  24430. }
  24431. module2.exports = {
  24432. printAngular
  24433. };
  24434. }
  24435. });
  24436. var require_jsx = __commonJS2({
  24437. "src/language-js/print/jsx.js"(exports2, module2) {
  24438. "use strict";
  24439. var {
  24440. printComments,
  24441. printDanglingComments
  24442. } = require_comments();
  24443. var {
  24444. builders: {
  24445. line,
  24446. hardline,
  24447. softline,
  24448. group,
  24449. indent,
  24450. conditionalGroup,
  24451. fill,
  24452. ifBreak,
  24453. lineSuffixBoundary,
  24454. join
  24455. },
  24456. utils: {
  24457. willBreak
  24458. }
  24459. } = require("./doc.js");
  24460. var {
  24461. getLast,
  24462. getPreferredQuote
  24463. } = require_util();
  24464. var {
  24465. isJsxNode,
  24466. rawText,
  24467. isLiteral,
  24468. isCallExpression,
  24469. isStringLiteral,
  24470. isBinaryish,
  24471. hasComment,
  24472. CommentCheckFlags,
  24473. hasNodeIgnoreComment
  24474. } = require_utils7();
  24475. var pathNeedsParens = require_needs_parens();
  24476. var {
  24477. willPrintOwnComments
  24478. } = require_comments2();
  24479. var isEmptyStringOrAnyLine = (doc2) => doc2 === "" || doc2 === line || doc2 === hardline || doc2 === softline;
  24480. function printJsxElementInternal(path, options, print) {
  24481. const node = path.getValue();
  24482. if (node.type === "JSXElement" && isEmptyJsxElement(node)) {
  24483. return [print("openingElement"), print("closingElement")];
  24484. }
  24485. const openingLines = node.type === "JSXElement" ? print("openingElement") : print("openingFragment");
  24486. const closingLines = node.type === "JSXElement" ? print("closingElement") : print("closingFragment");
  24487. if (node.children.length === 1 && node.children[0].type === "JSXExpressionContainer" && (node.children[0].expression.type === "TemplateLiteral" || node.children[0].expression.type === "TaggedTemplateExpression")) {
  24488. return [openingLines, ...path.map(print, "children"), closingLines];
  24489. }
  24490. node.children = node.children.map((child) => {
  24491. if (isJsxWhitespaceExpression(child)) {
  24492. return {
  24493. type: "JSXText",
  24494. value: " ",
  24495. raw: " "
  24496. };
  24497. }
  24498. return child;
  24499. });
  24500. const containsTag = node.children.some(isJsxNode);
  24501. const containsMultipleExpressions = node.children.filter((child) => child.type === "JSXExpressionContainer").length > 1;
  24502. const containsMultipleAttributes = node.type === "JSXElement" && node.openingElement.attributes.length > 1;
  24503. let forcedBreak = willBreak(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
  24504. const isMdxBlock = path.getParentNode().rootMarker === "mdx";
  24505. const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
  24506. const jsxWhitespace = isMdxBlock ? " " : ifBreak([rawJsxWhitespace, softline], " ");
  24507. const isFacebookTranslationTag = node.openingElement && node.openingElement.name && node.openingElement.name.name === "fbt";
  24508. const children = printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
  24509. const containsText = node.children.some((child) => isMeaningfulJsxText(child));
  24510. for (let i = children.length - 2; i >= 0; i--) {
  24511. const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
  24512. const isPairOfHardlines = children[i] === hardline && children[i + 1] === "" && children[i + 2] === hardline;
  24513. const isLineFollowedByJsxWhitespace = (children[i] === softline || children[i] === hardline) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24514. const isJsxWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline || children[i + 2] === hardline);
  24515. const isDoubleJsxWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
  24516. const isPairOfHardOrSoftLines = children[i] === softline && children[i + 1] === "" && children[i + 2] === hardline || children[i] === hardline && children[i + 1] === "" && children[i + 2] === softline;
  24517. if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJsxWhitespace || isDoubleJsxWhitespace || isPairOfHardOrSoftLines) {
  24518. children.splice(i, 2);
  24519. } else if (isJsxWhitespaceFollowedByLine) {
  24520. children.splice(i + 1, 2);
  24521. }
  24522. }
  24523. while (children.length > 0 && isEmptyStringOrAnyLine(getLast(children))) {
  24524. children.pop();
  24525. }
  24526. while (children.length > 1 && isEmptyStringOrAnyLine(children[0]) && isEmptyStringOrAnyLine(children[1])) {
  24527. children.shift();
  24528. children.shift();
  24529. }
  24530. const multilineChildren = [];
  24531. for (const [i, child] of children.entries()) {
  24532. if (child === jsxWhitespace) {
  24533. if (i === 1 && children[i - 1] === "") {
  24534. if (children.length === 2) {
  24535. multilineChildren.push(rawJsxWhitespace);
  24536. continue;
  24537. }
  24538. multilineChildren.push([rawJsxWhitespace, hardline]);
  24539. continue;
  24540. } else if (i === children.length - 1) {
  24541. multilineChildren.push(rawJsxWhitespace);
  24542. continue;
  24543. } else if (children[i - 1] === "" && children[i - 2] === hardline) {
  24544. multilineChildren.push(rawJsxWhitespace);
  24545. continue;
  24546. }
  24547. }
  24548. multilineChildren.push(child);
  24549. if (willBreak(child)) {
  24550. forcedBreak = true;
  24551. }
  24552. }
  24553. const content = containsText ? fill(multilineChildren) : group(multilineChildren, {
  24554. shouldBreak: true
  24555. });
  24556. if (isMdxBlock) {
  24557. return content;
  24558. }
  24559. const multiLineElem = group([openingLines, indent([hardline, content]), hardline, closingLines]);
  24560. if (forcedBreak) {
  24561. return multiLineElem;
  24562. }
  24563. return conditionalGroup([group([openingLines, ...children, closingLines]), multiLineElem]);
  24564. }
  24565. function printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
  24566. const parts = [];
  24567. path.each((childPath, i, children) => {
  24568. const child = childPath.getValue();
  24569. if (isLiteral(child)) {
  24570. const text = rawText(child);
  24571. if (isMeaningfulJsxText(child)) {
  24572. const words = text.split(matchJsxWhitespaceRegex);
  24573. if (words[0] === "") {
  24574. parts.push("");
  24575. words.shift();
  24576. if (/\n/.test(words[0])) {
  24577. const next = children[i + 1];
  24578. parts.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
  24579. } else {
  24580. parts.push(jsxWhitespace);
  24581. }
  24582. words.shift();
  24583. }
  24584. let endWhitespace;
  24585. if (getLast(words) === "") {
  24586. words.pop();
  24587. endWhitespace = words.pop();
  24588. }
  24589. if (words.length === 0) {
  24590. return;
  24591. }
  24592. for (const [i2, word] of words.entries()) {
  24593. if (i2 % 2 === 1) {
  24594. parts.push(line);
  24595. } else {
  24596. parts.push(word);
  24597. }
  24598. }
  24599. if (endWhitespace !== void 0) {
  24600. if (/\n/.test(endWhitespace)) {
  24601. const next = children[i + 1];
  24602. parts.push(separatorWithWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24603. } else {
  24604. parts.push(jsxWhitespace);
  24605. }
  24606. } else {
  24607. const next = children[i + 1];
  24608. parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
  24609. }
  24610. } else if (/\n/.test(text)) {
  24611. if (text.match(/\n/g).length > 1) {
  24612. parts.push("", hardline);
  24613. }
  24614. } else {
  24615. parts.push("", jsxWhitespace);
  24616. }
  24617. } else {
  24618. const printedChild = print();
  24619. parts.push(printedChild);
  24620. const next = children[i + 1];
  24621. const directlyFollowedByMeaningfulText = next && isMeaningfulJsxText(next);
  24622. if (directlyFollowedByMeaningfulText) {
  24623. const firstWord = trimJsxWhitespace(rawText(next)).split(matchJsxWhitespaceRegex)[0];
  24624. parts.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
  24625. } else {
  24626. parts.push(hardline);
  24627. }
  24628. }
  24629. }, "children");
  24630. return parts;
  24631. }
  24632. function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24633. if (isFacebookTranslationTag) {
  24634. return "";
  24635. }
  24636. if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
  24637. return child.length === 1 ? softline : hardline;
  24638. }
  24639. return softline;
  24640. }
  24641. function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
  24642. if (isFacebookTranslationTag) {
  24643. return hardline;
  24644. }
  24645. if (child.length === 1) {
  24646. return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline : softline;
  24647. }
  24648. return hardline;
  24649. }
  24650. function maybeWrapJsxElementInParens(path, elem, options) {
  24651. const parent = path.getParentNode();
  24652. if (!parent) {
  24653. return elem;
  24654. }
  24655. const NO_WRAP_PARENTS = {
  24656. ArrayExpression: true,
  24657. JSXAttribute: true,
  24658. JSXElement: true,
  24659. JSXExpressionContainer: true,
  24660. JSXFragment: true,
  24661. ExpressionStatement: true,
  24662. CallExpression: true,
  24663. OptionalCallExpression: true,
  24664. ConditionalExpression: true,
  24665. JsExpressionRoot: true
  24666. };
  24667. if (NO_WRAP_PARENTS[parent.type]) {
  24668. return elem;
  24669. }
  24670. const shouldBreak = path.match(void 0, (node) => node.type === "ArrowFunctionExpression", isCallExpression, (node) => node.type === "JSXExpressionContainer");
  24671. const needsParens = pathNeedsParens(path, options);
  24672. return group([needsParens ? "" : ifBreak("("), indent([softline, elem]), softline, needsParens ? "" : ifBreak(")")], {
  24673. shouldBreak
  24674. });
  24675. }
  24676. function printJsxAttribute(path, options, print) {
  24677. const node = path.getValue();
  24678. const parts = [];
  24679. parts.push(print("name"));
  24680. if (node.value) {
  24681. let res;
  24682. if (isStringLiteral(node.value)) {
  24683. const raw = rawText(node.value);
  24684. let final = raw.slice(1, -1).replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  24685. const {
  24686. escaped,
  24687. quote,
  24688. regex
  24689. } = getPreferredQuote(final, options.jsxSingleQuote ? "'" : '"');
  24690. final = final.replace(regex, escaped);
  24691. res = [quote, final, quote];
  24692. } else {
  24693. res = print("value");
  24694. }
  24695. parts.push("=", res);
  24696. }
  24697. return parts;
  24698. }
  24699. function printJsxExpressionContainer(path, options, print) {
  24700. const node = path.getValue();
  24701. 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)));
  24702. if (shouldInline(node.expression, path.getParentNode(0))) {
  24703. return group(["{", print("expression"), lineSuffixBoundary, "}"]);
  24704. }
  24705. return group(["{", indent([softline, print("expression")]), softline, lineSuffixBoundary, "}"]);
  24706. }
  24707. function printJsxOpeningElement(path, options, print) {
  24708. const node = path.getValue();
  24709. const nameHasComments = node.name && hasComment(node.name) || node.typeParameters && hasComment(node.typeParameters);
  24710. if (node.selfClosing && node.attributes.length === 0 && !nameHasComments) {
  24711. return ["<", print("name"), print("typeParameters"), " />"];
  24712. }
  24713. 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])) {
  24714. return group(["<", print("name"), print("typeParameters"), " ", ...path.map(print, "attributes"), node.selfClosing ? " />" : ">"]);
  24715. }
  24716. const lastAttrHasTrailingComments = node.attributes.length > 0 && hasComment(getLast(node.attributes), CommentCheckFlags.Trailing);
  24717. const bracketSameLine = node.attributes.length === 0 && !nameHasComments || (options.bracketSameLine || options.jsxBracketSameLine) && (!nameHasComments || node.attributes.length > 0) && !lastAttrHasTrailingComments;
  24718. const shouldBreak = node.attributes && node.attributes.some((attr) => attr.value && isStringLiteral(attr.value) && attr.value.value.includes("\n"));
  24719. const attributeLine = options.singleAttributePerLine && node.attributes.length > 1 ? hardline : line;
  24720. return group(["<", print("name"), print("typeParameters"), indent(path.map(() => [attributeLine, print()], "attributes")), node.selfClosing ? line : bracketSameLine ? ">" : softline, node.selfClosing ? "/>" : bracketSameLine ? "" : ">"], {
  24721. shouldBreak
  24722. });
  24723. }
  24724. function printJsxClosingElement(path, options, print) {
  24725. const node = path.getValue();
  24726. const parts = [];
  24727. parts.push("</");
  24728. const printed = print("name");
  24729. if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Line)) {
  24730. parts.push(indent([hardline, printed]), hardline);
  24731. } else if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Block)) {
  24732. parts.push(" ", printed);
  24733. } else {
  24734. parts.push(printed);
  24735. }
  24736. parts.push(">");
  24737. return parts;
  24738. }
  24739. function printJsxOpeningClosingFragment(path, options) {
  24740. const node = path.getValue();
  24741. const nodeHasComment = hasComment(node);
  24742. const hasOwnLineComment = hasComment(node, CommentCheckFlags.Line);
  24743. const isOpeningFragment = node.type === "JSXOpeningFragment";
  24744. return [isOpeningFragment ? "<" : "</", indent([hasOwnLineComment ? hardline : nodeHasComment && !isOpeningFragment ? " " : "", printDanglingComments(path, options, true)]), hasOwnLineComment ? hardline : "", ">"];
  24745. }
  24746. function printJsxElement(path, options, print) {
  24747. const elem = printComments(path, printJsxElementInternal(path, options, print), options);
  24748. return maybeWrapJsxElementInParens(path, elem, options);
  24749. }
  24750. function printJsxEmptyExpression(path, options) {
  24751. const node = path.getValue();
  24752. const requiresHardline = hasComment(node, CommentCheckFlags.Line);
  24753. return [printDanglingComments(path, options, !requiresHardline), requiresHardline ? hardline : ""];
  24754. }
  24755. function printJsxSpreadAttribute(path, options, print) {
  24756. const node = path.getValue();
  24757. return ["{", path.call((p) => {
  24758. const printed = ["...", print()];
  24759. const node2 = p.getValue();
  24760. if (!hasComment(node2) || !willPrintOwnComments(p)) {
  24761. return printed;
  24762. }
  24763. return [indent([softline, printComments(p, printed, options)]), softline];
  24764. }, node.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
  24765. }
  24766. function printJsx(path, options, print) {
  24767. const node = path.getValue();
  24768. if (!node.type.startsWith("JSX")) {
  24769. return;
  24770. }
  24771. switch (node.type) {
  24772. case "JSXAttribute":
  24773. return printJsxAttribute(path, options, print);
  24774. case "JSXIdentifier":
  24775. return String(node.name);
  24776. case "JSXNamespacedName":
  24777. return join(":", [print("namespace"), print("name")]);
  24778. case "JSXMemberExpression":
  24779. return join(".", [print("object"), print("property")]);
  24780. case "JSXSpreadAttribute":
  24781. return printJsxSpreadAttribute(path, options, print);
  24782. case "JSXSpreadChild": {
  24783. const printJsxSpreadChild = printJsxSpreadAttribute;
  24784. return printJsxSpreadChild(path, options, print);
  24785. }
  24786. case "JSXExpressionContainer":
  24787. return printJsxExpressionContainer(path, options, print);
  24788. case "JSXFragment":
  24789. case "JSXElement":
  24790. return printJsxElement(path, options, print);
  24791. case "JSXOpeningElement":
  24792. return printJsxOpeningElement(path, options, print);
  24793. case "JSXClosingElement":
  24794. return printJsxClosingElement(path, options, print);
  24795. case "JSXOpeningFragment":
  24796. case "JSXClosingFragment":
  24797. return printJsxOpeningClosingFragment(path, options);
  24798. case "JSXEmptyExpression":
  24799. return printJsxEmptyExpression(path, options);
  24800. case "JSXText":
  24801. throw new Error("JSXTest should be handled by JSXElement");
  24802. default:
  24803. throw new Error(`Unknown JSX node type: ${JSON.stringify(node.type)}.`);
  24804. }
  24805. }
  24806. var jsxWhitespaceChars = " \n\r ";
  24807. var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
  24808. var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
  24809. var trimJsxWhitespace = (text) => text.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
  24810. function isEmptyJsxElement(node) {
  24811. if (node.children.length === 0) {
  24812. return true;
  24813. }
  24814. if (node.children.length > 1) {
  24815. return false;
  24816. }
  24817. const child = node.children[0];
  24818. return isLiteral(child) && !isMeaningfulJsxText(child);
  24819. }
  24820. function isMeaningfulJsxText(node) {
  24821. return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
  24822. }
  24823. function isJsxWhitespaceExpression(node) {
  24824. return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !hasComment(node.expression);
  24825. }
  24826. function hasJsxIgnoreComment(path) {
  24827. const node = path.getValue();
  24828. const parent = path.getParentNode();
  24829. if (!parent || !node || !isJsxNode(node) || !isJsxNode(parent)) {
  24830. return false;
  24831. }
  24832. const index = parent.children.indexOf(node);
  24833. let prevSibling = null;
  24834. for (let i = index; i > 0; i--) {
  24835. const candidate = parent.children[i - 1];
  24836. if (candidate.type === "JSXText" && !isMeaningfulJsxText(candidate)) {
  24837. continue;
  24838. }
  24839. prevSibling = candidate;
  24840. break;
  24841. }
  24842. return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && hasNodeIgnoreComment(prevSibling.expression);
  24843. }
  24844. module2.exports = {
  24845. hasJsxIgnoreComment,
  24846. printJsx
  24847. };
  24848. }
  24849. });
  24850. var require_misc = __commonJS2({
  24851. "src/language-js/print/misc.js"(exports2, module2) {
  24852. "use strict";
  24853. var {
  24854. isNonEmptyArray
  24855. } = require_util();
  24856. var {
  24857. builders: {
  24858. indent,
  24859. join,
  24860. line
  24861. }
  24862. } = require("./doc.js");
  24863. var {
  24864. isFlowAnnotationComment
  24865. } = require_utils7();
  24866. function printOptionalToken(path) {
  24867. const node = path.getValue();
  24868. if (!node.optional || node.type === "Identifier" && node === path.getParentNode().key) {
  24869. return "";
  24870. }
  24871. if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
  24872. return "?.";
  24873. }
  24874. return "?";
  24875. }
  24876. function printDefiniteToken(path) {
  24877. return path.getValue().definite || path.match(void 0, (node, name) => name === "id" && node.type === "VariableDeclarator" && node.definite) ? "!" : "";
  24878. }
  24879. function printFunctionTypeParameters(path, options, print) {
  24880. const fun = path.getValue();
  24881. if (fun.typeArguments) {
  24882. return print("typeArguments");
  24883. }
  24884. if (fun.typeParameters) {
  24885. return print("typeParameters");
  24886. }
  24887. return "";
  24888. }
  24889. function printTypeAnnotation(path, options, print) {
  24890. const node = path.getValue();
  24891. if (!node.typeAnnotation) {
  24892. return "";
  24893. }
  24894. const parentNode = path.getParentNode();
  24895. const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
  24896. if (isFlowAnnotationComment(options.originalText, node.typeAnnotation)) {
  24897. return [" /*: ", print("typeAnnotation"), " */"];
  24898. }
  24899. return [isFunctionDeclarationIdentifier ? "" : ": ", print("typeAnnotation")];
  24900. }
  24901. function printBindExpressionCallee(path, options, print) {
  24902. return ["::", print("callee")];
  24903. }
  24904. function printTypeScriptModifiers(path, options, print) {
  24905. const node = path.getValue();
  24906. if (!isNonEmptyArray(node.modifiers)) {
  24907. return "";
  24908. }
  24909. return [join(" ", path.map(print, "modifiers")), " "];
  24910. }
  24911. function adjustClause(node, clause, forceSpace) {
  24912. if (node.type === "EmptyStatement") {
  24913. return ";";
  24914. }
  24915. if (node.type === "BlockStatement" || forceSpace) {
  24916. return [" ", clause];
  24917. }
  24918. return indent([line, clause]);
  24919. }
  24920. function printRestSpread(path, options, print) {
  24921. return ["...", print("argument"), printTypeAnnotation(path, options, print)];
  24922. }
  24923. module2.exports = {
  24924. printOptionalToken,
  24925. printDefiniteToken,
  24926. printFunctionTypeParameters,
  24927. printBindExpressionCallee,
  24928. printTypeScriptModifiers,
  24929. printTypeAnnotation,
  24930. printRestSpread,
  24931. adjustClause
  24932. };
  24933. }
  24934. });
  24935. var require_array4 = __commonJS2({
  24936. "src/language-js/print/array.js"(exports2, module2) {
  24937. "use strict";
  24938. var {
  24939. printDanglingComments
  24940. } = require_comments();
  24941. var {
  24942. builders: {
  24943. line,
  24944. softline,
  24945. hardline,
  24946. group,
  24947. indent,
  24948. ifBreak,
  24949. fill
  24950. }
  24951. } = require("./doc.js");
  24952. var {
  24953. getLast,
  24954. hasNewline
  24955. } = require_util();
  24956. var {
  24957. shouldPrintComma,
  24958. hasComment,
  24959. CommentCheckFlags,
  24960. isNextLineEmpty,
  24961. isNumericLiteral,
  24962. isSignedNumericLiteral
  24963. } = require_utils7();
  24964. var {
  24965. locStart
  24966. } = require_loc();
  24967. var {
  24968. printOptionalToken,
  24969. printTypeAnnotation
  24970. } = require_misc();
  24971. function printArray(path, options, print) {
  24972. const node = path.getValue();
  24973. const parts = [];
  24974. const openBracket = node.type === "TupleExpression" ? "#[" : "[";
  24975. const closeBracket = "]";
  24976. if (node.elements.length === 0) {
  24977. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  24978. parts.push(openBracket, closeBracket);
  24979. } else {
  24980. parts.push(group([openBracket, printDanglingComments(path, options), softline, closeBracket]));
  24981. }
  24982. } else {
  24983. const lastElem = getLast(node.elements);
  24984. const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement");
  24985. const needsForcedTrailingComma = lastElem === null;
  24986. const groupId = Symbol("array");
  24987. const shouldBreak = !options.__inJestEach && node.elements.length > 1 && node.elements.every((element, i, elements) => {
  24988. const elementType = element && element.type;
  24989. if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
  24990. return false;
  24991. }
  24992. const nextElement = elements[i + 1];
  24993. if (nextElement && elementType !== nextElement.type) {
  24994. return false;
  24995. }
  24996. const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
  24997. return element[itemsKey] && element[itemsKey].length > 1;
  24998. });
  24999. const shouldUseConciseFormatting = isConciselyPrintedArray(node, options);
  25000. const trailingComma = !canHaveTrailingComma ? "" : needsForcedTrailingComma ? "," : !shouldPrintComma(options) ? "" : shouldUseConciseFormatting ? ifBreak(",", "", {
  25001. groupId
  25002. }) : ifBreak(",");
  25003. parts.push(group([openBracket, indent([softline, shouldUseConciseFormatting ? printArrayItemsConcisely(path, options, print, trailingComma) : [printArrayItems(path, options, "elements", print), trailingComma], printDanglingComments(path, options, true)]), softline, closeBracket], {
  25004. shouldBreak,
  25005. id: groupId
  25006. }));
  25007. }
  25008. parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
  25009. return parts;
  25010. }
  25011. function isConciselyPrintedArray(node, options) {
  25012. 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), {
  25013. backwards: true
  25014. })));
  25015. }
  25016. function printArrayItems(path, options, printPath, print) {
  25017. const printedElements = [];
  25018. let separatorParts = [];
  25019. path.each((childPath) => {
  25020. printedElements.push(separatorParts, group(print()));
  25021. separatorParts = [",", line];
  25022. if (childPath.getValue() && isNextLineEmpty(childPath.getValue(), options)) {
  25023. separatorParts.push(softline);
  25024. }
  25025. }, printPath);
  25026. return printedElements;
  25027. }
  25028. function printArrayItemsConcisely(path, options, print, trailingComma) {
  25029. const parts = [];
  25030. path.each((childPath, i, elements) => {
  25031. const isLast = i === elements.length - 1;
  25032. parts.push([print(), isLast ? trailingComma : ","]);
  25033. if (!isLast) {
  25034. parts.push(isNextLineEmpty(childPath.getValue(), options) ? [hardline, hardline] : hasComment(elements[i + 1], CommentCheckFlags.Leading | CommentCheckFlags.Line) ? hardline : line);
  25035. }
  25036. }, "elements");
  25037. return fill(parts);
  25038. }
  25039. module2.exports = {
  25040. printArray,
  25041. printArrayItems,
  25042. isConciselyPrintedArray
  25043. };
  25044. }
  25045. });
  25046. var require_call_arguments = __commonJS2({
  25047. "src/language-js/print/call-arguments.js"(exports2, module2) {
  25048. "use strict";
  25049. var {
  25050. printDanglingComments
  25051. } = require_comments();
  25052. var {
  25053. getLast,
  25054. getPenultimate
  25055. } = require_util();
  25056. var {
  25057. getFunctionParameters,
  25058. hasComment,
  25059. CommentCheckFlags,
  25060. isFunctionCompositionArgs,
  25061. isJsxNode,
  25062. isLongCurriedCallExpression,
  25063. shouldPrintComma,
  25064. getCallArguments,
  25065. iterateCallArgumentsPath,
  25066. isNextLineEmpty,
  25067. isCallExpression,
  25068. isStringLiteral,
  25069. isObjectProperty
  25070. } = require_utils7();
  25071. var {
  25072. builders: {
  25073. line,
  25074. hardline,
  25075. softline,
  25076. group,
  25077. indent,
  25078. conditionalGroup,
  25079. ifBreak,
  25080. breakParent
  25081. },
  25082. utils: {
  25083. willBreak
  25084. }
  25085. } = require("./doc.js");
  25086. var {
  25087. ArgExpansionBailout
  25088. } = require_errors();
  25089. var {
  25090. isConciselyPrintedArray
  25091. } = require_array4();
  25092. function printCallArguments(path, options, print) {
  25093. const node = path.getValue();
  25094. const isDynamicImport = node.type === "ImportExpression";
  25095. const args = getCallArguments(node);
  25096. if (args.length === 0) {
  25097. return ["(", printDanglingComments(path, options, true), ")"];
  25098. }
  25099. if (isReactHookCallWithDepsArray(args)) {
  25100. return ["(", print(["arguments", 0]), ", ", print(["arguments", 1]), ")"];
  25101. }
  25102. let anyArgEmptyLine = false;
  25103. let hasEmptyLineFollowingFirstArg = false;
  25104. const lastArgIndex = args.length - 1;
  25105. const printedArguments = [];
  25106. iterateCallArgumentsPath(path, (argPath, index) => {
  25107. const arg = argPath.getNode();
  25108. const parts = [print()];
  25109. if (index === lastArgIndex) {
  25110. } else if (isNextLineEmpty(arg, options)) {
  25111. if (index === 0) {
  25112. hasEmptyLineFollowingFirstArg = true;
  25113. }
  25114. anyArgEmptyLine = true;
  25115. parts.push(",", hardline, hardline);
  25116. } else {
  25117. parts.push(",", line);
  25118. }
  25119. printedArguments.push(parts);
  25120. });
  25121. const maybeTrailingComma = !(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : "";
  25122. function allArgsBrokenOut() {
  25123. return group(["(", indent([line, ...printedArguments]), maybeTrailingComma, line, ")"], {
  25124. shouldBreak: true
  25125. });
  25126. }
  25127. if (anyArgEmptyLine || path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs(args)) {
  25128. return allArgsBrokenOut();
  25129. }
  25130. const shouldGroupFirst = shouldGroupFirstArg(args);
  25131. const shouldGroupLast = shouldGroupLastArg(args, options);
  25132. if (shouldGroupFirst || shouldGroupLast) {
  25133. if (shouldGroupFirst ? printedArguments.slice(1).some(willBreak) : printedArguments.slice(0, -1).some(willBreak)) {
  25134. return allArgsBrokenOut();
  25135. }
  25136. let printedExpanded = [];
  25137. try {
  25138. path.try(() => {
  25139. iterateCallArgumentsPath(path, (argPath, i) => {
  25140. if (shouldGroupFirst && i === 0) {
  25141. printedExpanded = [[print([], {
  25142. expandFirstArg: true
  25143. }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline : line, hasEmptyLineFollowingFirstArg ? hardline : ""], ...printedArguments.slice(1)];
  25144. }
  25145. if (shouldGroupLast && i === lastArgIndex) {
  25146. printedExpanded = [...printedArguments.slice(0, -1), print([], {
  25147. expandLastArg: true
  25148. })];
  25149. }
  25150. });
  25151. });
  25152. } catch (caught) {
  25153. if (caught instanceof ArgExpansionBailout) {
  25154. return allArgsBrokenOut();
  25155. }
  25156. throw caught;
  25157. }
  25158. return [printedArguments.some(willBreak) ? breakParent : "", conditionalGroup([["(", ...printedExpanded, ")"], shouldGroupFirst ? ["(", group(printedExpanded[0], {
  25159. shouldBreak: true
  25160. }), ...printedExpanded.slice(1), ")"] : ["(", ...printedArguments.slice(0, -1), group(getLast(printedExpanded), {
  25161. shouldBreak: true
  25162. }), ")"], allArgsBrokenOut()])];
  25163. }
  25164. const contents = ["(", indent([softline, ...printedArguments]), ifBreak(maybeTrailingComma), softline, ")"];
  25165. if (isLongCurriedCallExpression(path)) {
  25166. return contents;
  25167. }
  25168. return group(contents, {
  25169. shouldBreak: printedArguments.some(willBreak) || anyArgEmptyLine
  25170. });
  25171. }
  25172. function couldGroupArg(arg, arrowChainRecursion = false) {
  25173. 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) || arg.type === "TSAsExpression" && 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";
  25174. }
  25175. function shouldGroupLastArg(args, options) {
  25176. const lastArg = getLast(args);
  25177. const penultimateArg = getPenultimate(args);
  25178. 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));
  25179. }
  25180. function shouldGroupFirstArg(args) {
  25181. if (args.length !== 2) {
  25182. return false;
  25183. }
  25184. const [firstArg, secondArg] = args;
  25185. if (firstArg.type === "ModuleExpression" && isTypeModuleObjectExpression(secondArg)) {
  25186. return true;
  25187. }
  25188. return !hasComment(firstArg) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
  25189. }
  25190. function isReactHookCallWithDepsArray(args) {
  25191. 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));
  25192. }
  25193. function isNonEmptyBlockStatement(node) {
  25194. return node.type === "BlockStatement" && (node.body.some((node2) => node2.type !== "EmptyStatement") || hasComment(node, CommentCheckFlags.Dangling));
  25195. }
  25196. function isTypeModuleObjectExpression(node) {
  25197. 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";
  25198. }
  25199. module2.exports = printCallArguments;
  25200. }
  25201. });
  25202. var require_member = __commonJS2({
  25203. "src/language-js/print/member.js"(exports2, module2) {
  25204. "use strict";
  25205. var {
  25206. builders: {
  25207. softline,
  25208. group,
  25209. indent,
  25210. label
  25211. }
  25212. } = require("./doc.js");
  25213. var {
  25214. isNumericLiteral,
  25215. isMemberExpression,
  25216. isCallExpression
  25217. } = require_utils7();
  25218. var {
  25219. printOptionalToken
  25220. } = require_misc();
  25221. function printMemberExpression(path, options, print) {
  25222. const node = path.getValue();
  25223. const parent = path.getParentNode();
  25224. let firstNonMemberParent;
  25225. let i = 0;
  25226. do {
  25227. firstNonMemberParent = path.getParentNode(i);
  25228. i++;
  25229. } while (firstNonMemberParent && (isMemberExpression(firstNonMemberParent) || firstNonMemberParent.type === "TSNonNullExpression"));
  25230. const objectDoc = print("object");
  25231. const lookupDoc = printMemberLookup(path, options, print);
  25232. 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");
  25233. return label(objectDoc.label === "member-chain" ? "member-chain" : "member", [objectDoc, shouldInline ? lookupDoc : group(indent([softline, lookupDoc]))]);
  25234. }
  25235. function printMemberLookup(path, options, print) {
  25236. const property = print("property");
  25237. const node = path.getValue();
  25238. const optional = printOptionalToken(path);
  25239. if (!node.computed) {
  25240. return [optional, ".", property];
  25241. }
  25242. if (!node.property || isNumericLiteral(node.property)) {
  25243. return [optional, "[", property, "]"];
  25244. }
  25245. return group([optional, "[", indent([softline, property]), softline, "]"]);
  25246. }
  25247. module2.exports = {
  25248. printMemberExpression,
  25249. printMemberLookup
  25250. };
  25251. }
  25252. });
  25253. var require_member_chain = __commonJS2({
  25254. "src/language-js/print/member-chain.js"(exports2, module2) {
  25255. "use strict";
  25256. var {
  25257. printComments
  25258. } = require_comments();
  25259. var {
  25260. getLast,
  25261. isNextLineEmptyAfterIndex,
  25262. getNextNonSpaceNonCommentCharacterIndex
  25263. } = require_util();
  25264. var pathNeedsParens = require_needs_parens();
  25265. var {
  25266. isCallExpression,
  25267. isMemberExpression,
  25268. isFunctionOrArrowExpression,
  25269. isLongCurriedCallExpression,
  25270. isMemberish,
  25271. isNumericLiteral,
  25272. isSimpleCallArgument,
  25273. hasComment,
  25274. CommentCheckFlags,
  25275. isNextLineEmpty
  25276. } = require_utils7();
  25277. var {
  25278. locEnd
  25279. } = require_loc();
  25280. var {
  25281. builders: {
  25282. join,
  25283. hardline,
  25284. group,
  25285. indent,
  25286. conditionalGroup,
  25287. breakParent,
  25288. label
  25289. },
  25290. utils: {
  25291. willBreak
  25292. }
  25293. } = require("./doc.js");
  25294. var printCallArguments = require_call_arguments();
  25295. var {
  25296. printMemberLookup
  25297. } = require_member();
  25298. var {
  25299. printOptionalToken,
  25300. printFunctionTypeParameters,
  25301. printBindExpressionCallee
  25302. } = require_misc();
  25303. function printMemberChain(path, options, print) {
  25304. const parent = path.getParentNode();
  25305. const isExpressionStatement = !parent || parent.type === "ExpressionStatement";
  25306. const printedNodes = [];
  25307. function shouldInsertEmptyLineAfter(node2) {
  25308. const {
  25309. originalText
  25310. } = options;
  25311. const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex(originalText, node2, locEnd);
  25312. const nextChar = originalText.charAt(nextCharIndex);
  25313. if (nextChar === ")") {
  25314. return nextCharIndex !== false && isNextLineEmptyAfterIndex(originalText, nextCharIndex + 1);
  25315. }
  25316. return isNextLineEmpty(node2, options);
  25317. }
  25318. function rec(path2) {
  25319. const node2 = path2.getValue();
  25320. if (isCallExpression(node2) && (isMemberish(node2.callee) || isCallExpression(node2.callee))) {
  25321. printedNodes.unshift({
  25322. node: node2,
  25323. printed: [printComments(path2, [printOptionalToken(path2), printFunctionTypeParameters(path2, options, print), printCallArguments(path2, options, print)], options), shouldInsertEmptyLineAfter(node2) ? hardline : ""]
  25324. });
  25325. path2.call((callee) => rec(callee), "callee");
  25326. } else if (isMemberish(node2)) {
  25327. printedNodes.unshift({
  25328. node: node2,
  25329. needsParens: pathNeedsParens(path2, options),
  25330. printed: printComments(path2, isMemberExpression(node2) ? printMemberLookup(path2, options, print) : printBindExpressionCallee(path2, options, print), options)
  25331. });
  25332. path2.call((object) => rec(object), "object");
  25333. } else if (node2.type === "TSNonNullExpression") {
  25334. printedNodes.unshift({
  25335. node: node2,
  25336. printed: printComments(path2, "!", options)
  25337. });
  25338. path2.call((expression) => rec(expression), "expression");
  25339. } else {
  25340. printedNodes.unshift({
  25341. node: node2,
  25342. printed: print()
  25343. });
  25344. }
  25345. }
  25346. const node = path.getValue();
  25347. printedNodes.unshift({
  25348. node,
  25349. printed: [printOptionalToken(path), printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)]
  25350. });
  25351. if (node.callee) {
  25352. path.call((callee) => rec(callee), "callee");
  25353. }
  25354. const groups = [];
  25355. let currentGroup = [printedNodes[0]];
  25356. let i = 1;
  25357. for (; i < printedNodes.length; ++i) {
  25358. if (printedNodes[i].node.type === "TSNonNullExpression" || isCallExpression(printedNodes[i].node) || isMemberExpression(printedNodes[i].node) && printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  25359. currentGroup.push(printedNodes[i]);
  25360. } else {
  25361. break;
  25362. }
  25363. }
  25364. if (!isCallExpression(printedNodes[0].node)) {
  25365. for (; i + 1 < printedNodes.length; ++i) {
  25366. if (isMemberish(printedNodes[i].node) && isMemberish(printedNodes[i + 1].node)) {
  25367. currentGroup.push(printedNodes[i]);
  25368. } else {
  25369. break;
  25370. }
  25371. }
  25372. }
  25373. groups.push(currentGroup);
  25374. currentGroup = [];
  25375. let hasSeenCallExpression = false;
  25376. for (; i < printedNodes.length; ++i) {
  25377. if (hasSeenCallExpression && isMemberish(printedNodes[i].node)) {
  25378. if (printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
  25379. currentGroup.push(printedNodes[i]);
  25380. continue;
  25381. }
  25382. groups.push(currentGroup);
  25383. currentGroup = [];
  25384. hasSeenCallExpression = false;
  25385. }
  25386. if (isCallExpression(printedNodes[i].node) || printedNodes[i].node.type === "ImportExpression") {
  25387. hasSeenCallExpression = true;
  25388. }
  25389. currentGroup.push(printedNodes[i]);
  25390. if (hasComment(printedNodes[i].node, CommentCheckFlags.Trailing)) {
  25391. groups.push(currentGroup);
  25392. currentGroup = [];
  25393. hasSeenCallExpression = false;
  25394. }
  25395. }
  25396. if (currentGroup.length > 0) {
  25397. groups.push(currentGroup);
  25398. }
  25399. function isFactory(name) {
  25400. return /^[A-Z]|^[$_]+$/.test(name);
  25401. }
  25402. function isShort(name) {
  25403. return name.length <= options.tabWidth;
  25404. }
  25405. function shouldNotWrap(groups2) {
  25406. const hasComputed = groups2[1].length > 0 && groups2[1][0].node.computed;
  25407. if (groups2[0].length === 1) {
  25408. const firstNode = groups2[0][0].node;
  25409. return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpressionStatement && isShort(firstNode.name) || hasComputed);
  25410. }
  25411. const lastNode = getLast(groups2[0]).node;
  25412. return isMemberExpression(lastNode) && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
  25413. }
  25414. const shouldMerge = groups.length >= 2 && !hasComment(groups[1][0].node) && shouldNotWrap(groups);
  25415. function printGroup(printedGroup) {
  25416. const printed = printedGroup.map((tuple) => tuple.printed);
  25417. if (printedGroup.length > 0 && getLast(printedGroup).needsParens) {
  25418. return ["(", ...printed, ")"];
  25419. }
  25420. return printed;
  25421. }
  25422. function printIndentedGroup(groups2) {
  25423. if (groups2.length === 0) {
  25424. return "";
  25425. }
  25426. return indent(group([hardline, join(hardline, groups2.map(printGroup))]));
  25427. }
  25428. const printedGroups = groups.map(printGroup);
  25429. const oneLine = printedGroups;
  25430. const cutoff = shouldMerge ? 3 : 2;
  25431. const flatGroups = groups.flat();
  25432. 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);
  25433. if (groups.length <= cutoff && !nodeHasComment) {
  25434. if (isLongCurriedCallExpression(path)) {
  25435. return oneLine;
  25436. }
  25437. return group(oneLine);
  25438. }
  25439. const lastNodeBeforeIndent = getLast(groups[shouldMerge ? 1 : 0]).node;
  25440. const shouldHaveEmptyLineBeforeIndent = !isCallExpression(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
  25441. const expanded = [printGroup(groups[0]), shouldMerge ? groups.slice(1, 2).map(printGroup) : "", shouldHaveEmptyLineBeforeIndent ? hardline : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))];
  25442. const callExpressions = printedNodes.map(({
  25443. node: node2
  25444. }) => node2).filter(isCallExpression);
  25445. function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
  25446. const lastGroupNode = getLast(getLast(groups)).node;
  25447. const lastGroupDoc = getLast(printedGroups);
  25448. return isCallExpression(lastGroupNode) && willBreak(lastGroupDoc) && callExpressions.slice(0, -1).some((node2) => node2.arguments.some(isFunctionOrArrowExpression));
  25449. }
  25450. let result;
  25451. if (nodeHasComment || callExpressions.length > 2 && callExpressions.some((expr) => !expr.arguments.every((arg) => isSimpleCallArgument(arg, 0))) || printedGroups.slice(0, -1).some(willBreak) || lastGroupWillBreakAndOtherCallsHaveFunctionArguments()) {
  25452. result = group(expanded);
  25453. } else {
  25454. result = [willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", conditionalGroup([oneLine, expanded])];
  25455. }
  25456. return label("member-chain", result);
  25457. }
  25458. module2.exports = printMemberChain;
  25459. }
  25460. });
  25461. var require_call_expression = __commonJS2({
  25462. "src/language-js/print/call-expression.js"(exports2, module2) {
  25463. "use strict";
  25464. var {
  25465. builders: {
  25466. join,
  25467. group
  25468. }
  25469. } = require("./doc.js");
  25470. var pathNeedsParens = require_needs_parens();
  25471. var {
  25472. getCallArguments,
  25473. hasFlowAnnotationComment,
  25474. isCallExpression,
  25475. isMemberish,
  25476. isStringLiteral,
  25477. isTemplateOnItsOwnLine,
  25478. isTestCall,
  25479. iterateCallArgumentsPath
  25480. } = require_utils7();
  25481. var printMemberChain = require_member_chain();
  25482. var printCallArguments = require_call_arguments();
  25483. var {
  25484. printOptionalToken,
  25485. printFunctionTypeParameters
  25486. } = require_misc();
  25487. function printCallExpression(path, options, print) {
  25488. const node = path.getValue();
  25489. const parentNode = path.getParentNode();
  25490. const isNew = node.type === "NewExpression";
  25491. const isDynamicImport = node.type === "ImportExpression";
  25492. const optional = printOptionalToken(path);
  25493. const args = getCallArguments(node);
  25494. if (args.length > 0 && (!isDynamicImport && !isNew && isCommonsJsOrAmdCall(node, parentNode) || args.length === 1 && isTemplateOnItsOwnLine(args[0], options.originalText) || !isNew && isTestCall(node, parentNode))) {
  25495. const printed = [];
  25496. iterateCallArgumentsPath(path, () => {
  25497. printed.push(print());
  25498. });
  25499. return [isNew ? "new " : "", print("callee"), optional, printFunctionTypeParameters(path, options, print), "(", join(", ", printed), ")"];
  25500. }
  25501. const isIdentifierWithFlowAnnotation = (options.parser === "babel" || options.parser === "babel-flow") && node.callee && node.callee.type === "Identifier" && hasFlowAnnotationComment(node.callee.trailingComments);
  25502. if (isIdentifierWithFlowAnnotation) {
  25503. node.callee.trailingComments[0].printed = true;
  25504. }
  25505. if (!isDynamicImport && !isNew && isMemberish(node.callee) && !path.call((path2) => pathNeedsParens(path2, options), "callee")) {
  25506. return printMemberChain(path, options, print);
  25507. }
  25508. 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)];
  25509. if (isDynamicImport || isCallExpression(node.callee)) {
  25510. return group(contents);
  25511. }
  25512. return contents;
  25513. }
  25514. function isCommonsJsOrAmdCall(node, parentNode) {
  25515. if (node.callee.type !== "Identifier") {
  25516. return false;
  25517. }
  25518. if (node.callee.name === "require") {
  25519. return true;
  25520. }
  25521. if (node.callee.name === "define") {
  25522. const args = getCallArguments(node);
  25523. return parentNode.type === "ExpressionStatement" && (args.length === 1 || args.length === 2 && args[0].type === "ArrayExpression" || args.length === 3 && isStringLiteral(args[0]) && args[1].type === "ArrayExpression");
  25524. }
  25525. return false;
  25526. }
  25527. module2.exports = {
  25528. printCallExpression
  25529. };
  25530. }
  25531. });
  25532. var require_assignment = __commonJS2({
  25533. "src/language-js/print/assignment.js"(exports2, module2) {
  25534. "use strict";
  25535. var {
  25536. isNonEmptyArray,
  25537. getStringWidth
  25538. } = require_util();
  25539. var {
  25540. builders: {
  25541. line,
  25542. group,
  25543. indent,
  25544. indentIfBreak,
  25545. lineSuffixBoundary
  25546. },
  25547. utils: {
  25548. cleanDoc,
  25549. willBreak,
  25550. canBreak
  25551. }
  25552. } = require("./doc.js");
  25553. var {
  25554. hasLeadingOwnLineComment,
  25555. isBinaryish,
  25556. isStringLiteral,
  25557. isLiteral,
  25558. isNumericLiteral,
  25559. isCallExpression,
  25560. isMemberExpression,
  25561. getCallArguments,
  25562. rawText,
  25563. hasComment,
  25564. isSignedNumericLiteral,
  25565. isObjectProperty
  25566. } = require_utils7();
  25567. var {
  25568. shouldInlineLogicalExpression
  25569. } = require_binaryish();
  25570. var {
  25571. printCallExpression
  25572. } = require_call_expression();
  25573. function printAssignment(path, options, print, leftDoc, operator, rightPropertyName) {
  25574. const layout = chooseLayout(path, options, print, leftDoc, rightPropertyName);
  25575. const rightDoc = print(rightPropertyName, {
  25576. assignmentLayout: layout
  25577. });
  25578. switch (layout) {
  25579. case "break-after-operator":
  25580. return group([group(leftDoc), operator, group(indent([line, rightDoc]))]);
  25581. case "never-break-after-operator":
  25582. return group([group(leftDoc), operator, " ", rightDoc]);
  25583. case "fluid": {
  25584. const groupId = Symbol("assignment");
  25585. return group([group(leftDoc), operator, group(indent(line), {
  25586. id: groupId
  25587. }), lineSuffixBoundary, indentIfBreak(rightDoc, {
  25588. groupId
  25589. })]);
  25590. }
  25591. case "break-lhs":
  25592. return group([leftDoc, operator, " ", group(rightDoc)]);
  25593. case "chain":
  25594. return [group(leftDoc), operator, line, rightDoc];
  25595. case "chain-tail":
  25596. return [group(leftDoc), operator, indent([line, rightDoc])];
  25597. case "chain-tail-arrow-chain":
  25598. return [group(leftDoc), operator, rightDoc];
  25599. case "only-left":
  25600. return leftDoc;
  25601. }
  25602. }
  25603. function printAssignmentExpression(path, options, print) {
  25604. const node = path.getValue();
  25605. return printAssignment(path, options, print, print("left"), [" ", node.operator], "right");
  25606. }
  25607. function printVariableDeclarator(path, options, print) {
  25608. return printAssignment(path, options, print, print("id"), " =", "init");
  25609. }
  25610. function chooseLayout(path, options, print, leftDoc, rightPropertyName) {
  25611. const node = path.getValue();
  25612. const rightNode = node[rightPropertyName];
  25613. if (!rightNode) {
  25614. return "only-left";
  25615. }
  25616. const isTail = !isAssignment(rightNode);
  25617. const shouldUseChainFormatting = path.match(isAssignment, isAssignmentOrVariableDeclarator, (node2) => !isTail || node2.type !== "ExpressionStatement" && node2.type !== "VariableDeclaration");
  25618. if (shouldUseChainFormatting) {
  25619. return !isTail ? "chain" : rightNode.type === "ArrowFunctionExpression" && rightNode.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail";
  25620. }
  25621. const isHeadOfLongChain = !isTail && isAssignment(rightNode.right);
  25622. if (isHeadOfLongChain || hasLeadingOwnLineComment(options.originalText, rightNode)) {
  25623. return "break-after-operator";
  25624. }
  25625. if (rightNode.type === "CallExpression" && rightNode.callee.name === "require" || options.parser === "json5" || options.parser === "json") {
  25626. return "never-break-after-operator";
  25627. }
  25628. if (isComplexDestructuring(node) || isComplexTypeAliasParams(node) || hasComplexTypeAnnotation(node) || isArrowFunctionVariableDeclarator(node) && canBreak(leftDoc)) {
  25629. return "break-lhs";
  25630. }
  25631. const hasShortKey = isObjectPropertyWithShortKey(node, leftDoc, options);
  25632. if (path.call(() => shouldBreakAfterOperator(path, options, print, hasShortKey), rightPropertyName)) {
  25633. return "break-after-operator";
  25634. }
  25635. if (hasShortKey || rightNode.type === "TemplateLiteral" || rightNode.type === "TaggedTemplateExpression" || rightNode.type === "BooleanLiteral" || isNumericLiteral(rightNode) || rightNode.type === "ClassExpression") {
  25636. return "never-break-after-operator";
  25637. }
  25638. return "fluid";
  25639. }
  25640. function shouldBreakAfterOperator(path, options, print, hasShortKey) {
  25641. const rightNode = path.getValue();
  25642. if (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
  25643. return true;
  25644. }
  25645. switch (rightNode.type) {
  25646. case "StringLiteralTypeAnnotation":
  25647. case "SequenceExpression":
  25648. return true;
  25649. case "ConditionalExpression": {
  25650. const {
  25651. test
  25652. } = rightNode;
  25653. return isBinaryish(test) && !shouldInlineLogicalExpression(test);
  25654. }
  25655. case "ClassExpression":
  25656. return isNonEmptyArray(rightNode.decorators);
  25657. }
  25658. if (hasShortKey) {
  25659. return false;
  25660. }
  25661. let node = rightNode;
  25662. const propertiesForPath = [];
  25663. for (; ; ) {
  25664. if (node.type === "UnaryExpression") {
  25665. node = node.argument;
  25666. propertiesForPath.push("argument");
  25667. } else if (node.type === "TSNonNullExpression") {
  25668. node = node.expression;
  25669. propertiesForPath.push("expression");
  25670. } else {
  25671. break;
  25672. }
  25673. }
  25674. if (isStringLiteral(node) || path.call(() => isPoorlyBreakableMemberOrCallChain(path, options, print), ...propertiesForPath)) {
  25675. return true;
  25676. }
  25677. return false;
  25678. }
  25679. function isComplexDestructuring(node) {
  25680. if (isAssignmentOrVariableDeclarator(node)) {
  25681. const leftNode = node.left || node.id;
  25682. return leftNode.type === "ObjectPattern" && leftNode.properties.length > 2 && leftNode.properties.some((property) => isObjectProperty(property) && (!property.shorthand || property.value && property.value.type === "AssignmentPattern"));
  25683. }
  25684. return false;
  25685. }
  25686. function isAssignment(node) {
  25687. return node.type === "AssignmentExpression";
  25688. }
  25689. function isAssignmentOrVariableDeclarator(node) {
  25690. return isAssignment(node) || node.type === "VariableDeclarator";
  25691. }
  25692. function isComplexTypeAliasParams(node) {
  25693. const typeParams = getTypeParametersFromTypeAlias(node);
  25694. if (isNonEmptyArray(typeParams)) {
  25695. const constraintPropertyName = node.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
  25696. if (typeParams.length > 1 && typeParams.some((param) => param[constraintPropertyName] || param.default)) {
  25697. return true;
  25698. }
  25699. }
  25700. return false;
  25701. }
  25702. function getTypeParametersFromTypeAlias(node) {
  25703. if (isTypeAlias(node) && node.typeParameters && node.typeParameters.params) {
  25704. return node.typeParameters.params;
  25705. }
  25706. return null;
  25707. }
  25708. function isTypeAlias(node) {
  25709. return node.type === "TSTypeAliasDeclaration" || node.type === "TypeAlias";
  25710. }
  25711. function hasComplexTypeAnnotation(node) {
  25712. if (node.type !== "VariableDeclarator") {
  25713. return false;
  25714. }
  25715. const {
  25716. typeAnnotation
  25717. } = node.id;
  25718. if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
  25719. return false;
  25720. }
  25721. const typeParams = getTypeParametersFromTypeReference(typeAnnotation.typeAnnotation);
  25722. return isNonEmptyArray(typeParams) && typeParams.length > 1 && typeParams.some((param) => isNonEmptyArray(getTypeParametersFromTypeReference(param)) || param.type === "TSConditionalType");
  25723. }
  25724. function isArrowFunctionVariableDeclarator(node) {
  25725. return node.type === "VariableDeclarator" && node.init && node.init.type === "ArrowFunctionExpression";
  25726. }
  25727. function getTypeParametersFromTypeReference(node) {
  25728. if (isTypeReference(node) && node.typeParameters && node.typeParameters.params) {
  25729. return node.typeParameters.params;
  25730. }
  25731. return null;
  25732. }
  25733. function isTypeReference(node) {
  25734. return node.type === "TSTypeReference" || node.type === "GenericTypeAnnotation";
  25735. }
  25736. function isPoorlyBreakableMemberOrCallChain(path, options, print, deep = false) {
  25737. const node = path.getValue();
  25738. const goDeeper = () => isPoorlyBreakableMemberOrCallChain(path, options, print, true);
  25739. if (node.type === "TSNonNullExpression") {
  25740. return path.call(goDeeper, "expression");
  25741. }
  25742. if (isCallExpression(node)) {
  25743. const doc2 = printCallExpression(path, options, print);
  25744. if (doc2.label === "member-chain") {
  25745. return false;
  25746. }
  25747. const args = getCallArguments(node);
  25748. const isPoorlyBreakableCall = args.length === 0 || args.length === 1 && isLoneShortArgument(args[0], options);
  25749. if (!isPoorlyBreakableCall) {
  25750. return false;
  25751. }
  25752. if (isCallExpressionWithComplexTypeArguments(node, print)) {
  25753. return false;
  25754. }
  25755. return path.call(goDeeper, "callee");
  25756. }
  25757. if (isMemberExpression(node)) {
  25758. return path.call(goDeeper, "object");
  25759. }
  25760. return deep && (node.type === "Identifier" || node.type === "ThisExpression");
  25761. }
  25762. var LONE_SHORT_ARGUMENT_THRESHOLD_RATE = 0.25;
  25763. function isLoneShortArgument(node, {
  25764. printWidth
  25765. }) {
  25766. if (hasComment(node)) {
  25767. return false;
  25768. }
  25769. const threshold = printWidth * LONE_SHORT_ARGUMENT_THRESHOLD_RATE;
  25770. if (node.type === "ThisExpression" || node.type === "Identifier" && node.name.length <= threshold || isSignedNumericLiteral(node) && !hasComment(node.argument)) {
  25771. return true;
  25772. }
  25773. const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
  25774. if (regexpPattern) {
  25775. return regexpPattern.length <= threshold;
  25776. }
  25777. if (isStringLiteral(node)) {
  25778. return rawText(node).length <= threshold;
  25779. }
  25780. if (node.type === "TemplateLiteral") {
  25781. return node.expressions.length === 0 && node.quasis[0].value.raw.length <= threshold && !node.quasis[0].value.raw.includes("\n");
  25782. }
  25783. return isLiteral(node);
  25784. }
  25785. function isObjectPropertyWithShortKey(node, keyDoc, options) {
  25786. if (!isObjectProperty(node)) {
  25787. return false;
  25788. }
  25789. keyDoc = cleanDoc(keyDoc);
  25790. const MIN_OVERLAP_FOR_BREAK = 3;
  25791. return typeof keyDoc === "string" && getStringWidth(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK;
  25792. }
  25793. function isCallExpressionWithComplexTypeArguments(node, print) {
  25794. const typeArgs = getTypeArgumentsFromCallExpression(node);
  25795. if (isNonEmptyArray(typeArgs)) {
  25796. if (typeArgs.length > 1) {
  25797. return true;
  25798. }
  25799. if (typeArgs.length === 1) {
  25800. const firstArg = typeArgs[0];
  25801. if (firstArg.type === "TSUnionType" || firstArg.type === "UnionTypeAnnotation" || firstArg.type === "TSIntersectionType" || firstArg.type === "IntersectionTypeAnnotation" || firstArg.type === "TSTypeLiteral" || firstArg.type === "ObjectTypeAnnotation") {
  25802. return true;
  25803. }
  25804. }
  25805. const typeArgsKeyName = node.typeParameters ? "typeParameters" : "typeArguments";
  25806. if (willBreak(print(typeArgsKeyName))) {
  25807. return true;
  25808. }
  25809. }
  25810. return false;
  25811. }
  25812. function getTypeArgumentsFromCallExpression(node) {
  25813. return node.typeParameters && node.typeParameters.params || node.typeArguments && node.typeArguments.params;
  25814. }
  25815. module2.exports = {
  25816. printVariableDeclarator,
  25817. printAssignmentExpression,
  25818. printAssignment,
  25819. isArrowFunctionVariableDeclarator
  25820. };
  25821. }
  25822. });
  25823. var require_function_parameters = __commonJS2({
  25824. "src/language-js/print/function-parameters.js"(exports2, module2) {
  25825. "use strict";
  25826. var {
  25827. getNextNonSpaceNonCommentCharacter
  25828. } = require_util();
  25829. var {
  25830. printDanglingComments
  25831. } = require_comments();
  25832. var {
  25833. builders: {
  25834. line,
  25835. hardline,
  25836. softline,
  25837. group,
  25838. indent,
  25839. ifBreak
  25840. },
  25841. utils: {
  25842. removeLines,
  25843. willBreak
  25844. }
  25845. } = require("./doc.js");
  25846. var {
  25847. getFunctionParameters,
  25848. iterateFunctionParametersPath,
  25849. isSimpleType,
  25850. isTestCall,
  25851. isTypeAnnotationAFunction,
  25852. isObjectType,
  25853. isObjectTypePropertyAFunction,
  25854. hasRestParameter,
  25855. shouldPrintComma,
  25856. hasComment,
  25857. isNextLineEmpty
  25858. } = require_utils7();
  25859. var {
  25860. locEnd
  25861. } = require_loc();
  25862. var {
  25863. ArgExpansionBailout
  25864. } = require_errors();
  25865. var {
  25866. printFunctionTypeParameters
  25867. } = require_misc();
  25868. function printFunctionParameters(path, print, options, expandArg, printTypeParams) {
  25869. const functionNode = path.getValue();
  25870. const parameters = getFunctionParameters(functionNode);
  25871. const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
  25872. if (parameters.length === 0) {
  25873. return [typeParams, "(", printDanglingComments(path, options, true, (comment) => getNextNonSpaceNonCommentCharacter(options.originalText, comment, locEnd) === ")"), ")"];
  25874. }
  25875. const parent = path.getParentNode();
  25876. const isParametersInTestCall = isTestCall(parent);
  25877. const shouldHugParameters = shouldHugFunctionParameters(functionNode);
  25878. const printed = [];
  25879. iterateFunctionParametersPath(path, (parameterPath, index) => {
  25880. const isLastParameter = index === parameters.length - 1;
  25881. if (isLastParameter && functionNode.rest) {
  25882. printed.push("...");
  25883. }
  25884. printed.push(print());
  25885. if (isLastParameter) {
  25886. return;
  25887. }
  25888. printed.push(",");
  25889. if (isParametersInTestCall || shouldHugParameters) {
  25890. printed.push(" ");
  25891. } else if (isNextLineEmpty(parameters[index], options)) {
  25892. printed.push(hardline, hardline);
  25893. } else {
  25894. printed.push(line);
  25895. }
  25896. });
  25897. if (expandArg) {
  25898. if (willBreak(typeParams) || willBreak(printed)) {
  25899. throw new ArgExpansionBailout();
  25900. }
  25901. return group([removeLines(typeParams), "(", removeLines(printed), ")"]);
  25902. }
  25903. const hasNotParameterDecorator = parameters.every((node) => !node.decorators);
  25904. if (shouldHugParameters && hasNotParameterDecorator) {
  25905. return [typeParams, "(", ...printed, ")"];
  25906. }
  25907. if (isParametersInTestCall) {
  25908. return [typeParams, "(", ...printed, ")"];
  25909. }
  25910. 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;
  25911. if (isFlowShorthandWithOneArg) {
  25912. if (options.arrowParens === "always") {
  25913. return ["(", ...printed, ")"];
  25914. }
  25915. return printed;
  25916. }
  25917. return [typeParams, "(", indent([softline, ...printed]), ifBreak(!hasRestParameter(functionNode) && shouldPrintComma(options, "all") ? "," : ""), softline, ")"];
  25918. }
  25919. function shouldHugFunctionParameters(node) {
  25920. if (!node) {
  25921. return false;
  25922. }
  25923. const parameters = getFunctionParameters(node);
  25924. if (parameters.length !== 1) {
  25925. return false;
  25926. }
  25927. const [parameter] = parameters;
  25928. 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));
  25929. }
  25930. function getReturnTypeNode(functionNode) {
  25931. let returnTypeNode;
  25932. if (functionNode.returnType) {
  25933. returnTypeNode = functionNode.returnType;
  25934. if (returnTypeNode.typeAnnotation) {
  25935. returnTypeNode = returnTypeNode.typeAnnotation;
  25936. }
  25937. } else if (functionNode.typeAnnotation) {
  25938. returnTypeNode = functionNode.typeAnnotation;
  25939. }
  25940. return returnTypeNode;
  25941. }
  25942. function shouldGroupFunctionParameters(functionNode, returnTypeDoc) {
  25943. const returnTypeNode = getReturnTypeNode(functionNode);
  25944. if (!returnTypeNode) {
  25945. return false;
  25946. }
  25947. const typeParameters = functionNode.typeParameters && functionNode.typeParameters.params;
  25948. if (typeParameters) {
  25949. if (typeParameters.length > 1) {
  25950. return false;
  25951. }
  25952. if (typeParameters.length === 1) {
  25953. const typeParameter = typeParameters[0];
  25954. if (typeParameter.constraint || typeParameter.default) {
  25955. return false;
  25956. }
  25957. }
  25958. }
  25959. return getFunctionParameters(functionNode).length === 1 && (isObjectType(returnTypeNode) || willBreak(returnTypeDoc));
  25960. }
  25961. module2.exports = {
  25962. printFunctionParameters,
  25963. shouldHugFunctionParameters,
  25964. shouldGroupFunctionParameters
  25965. };
  25966. }
  25967. });
  25968. var require_type_annotation = __commonJS2({
  25969. "src/language-js/print/type-annotation.js"(exports2, module2) {
  25970. "use strict";
  25971. var {
  25972. printComments,
  25973. printDanglingComments
  25974. } = require_comments();
  25975. var {
  25976. isNonEmptyArray
  25977. } = require_util();
  25978. var {
  25979. builders: {
  25980. group,
  25981. join,
  25982. line,
  25983. softline,
  25984. indent,
  25985. align,
  25986. ifBreak
  25987. }
  25988. } = require("./doc.js");
  25989. var pathNeedsParens = require_needs_parens();
  25990. var {
  25991. locStart
  25992. } = require_loc();
  25993. var {
  25994. isSimpleType,
  25995. isObjectType,
  25996. hasLeadingOwnLineComment,
  25997. isObjectTypePropertyAFunction,
  25998. shouldPrintComma
  25999. } = require_utils7();
  26000. var {
  26001. printAssignment
  26002. } = require_assignment();
  26003. var {
  26004. printFunctionParameters,
  26005. shouldGroupFunctionParameters
  26006. } = require_function_parameters();
  26007. var {
  26008. printArrayItems
  26009. } = require_array4();
  26010. function shouldHugType(node) {
  26011. if (isSimpleType(node) || isObjectType(node)) {
  26012. return true;
  26013. }
  26014. if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
  26015. const voidCount = node.types.filter((node2) => node2.type === "VoidTypeAnnotation" || node2.type === "TSVoidKeyword" || node2.type === "NullLiteralTypeAnnotation" || node2.type === "TSNullKeyword").length;
  26016. const hasObject = node.types.some((node2) => node2.type === "ObjectTypeAnnotation" || node2.type === "TSTypeLiteral" || node2.type === "GenericTypeAnnotation" || node2.type === "TSTypeReference");
  26017. if (node.types.length - 1 === voidCount && hasObject) {
  26018. return true;
  26019. }
  26020. }
  26021. return false;
  26022. }
  26023. function printOpaqueType(path, options, print) {
  26024. const semi = options.semi ? ";" : "";
  26025. const node = path.getValue();
  26026. const parts = [];
  26027. parts.push("opaque type ", print("id"), print("typeParameters"));
  26028. if (node.supertype) {
  26029. parts.push(": ", print("supertype"));
  26030. }
  26031. if (node.impltype) {
  26032. parts.push(" = ", print("impltype"));
  26033. }
  26034. parts.push(semi);
  26035. return parts;
  26036. }
  26037. function printTypeAlias(path, options, print) {
  26038. const semi = options.semi ? ";" : "";
  26039. const node = path.getValue();
  26040. const parts = [];
  26041. if (node.declare) {
  26042. parts.push("declare ");
  26043. }
  26044. parts.push("type ", print("id"), print("typeParameters"));
  26045. const rightPropertyName = node.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
  26046. return [printAssignment(path, options, print, parts, " =", rightPropertyName), semi];
  26047. }
  26048. function printIntersectionType(path, options, print) {
  26049. const node = path.getValue();
  26050. const types = path.map(print, "types");
  26051. const result = [];
  26052. let wasIndented = false;
  26053. for (let i = 0; i < types.length; ++i) {
  26054. if (i === 0) {
  26055. result.push(types[i]);
  26056. } else if (isObjectType(node.types[i - 1]) && isObjectType(node.types[i])) {
  26057. result.push([" & ", wasIndented ? indent(types[i]) : types[i]]);
  26058. } else if (!isObjectType(node.types[i - 1]) && !isObjectType(node.types[i])) {
  26059. result.push(indent([" &", line, types[i]]));
  26060. } else {
  26061. if (i > 1) {
  26062. wasIndented = true;
  26063. }
  26064. result.push(" & ", i > 1 ? indent(types[i]) : types[i]);
  26065. }
  26066. }
  26067. return group(result);
  26068. }
  26069. function printUnionType(path, options, print) {
  26070. const node = path.getValue();
  26071. const parent = path.getParentNode();
  26072. 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));
  26073. const shouldHug = shouldHugType(node);
  26074. const printed = path.map((typePath) => {
  26075. let printedType = print();
  26076. if (!shouldHug) {
  26077. printedType = align(2, printedType);
  26078. }
  26079. return printComments(typePath, printedType, options);
  26080. }, "types");
  26081. if (shouldHug) {
  26082. return join(" | ", printed);
  26083. }
  26084. const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, node);
  26085. const code = [ifBreak([shouldAddStartLine ? line : "", "| "]), join([line, "| "], printed)];
  26086. if (pathNeedsParens(path, options)) {
  26087. return group([indent(code), softline]);
  26088. }
  26089. if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
  26090. return group([indent([ifBreak(["(", softline]), code]), softline, ifBreak(")")]);
  26091. }
  26092. return group(shouldIndent ? indent(code) : code);
  26093. }
  26094. function printFunctionType(path, options, print) {
  26095. const node = path.getValue();
  26096. const parts = [];
  26097. const parent = path.getParentNode(0);
  26098. const parentParent = path.getParentNode(1);
  26099. const parentParentParent = path.getParentNode(2);
  26100. 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");
  26101. let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation");
  26102. const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
  26103. if (isObjectTypePropertyAFunction(parent)) {
  26104. isArrowFunctionTypeAnnotation = true;
  26105. needsColon = true;
  26106. }
  26107. if (needsParens) {
  26108. parts.push("(");
  26109. }
  26110. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  26111. const returnTypeDoc = node.returnType || node.predicate || node.typeAnnotation ? [isArrowFunctionTypeAnnotation ? " => " : ": ", print("returnType"), print("predicate"), print("typeAnnotation")] : "";
  26112. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26113. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  26114. if (returnTypeDoc) {
  26115. parts.push(returnTypeDoc);
  26116. }
  26117. if (needsParens) {
  26118. parts.push(")");
  26119. }
  26120. return group(parts);
  26121. }
  26122. function printTupleType(path, options, print) {
  26123. const node = path.getValue();
  26124. const typesField = node.type === "TSTupleType" ? "elementTypes" : "types";
  26125. const types = node[typesField];
  26126. const isNonEmptyTuple = isNonEmptyArray(types);
  26127. const bracketsDelimiterLine = isNonEmptyTuple ? softline : "";
  26128. return group(["[", indent([bracketsDelimiterLine, printArrayItems(path, options, typesField, print)]), ifBreak(isNonEmptyTuple && shouldPrintComma(options, "all") ? "," : ""), printDanglingComments(path, options, true), bracketsDelimiterLine, "]"]);
  26129. }
  26130. function printIndexedAccessType(path, options, print) {
  26131. const node = path.getValue();
  26132. const leftDelimiter = node.type === "OptionalIndexedAccessType" && node.optional ? "?.[" : "[";
  26133. return [print("objectType"), leftDelimiter, print("indexType"), "]"];
  26134. }
  26135. function printJSDocType(path, print, token) {
  26136. const node = path.getValue();
  26137. return [node.postfix ? "" : token, print("typeAnnotation"), node.postfix ? token : ""];
  26138. }
  26139. module2.exports = {
  26140. printOpaqueType,
  26141. printTypeAlias,
  26142. printIntersectionType,
  26143. printUnionType,
  26144. printFunctionType,
  26145. printTupleType,
  26146. printIndexedAccessType,
  26147. shouldHugType,
  26148. printJSDocType
  26149. };
  26150. }
  26151. });
  26152. var require_type_parameters = __commonJS2({
  26153. "src/language-js/print/type-parameters.js"(exports2, module2) {
  26154. "use strict";
  26155. var {
  26156. printDanglingComments
  26157. } = require_comments();
  26158. var {
  26159. builders: {
  26160. join,
  26161. line,
  26162. hardline,
  26163. softline,
  26164. group,
  26165. indent,
  26166. ifBreak
  26167. }
  26168. } = require("./doc.js");
  26169. var {
  26170. isTestCall,
  26171. hasComment,
  26172. CommentCheckFlags,
  26173. isTSXFile,
  26174. shouldPrintComma,
  26175. getFunctionParameters,
  26176. isObjectType
  26177. } = require_utils7();
  26178. var {
  26179. createGroupIdMapper
  26180. } = require_util();
  26181. var {
  26182. shouldHugType
  26183. } = require_type_annotation();
  26184. var {
  26185. isArrowFunctionVariableDeclarator
  26186. } = require_assignment();
  26187. var getTypeParametersGroupId = createGroupIdMapper("typeParameters");
  26188. function printTypeParameters(path, options, print, paramsKey) {
  26189. const node = path.getValue();
  26190. if (!node[paramsKey]) {
  26191. return "";
  26192. }
  26193. if (!Array.isArray(node[paramsKey])) {
  26194. return print(paramsKey);
  26195. }
  26196. const grandparent = path.getNode(2);
  26197. const isParameterInTestCall = grandparent && isTestCall(grandparent);
  26198. const isArrowFunctionVariable = path.match((node2) => !(node2[paramsKey].length === 1 && isObjectType(node2[paramsKey][0])), void 0, (node2, name) => name === "typeAnnotation", (node2) => node2.type === "Identifier", isArrowFunctionVariableDeclarator);
  26199. const shouldInline = !isArrowFunctionVariable && (isParameterInTestCall || node[paramsKey].length === 0 || node[paramsKey].length === 1 && (node[paramsKey][0].type === "NullableTypeAnnotation" || shouldHugType(node[paramsKey][0])));
  26200. if (shouldInline) {
  26201. return ["<", join(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(path, options), ">"];
  26202. }
  26203. const trailingComma = node.type === "TSTypeParameterInstantiation" ? "" : getFunctionParameters(node).length === 1 && isTSXFile(options) && !node[paramsKey][0].constraint && path.getParentNode().type === "ArrowFunctionExpression" ? "," : shouldPrintComma(options, "all") ? ifBreak(",") : "";
  26204. return group(["<", indent([softline, join([",", line], path.map(print, paramsKey))]), trailingComma, softline, ">"], {
  26205. id: getTypeParametersGroupId(node)
  26206. });
  26207. }
  26208. function printDanglingCommentsForInline(path, options) {
  26209. const node = path.getValue();
  26210. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  26211. return "";
  26212. }
  26213. const hasOnlyBlockComments = !hasComment(node, CommentCheckFlags.Line);
  26214. const printed = printDanglingComments(path, options, hasOnlyBlockComments);
  26215. if (hasOnlyBlockComments) {
  26216. return printed;
  26217. }
  26218. return [printed, hardline];
  26219. }
  26220. function printTypeParameter(path, options, print) {
  26221. const node = path.getValue();
  26222. const parts = [];
  26223. const parent = path.getParentNode();
  26224. if (parent.type === "TSMappedType") {
  26225. parts.push("[", print("name"));
  26226. if (node.constraint) {
  26227. parts.push(" in ", print("constraint"));
  26228. }
  26229. if (parent.nameType) {
  26230. parts.push(" as ", path.callParent(() => print("nameType")));
  26231. }
  26232. parts.push("]");
  26233. return parts;
  26234. }
  26235. if (node.variance) {
  26236. parts.push(print("variance"));
  26237. }
  26238. if (node.in) {
  26239. parts.push("in ");
  26240. }
  26241. if (node.out) {
  26242. parts.push("out ");
  26243. }
  26244. parts.push(print("name"));
  26245. if (node.bound) {
  26246. parts.push(": ", print("bound"));
  26247. }
  26248. if (node.constraint) {
  26249. parts.push(" extends ", print("constraint"));
  26250. }
  26251. if (node.default) {
  26252. parts.push(" = ", print("default"));
  26253. }
  26254. return parts;
  26255. }
  26256. module2.exports = {
  26257. printTypeParameter,
  26258. printTypeParameters,
  26259. getTypeParametersGroupId
  26260. };
  26261. }
  26262. });
  26263. var require_property = __commonJS2({
  26264. "src/language-js/print/property.js"(exports2, module2) {
  26265. "use strict";
  26266. var {
  26267. printComments
  26268. } = require_comments();
  26269. var {
  26270. printString,
  26271. printNumber
  26272. } = require_util();
  26273. var {
  26274. isNumericLiteral,
  26275. isSimpleNumber,
  26276. isStringLiteral,
  26277. isStringPropSafeToUnquote,
  26278. rawText
  26279. } = require_utils7();
  26280. var {
  26281. printAssignment
  26282. } = require_assignment();
  26283. var needsQuoteProps = /* @__PURE__ */ new WeakMap();
  26284. function printPropertyKey(path, options, print) {
  26285. const node = path.getNode();
  26286. if (node.computed) {
  26287. return ["[", print("key"), "]"];
  26288. }
  26289. const parent = path.getParentNode();
  26290. const {
  26291. key
  26292. } = node;
  26293. if (node.type === "ClassPrivateProperty" && key.type === "Identifier") {
  26294. return ["#", print("key")];
  26295. }
  26296. if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
  26297. const objectHasStringProp = (parent.properties || parent.body || parent.members).some((prop) => !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToUnquote(prop, options));
  26298. needsQuoteProps.set(parent, objectHasStringProp);
  26299. }
  26300. 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))) {
  26301. const prop = printString(JSON.stringify(key.type === "Identifier" ? key.name : key.value.toString()), options);
  26302. return path.call((keyPath) => printComments(keyPath, prop, options), "key");
  26303. }
  26304. if (isStringPropSafeToUnquote(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
  26305. return path.call((keyPath) => printComments(keyPath, /^\d/.test(key.value) ? printNumber(key.value) : key.value, options), "key");
  26306. }
  26307. return print("key");
  26308. }
  26309. function printProperty(path, options, print) {
  26310. const node = path.getValue();
  26311. if (node.shorthand) {
  26312. return print("value");
  26313. }
  26314. return printAssignment(path, options, print, printPropertyKey(path, options, print), ":", "value");
  26315. }
  26316. module2.exports = {
  26317. printProperty,
  26318. printPropertyKey
  26319. };
  26320. }
  26321. });
  26322. var require_function = __commonJS2({
  26323. "src/language-js/print/function.js"(exports2, module2) {
  26324. "use strict";
  26325. var assert = require("assert");
  26326. var {
  26327. printDanglingComments,
  26328. printCommentsSeparately
  26329. } = require_comments();
  26330. var getLast = require_get_last();
  26331. var {
  26332. getNextNonSpaceNonCommentCharacterIndex
  26333. } = require_util();
  26334. var {
  26335. builders: {
  26336. line,
  26337. softline,
  26338. group,
  26339. indent,
  26340. ifBreak,
  26341. hardline,
  26342. join,
  26343. indentIfBreak
  26344. },
  26345. utils: {
  26346. removeLines,
  26347. willBreak
  26348. }
  26349. } = require("./doc.js");
  26350. var {
  26351. ArgExpansionBailout
  26352. } = require_errors();
  26353. var {
  26354. getFunctionParameters,
  26355. hasLeadingOwnLineComment,
  26356. isFlowAnnotationComment,
  26357. isJsxNode,
  26358. isTemplateOnItsOwnLine,
  26359. shouldPrintComma,
  26360. startsWithNoLookaheadToken,
  26361. isBinaryish,
  26362. isLineComment,
  26363. hasComment,
  26364. getComments,
  26365. CommentCheckFlags,
  26366. isCallLikeExpression,
  26367. isCallExpression,
  26368. getCallArguments,
  26369. hasNakedLeftSide,
  26370. getLeftSide
  26371. } = require_utils7();
  26372. var {
  26373. locEnd
  26374. } = require_loc();
  26375. var {
  26376. printFunctionParameters,
  26377. shouldGroupFunctionParameters
  26378. } = require_function_parameters();
  26379. var {
  26380. printPropertyKey
  26381. } = require_property();
  26382. var {
  26383. printFunctionTypeParameters
  26384. } = require_misc();
  26385. function printFunction(path, print, options, args) {
  26386. const node = path.getValue();
  26387. let expandArg = false;
  26388. if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && args && args.expandLastArg) {
  26389. const parent = path.getParentNode();
  26390. if (isCallExpression(parent) && getCallArguments(parent).length > 1) {
  26391. expandArg = true;
  26392. }
  26393. }
  26394. const parts = [];
  26395. if (node.type === "TSDeclareFunction" && node.declare) {
  26396. parts.push("declare ");
  26397. }
  26398. if (node.async) {
  26399. parts.push("async ");
  26400. }
  26401. if (node.generator) {
  26402. parts.push("function* ");
  26403. } else {
  26404. parts.push("function ");
  26405. }
  26406. if (node.id) {
  26407. parts.push(print("id"));
  26408. }
  26409. const parametersDoc = printFunctionParameters(path, print, options, expandArg);
  26410. const returnTypeDoc = printReturnType(path, print, options);
  26411. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26412. parts.push(printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc]), node.body ? " " : "", print("body"));
  26413. if (options.semi && (node.declare || !node.body)) {
  26414. parts.push(";");
  26415. }
  26416. return parts;
  26417. }
  26418. function printMethod(path, options, print) {
  26419. const node = path.getNode();
  26420. const {
  26421. kind
  26422. } = node;
  26423. const value = node.value || node;
  26424. const parts = [];
  26425. if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
  26426. if (value.async) {
  26427. parts.push("async ");
  26428. }
  26429. } else {
  26430. assert.ok(kind === "get" || kind === "set");
  26431. parts.push(kind, " ");
  26432. }
  26433. if (value.generator) {
  26434. parts.push("*");
  26435. }
  26436. parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "");
  26437. if (node === value) {
  26438. parts.push(printMethodInternal(path, options, print));
  26439. } else if (value.type === "FunctionExpression") {
  26440. parts.push(path.call((path2) => printMethodInternal(path2, options, print), "value"));
  26441. } else {
  26442. parts.push(print("value"));
  26443. }
  26444. return parts;
  26445. }
  26446. function printMethodInternal(path, options, print) {
  26447. const node = path.getNode();
  26448. const parametersDoc = printFunctionParameters(path, print, options);
  26449. const returnTypeDoc = printReturnType(path, print, options);
  26450. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  26451. const parts = [printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc])];
  26452. if (node.body) {
  26453. parts.push(" ", print("body"));
  26454. } else {
  26455. parts.push(options.semi ? ";" : "");
  26456. }
  26457. return parts;
  26458. }
  26459. function printArrowFunctionSignature(path, options, print, args) {
  26460. const node = path.getValue();
  26461. const parts = [];
  26462. if (node.async) {
  26463. parts.push("async ");
  26464. }
  26465. if (shouldPrintParamsWithoutParens(path, options)) {
  26466. parts.push(print(["params", 0]));
  26467. } else {
  26468. const expandArg = args && (args.expandLastArg || args.expandFirstArg);
  26469. let returnTypeDoc = printReturnType(path, print, options);
  26470. if (expandArg) {
  26471. if (willBreak(returnTypeDoc)) {
  26472. throw new ArgExpansionBailout();
  26473. }
  26474. returnTypeDoc = group(removeLines(returnTypeDoc));
  26475. }
  26476. parts.push(group([printFunctionParameters(path, print, options, expandArg, true), returnTypeDoc]));
  26477. }
  26478. const dangling = printDanglingComments(path, options, true, (comment) => {
  26479. const nextCharacter = getNextNonSpaceNonCommentCharacterIndex(options.originalText, comment, locEnd);
  26480. return nextCharacter !== false && options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
  26481. });
  26482. if (dangling) {
  26483. parts.push(" ", dangling);
  26484. }
  26485. return parts;
  26486. }
  26487. function printArrowChain(path, args, signatures, shouldBreak, bodyDoc, tailNode) {
  26488. const name = path.getName();
  26489. const parent = path.getParentNode();
  26490. const isCallee = isCallLikeExpression(parent) && name === "callee";
  26491. const isAssignmentRhs = Boolean(args && args.assignmentLayout);
  26492. const shouldPutBodyOnSeparateLine = tailNode.body.type !== "BlockStatement" && tailNode.body.type !== "ObjectExpression" && tailNode.body.type !== "SequenceExpression";
  26493. const shouldBreakBeforeChain = isCallee && shouldPutBodyOnSeparateLine || args && args.assignmentLayout === "chain-tail-arrow-chain";
  26494. const groupId = Symbol("arrow-chain");
  26495. if (tailNode.body.type === "SequenceExpression") {
  26496. bodyDoc = group(["(", indent([softline, bodyDoc]), softline, ")"]);
  26497. }
  26498. return group([group(indent([isCallee || isAssignmentRhs ? softline : "", group(join([" =>", line], signatures), {
  26499. shouldBreak
  26500. })]), {
  26501. id: groupId,
  26502. shouldBreak: shouldBreakBeforeChain
  26503. }), " =>", indentIfBreak(shouldPutBodyOnSeparateLine ? indent([line, bodyDoc]) : [" ", bodyDoc], {
  26504. groupId
  26505. }), isCallee ? ifBreak(softline, "", {
  26506. groupId
  26507. }) : ""]);
  26508. }
  26509. function printArrowFunction(path, options, print, args) {
  26510. let node = path.getValue();
  26511. const signatures = [];
  26512. const body = [];
  26513. let chainShouldBreak = false;
  26514. (function rec() {
  26515. const doc2 = printArrowFunctionSignature(path, options, print, args);
  26516. if (signatures.length === 0) {
  26517. signatures.push(doc2);
  26518. } else {
  26519. const {
  26520. leading,
  26521. trailing
  26522. } = printCommentsSeparately(path, options);
  26523. signatures.push([leading, doc2]);
  26524. body.unshift(trailing);
  26525. }
  26526. chainShouldBreak = chainShouldBreak || node.returnType && getFunctionParameters(node).length > 0 || node.typeParameters || getFunctionParameters(node).some((param) => param.type !== "Identifier");
  26527. if (node.body.type !== "ArrowFunctionExpression" || args && args.expandLastArg) {
  26528. body.unshift(print("body", args));
  26529. } else {
  26530. node = node.body;
  26531. path.call(rec, "body");
  26532. }
  26533. })();
  26534. if (signatures.length > 1) {
  26535. return printArrowChain(path, args, signatures, chainShouldBreak, body, node);
  26536. }
  26537. const parts = signatures;
  26538. parts.push(" =>");
  26539. 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")) {
  26540. return group([...parts, " ", body]);
  26541. }
  26542. if (node.body.type === "SequenceExpression") {
  26543. return group([...parts, group([" (", indent([softline, body]), softline, ")"])]);
  26544. }
  26545. const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !hasComment(node);
  26546. const printTrailingComma = args && args.expandLastArg && shouldPrintComma(options, "all");
  26547. const shouldAddParens = node.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken(node.body, false);
  26548. return group([...parts, group([indent([line, shouldAddParens ? ifBreak("", "(") : "", body, shouldAddParens ? ifBreak("", ")") : ""]), shouldAddSoftLine ? [ifBreak(printTrailingComma ? "," : ""), softline] : ""])]);
  26549. }
  26550. function canPrintParamsWithoutParens(node) {
  26551. const parameters = getFunctionParameters(node);
  26552. 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;
  26553. }
  26554. function shouldPrintParamsWithoutParens(path, options) {
  26555. if (options.arrowParens === "always") {
  26556. return false;
  26557. }
  26558. if (options.arrowParens === "avoid") {
  26559. const node = path.getValue();
  26560. return canPrintParamsWithoutParens(node);
  26561. }
  26562. return false;
  26563. }
  26564. function printReturnType(path, print, options) {
  26565. const node = path.getValue();
  26566. const returnType = print("returnType");
  26567. if (node.returnType && isFlowAnnotationComment(options.originalText, node.returnType)) {
  26568. return [" /*: ", returnType, " */"];
  26569. }
  26570. const parts = [returnType];
  26571. if (node.returnType && node.returnType.typeAnnotation) {
  26572. parts.unshift(": ");
  26573. }
  26574. if (node.predicate) {
  26575. parts.push(node.returnType ? " " : ": ", print("predicate"));
  26576. }
  26577. return parts;
  26578. }
  26579. function printReturnOrThrowArgument(path, options, print) {
  26580. const node = path.getValue();
  26581. const semi = options.semi ? ";" : "";
  26582. const parts = [];
  26583. if (node.argument) {
  26584. if (returnArgumentHasLeadingComment(options, node.argument)) {
  26585. parts.push([" (", indent([hardline, print("argument")]), hardline, ")"]);
  26586. } else if (isBinaryish(node.argument) || node.argument.type === "SequenceExpression") {
  26587. parts.push(group([ifBreak(" (", " "), indent([softline, print("argument")]), softline, ifBreak(")")]));
  26588. } else {
  26589. parts.push(" ", print("argument"));
  26590. }
  26591. }
  26592. const comments = getComments(node);
  26593. const lastComment = getLast(comments);
  26594. const isLastCommentLine = lastComment && isLineComment(lastComment);
  26595. if (isLastCommentLine) {
  26596. parts.push(semi);
  26597. }
  26598. if (hasComment(node, CommentCheckFlags.Dangling)) {
  26599. parts.push(" ", printDanglingComments(path, options, true));
  26600. }
  26601. if (!isLastCommentLine) {
  26602. parts.push(semi);
  26603. }
  26604. return parts;
  26605. }
  26606. function printReturnStatement(path, options, print) {
  26607. return ["return", printReturnOrThrowArgument(path, options, print)];
  26608. }
  26609. function printThrowStatement(path, options, print) {
  26610. return ["throw", printReturnOrThrowArgument(path, options, print)];
  26611. }
  26612. function returnArgumentHasLeadingComment(options, argument) {
  26613. if (hasLeadingOwnLineComment(options.originalText, argument)) {
  26614. return true;
  26615. }
  26616. if (hasNakedLeftSide(argument)) {
  26617. let leftMost = argument;
  26618. let newLeftMost;
  26619. while (newLeftMost = getLeftSide(leftMost)) {
  26620. leftMost = newLeftMost;
  26621. if (hasLeadingOwnLineComment(options.originalText, leftMost)) {
  26622. return true;
  26623. }
  26624. }
  26625. }
  26626. return false;
  26627. }
  26628. module2.exports = {
  26629. printFunction,
  26630. printArrowFunction,
  26631. printMethod,
  26632. printReturnStatement,
  26633. printThrowStatement,
  26634. printMethodInternal,
  26635. shouldPrintParamsWithoutParens
  26636. };
  26637. }
  26638. });
  26639. var require_decorators = __commonJS2({
  26640. "src/language-js/print/decorators.js"(exports2, module2) {
  26641. "use strict";
  26642. var {
  26643. isNonEmptyArray,
  26644. hasNewline
  26645. } = require_util();
  26646. var {
  26647. builders: {
  26648. line,
  26649. hardline,
  26650. join,
  26651. breakParent,
  26652. group
  26653. }
  26654. } = require("./doc.js");
  26655. var {
  26656. locStart,
  26657. locEnd
  26658. } = require_loc();
  26659. var {
  26660. getParentExportDeclaration
  26661. } = require_utils7();
  26662. function printClassMemberDecorators(path, options, print) {
  26663. const node = path.getValue();
  26664. return group([join(line, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators(node, options) ? hardline : line]);
  26665. }
  26666. function printDecoratorsBeforeExport(path, options, print) {
  26667. return [join(hardline, path.map(print, "declaration", "decorators")), hardline];
  26668. }
  26669. function printDecorators(path, options, print) {
  26670. const node = path.getValue();
  26671. const {
  26672. decorators
  26673. } = node;
  26674. if (!isNonEmptyArray(decorators) || hasDecoratorsBeforeExport(path.getParentNode())) {
  26675. return;
  26676. }
  26677. const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators(node, options);
  26678. return [getParentExportDeclaration(path) ? hardline : shouldBreak ? breakParent : "", join(line, path.map(print, "decorators")), line];
  26679. }
  26680. function hasNewlineBetweenOrAfterDecorators(node, options) {
  26681. return node.decorators.some((decorator) => hasNewline(options.originalText, locEnd(decorator)));
  26682. }
  26683. function hasDecoratorsBeforeExport(node) {
  26684. if (node.type !== "ExportDefaultDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "DeclareExportDeclaration") {
  26685. return false;
  26686. }
  26687. const decorators = node.declaration && node.declaration.decorators;
  26688. return isNonEmptyArray(decorators) && locStart(node, {
  26689. ignoreDecorators: true
  26690. }) > locStart(decorators[0]);
  26691. }
  26692. module2.exports = {
  26693. printDecorators,
  26694. printClassMemberDecorators,
  26695. printDecoratorsBeforeExport,
  26696. hasDecoratorsBeforeExport
  26697. };
  26698. }
  26699. });
  26700. var require_class = __commonJS2({
  26701. "src/language-js/print/class.js"(exports2, module2) {
  26702. "use strict";
  26703. var {
  26704. isNonEmptyArray,
  26705. createGroupIdMapper
  26706. } = require_util();
  26707. var {
  26708. printComments,
  26709. printDanglingComments
  26710. } = require_comments();
  26711. var {
  26712. builders: {
  26713. join,
  26714. line,
  26715. hardline,
  26716. softline,
  26717. group,
  26718. indent,
  26719. ifBreak
  26720. }
  26721. } = require("./doc.js");
  26722. var {
  26723. hasComment,
  26724. CommentCheckFlags
  26725. } = require_utils7();
  26726. var {
  26727. getTypeParametersGroupId
  26728. } = require_type_parameters();
  26729. var {
  26730. printMethod
  26731. } = require_function();
  26732. var {
  26733. printOptionalToken,
  26734. printTypeAnnotation,
  26735. printDefiniteToken
  26736. } = require_misc();
  26737. var {
  26738. printPropertyKey
  26739. } = require_property();
  26740. var {
  26741. printAssignment
  26742. } = require_assignment();
  26743. var {
  26744. printClassMemberDecorators
  26745. } = require_decorators();
  26746. function printClass(path, options, print) {
  26747. const node = path.getValue();
  26748. const parts = [];
  26749. if (node.declare) {
  26750. parts.push("declare ");
  26751. }
  26752. if (node.abstract) {
  26753. parts.push("abstract ");
  26754. }
  26755. parts.push("class");
  26756. 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);
  26757. const partsGroup = [];
  26758. const extendsParts = [];
  26759. if (node.id) {
  26760. partsGroup.push(" ", print("id"));
  26761. }
  26762. partsGroup.push(print("typeParameters"));
  26763. if (node.superClass) {
  26764. const printed = [printSuperClass(path, options, print), print("superTypeParameters")];
  26765. const printedWithComments = path.call((superClass) => ["extends ", printComments(superClass, printed, options)], "superClass");
  26766. if (groupMode) {
  26767. extendsParts.push(line, group(printedWithComments));
  26768. } else {
  26769. extendsParts.push(" ", printedWithComments);
  26770. }
  26771. } else {
  26772. extendsParts.push(printList(path, options, print, "extends"));
  26773. }
  26774. extendsParts.push(printList(path, options, print, "mixins"), printList(path, options, print, "implements"));
  26775. if (groupMode) {
  26776. let printedPartsGroup;
  26777. if (shouldIndentOnlyHeritageClauses(node)) {
  26778. printedPartsGroup = [...partsGroup, indent(extendsParts)];
  26779. } else {
  26780. printedPartsGroup = indent([...partsGroup, extendsParts]);
  26781. }
  26782. parts.push(group(printedPartsGroup, {
  26783. id: getHeritageGroupId(node)
  26784. }));
  26785. } else {
  26786. parts.push(...partsGroup, ...extendsParts);
  26787. }
  26788. parts.push(" ", print("body"));
  26789. return parts;
  26790. }
  26791. var getHeritageGroupId = createGroupIdMapper("heritageGroup");
  26792. function printHardlineAfterHeritage(node) {
  26793. return ifBreak(hardline, "", {
  26794. groupId: getHeritageGroupId(node)
  26795. });
  26796. }
  26797. function hasMultipleHeritage(node) {
  26798. return ["superClass", "extends", "mixins", "implements"].filter((key) => Boolean(node[key])).length > 1;
  26799. }
  26800. function shouldIndentOnlyHeritageClauses(node) {
  26801. return node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line) && !hasMultipleHeritage(node);
  26802. }
  26803. function printList(path, options, print, listName) {
  26804. const node = path.getValue();
  26805. if (!isNonEmptyArray(node[listName])) {
  26806. return "";
  26807. }
  26808. const printedLeadingComments = printDanglingComments(path, options, true, ({
  26809. marker
  26810. }) => marker === listName);
  26811. return [shouldIndentOnlyHeritageClauses(node) ? ifBreak(" ", line, {
  26812. groupId: getTypeParametersGroupId(node.typeParameters)
  26813. }) : line, printedLeadingComments, printedLeadingComments && hardline, listName, group(indent([line, join([",", line], path.map(print, listName))]))];
  26814. }
  26815. function printSuperClass(path, options, print) {
  26816. const printed = print("superClass");
  26817. const parent = path.getParentNode();
  26818. if (parent.type === "AssignmentExpression") {
  26819. return group(ifBreak(["(", indent([softline, printed]), softline, ")"], printed));
  26820. }
  26821. return printed;
  26822. }
  26823. function printClassMethod(path, options, print) {
  26824. const node = path.getValue();
  26825. const parts = [];
  26826. if (isNonEmptyArray(node.decorators)) {
  26827. parts.push(printClassMemberDecorators(path, options, print));
  26828. }
  26829. if (node.accessibility) {
  26830. parts.push(node.accessibility + " ");
  26831. }
  26832. if (node.readonly) {
  26833. parts.push("readonly ");
  26834. }
  26835. if (node.declare) {
  26836. parts.push("declare ");
  26837. }
  26838. if (node.static) {
  26839. parts.push("static ");
  26840. }
  26841. if (node.type === "TSAbstractMethodDefinition" || node.abstract) {
  26842. parts.push("abstract ");
  26843. }
  26844. if (node.override) {
  26845. parts.push("override ");
  26846. }
  26847. parts.push(printMethod(path, options, print));
  26848. return parts;
  26849. }
  26850. function printClassProperty(path, options, print) {
  26851. const node = path.getValue();
  26852. const parts = [];
  26853. const semi = options.semi ? ";" : "";
  26854. if (isNonEmptyArray(node.decorators)) {
  26855. parts.push(printClassMemberDecorators(path, options, print));
  26856. }
  26857. if (node.accessibility) {
  26858. parts.push(node.accessibility + " ");
  26859. }
  26860. if (node.declare) {
  26861. parts.push("declare ");
  26862. }
  26863. if (node.static) {
  26864. parts.push("static ");
  26865. }
  26866. if (node.type === "TSAbstractPropertyDefinition" || node.abstract) {
  26867. parts.push("abstract ");
  26868. }
  26869. if (node.override) {
  26870. parts.push("override ");
  26871. }
  26872. if (node.readonly) {
  26873. parts.push("readonly ");
  26874. }
  26875. if (node.variance) {
  26876. parts.push(print("variance"));
  26877. }
  26878. if (node.type === "ClassAccessorProperty") {
  26879. parts.push("accessor ");
  26880. }
  26881. parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print));
  26882. return [printAssignment(path, options, print, parts, " =", "value"), semi];
  26883. }
  26884. module2.exports = {
  26885. printClass,
  26886. printClassMethod,
  26887. printClassProperty,
  26888. printHardlineAfterHeritage
  26889. };
  26890. }
  26891. });
  26892. var require_interface = __commonJS2({
  26893. "src/language-js/print/interface.js"(exports2, module2) {
  26894. "use strict";
  26895. var {
  26896. isNonEmptyArray
  26897. } = require_util();
  26898. var {
  26899. builders: {
  26900. join,
  26901. line,
  26902. group,
  26903. indent,
  26904. ifBreak
  26905. }
  26906. } = require("./doc.js");
  26907. var {
  26908. hasComment,
  26909. identity,
  26910. CommentCheckFlags
  26911. } = require_utils7();
  26912. var {
  26913. getTypeParametersGroupId
  26914. } = require_type_parameters();
  26915. var {
  26916. printTypeScriptModifiers
  26917. } = require_misc();
  26918. function printInterface(path, options, print) {
  26919. const node = path.getValue();
  26920. const parts = [];
  26921. if (node.declare) {
  26922. parts.push("declare ");
  26923. }
  26924. if (node.type === "TSInterfaceDeclaration") {
  26925. parts.push(node.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print));
  26926. }
  26927. parts.push("interface");
  26928. const partsGroup = [];
  26929. const extendsParts = [];
  26930. if (node.type !== "InterfaceTypeAnnotation") {
  26931. partsGroup.push(" ", print("id"), print("typeParameters"));
  26932. }
  26933. const shouldIndentOnlyHeritageClauses = node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
  26934. if (isNonEmptyArray(node.extends)) {
  26935. extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak(" ", line, {
  26936. groupId: getTypeParametersGroupId(node.typeParameters)
  26937. }) : line, "extends ", (node.extends.length === 1 ? identity : indent)(join([",", line], path.map(print, "extends"))));
  26938. }
  26939. if (node.id && hasComment(node.id, CommentCheckFlags.Trailing) || isNonEmptyArray(node.extends)) {
  26940. if (shouldIndentOnlyHeritageClauses) {
  26941. parts.push(group([...partsGroup, indent(extendsParts)]));
  26942. } else {
  26943. parts.push(group(indent([...partsGroup, ...extendsParts])));
  26944. }
  26945. } else {
  26946. parts.push(...partsGroup, ...extendsParts);
  26947. }
  26948. parts.push(" ", print("body"));
  26949. return group(parts);
  26950. }
  26951. module2.exports = {
  26952. printInterface
  26953. };
  26954. }
  26955. });
  26956. var require_module = __commonJS2({
  26957. "src/language-js/print/module.js"(exports2, module2) {
  26958. "use strict";
  26959. var {
  26960. isNonEmptyArray
  26961. } = require_util();
  26962. var {
  26963. builders: {
  26964. softline,
  26965. group,
  26966. indent,
  26967. join,
  26968. line,
  26969. ifBreak,
  26970. hardline
  26971. }
  26972. } = require("./doc.js");
  26973. var {
  26974. printDanglingComments
  26975. } = require_comments();
  26976. var {
  26977. hasComment,
  26978. CommentCheckFlags,
  26979. shouldPrintComma,
  26980. needsHardlineAfterDanglingComment,
  26981. isStringLiteral,
  26982. rawText
  26983. } = require_utils7();
  26984. var {
  26985. locStart,
  26986. hasSameLoc
  26987. } = require_loc();
  26988. var {
  26989. hasDecoratorsBeforeExport,
  26990. printDecoratorsBeforeExport
  26991. } = require_decorators();
  26992. function printImportDeclaration(path, options, print) {
  26993. const node = path.getValue();
  26994. const semi = options.semi ? ";" : "";
  26995. const parts = [];
  26996. const {
  26997. importKind
  26998. } = node;
  26999. parts.push("import");
  27000. if (importKind && importKind !== "value") {
  27001. parts.push(" ", importKind);
  27002. }
  27003. parts.push(printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27004. return parts;
  27005. }
  27006. function printExportDeclaration(path, options, print) {
  27007. const node = path.getValue();
  27008. const parts = [];
  27009. if (hasDecoratorsBeforeExport(node)) {
  27010. parts.push(printDecoratorsBeforeExport(path, options, print));
  27011. }
  27012. const {
  27013. type,
  27014. exportKind,
  27015. declaration
  27016. } = node;
  27017. parts.push("export");
  27018. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27019. if (isDefaultExport) {
  27020. parts.push(" default");
  27021. }
  27022. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27023. parts.push(" ", printDanglingComments(path, options, true));
  27024. if (needsHardlineAfterDanglingComment(node)) {
  27025. parts.push(hardline);
  27026. }
  27027. }
  27028. if (declaration) {
  27029. parts.push(" ", print("declaration"));
  27030. } else {
  27031. parts.push(exportKind === "type" ? " type" : "", printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print));
  27032. }
  27033. if (shouldExportDeclarationPrintSemi(node, options)) {
  27034. parts.push(";");
  27035. }
  27036. return parts;
  27037. }
  27038. function printExportAllDeclaration(path, options, print) {
  27039. const node = path.getValue();
  27040. const semi = options.semi ? ";" : "";
  27041. const parts = [];
  27042. const {
  27043. exportKind,
  27044. exported
  27045. } = node;
  27046. parts.push("export");
  27047. if (exportKind === "type") {
  27048. parts.push(" type");
  27049. }
  27050. parts.push(" *");
  27051. if (exported) {
  27052. parts.push(" as ", print("exported"));
  27053. }
  27054. parts.push(printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
  27055. return parts;
  27056. }
  27057. function shouldExportDeclarationPrintSemi(node, options) {
  27058. if (!options.semi) {
  27059. return false;
  27060. }
  27061. const {
  27062. type,
  27063. declaration
  27064. } = node;
  27065. const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
  27066. if (!declaration) {
  27067. return true;
  27068. }
  27069. const {
  27070. type: declarationType
  27071. } = declaration;
  27072. if (isDefaultExport && declarationType !== "ClassDeclaration" && declarationType !== "FunctionDeclaration" && declarationType !== "TSInterfaceDeclaration" && declarationType !== "DeclareClass" && declarationType !== "DeclareFunction" && declarationType !== "TSDeclareFunction" && declarationType !== "EnumDeclaration") {
  27073. return true;
  27074. }
  27075. return false;
  27076. }
  27077. function printModuleSource(path, options, print) {
  27078. const node = path.getValue();
  27079. if (!node.source) {
  27080. return "";
  27081. }
  27082. const parts = [];
  27083. if (!shouldNotPrintSpecifiers(node, options)) {
  27084. parts.push(" from");
  27085. }
  27086. parts.push(" ", print("source"));
  27087. return parts;
  27088. }
  27089. function printModuleSpecifiers(path, options, print) {
  27090. const node = path.getValue();
  27091. if (shouldNotPrintSpecifiers(node, options)) {
  27092. return "";
  27093. }
  27094. const parts = [" "];
  27095. if (isNonEmptyArray(node.specifiers)) {
  27096. const standaloneSpecifiers = [];
  27097. const groupedSpecifiers = [];
  27098. path.each(() => {
  27099. const specifierType = path.getValue().type;
  27100. if (specifierType === "ExportNamespaceSpecifier" || specifierType === "ExportDefaultSpecifier" || specifierType === "ImportNamespaceSpecifier" || specifierType === "ImportDefaultSpecifier") {
  27101. standaloneSpecifiers.push(print());
  27102. } else if (specifierType === "ExportSpecifier" || specifierType === "ImportSpecifier") {
  27103. groupedSpecifiers.push(print());
  27104. } else {
  27105. throw new Error(`Unknown specifier type ${JSON.stringify(specifierType)}`);
  27106. }
  27107. }, "specifiers");
  27108. parts.push(join(", ", standaloneSpecifiers));
  27109. if (groupedSpecifiers.length > 0) {
  27110. if (standaloneSpecifiers.length > 0) {
  27111. parts.push(", ");
  27112. }
  27113. const canBreak = groupedSpecifiers.length > 1 || standaloneSpecifiers.length > 0 || node.specifiers.some((node2) => hasComment(node2));
  27114. if (canBreak) {
  27115. parts.push(group(["{", indent([options.bracketSpacing ? line : softline, join([",", line], groupedSpecifiers)]), ifBreak(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line : softline, "}"]));
  27116. } else {
  27117. parts.push(["{", options.bracketSpacing ? " " : "", ...groupedSpecifiers, options.bracketSpacing ? " " : "", "}"]);
  27118. }
  27119. }
  27120. } else {
  27121. parts.push("{}");
  27122. }
  27123. return parts;
  27124. }
  27125. function shouldNotPrintSpecifiers(node, options) {
  27126. const {
  27127. type,
  27128. importKind,
  27129. source,
  27130. specifiers
  27131. } = node;
  27132. if (type !== "ImportDeclaration" || isNonEmptyArray(specifiers) || importKind === "type") {
  27133. return false;
  27134. }
  27135. return !/{\s*}/.test(options.originalText.slice(locStart(node), locStart(source)));
  27136. }
  27137. function printImportAssertions(path, options, print) {
  27138. const node = path.getNode();
  27139. if (isNonEmptyArray(node.assertions)) {
  27140. return [" assert {", options.bracketSpacing ? " " : "", join(", ", path.map(print, "assertions")), options.bracketSpacing ? " " : "", "}"];
  27141. }
  27142. return "";
  27143. }
  27144. function printModuleSpecifier(path, options, print) {
  27145. const node = path.getNode();
  27146. const {
  27147. type
  27148. } = node;
  27149. const parts = [];
  27150. const kind = type === "ImportSpecifier" ? node.importKind : node.exportKind;
  27151. if (kind && kind !== "value") {
  27152. parts.push(kind, " ");
  27153. }
  27154. const isImport = type.startsWith("Import");
  27155. const leftSideProperty = isImport ? "imported" : "local";
  27156. const rightSideProperty = isImport ? "local" : "exported";
  27157. const leftSideNode = node[leftSideProperty];
  27158. const rightSideNode = node[rightSideProperty];
  27159. let left = "";
  27160. let right = "";
  27161. if (type === "ExportNamespaceSpecifier" || type === "ImportNamespaceSpecifier") {
  27162. left = "*";
  27163. } else if (leftSideNode) {
  27164. left = print(leftSideProperty);
  27165. }
  27166. if (rightSideNode && !isShorthandSpecifier(node)) {
  27167. right = print(rightSideProperty);
  27168. }
  27169. parts.push(left, left && right ? " as " : "", right);
  27170. return parts;
  27171. }
  27172. function isShorthandSpecifier(specifier) {
  27173. if (specifier.type !== "ImportSpecifier" && specifier.type !== "ExportSpecifier") {
  27174. return false;
  27175. }
  27176. const {
  27177. local,
  27178. [specifier.type === "ImportSpecifier" ? "imported" : "exported"]: importedOrExported
  27179. } = specifier;
  27180. if (local.type !== importedOrExported.type || !hasSameLoc(local, importedOrExported)) {
  27181. return false;
  27182. }
  27183. if (isStringLiteral(local)) {
  27184. return local.value === importedOrExported.value && rawText(local) === rawText(importedOrExported);
  27185. }
  27186. switch (local.type) {
  27187. case "Identifier":
  27188. return local.name === importedOrExported.name;
  27189. default:
  27190. return false;
  27191. }
  27192. }
  27193. module2.exports = {
  27194. printImportDeclaration,
  27195. printExportDeclaration,
  27196. printExportAllDeclaration,
  27197. printModuleSpecifier
  27198. };
  27199. }
  27200. });
  27201. var require_object = __commonJS2({
  27202. "src/language-js/print/object.js"(exports2, module2) {
  27203. "use strict";
  27204. var {
  27205. printDanglingComments
  27206. } = require_comments();
  27207. var {
  27208. builders: {
  27209. line,
  27210. softline,
  27211. group,
  27212. indent,
  27213. ifBreak,
  27214. hardline
  27215. }
  27216. } = require("./doc.js");
  27217. var {
  27218. getLast,
  27219. hasNewlineInRange,
  27220. hasNewline,
  27221. isNonEmptyArray
  27222. } = require_util();
  27223. var {
  27224. shouldPrintComma,
  27225. hasComment,
  27226. getComments,
  27227. CommentCheckFlags,
  27228. isNextLineEmpty
  27229. } = require_utils7();
  27230. var {
  27231. locStart,
  27232. locEnd
  27233. } = require_loc();
  27234. var {
  27235. printOptionalToken,
  27236. printTypeAnnotation
  27237. } = require_misc();
  27238. var {
  27239. shouldHugFunctionParameters
  27240. } = require_function_parameters();
  27241. var {
  27242. shouldHugType
  27243. } = require_type_annotation();
  27244. var {
  27245. printHardlineAfterHeritage
  27246. } = require_class();
  27247. function printObject(path, options, print) {
  27248. const semi = options.semi ? ";" : "";
  27249. const node = path.getValue();
  27250. let propertiesField;
  27251. if (node.type === "TSTypeLiteral") {
  27252. propertiesField = "members";
  27253. } else if (node.type === "TSInterfaceBody") {
  27254. propertiesField = "body";
  27255. } else {
  27256. propertiesField = "properties";
  27257. }
  27258. const isTypeAnnotation = node.type === "ObjectTypeAnnotation";
  27259. const fields = [propertiesField];
  27260. if (isTypeAnnotation) {
  27261. fields.push("indexers", "callProperties", "internalSlots");
  27262. }
  27263. const firstProperty = fields.map((field) => node[field][0]).sort((a, b) => locStart(a) - locStart(b))[0];
  27264. const parent = path.getParentNode(0);
  27265. const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
  27266. 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));
  27267. const separator = isFlowInterfaceLikeBody ? ";" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" ? ifBreak(semi, ";") : ",";
  27268. const leftBrace = node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
  27269. const rightBrace = node.exact ? "|}" : "}";
  27270. const propsAndLoc = [];
  27271. for (const field of fields) {
  27272. path.each((childPath) => {
  27273. const node2 = childPath.getValue();
  27274. propsAndLoc.push({
  27275. node: node2,
  27276. printed: print(),
  27277. loc: locStart(node2)
  27278. });
  27279. }, field);
  27280. }
  27281. if (fields.length > 1) {
  27282. propsAndLoc.sort((a, b) => a.loc - b.loc);
  27283. }
  27284. let separatorParts = [];
  27285. const props = propsAndLoc.map((prop) => {
  27286. const result = [...separatorParts, group(prop.printed)];
  27287. separatorParts = [separator, line];
  27288. if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasComment(prop.node, CommentCheckFlags.PrettierIgnore)) {
  27289. separatorParts.shift();
  27290. }
  27291. if (isNextLineEmpty(prop.node, options)) {
  27292. separatorParts.push(hardline);
  27293. }
  27294. return result;
  27295. });
  27296. if (node.inexact) {
  27297. let printed;
  27298. if (hasComment(node, CommentCheckFlags.Dangling)) {
  27299. const hasLineComments = hasComment(node, CommentCheckFlags.Line);
  27300. const printedDanglingComments = printDanglingComments(path, options, true);
  27301. printed = [printedDanglingComments, hasLineComments || hasNewline(options.originalText, locEnd(getLast(getComments(node)))) ? hardline : line, "..."];
  27302. } else {
  27303. printed = ["..."];
  27304. }
  27305. props.push([...separatorParts, ...printed]);
  27306. }
  27307. const lastElem = getLast(node[propertiesField]);
  27308. 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));
  27309. let content;
  27310. if (props.length === 0) {
  27311. if (!hasComment(node, CommentCheckFlags.Dangling)) {
  27312. return [leftBrace, rightBrace, printTypeAnnotation(path, options, print)];
  27313. }
  27314. content = group([leftBrace, printDanglingComments(path, options), softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
  27315. } else {
  27316. 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)];
  27317. }
  27318. 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")) {
  27319. return content;
  27320. }
  27321. return group(content, {
  27322. shouldBreak
  27323. });
  27324. }
  27325. module2.exports = {
  27326. printObject
  27327. };
  27328. }
  27329. });
  27330. var require_flow = __commonJS2({
  27331. "src/language-js/print/flow.js"(exports2, module2) {
  27332. "use strict";
  27333. var assert = require("assert");
  27334. var {
  27335. printDanglingComments
  27336. } = require_comments();
  27337. var {
  27338. printString,
  27339. printNumber
  27340. } = require_util();
  27341. var {
  27342. builders: {
  27343. hardline,
  27344. softline,
  27345. group,
  27346. indent
  27347. }
  27348. } = require("./doc.js");
  27349. var {
  27350. getParentExportDeclaration,
  27351. isFunctionNotation,
  27352. isGetterOrSetter,
  27353. rawText,
  27354. shouldPrintComma
  27355. } = require_utils7();
  27356. var {
  27357. locStart,
  27358. locEnd
  27359. } = require_loc();
  27360. var {
  27361. printClass
  27362. } = require_class();
  27363. var {
  27364. printOpaqueType,
  27365. printTypeAlias,
  27366. printIntersectionType,
  27367. printUnionType,
  27368. printFunctionType,
  27369. printTupleType,
  27370. printIndexedAccessType
  27371. } = require_type_annotation();
  27372. var {
  27373. printInterface
  27374. } = require_interface();
  27375. var {
  27376. printTypeParameter,
  27377. printTypeParameters
  27378. } = require_type_parameters();
  27379. var {
  27380. printExportDeclaration,
  27381. printExportAllDeclaration
  27382. } = require_module();
  27383. var {
  27384. printArrayItems
  27385. } = require_array4();
  27386. var {
  27387. printObject
  27388. } = require_object();
  27389. var {
  27390. printPropertyKey
  27391. } = require_property();
  27392. var {
  27393. printOptionalToken,
  27394. printTypeAnnotation,
  27395. printRestSpread
  27396. } = require_misc();
  27397. function printFlow(path, options, print) {
  27398. const node = path.getValue();
  27399. const semi = options.semi ? ";" : "";
  27400. const parts = [];
  27401. switch (node.type) {
  27402. case "DeclareClass":
  27403. return printFlowDeclaration(path, printClass(path, options, print));
  27404. case "DeclareFunction":
  27405. return printFlowDeclaration(path, ["function ", print("id"), node.predicate ? " " : "", print("predicate"), semi]);
  27406. case "DeclareModule":
  27407. return printFlowDeclaration(path, ["module ", print("id"), " ", print("body")]);
  27408. case "DeclareModuleExports":
  27409. return printFlowDeclaration(path, ["module.exports", ": ", print("typeAnnotation"), semi]);
  27410. case "DeclareVariable":
  27411. return printFlowDeclaration(path, ["var ", print("id"), semi]);
  27412. case "DeclareOpaqueType":
  27413. return printFlowDeclaration(path, printOpaqueType(path, options, print));
  27414. case "DeclareInterface":
  27415. return printFlowDeclaration(path, printInterface(path, options, print));
  27416. case "DeclareTypeAlias":
  27417. return printFlowDeclaration(path, printTypeAlias(path, options, print));
  27418. case "DeclareExportDeclaration":
  27419. return printFlowDeclaration(path, printExportDeclaration(path, options, print));
  27420. case "DeclareExportAllDeclaration":
  27421. return printFlowDeclaration(path, printExportAllDeclaration(path, options, print));
  27422. case "OpaqueType":
  27423. return printOpaqueType(path, options, print);
  27424. case "TypeAlias":
  27425. return printTypeAlias(path, options, print);
  27426. case "IntersectionTypeAnnotation":
  27427. return printIntersectionType(path, options, print);
  27428. case "UnionTypeAnnotation":
  27429. return printUnionType(path, options, print);
  27430. case "FunctionTypeAnnotation":
  27431. return printFunctionType(path, options, print);
  27432. case "TupleTypeAnnotation":
  27433. return printTupleType(path, options, print);
  27434. case "GenericTypeAnnotation":
  27435. return [print("id"), printTypeParameters(path, options, print, "typeParameters")];
  27436. case "IndexedAccessType":
  27437. case "OptionalIndexedAccessType":
  27438. return printIndexedAccessType(path, options, print);
  27439. case "TypeAnnotation":
  27440. return print("typeAnnotation");
  27441. case "TypeParameter":
  27442. return printTypeParameter(path, options, print);
  27443. case "TypeofTypeAnnotation":
  27444. return ["typeof ", print("argument")];
  27445. case "ExistsTypeAnnotation":
  27446. return "*";
  27447. case "EmptyTypeAnnotation":
  27448. return "empty";
  27449. case "MixedTypeAnnotation":
  27450. return "mixed";
  27451. case "ArrayTypeAnnotation":
  27452. return [print("elementType"), "[]"];
  27453. case "BooleanLiteralTypeAnnotation":
  27454. return String(node.value);
  27455. case "EnumDeclaration":
  27456. return ["enum ", print("id"), " ", print("body")];
  27457. case "EnumBooleanBody":
  27458. case "EnumNumberBody":
  27459. case "EnumStringBody":
  27460. case "EnumSymbolBody": {
  27461. if (node.type === "EnumSymbolBody" || node.explicitType) {
  27462. let type = null;
  27463. switch (node.type) {
  27464. case "EnumBooleanBody":
  27465. type = "boolean";
  27466. break;
  27467. case "EnumNumberBody":
  27468. type = "number";
  27469. break;
  27470. case "EnumStringBody":
  27471. type = "string";
  27472. break;
  27473. case "EnumSymbolBody":
  27474. type = "symbol";
  27475. break;
  27476. }
  27477. parts.push("of ", type, " ");
  27478. }
  27479. if (node.members.length === 0 && !node.hasUnknownMembers) {
  27480. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  27481. } else {
  27482. const members = node.members.length > 0 ? [hardline, printArrayItems(path, options, "members", print), node.hasUnknownMembers || shouldPrintComma(options) ? "," : ""] : [];
  27483. parts.push(group(["{", indent([...members, ...node.hasUnknownMembers ? [hardline, "..."] : []]), printDanglingComments(path, options, true), hardline, "}"]));
  27484. }
  27485. return parts;
  27486. }
  27487. case "EnumBooleanMember":
  27488. case "EnumNumberMember":
  27489. case "EnumStringMember":
  27490. return [print("id"), " = ", typeof node.init === "object" ? print("init") : String(node.init)];
  27491. case "EnumDefaultedMember":
  27492. return print("id");
  27493. case "FunctionTypeParam": {
  27494. const name = node.name ? print("name") : path.getParentNode().this === node ? "this" : "";
  27495. return [name, printOptionalToken(path), name ? ": " : "", print("typeAnnotation")];
  27496. }
  27497. case "InterfaceDeclaration":
  27498. case "InterfaceTypeAnnotation":
  27499. return printInterface(path, options, print);
  27500. case "ClassImplements":
  27501. case "InterfaceExtends":
  27502. return [print("id"), print("typeParameters")];
  27503. case "NullableTypeAnnotation":
  27504. return ["?", print("typeAnnotation")];
  27505. case "Variance": {
  27506. const {
  27507. kind
  27508. } = node;
  27509. assert.ok(kind === "plus" || kind === "minus");
  27510. return kind === "plus" ? "+" : "-";
  27511. }
  27512. case "ObjectTypeCallProperty":
  27513. if (node.static) {
  27514. parts.push("static ");
  27515. }
  27516. parts.push(print("value"));
  27517. return parts;
  27518. case "ObjectTypeIndexer": {
  27519. return [node.static ? "static " : "", node.variance ? print("variance") : "", "[", print("id"), node.id ? ": " : "", print("key"), "]: ", print("value")];
  27520. }
  27521. case "ObjectTypeProperty": {
  27522. let modifier = "";
  27523. if (node.proto) {
  27524. modifier = "proto ";
  27525. } else if (node.static) {
  27526. modifier = "static ";
  27527. }
  27528. return [modifier, isGetterOrSetter(node) ? node.kind + " " : "", node.variance ? print("variance") : "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation(node) ? "" : ": ", print("value")];
  27529. }
  27530. case "ObjectTypeAnnotation":
  27531. return printObject(path, options, print);
  27532. case "ObjectTypeInternalSlot":
  27533. return [node.static ? "static " : "", "[[", print("id"), "]]", printOptionalToken(path), node.method ? "" : ": ", print("value")];
  27534. case "ObjectTypeSpreadProperty":
  27535. return printRestSpread(path, options, print);
  27536. case "QualifiedTypeofIdentifier":
  27537. case "QualifiedTypeIdentifier":
  27538. return [print("qualification"), ".", print("id")];
  27539. case "StringLiteralTypeAnnotation":
  27540. return printString(rawText(node), options);
  27541. case "NumberLiteralTypeAnnotation":
  27542. assert.strictEqual(typeof node.value, "number");
  27543. case "BigIntLiteralTypeAnnotation":
  27544. if (node.extra) {
  27545. return printNumber(node.extra.raw);
  27546. }
  27547. return printNumber(node.raw);
  27548. case "TypeCastExpression": {
  27549. return ["(", print("expression"), printTypeAnnotation(path, options, print), ")"];
  27550. }
  27551. case "TypeParameterDeclaration":
  27552. case "TypeParameterInstantiation": {
  27553. const printed = printTypeParameters(path, options, print, "params");
  27554. if (options.parser === "flow") {
  27555. const start = locStart(node);
  27556. const end = locEnd(node);
  27557. const commentStartIndex = options.originalText.lastIndexOf("/*", start);
  27558. const commentEndIndex = options.originalText.indexOf("*/", end);
  27559. if (commentStartIndex !== -1 && commentEndIndex !== -1) {
  27560. const comment = options.originalText.slice(commentStartIndex + 2, commentEndIndex).trim();
  27561. if (comment.startsWith("::") && !comment.includes("/*") && !comment.includes("*/")) {
  27562. return ["/*:: ", printed, " */"];
  27563. }
  27564. }
  27565. }
  27566. return printed;
  27567. }
  27568. case "InferredPredicate":
  27569. return "%checks";
  27570. case "DeclaredPredicate":
  27571. return ["%checks(", print("value"), ")"];
  27572. case "AnyTypeAnnotation":
  27573. return "any";
  27574. case "BooleanTypeAnnotation":
  27575. return "boolean";
  27576. case "BigIntTypeAnnotation":
  27577. return "bigint";
  27578. case "NullLiteralTypeAnnotation":
  27579. return "null";
  27580. case "NumberTypeAnnotation":
  27581. return "number";
  27582. case "SymbolTypeAnnotation":
  27583. return "symbol";
  27584. case "StringTypeAnnotation":
  27585. return "string";
  27586. case "VoidTypeAnnotation":
  27587. return "void";
  27588. case "ThisTypeAnnotation":
  27589. return "this";
  27590. case "Node":
  27591. case "Printable":
  27592. case "SourceLocation":
  27593. case "Position":
  27594. case "Statement":
  27595. case "Function":
  27596. case "Pattern":
  27597. case "Expression":
  27598. case "Declaration":
  27599. case "Specifier":
  27600. case "NamedSpecifier":
  27601. case "Comment":
  27602. case "MemberTypeAnnotation":
  27603. case "Type":
  27604. throw new Error("unprintable type: " + JSON.stringify(node.type));
  27605. }
  27606. }
  27607. function printFlowDeclaration(path, printed) {
  27608. const parentExportDecl = getParentExportDeclaration(path);
  27609. if (parentExportDecl) {
  27610. assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
  27611. return printed;
  27612. }
  27613. return ["declare ", printed];
  27614. }
  27615. module2.exports = {
  27616. printFlow
  27617. };
  27618. }
  27619. });
  27620. var require_is_ts_keyword_type = __commonJS2({
  27621. "src/language-js/utils/is-ts-keyword-type.js"(exports2, module2) {
  27622. "use strict";
  27623. function isTsKeywordType({
  27624. type
  27625. }) {
  27626. return type.startsWith("TS") && type.endsWith("Keyword");
  27627. }
  27628. module2.exports = isTsKeywordType;
  27629. }
  27630. });
  27631. var require_ternary = __commonJS2({
  27632. "src/language-js/print/ternary.js"(exports2, module2) {
  27633. "use strict";
  27634. var {
  27635. hasNewlineInRange
  27636. } = require_util();
  27637. var {
  27638. isJsxNode,
  27639. getComments,
  27640. isCallExpression,
  27641. isMemberExpression
  27642. } = require_utils7();
  27643. var {
  27644. locStart,
  27645. locEnd
  27646. } = require_loc();
  27647. var isBlockComment = require_is_block_comment();
  27648. var {
  27649. builders: {
  27650. line,
  27651. softline,
  27652. group,
  27653. indent,
  27654. align,
  27655. ifBreak,
  27656. dedent,
  27657. breakParent
  27658. }
  27659. } = require("./doc.js");
  27660. function conditionalExpressionChainContainsJsx(node) {
  27661. const conditionalExpressions = [node];
  27662. for (let index = 0; index < conditionalExpressions.length; index++) {
  27663. const conditionalExpression = conditionalExpressions[index];
  27664. for (const property of ["test", "consequent", "alternate"]) {
  27665. const node2 = conditionalExpression[property];
  27666. if (isJsxNode(node2)) {
  27667. return true;
  27668. }
  27669. if (node2.type === "ConditionalExpression") {
  27670. conditionalExpressions.push(node2);
  27671. }
  27672. }
  27673. }
  27674. return false;
  27675. }
  27676. function printTernaryTest(path, options, print) {
  27677. const node = path.getValue();
  27678. const isConditionalExpression = node.type === "ConditionalExpression";
  27679. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  27680. const parent = path.getParentNode();
  27681. const printed = isConditionalExpression ? print("test") : [print("checkType"), " ", "extends", " ", print("extendsType")];
  27682. if (parent.type === node.type && parent[alternateNodePropertyName] === node) {
  27683. return align(2, printed);
  27684. }
  27685. return printed;
  27686. }
  27687. var ancestorNameMap = /* @__PURE__ */ new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"]]);
  27688. function shouldExtraIndentForConditionalExpression(path) {
  27689. const node = path.getValue();
  27690. if (node.type !== "ConditionalExpression") {
  27691. return false;
  27692. }
  27693. let parent;
  27694. let child = node;
  27695. for (let ancestorCount = 0; !parent; ancestorCount++) {
  27696. const node2 = path.getParentNode(ancestorCount);
  27697. if (isCallExpression(node2) && node2.callee === child || isMemberExpression(node2) && node2.object === child || node2.type === "TSNonNullExpression" && node2.expression === child) {
  27698. child = node2;
  27699. continue;
  27700. }
  27701. if (node2.type === "NewExpression" && node2.callee === child || node2.type === "TSAsExpression" && node2.expression === child) {
  27702. parent = path.getParentNode(ancestorCount + 1);
  27703. child = node2;
  27704. } else {
  27705. parent = node2;
  27706. }
  27707. }
  27708. if (child === node) {
  27709. return false;
  27710. }
  27711. return parent[ancestorNameMap.get(parent.type)] === child;
  27712. }
  27713. function printTernary(path, options, print) {
  27714. const node = path.getValue();
  27715. const isConditionalExpression = node.type === "ConditionalExpression";
  27716. const consequentNodePropertyName = isConditionalExpression ? "consequent" : "trueType";
  27717. const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
  27718. const testNodePropertyNames = isConditionalExpression ? ["test"] : ["checkType", "extendsType"];
  27719. const consequentNode = node[consequentNodePropertyName];
  27720. const alternateNode = node[alternateNodePropertyName];
  27721. const parts = [];
  27722. let jsxMode = false;
  27723. const parent = path.getParentNode();
  27724. const isParentTest = parent.type === node.type && testNodePropertyNames.some((prop) => parent[prop] === node);
  27725. let forceNoIndent = parent.type === node.type && !isParentTest;
  27726. let currentParent;
  27727. let previousParent;
  27728. let i = 0;
  27729. do {
  27730. previousParent = currentParent || node;
  27731. currentParent = path.getParentNode(i);
  27732. i++;
  27733. } while (currentParent && currentParent.type === node.type && testNodePropertyNames.every((prop) => currentParent[prop] !== previousParent));
  27734. const firstNonConditionalParent = currentParent || parent;
  27735. const lastConditionalParent = previousParent;
  27736. if (isConditionalExpression && (isJsxNode(node[testNodePropertyNames[0]]) || isJsxNode(consequentNode) || isJsxNode(alternateNode) || conditionalExpressionChainContainsJsx(lastConditionalParent))) {
  27737. jsxMode = true;
  27738. forceNoIndent = true;
  27739. const wrap = (doc2) => [ifBreak("("), indent([softline, doc2]), softline, ifBreak(")")];
  27740. const isNil = (node2) => node2.type === "NullLiteral" || node2.type === "Literal" && node2.value === null || node2.type === "Identifier" && node2.name === "undefined";
  27741. parts.push(" ? ", isNil(consequentNode) ? print(consequentNodePropertyName) : wrap(print(consequentNodePropertyName)), " : ", alternateNode.type === node.type || isNil(alternateNode) ? print(alternateNodePropertyName) : wrap(print(alternateNodePropertyName)));
  27742. } else {
  27743. 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))];
  27744. parts.push(parent.type !== node.type || parent[alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent(indent(part)) : align(Math.max(0, options.tabWidth - 2), part));
  27745. }
  27746. const comments = [...testNodePropertyNames.map((propertyName) => getComments(node[propertyName])), getComments(consequentNode), getComments(alternateNode)].flat();
  27747. const shouldBreak = comments.some((comment) => isBlockComment(comment) && hasNewlineInRange(options.originalText, locStart(comment), locEnd(comment)));
  27748. const maybeGroup = (doc2) => parent === firstNonConditionalParent ? group(doc2, {
  27749. shouldBreak
  27750. }) : shouldBreak ? [doc2, breakParent] : doc2;
  27751. const breakClosingParen = !jsxMode && (isMemberExpression(parent) || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
  27752. const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
  27753. const result = maybeGroup([printTernaryTest(path, options, print), forceNoIndent ? parts : indent(parts), isConditionalExpression && breakClosingParen && !shouldExtraIndent ? softline : ""]);
  27754. return isParentTest || shouldExtraIndent ? group([indent([softline, result]), softline]) : result;
  27755. }
  27756. module2.exports = {
  27757. printTernary
  27758. };
  27759. }
  27760. });
  27761. var require_statement = __commonJS2({
  27762. "src/language-js/print/statement.js"(exports2, module2) {
  27763. "use strict";
  27764. var {
  27765. builders: {
  27766. hardline
  27767. }
  27768. } = require("./doc.js");
  27769. var pathNeedsParens = require_needs_parens();
  27770. var {
  27771. getLeftSidePathName,
  27772. hasNakedLeftSide,
  27773. isJsxNode,
  27774. isTheOnlyJsxElementInMarkdown,
  27775. hasComment,
  27776. CommentCheckFlags,
  27777. isNextLineEmpty
  27778. } = require_utils7();
  27779. var {
  27780. shouldPrintParamsWithoutParens
  27781. } = require_function();
  27782. function printStatementSequence(path, options, print, property) {
  27783. const node = path.getValue();
  27784. const parts = [];
  27785. const isClassBody = node.type === "ClassBody";
  27786. const lastStatement = getLastStatement(node[property]);
  27787. path.each((path2, index, statements) => {
  27788. const node2 = path2.getValue();
  27789. if (node2.type === "EmptyStatement") {
  27790. return;
  27791. }
  27792. const printed = print();
  27793. if (!options.semi && !isClassBody && !isTheOnlyJsxElementInMarkdown(options, path2) && statementNeedsASIProtection(path2, options)) {
  27794. if (hasComment(node2, CommentCheckFlags.Leading)) {
  27795. parts.push(print([], {
  27796. needsSemi: true
  27797. }));
  27798. } else {
  27799. parts.push(";", printed);
  27800. }
  27801. } else {
  27802. parts.push(printed);
  27803. }
  27804. if (!options.semi && isClassBody && isClassProperty(node2) && shouldPrintSemicolonAfterClassProperty(node2, statements[index + 1])) {
  27805. parts.push(";");
  27806. }
  27807. if (node2 !== lastStatement) {
  27808. parts.push(hardline);
  27809. if (isNextLineEmpty(node2, options)) {
  27810. parts.push(hardline);
  27811. }
  27812. }
  27813. }, property);
  27814. return parts;
  27815. }
  27816. function getLastStatement(statements) {
  27817. for (let i = statements.length - 1; i >= 0; i--) {
  27818. const statement = statements[i];
  27819. if (statement.type !== "EmptyStatement") {
  27820. return statement;
  27821. }
  27822. }
  27823. }
  27824. function statementNeedsASIProtection(path, options) {
  27825. const node = path.getNode();
  27826. if (node.type !== "ExpressionStatement") {
  27827. return false;
  27828. }
  27829. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), "expression");
  27830. }
  27831. function expressionNeedsASIProtection(path, options) {
  27832. const node = path.getValue();
  27833. switch (node.type) {
  27834. case "ParenthesizedExpression":
  27835. case "TypeCastExpression":
  27836. case "ArrayExpression":
  27837. case "ArrayPattern":
  27838. case "TemplateLiteral":
  27839. case "TemplateElement":
  27840. case "RegExpLiteral":
  27841. return true;
  27842. case "ArrowFunctionExpression": {
  27843. if (!shouldPrintParamsWithoutParens(path, options)) {
  27844. return true;
  27845. }
  27846. break;
  27847. }
  27848. case "UnaryExpression": {
  27849. const {
  27850. prefix,
  27851. operator
  27852. } = node;
  27853. if (prefix && (operator === "+" || operator === "-")) {
  27854. return true;
  27855. }
  27856. break;
  27857. }
  27858. case "BindExpression": {
  27859. if (!node.object) {
  27860. return true;
  27861. }
  27862. break;
  27863. }
  27864. case "Literal": {
  27865. if (node.regex) {
  27866. return true;
  27867. }
  27868. break;
  27869. }
  27870. default: {
  27871. if (isJsxNode(node)) {
  27872. return true;
  27873. }
  27874. }
  27875. }
  27876. if (pathNeedsParens(path, options)) {
  27877. return true;
  27878. }
  27879. if (!hasNakedLeftSide(node)) {
  27880. return false;
  27881. }
  27882. return path.call((childPath) => expressionNeedsASIProtection(childPath, options), ...getLeftSidePathName(path, node));
  27883. }
  27884. function printBody(path, options, print) {
  27885. return printStatementSequence(path, options, print, "body");
  27886. }
  27887. function printSwitchCaseConsequent(path, options, print) {
  27888. return printStatementSequence(path, options, print, "consequent");
  27889. }
  27890. var isClassProperty = ({
  27891. type
  27892. }) => type === "ClassProperty" || type === "PropertyDefinition" || type === "ClassPrivateProperty" || type === "ClassAccessorProperty";
  27893. function shouldPrintSemicolonAfterClassProperty(node, nextNode) {
  27894. const name = node.key && node.key.name;
  27895. if ((name === "static" || name === "get" || name === "set") && !node.value && !node.typeAnnotation) {
  27896. return true;
  27897. }
  27898. if (!nextNode) {
  27899. return false;
  27900. }
  27901. if (nextNode.static || nextNode.accessibility) {
  27902. return false;
  27903. }
  27904. if (!nextNode.computed) {
  27905. const name2 = nextNode.key && nextNode.key.name;
  27906. if (name2 === "in" || name2 === "instanceof") {
  27907. return true;
  27908. }
  27909. }
  27910. if (isClassProperty(nextNode) && nextNode.variance && !nextNode.static && !nextNode.declare) {
  27911. return true;
  27912. }
  27913. switch (nextNode.type) {
  27914. case "ClassProperty":
  27915. case "PropertyDefinition":
  27916. case "TSAbstractPropertyDefinition":
  27917. return nextNode.computed;
  27918. case "MethodDefinition":
  27919. case "TSAbstractMethodDefinition":
  27920. case "ClassMethod":
  27921. case "ClassPrivateMethod": {
  27922. const isAsync = nextNode.value ? nextNode.value.async : nextNode.async;
  27923. if (isAsync || nextNode.kind === "get" || nextNode.kind === "set") {
  27924. return false;
  27925. }
  27926. const isGenerator = nextNode.value ? nextNode.value.generator : nextNode.generator;
  27927. if (nextNode.computed || isGenerator) {
  27928. return true;
  27929. }
  27930. return false;
  27931. }
  27932. case "TSIndexSignature":
  27933. return true;
  27934. }
  27935. return false;
  27936. }
  27937. module2.exports = {
  27938. printBody,
  27939. printSwitchCaseConsequent
  27940. };
  27941. }
  27942. });
  27943. var require_block = __commonJS2({
  27944. "src/language-js/print/block.js"(exports2, module2) {
  27945. "use strict";
  27946. var {
  27947. printDanglingComments
  27948. } = require_comments();
  27949. var {
  27950. isNonEmptyArray
  27951. } = require_util();
  27952. var {
  27953. builders: {
  27954. hardline,
  27955. indent
  27956. }
  27957. } = require("./doc.js");
  27958. var {
  27959. hasComment,
  27960. CommentCheckFlags,
  27961. isNextLineEmpty
  27962. } = require_utils7();
  27963. var {
  27964. printHardlineAfterHeritage
  27965. } = require_class();
  27966. var {
  27967. printBody
  27968. } = require_statement();
  27969. function printBlock(path, options, print) {
  27970. const node = path.getValue();
  27971. const parts = [];
  27972. if (node.type === "StaticBlock") {
  27973. parts.push("static ");
  27974. }
  27975. if (node.type === "ClassBody" && isNonEmptyArray(node.body)) {
  27976. const parent = path.getParentNode();
  27977. parts.push(printHardlineAfterHeritage(parent));
  27978. }
  27979. parts.push("{");
  27980. const printed = printBlockBody(path, options, print);
  27981. if (printed) {
  27982. parts.push(indent([hardline, printed]), hardline);
  27983. } else {
  27984. const parent = path.getParentNode();
  27985. const parentParent = path.getParentNode(1);
  27986. 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")) {
  27987. parts.push(hardline);
  27988. }
  27989. }
  27990. parts.push("}");
  27991. return parts;
  27992. }
  27993. function printBlockBody(path, options, print) {
  27994. const node = path.getValue();
  27995. const nodeHasDirectives = isNonEmptyArray(node.directives);
  27996. const nodeHasBody = node.body.some((node2) => node2.type !== "EmptyStatement");
  27997. const nodeHasComment = hasComment(node, CommentCheckFlags.Dangling);
  27998. if (!nodeHasDirectives && !nodeHasBody && !nodeHasComment) {
  27999. return "";
  28000. }
  28001. const parts = [];
  28002. if (nodeHasDirectives) {
  28003. path.each((childPath, index, directives) => {
  28004. parts.push(print());
  28005. if (index < directives.length - 1 || nodeHasBody || nodeHasComment) {
  28006. parts.push(hardline);
  28007. if (isNextLineEmpty(childPath.getValue(), options)) {
  28008. parts.push(hardline);
  28009. }
  28010. }
  28011. }, "directives");
  28012. }
  28013. if (nodeHasBody) {
  28014. parts.push(printBody(path, options, print));
  28015. }
  28016. if (nodeHasComment) {
  28017. parts.push(printDanglingComments(path, options, true));
  28018. }
  28019. if (node.type === "Program") {
  28020. const parent = path.getParentNode();
  28021. if (!parent || parent.type !== "ModuleExpression") {
  28022. parts.push(hardline);
  28023. }
  28024. }
  28025. return parts;
  28026. }
  28027. module2.exports = {
  28028. printBlock,
  28029. printBlockBody
  28030. };
  28031. }
  28032. });
  28033. var require_typescript = __commonJS2({
  28034. "src/language-js/print/typescript.js"(exports2, module2) {
  28035. "use strict";
  28036. var {
  28037. printDanglingComments
  28038. } = require_comments();
  28039. var {
  28040. hasNewlineInRange
  28041. } = require_util();
  28042. var {
  28043. builders: {
  28044. join,
  28045. line,
  28046. hardline,
  28047. softline,
  28048. group,
  28049. indent,
  28050. conditionalGroup,
  28051. ifBreak
  28052. }
  28053. } = require("./doc.js");
  28054. var {
  28055. isLiteral,
  28056. getTypeScriptMappedTypeModifier,
  28057. shouldPrintComma,
  28058. isCallExpression,
  28059. isMemberExpression
  28060. } = require_utils7();
  28061. var isTsKeywordType = require_is_ts_keyword_type();
  28062. var {
  28063. locStart,
  28064. locEnd
  28065. } = require_loc();
  28066. var {
  28067. printOptionalToken,
  28068. printTypeScriptModifiers
  28069. } = require_misc();
  28070. var {
  28071. printTernary
  28072. } = require_ternary();
  28073. var {
  28074. printFunctionParameters,
  28075. shouldGroupFunctionParameters
  28076. } = require_function_parameters();
  28077. var {
  28078. printTemplateLiteral
  28079. } = require_template_literal();
  28080. var {
  28081. printArrayItems
  28082. } = require_array4();
  28083. var {
  28084. printObject
  28085. } = require_object();
  28086. var {
  28087. printClassProperty,
  28088. printClassMethod
  28089. } = require_class();
  28090. var {
  28091. printTypeParameter,
  28092. printTypeParameters
  28093. } = require_type_parameters();
  28094. var {
  28095. printPropertyKey
  28096. } = require_property();
  28097. var {
  28098. printFunction,
  28099. printMethodInternal
  28100. } = require_function();
  28101. var {
  28102. printInterface
  28103. } = require_interface();
  28104. var {
  28105. printBlock
  28106. } = require_block();
  28107. var {
  28108. printTypeAlias,
  28109. printIntersectionType,
  28110. printUnionType,
  28111. printFunctionType,
  28112. printTupleType,
  28113. printIndexedAccessType,
  28114. printJSDocType
  28115. } = require_type_annotation();
  28116. function printTypescript(path, options, print) {
  28117. const node = path.getValue();
  28118. if (!node.type.startsWith("TS")) {
  28119. return;
  28120. }
  28121. if (isTsKeywordType(node)) {
  28122. return node.type.slice(2, -7).toLowerCase();
  28123. }
  28124. const semi = options.semi ? ";" : "";
  28125. const parts = [];
  28126. switch (node.type) {
  28127. case "TSThisType":
  28128. return "this";
  28129. case "TSTypeAssertion": {
  28130. const shouldBreakAfterCast = !(node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression");
  28131. const castGroup = group(["<", indent([softline, print("typeAnnotation")]), softline, ">"]);
  28132. const exprContents = [ifBreak("("), indent([softline, print("expression")]), softline, ifBreak(")")];
  28133. if (shouldBreakAfterCast) {
  28134. return conditionalGroup([[castGroup, print("expression")], [castGroup, group(exprContents, {
  28135. shouldBreak: true
  28136. })], [castGroup, print("expression")]]);
  28137. }
  28138. return group([castGroup, print("expression")]);
  28139. }
  28140. case "TSDeclareFunction":
  28141. return printFunction(path, print, options);
  28142. case "TSExportAssignment":
  28143. return ["export = ", print("expression"), semi];
  28144. case "TSModuleBlock":
  28145. return printBlock(path, options, print);
  28146. case "TSInterfaceBody":
  28147. case "TSTypeLiteral":
  28148. return printObject(path, options, print);
  28149. case "TSTypeAliasDeclaration":
  28150. return printTypeAlias(path, options, print);
  28151. case "TSQualifiedName":
  28152. return join(".", [print("left"), print("right")]);
  28153. case "TSAbstractMethodDefinition":
  28154. case "TSDeclareMethod":
  28155. return printClassMethod(path, options, print);
  28156. case "TSAbstractPropertyDefinition":
  28157. return printClassProperty(path, options, print);
  28158. case "TSInterfaceHeritage":
  28159. case "TSExpressionWithTypeArguments":
  28160. parts.push(print("expression"));
  28161. if (node.typeParameters) {
  28162. parts.push(print("typeParameters"));
  28163. }
  28164. return parts;
  28165. case "TSTemplateLiteralType":
  28166. return printTemplateLiteral(path, print, options);
  28167. case "TSNamedTupleMember":
  28168. return [print("label"), node.optional ? "?" : "", ": ", print("elementType")];
  28169. case "TSRestType":
  28170. return ["...", print("typeAnnotation")];
  28171. case "TSOptionalType":
  28172. return [print("typeAnnotation"), "?"];
  28173. case "TSInterfaceDeclaration":
  28174. return printInterface(path, options, print);
  28175. case "TSClassImplements":
  28176. return [print("expression"), print("typeParameters")];
  28177. case "TSTypeParameterDeclaration":
  28178. case "TSTypeParameterInstantiation":
  28179. return printTypeParameters(path, options, print, "params");
  28180. case "TSTypeParameter":
  28181. return printTypeParameter(path, options, print);
  28182. case "TSAsExpression": {
  28183. parts.push(print("expression"), " as ", print("typeAnnotation"));
  28184. const parent = path.getParentNode();
  28185. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  28186. return group([indent([softline, ...parts]), softline]);
  28187. }
  28188. return parts;
  28189. }
  28190. case "TSArrayType":
  28191. return [print("elementType"), "[]"];
  28192. case "TSPropertySignature": {
  28193. if (node.readonly) {
  28194. parts.push("readonly ");
  28195. }
  28196. parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
  28197. if (node.typeAnnotation) {
  28198. parts.push(": ", print("typeAnnotation"));
  28199. }
  28200. if (node.initializer) {
  28201. parts.push(" = ", print("initializer"));
  28202. }
  28203. return parts;
  28204. }
  28205. case "TSParameterProperty":
  28206. if (node.accessibility) {
  28207. parts.push(node.accessibility + " ");
  28208. }
  28209. if (node.export) {
  28210. parts.push("export ");
  28211. }
  28212. if (node.static) {
  28213. parts.push("static ");
  28214. }
  28215. if (node.override) {
  28216. parts.push("override ");
  28217. }
  28218. if (node.readonly) {
  28219. parts.push("readonly ");
  28220. }
  28221. parts.push(print("parameter"));
  28222. return parts;
  28223. case "TSTypeQuery":
  28224. return ["typeof ", print("exprName"), print("typeParameters")];
  28225. case "TSIndexSignature": {
  28226. const parent = path.getParentNode();
  28227. const trailingComma = node.parameters.length > 1 ? ifBreak(shouldPrintComma(options) ? "," : "") : "";
  28228. const parametersGroup = group([indent([softline, join([", ", softline], path.map(print, "parameters"))]), trailingComma, softline]);
  28229. 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 : ""];
  28230. }
  28231. case "TSTypePredicate":
  28232. return [node.asserts ? "asserts " : "", print("parameterName"), node.typeAnnotation ? [" is ", print("typeAnnotation")] : ""];
  28233. case "TSNonNullExpression":
  28234. return [print("expression"), "!"];
  28235. case "TSImportType":
  28236. return [!node.isTypeOf ? "" : "typeof ", "import(", print(node.parameter ? "parameter" : "argument"), ")", !node.qualifier ? "" : [".", print("qualifier")], printTypeParameters(path, options, print, "typeParameters")];
  28237. case "TSLiteralType":
  28238. return print("literal");
  28239. case "TSIndexedAccessType":
  28240. return printIndexedAccessType(path, options, print);
  28241. case "TSConstructSignatureDeclaration":
  28242. case "TSCallSignatureDeclaration":
  28243. case "TSConstructorType": {
  28244. if (node.type === "TSConstructorType" && node.abstract) {
  28245. parts.push("abstract ");
  28246. }
  28247. if (node.type !== "TSCallSignatureDeclaration") {
  28248. parts.push("new ");
  28249. }
  28250. parts.push(group(printFunctionParameters(path, print, options, false, true)));
  28251. if (node.returnType || node.typeAnnotation) {
  28252. const isType = node.type === "TSConstructorType";
  28253. parts.push(isType ? " => " : ": ", print("returnType"), print("typeAnnotation"));
  28254. }
  28255. return parts;
  28256. }
  28257. case "TSTypeOperator":
  28258. return [node.operator, " ", print("typeAnnotation")];
  28259. case "TSMappedType": {
  28260. const shouldBreak = hasNewlineInRange(options.originalText, locStart(node), locEnd(node));
  28261. return group(["{", indent([options.bracketSpacing ? line : softline, node.readonly ? [getTypeScriptMappedTypeModifier(node.readonly, "readonly"), " "] : "", printTypeScriptModifiers(path, options, print), print("typeParameter"), node.optional ? getTypeScriptMappedTypeModifier(node.optional, "?") : "", node.typeAnnotation ? ": " : "", print("typeAnnotation"), ifBreak(semi)]), printDanglingComments(path, options, true), options.bracketSpacing ? line : softline, "}"], {
  28262. shouldBreak
  28263. });
  28264. }
  28265. case "TSMethodSignature": {
  28266. const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
  28267. 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));
  28268. const parametersDoc = printFunctionParameters(path, print, options, false, true);
  28269. const returnTypePropertyName = node.returnType ? "returnType" : "typeAnnotation";
  28270. const returnTypeNode = node[returnTypePropertyName];
  28271. const returnTypeDoc = returnTypeNode ? print(returnTypePropertyName) : "";
  28272. const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
  28273. parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
  28274. if (returnTypeNode) {
  28275. parts.push(": ", group(returnTypeDoc));
  28276. }
  28277. return group(parts);
  28278. }
  28279. case "TSNamespaceExportDeclaration":
  28280. parts.push("export as namespace ", print("id"));
  28281. if (options.semi) {
  28282. parts.push(";");
  28283. }
  28284. return group(parts);
  28285. case "TSEnumDeclaration":
  28286. if (node.declare) {
  28287. parts.push("declare ");
  28288. }
  28289. if (node.modifiers) {
  28290. parts.push(printTypeScriptModifiers(path, options, print));
  28291. }
  28292. if (node.const) {
  28293. parts.push("const ");
  28294. }
  28295. parts.push("enum ", print("id"), " ");
  28296. if (node.members.length === 0) {
  28297. parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
  28298. } else {
  28299. parts.push(group(["{", indent([hardline, printArrayItems(path, options, "members", print), shouldPrintComma(options, "es5") ? "," : ""]), printDanglingComments(path, options, true), hardline, "}"]));
  28300. }
  28301. return parts;
  28302. case "TSEnumMember":
  28303. if (node.computed) {
  28304. parts.push("[", print("id"), "]");
  28305. } else {
  28306. parts.push(print("id"));
  28307. }
  28308. if (node.initializer) {
  28309. parts.push(" = ", print("initializer"));
  28310. }
  28311. return parts;
  28312. case "TSImportEqualsDeclaration":
  28313. if (node.isExport) {
  28314. parts.push("export ");
  28315. }
  28316. parts.push("import ");
  28317. if (node.importKind && node.importKind !== "value") {
  28318. parts.push(node.importKind, " ");
  28319. }
  28320. parts.push(print("id"), " = ", print("moduleReference"));
  28321. if (options.semi) {
  28322. parts.push(";");
  28323. }
  28324. return group(parts);
  28325. case "TSExternalModuleReference":
  28326. return ["require(", print("expression"), ")"];
  28327. case "TSModuleDeclaration": {
  28328. const parent = path.getParentNode();
  28329. const isExternalModule = isLiteral(node.id);
  28330. const parentIsDeclaration = parent.type === "TSModuleDeclaration";
  28331. const bodyIsDeclaration = node.body && node.body.type === "TSModuleDeclaration";
  28332. if (parentIsDeclaration) {
  28333. parts.push(".");
  28334. } else {
  28335. if (node.declare) {
  28336. parts.push("declare ");
  28337. }
  28338. parts.push(printTypeScriptModifiers(path, options, print));
  28339. const textBetweenNodeAndItsId = options.originalText.slice(locStart(node), locStart(node.id));
  28340. const isGlobalDeclaration = node.id.type === "Identifier" && node.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
  28341. if (!isGlobalDeclaration) {
  28342. parts.push(isExternalModule || /(?:^|\s)module(?:\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
  28343. }
  28344. }
  28345. parts.push(print("id"));
  28346. if (bodyIsDeclaration) {
  28347. parts.push(print("body"));
  28348. } else if (node.body) {
  28349. parts.push(" ", group(print("body")));
  28350. } else {
  28351. parts.push(semi);
  28352. }
  28353. return parts;
  28354. }
  28355. case "TSConditionalType":
  28356. return printTernary(path, options, print);
  28357. case "TSInferType":
  28358. return ["infer", " ", print("typeParameter")];
  28359. case "TSIntersectionType":
  28360. return printIntersectionType(path, options, print);
  28361. case "TSUnionType":
  28362. return printUnionType(path, options, print);
  28363. case "TSFunctionType":
  28364. return printFunctionType(path, options, print);
  28365. case "TSTupleType":
  28366. return printTupleType(path, options, print);
  28367. case "TSTypeReference":
  28368. return [print("typeName"), printTypeParameters(path, options, print, "typeParameters")];
  28369. case "TSTypeAnnotation":
  28370. return print("typeAnnotation");
  28371. case "TSEmptyBodyFunctionExpression":
  28372. return printMethodInternal(path, options, print);
  28373. case "TSJSDocAllType":
  28374. return "*";
  28375. case "TSJSDocUnknownType":
  28376. return "?";
  28377. case "TSJSDocNullableType":
  28378. return printJSDocType(path, print, "?");
  28379. case "TSJSDocNonNullableType":
  28380. return printJSDocType(path, print, "!");
  28381. case "TSInstantiationExpression":
  28382. return [print("expression"), print("typeParameters")];
  28383. default:
  28384. throw new Error(`Unknown TypeScript node type: ${JSON.stringify(node.type)}.`);
  28385. }
  28386. }
  28387. module2.exports = {
  28388. printTypescript
  28389. };
  28390. }
  28391. });
  28392. var require_comment = __commonJS2({
  28393. "src/language-js/print/comment.js"(exports2, module2) {
  28394. "use strict";
  28395. var {
  28396. hasNewline
  28397. } = require_util();
  28398. var {
  28399. builders: {
  28400. join,
  28401. hardline
  28402. },
  28403. utils: {
  28404. replaceTextEndOfLine
  28405. }
  28406. } = require("./doc.js");
  28407. var {
  28408. isLineComment
  28409. } = require_utils7();
  28410. var {
  28411. locStart,
  28412. locEnd
  28413. } = require_loc();
  28414. var isBlockComment = require_is_block_comment();
  28415. function printComment(commentPath, options) {
  28416. const comment = commentPath.getValue();
  28417. if (isLineComment(comment)) {
  28418. return options.originalText.slice(locStart(comment), locEnd(comment)).trimEnd();
  28419. }
  28420. if (isBlockComment(comment)) {
  28421. if (isIndentableBlockComment(comment)) {
  28422. const printed = printIndentableBlockComment(comment);
  28423. if (comment.trailing && !hasNewline(options.originalText, locStart(comment), {
  28424. backwards: true
  28425. })) {
  28426. return [hardline, printed];
  28427. }
  28428. return printed;
  28429. }
  28430. const commentEnd = locEnd(comment);
  28431. const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
  28432. return ["/*", replaceTextEndOfLine(comment.value), isInsideFlowComment ? "*-/" : "*/"];
  28433. }
  28434. throw new Error("Not a comment: " + JSON.stringify(comment));
  28435. }
  28436. function isIndentableBlockComment(comment) {
  28437. const lines = `*${comment.value}*`.split("\n");
  28438. return lines.length > 1 && lines.every((line) => line.trim()[0] === "*");
  28439. }
  28440. function printIndentableBlockComment(comment) {
  28441. const lines = comment.value.split("\n");
  28442. return ["/*", join(hardline, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"];
  28443. }
  28444. module2.exports = {
  28445. printComment
  28446. };
  28447. }
  28448. });
  28449. var require_literal = __commonJS2({
  28450. "src/language-js/print/literal.js"(exports2, module2) {
  28451. "use strict";
  28452. var {
  28453. printString,
  28454. printNumber
  28455. } = require_util();
  28456. function printLiteral(path, options) {
  28457. const node = path.getNode();
  28458. switch (node.type) {
  28459. case "RegExpLiteral":
  28460. return printRegex(node);
  28461. case "BigIntLiteral":
  28462. return printBigInt(node.bigint || node.extra.raw);
  28463. case "NumericLiteral":
  28464. return printNumber(node.extra.raw);
  28465. case "StringLiteral":
  28466. return printString(node.extra.raw, options);
  28467. case "NullLiteral":
  28468. return "null";
  28469. case "BooleanLiteral":
  28470. return String(node.value);
  28471. case "DecimalLiteral":
  28472. return printNumber(node.value) + "m";
  28473. case "Literal": {
  28474. if (node.regex) {
  28475. return printRegex(node.regex);
  28476. }
  28477. if (node.bigint) {
  28478. return printBigInt(node.raw);
  28479. }
  28480. if (node.decimal) {
  28481. return printNumber(node.decimal) + "m";
  28482. }
  28483. const {
  28484. value
  28485. } = node;
  28486. if (typeof value === "number") {
  28487. return printNumber(node.raw);
  28488. }
  28489. if (typeof value === "string") {
  28490. return printString(node.raw, options);
  28491. }
  28492. return String(value);
  28493. }
  28494. }
  28495. }
  28496. function printBigInt(raw) {
  28497. return raw.toLowerCase();
  28498. }
  28499. function printRegex({
  28500. pattern,
  28501. flags
  28502. }) {
  28503. flags = [...flags].sort().join("");
  28504. return `/${pattern}/${flags}`;
  28505. }
  28506. module2.exports = {
  28507. printLiteral
  28508. };
  28509. }
  28510. });
  28511. var require_printer_estree = __commonJS2({
  28512. "src/language-js/printer-estree.js"(exports2, module2) {
  28513. "use strict";
  28514. var {
  28515. printDanglingComments
  28516. } = require_comments();
  28517. var {
  28518. hasNewline
  28519. } = require_util();
  28520. var {
  28521. builders: {
  28522. join,
  28523. line,
  28524. hardline,
  28525. softline,
  28526. group,
  28527. indent
  28528. },
  28529. utils: {
  28530. replaceTextEndOfLine
  28531. }
  28532. } = require("./doc.js");
  28533. var embed = require_embed();
  28534. var clean = require_clean();
  28535. var {
  28536. insertPragma
  28537. } = require_pragma();
  28538. var handleComments = require_comments2();
  28539. var pathNeedsParens = require_needs_parens();
  28540. var preprocess = require_print_preprocess();
  28541. var {
  28542. hasFlowShorthandAnnotationComment,
  28543. hasComment,
  28544. CommentCheckFlags,
  28545. isTheOnlyJsxElementInMarkdown,
  28546. isLineComment,
  28547. isNextLineEmpty,
  28548. needsHardlineAfterDanglingComment,
  28549. rawText,
  28550. hasIgnoreComment,
  28551. isCallExpression,
  28552. isMemberExpression,
  28553. markerForIfWithoutBlockAndSameLineComment
  28554. } = require_utils7();
  28555. var {
  28556. locStart,
  28557. locEnd
  28558. } = require_loc();
  28559. var isBlockComment = require_is_block_comment();
  28560. var {
  28561. printHtmlBinding,
  28562. isVueEventBindingExpression
  28563. } = require_html_binding();
  28564. var {
  28565. printAngular
  28566. } = require_angular();
  28567. var {
  28568. printJsx,
  28569. hasJsxIgnoreComment
  28570. } = require_jsx();
  28571. var {
  28572. printFlow
  28573. } = require_flow();
  28574. var {
  28575. printTypescript
  28576. } = require_typescript();
  28577. var {
  28578. printOptionalToken,
  28579. printBindExpressionCallee,
  28580. printTypeAnnotation,
  28581. adjustClause,
  28582. printRestSpread,
  28583. printDefiniteToken
  28584. } = require_misc();
  28585. var {
  28586. printImportDeclaration,
  28587. printExportDeclaration,
  28588. printExportAllDeclaration,
  28589. printModuleSpecifier
  28590. } = require_module();
  28591. var {
  28592. printTernary
  28593. } = require_ternary();
  28594. var {
  28595. printTemplateLiteral
  28596. } = require_template_literal();
  28597. var {
  28598. printArray
  28599. } = require_array4();
  28600. var {
  28601. printObject
  28602. } = require_object();
  28603. var {
  28604. printClass,
  28605. printClassMethod,
  28606. printClassProperty
  28607. } = require_class();
  28608. var {
  28609. printProperty
  28610. } = require_property();
  28611. var {
  28612. printFunction,
  28613. printArrowFunction,
  28614. printMethod,
  28615. printReturnStatement,
  28616. printThrowStatement
  28617. } = require_function();
  28618. var {
  28619. printCallExpression
  28620. } = require_call_expression();
  28621. var {
  28622. printVariableDeclarator,
  28623. printAssignmentExpression
  28624. } = require_assignment();
  28625. var {
  28626. printBinaryishExpression
  28627. } = require_binaryish();
  28628. var {
  28629. printSwitchCaseConsequent
  28630. } = require_statement();
  28631. var {
  28632. printMemberExpression
  28633. } = require_member();
  28634. var {
  28635. printBlock,
  28636. printBlockBody
  28637. } = require_block();
  28638. var {
  28639. printComment
  28640. } = require_comment();
  28641. var {
  28642. printLiteral
  28643. } = require_literal();
  28644. var {
  28645. printDecorators
  28646. } = require_decorators();
  28647. function genericPrint(path, options, print, args) {
  28648. const printed = printPathNoParens(path, options, print, args);
  28649. if (!printed) {
  28650. return "";
  28651. }
  28652. const node = path.getValue();
  28653. const {
  28654. type
  28655. } = node;
  28656. if (type === "ClassMethod" || type === "ClassPrivateMethod" || type === "ClassProperty" || type === "ClassAccessorProperty" || type === "PropertyDefinition" || type === "TSAbstractPropertyDefinition" || type === "ClassPrivateProperty" || type === "MethodDefinition" || type === "TSAbstractMethodDefinition" || type === "TSDeclareMethod") {
  28657. return printed;
  28658. }
  28659. let parts = [printed];
  28660. const printedDecorators = printDecorators(path, options, print);
  28661. const isClassExpressionWithDecorators = node.type === "ClassExpression" && printedDecorators;
  28662. if (printedDecorators) {
  28663. parts = [...printedDecorators, printed];
  28664. if (!isClassExpressionWithDecorators) {
  28665. return group(parts);
  28666. }
  28667. }
  28668. const needsParens = pathNeedsParens(path, options);
  28669. if (!needsParens) {
  28670. if (args && args.needsSemi) {
  28671. parts.unshift(";");
  28672. }
  28673. if (parts.length === 1 && parts[0] === printed) {
  28674. return printed;
  28675. }
  28676. return parts;
  28677. }
  28678. if (isClassExpressionWithDecorators) {
  28679. parts = [indent([line, ...parts])];
  28680. }
  28681. parts.unshift("(");
  28682. if (args && args.needsSemi) {
  28683. parts.unshift(";");
  28684. }
  28685. if (hasFlowShorthandAnnotationComment(node)) {
  28686. const [comment] = node.trailingComments;
  28687. parts.push(" /*", comment.value.trimStart(), "*/");
  28688. comment.printed = true;
  28689. }
  28690. if (isClassExpressionWithDecorators) {
  28691. parts.push(line);
  28692. }
  28693. parts.push(")");
  28694. return parts;
  28695. }
  28696. function printPathNoParens(path, options, print, args) {
  28697. const node = path.getValue();
  28698. const semi = options.semi ? ";" : "";
  28699. if (!node) {
  28700. return "";
  28701. }
  28702. if (typeof node === "string") {
  28703. return node;
  28704. }
  28705. for (const printer of [printLiteral, printHtmlBinding, printAngular, printJsx, printFlow, printTypescript]) {
  28706. const printed = printer(path, options, print);
  28707. if (typeof printed !== "undefined") {
  28708. return printed;
  28709. }
  28710. }
  28711. let parts = [];
  28712. switch (node.type) {
  28713. case "JsExpressionRoot":
  28714. return print("node");
  28715. case "JsonRoot":
  28716. return [print("node"), hardline];
  28717. case "File":
  28718. if (node.program && node.program.interpreter) {
  28719. parts.push(print(["program", "interpreter"]));
  28720. }
  28721. parts.push(print("program"));
  28722. return parts;
  28723. case "Program":
  28724. return printBlockBody(path, options, print);
  28725. case "EmptyStatement":
  28726. return "";
  28727. case "ExpressionStatement": {
  28728. if (node.directive) {
  28729. return [printDirective(node.expression, options), semi];
  28730. }
  28731. if (options.parser === "__vue_event_binding" || options.parser === "__vue_ts_event_binding") {
  28732. const parent = path.getParentNode();
  28733. if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === node) {
  28734. return [print("expression"), isVueEventBindingExpression(node.expression) ? ";" : ""];
  28735. }
  28736. }
  28737. const danglingComment = printDanglingComments(path, options, true, ({
  28738. marker
  28739. }) => marker === markerForIfWithoutBlockAndSameLineComment);
  28740. return [print("expression"), isTheOnlyJsxElementInMarkdown(options, path) ? "" : semi, danglingComment ? [" ", danglingComment] : ""];
  28741. }
  28742. case "ParenthesizedExpression": {
  28743. const shouldHug = !hasComment(node.expression) && (node.expression.type === "ObjectExpression" || node.expression.type === "ArrayExpression");
  28744. if (shouldHug) {
  28745. return ["(", print("expression"), ")"];
  28746. }
  28747. return group(["(", indent([softline, print("expression")]), softline, ")"]);
  28748. }
  28749. case "AssignmentExpression":
  28750. return printAssignmentExpression(path, options, print);
  28751. case "VariableDeclarator":
  28752. return printVariableDeclarator(path, options, print);
  28753. case "BinaryExpression":
  28754. case "LogicalExpression":
  28755. return printBinaryishExpression(path, options, print);
  28756. case "AssignmentPattern":
  28757. return [print("left"), " = ", print("right")];
  28758. case "OptionalMemberExpression":
  28759. case "MemberExpression": {
  28760. return printMemberExpression(path, options, print);
  28761. }
  28762. case "MetaProperty":
  28763. return [print("meta"), ".", print("property")];
  28764. case "BindExpression":
  28765. if (node.object) {
  28766. parts.push(print("object"));
  28767. }
  28768. parts.push(group(indent([softline, printBindExpressionCallee(path, options, print)])));
  28769. return parts;
  28770. case "Identifier": {
  28771. return [node.name, printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print)];
  28772. }
  28773. case "V8IntrinsicIdentifier":
  28774. return ["%", node.name];
  28775. case "SpreadElement":
  28776. case "SpreadElementPattern":
  28777. case "SpreadProperty":
  28778. case "SpreadPropertyPattern":
  28779. case "RestElement":
  28780. return printRestSpread(path, options, print);
  28781. case "FunctionDeclaration":
  28782. case "FunctionExpression":
  28783. return printFunction(path, print, options, args);
  28784. case "ArrowFunctionExpression":
  28785. return printArrowFunction(path, options, print, args);
  28786. case "YieldExpression":
  28787. parts.push("yield");
  28788. if (node.delegate) {
  28789. parts.push("*");
  28790. }
  28791. if (node.argument) {
  28792. parts.push(" ", print("argument"));
  28793. }
  28794. return parts;
  28795. case "AwaitExpression": {
  28796. parts.push("await");
  28797. if (node.argument) {
  28798. parts.push(" ", print("argument"));
  28799. const parent = path.getParentNode();
  28800. if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
  28801. parts = [indent([softline, ...parts]), softline];
  28802. const parentAwaitOrBlock = path.findAncestor((node2) => node2.type === "AwaitExpression" || node2.type === "BlockStatement");
  28803. if (!parentAwaitOrBlock || parentAwaitOrBlock.type !== "AwaitExpression") {
  28804. return group(parts);
  28805. }
  28806. }
  28807. }
  28808. return parts;
  28809. }
  28810. case "ExportDefaultDeclaration":
  28811. case "ExportNamedDeclaration":
  28812. return printExportDeclaration(path, options, print);
  28813. case "ExportAllDeclaration":
  28814. return printExportAllDeclaration(path, options, print);
  28815. case "ImportDeclaration":
  28816. return printImportDeclaration(path, options, print);
  28817. case "ImportSpecifier":
  28818. case "ExportSpecifier":
  28819. case "ImportNamespaceSpecifier":
  28820. case "ExportNamespaceSpecifier":
  28821. case "ImportDefaultSpecifier":
  28822. case "ExportDefaultSpecifier":
  28823. return printModuleSpecifier(path, options, print);
  28824. case "ImportAttribute":
  28825. return [print("key"), ": ", print("value")];
  28826. case "Import":
  28827. return "import";
  28828. case "BlockStatement":
  28829. case "StaticBlock":
  28830. case "ClassBody":
  28831. return printBlock(path, options, print);
  28832. case "ThrowStatement":
  28833. return printThrowStatement(path, options, print);
  28834. case "ReturnStatement":
  28835. return printReturnStatement(path, options, print);
  28836. case "NewExpression":
  28837. case "ImportExpression":
  28838. case "OptionalCallExpression":
  28839. case "CallExpression":
  28840. return printCallExpression(path, options, print);
  28841. case "ObjectExpression":
  28842. case "ObjectPattern":
  28843. case "RecordExpression":
  28844. return printObject(path, options, print);
  28845. case "ObjectProperty":
  28846. case "Property":
  28847. if (node.method || node.kind === "get" || node.kind === "set") {
  28848. return printMethod(path, options, print);
  28849. }
  28850. return printProperty(path, options, print);
  28851. case "ObjectMethod":
  28852. return printMethod(path, options, print);
  28853. case "Decorator":
  28854. return ["@", print("expression")];
  28855. case "ArrayExpression":
  28856. case "ArrayPattern":
  28857. case "TupleExpression":
  28858. return printArray(path, options, print);
  28859. case "SequenceExpression": {
  28860. const parent = path.getParentNode(0);
  28861. if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
  28862. const parts2 = [];
  28863. path.each((expressionPath, index) => {
  28864. if (index === 0) {
  28865. parts2.push(print());
  28866. } else {
  28867. parts2.push(",", indent([line, print()]));
  28868. }
  28869. }, "expressions");
  28870. return group(parts2);
  28871. }
  28872. return group(join([",", line], path.map(print, "expressions")));
  28873. }
  28874. case "ThisExpression":
  28875. return "this";
  28876. case "Super":
  28877. return "super";
  28878. case "Directive":
  28879. return [print("value"), semi];
  28880. case "DirectiveLiteral":
  28881. return printDirective(node, options);
  28882. case "UnaryExpression":
  28883. parts.push(node.operator);
  28884. if (/[a-z]$/.test(node.operator)) {
  28885. parts.push(" ");
  28886. }
  28887. if (hasComment(node.argument)) {
  28888. parts.push(group(["(", indent([softline, print("argument")]), softline, ")"]));
  28889. } else {
  28890. parts.push(print("argument"));
  28891. }
  28892. return parts;
  28893. case "UpdateExpression":
  28894. parts.push(print("argument"), node.operator);
  28895. if (node.prefix) {
  28896. parts.reverse();
  28897. }
  28898. return parts;
  28899. case "ConditionalExpression":
  28900. return printTernary(path, options, print);
  28901. case "VariableDeclaration": {
  28902. const printed = path.map(print, "declarations");
  28903. const parentNode = path.getParentNode();
  28904. const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
  28905. const hasValue = node.declarations.some((decl) => decl.init);
  28906. let firstVariable;
  28907. if (printed.length === 1 && !hasComment(node.declarations[0])) {
  28908. firstVariable = printed[0];
  28909. } else if (printed.length > 0) {
  28910. firstVariable = indent(printed[0]);
  28911. }
  28912. parts = [node.declare ? "declare " : "", node.kind, firstVariable ? [" ", firstVariable] : "", indent(printed.slice(1).map((p) => [",", hasValue && !isParentForLoop ? hardline : line, p]))];
  28913. if (!(isParentForLoop && parentNode.body !== node)) {
  28914. parts.push(semi);
  28915. }
  28916. return group(parts);
  28917. }
  28918. case "WithStatement":
  28919. return group(["with (", print("object"), ")", adjustClause(node.body, print("body"))]);
  28920. case "IfStatement": {
  28921. const con = adjustClause(node.consequent, print("consequent"));
  28922. const opening = group(["if (", group([indent([softline, print("test")]), softline]), ")", con]);
  28923. parts.push(opening);
  28924. if (node.alternate) {
  28925. const commentOnOwnLine = hasComment(node.consequent, CommentCheckFlags.Trailing | CommentCheckFlags.Line) || needsHardlineAfterDanglingComment(node);
  28926. const elseOnSameLine = node.consequent.type === "BlockStatement" && !commentOnOwnLine;
  28927. parts.push(elseOnSameLine ? " " : hardline);
  28928. if (hasComment(node, CommentCheckFlags.Dangling)) {
  28929. parts.push(printDanglingComments(path, options, true), commentOnOwnLine ? hardline : " ");
  28930. }
  28931. parts.push("else", group(adjustClause(node.alternate, print("alternate"), node.alternate.type === "IfStatement")));
  28932. }
  28933. return parts;
  28934. }
  28935. case "ForStatement": {
  28936. const body = adjustClause(node.body, print("body"));
  28937. const dangling = printDanglingComments(path, options, true);
  28938. const printedComments = dangling ? [dangling, softline] : "";
  28939. if (!node.init && !node.test && !node.update) {
  28940. return [printedComments, group(["for (;;)", body])];
  28941. }
  28942. return [printedComments, group(["for (", group([indent([softline, print("init"), ";", line, print("test"), ";", line, print("update")]), softline]), ")", body])];
  28943. }
  28944. case "WhileStatement":
  28945. return group(["while (", group([indent([softline, print("test")]), softline]), ")", adjustClause(node.body, print("body"))]);
  28946. case "ForInStatement":
  28947. return group(["for (", print("left"), " in ", print("right"), ")", adjustClause(node.body, print("body"))]);
  28948. case "ForOfStatement":
  28949. return group(["for", node.await ? " await" : "", " (", print("left"), " of ", print("right"), ")", adjustClause(node.body, print("body"))]);
  28950. case "DoWhileStatement": {
  28951. const clause = adjustClause(node.body, print("body"));
  28952. const doBody = group(["do", clause]);
  28953. parts = [doBody];
  28954. if (node.body.type === "BlockStatement") {
  28955. parts.push(" ");
  28956. } else {
  28957. parts.push(hardline);
  28958. }
  28959. parts.push("while (", group([indent([softline, print("test")]), softline]), ")", semi);
  28960. return parts;
  28961. }
  28962. case "DoExpression":
  28963. return [node.async ? "async " : "", "do ", print("body")];
  28964. case "BreakStatement":
  28965. parts.push("break");
  28966. if (node.label) {
  28967. parts.push(" ", print("label"));
  28968. }
  28969. parts.push(semi);
  28970. return parts;
  28971. case "ContinueStatement":
  28972. parts.push("continue");
  28973. if (node.label) {
  28974. parts.push(" ", print("label"));
  28975. }
  28976. parts.push(semi);
  28977. return parts;
  28978. case "LabeledStatement":
  28979. if (node.body.type === "EmptyStatement") {
  28980. return [print("label"), ":;"];
  28981. }
  28982. return [print("label"), ": ", print("body")];
  28983. case "TryStatement":
  28984. return ["try ", print("block"), node.handler ? [" ", print("handler")] : "", node.finalizer ? [" finally ", print("finalizer")] : ""];
  28985. case "CatchClause":
  28986. if (node.param) {
  28987. const parameterHasComments = hasComment(node.param, (comment) => !isBlockComment(comment) || comment.leading && hasNewline(options.originalText, locEnd(comment)) || comment.trailing && hasNewline(options.originalText, locStart(comment), {
  28988. backwards: true
  28989. }));
  28990. const param = print("param");
  28991. return ["catch ", parameterHasComments ? ["(", indent([softline, param]), softline, ") "] : ["(", param, ") "], print("body")];
  28992. }
  28993. return ["catch ", print("body")];
  28994. case "SwitchStatement":
  28995. return [group(["switch (", indent([softline, print("discriminant")]), softline, ")"]), " {", node.cases.length > 0 ? indent([hardline, join(hardline, path.map((casePath, index, cases) => {
  28996. const caseNode = casePath.getValue();
  28997. return [print(), index !== cases.length - 1 && isNextLineEmpty(caseNode, options) ? hardline : ""];
  28998. }, "cases"))]) : "", hardline, "}"];
  28999. case "SwitchCase": {
  29000. if (node.test) {
  29001. parts.push("case ", print("test"), ":");
  29002. } else {
  29003. parts.push("default:");
  29004. }
  29005. if (hasComment(node, CommentCheckFlags.Dangling)) {
  29006. parts.push(" ", printDanglingComments(path, options, true));
  29007. }
  29008. const consequent = node.consequent.filter((node2) => node2.type !== "EmptyStatement");
  29009. if (consequent.length > 0) {
  29010. const cons = printSwitchCaseConsequent(path, options, print);
  29011. parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? [" ", cons] : indent([hardline, cons]));
  29012. }
  29013. return parts;
  29014. }
  29015. case "DebuggerStatement":
  29016. return ["debugger", semi];
  29017. case "ClassDeclaration":
  29018. case "ClassExpression":
  29019. return printClass(path, options, print);
  29020. case "ClassMethod":
  29021. case "ClassPrivateMethod":
  29022. case "MethodDefinition":
  29023. return printClassMethod(path, options, print);
  29024. case "ClassProperty":
  29025. case "PropertyDefinition":
  29026. case "ClassPrivateProperty":
  29027. case "ClassAccessorProperty":
  29028. return printClassProperty(path, options, print);
  29029. case "TemplateElement":
  29030. return replaceTextEndOfLine(node.value.raw);
  29031. case "TemplateLiteral":
  29032. return printTemplateLiteral(path, print, options);
  29033. case "TaggedTemplateExpression":
  29034. return [print("tag"), print("typeParameters"), print("quasi")];
  29035. case "PrivateIdentifier":
  29036. return ["#", print("name")];
  29037. case "PrivateName":
  29038. return ["#", print("id")];
  29039. case "InterpreterDirective":
  29040. parts.push("#!", node.value, hardline);
  29041. if (isNextLineEmpty(node, options)) {
  29042. parts.push(hardline);
  29043. }
  29044. return parts;
  29045. case "TopicReference":
  29046. return "%";
  29047. case "ArgumentPlaceholder":
  29048. return "?";
  29049. case "ModuleExpression": {
  29050. parts.push("module {");
  29051. const printed = print("body");
  29052. if (printed) {
  29053. parts.push(indent([hardline, printed]), hardline);
  29054. }
  29055. parts.push("}");
  29056. return parts;
  29057. }
  29058. default:
  29059. throw new Error("unknown type: " + JSON.stringify(node.type));
  29060. }
  29061. }
  29062. function printDirective(node, options) {
  29063. const raw = rawText(node);
  29064. const rawContent = raw.slice(1, -1);
  29065. if (rawContent.includes('"') || rawContent.includes("'")) {
  29066. return raw;
  29067. }
  29068. const enclosingQuote = options.singleQuote ? "'" : '"';
  29069. return enclosingQuote + rawContent + enclosingQuote;
  29070. }
  29071. function canAttachComment(node) {
  29072. return node.type && !isBlockComment(node) && !isLineComment(node) && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && node.type !== "TSEmptyBodyFunctionExpression";
  29073. }
  29074. module2.exports = {
  29075. preprocess,
  29076. print: genericPrint,
  29077. embed,
  29078. insertPragma,
  29079. massageAstNode: clean,
  29080. hasPrettierIgnore(path) {
  29081. return hasIgnoreComment(path) || hasJsxIgnoreComment(path);
  29082. },
  29083. willPrintOwnComments: handleComments.willPrintOwnComments,
  29084. canAttachComment,
  29085. printComment,
  29086. isBlockComment,
  29087. handleComments: {
  29088. avoidAstMutation: true,
  29089. ownLine: handleComments.handleOwnLineComment,
  29090. endOfLine: handleComments.handleEndOfLineComment,
  29091. remaining: handleComments.handleRemainingComment
  29092. },
  29093. getCommentChildNodes: handleComments.getCommentChildNodes
  29094. };
  29095. }
  29096. });
  29097. var require_printer_estree_json = __commonJS2({
  29098. "src/language-js/printer-estree-json.js"(exports2, module2) {
  29099. "use strict";
  29100. var {
  29101. builders: {
  29102. hardline,
  29103. indent,
  29104. join
  29105. }
  29106. } = require("./doc.js");
  29107. var preprocess = require_print_preprocess();
  29108. function genericPrint(path, options, print) {
  29109. const node = path.getValue();
  29110. switch (node.type) {
  29111. case "JsonRoot":
  29112. return [print("node"), hardline];
  29113. case "ArrayExpression": {
  29114. if (node.elements.length === 0) {
  29115. return "[]";
  29116. }
  29117. const printed = path.map(() => path.getValue() === null ? "null" : print(), "elements");
  29118. return ["[", indent([hardline, join([",", hardline], printed)]), hardline, "]"];
  29119. }
  29120. case "ObjectExpression":
  29121. return node.properties.length === 0 ? "{}" : ["{", indent([hardline, join([",", hardline], path.map(print, "properties"))]), hardline, "}"];
  29122. case "ObjectProperty":
  29123. return [print("key"), ": ", print("value")];
  29124. case "UnaryExpression":
  29125. return [node.operator === "+" ? "" : node.operator, print("argument")];
  29126. case "NullLiteral":
  29127. return "null";
  29128. case "BooleanLiteral":
  29129. return node.value ? "true" : "false";
  29130. case "StringLiteral":
  29131. case "NumericLiteral":
  29132. return JSON.stringify(node.value);
  29133. case "Identifier": {
  29134. const parent = path.getParentNode();
  29135. if (parent && parent.type === "ObjectProperty" && parent.key === node) {
  29136. return JSON.stringify(node.name);
  29137. }
  29138. return node.name;
  29139. }
  29140. case "TemplateLiteral":
  29141. return print(["quasis", 0]);
  29142. case "TemplateElement":
  29143. return JSON.stringify(node.value.cooked);
  29144. default:
  29145. throw new Error("unknown type: " + JSON.stringify(node.type));
  29146. }
  29147. }
  29148. var ignoredProperties = /* @__PURE__ */ new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
  29149. function clean(node, newNode) {
  29150. const {
  29151. type
  29152. } = node;
  29153. if (type === "ObjectProperty" && node.key.type === "Identifier") {
  29154. newNode.key = {
  29155. type: "StringLiteral",
  29156. value: node.key.name
  29157. };
  29158. return;
  29159. }
  29160. if (type === "UnaryExpression" && node.operator === "+") {
  29161. return newNode.argument;
  29162. }
  29163. if (type === "ArrayExpression") {
  29164. for (const [index, element] of node.elements.entries()) {
  29165. if (element === null) {
  29166. newNode.elements.splice(index, 0, {
  29167. type: "NullLiteral"
  29168. });
  29169. }
  29170. }
  29171. return;
  29172. }
  29173. if (type === "TemplateLiteral") {
  29174. return {
  29175. type: "StringLiteral",
  29176. value: node.quasis[0].value.cooked
  29177. };
  29178. }
  29179. }
  29180. clean.ignoredProperties = ignoredProperties;
  29181. module2.exports = {
  29182. preprocess,
  29183. print: genericPrint,
  29184. massageAstNode: clean
  29185. };
  29186. }
  29187. });
  29188. var require_common_options = __commonJS2({
  29189. "src/common/common-options.js"(exports2, module2) {
  29190. "use strict";
  29191. var CATEGORY_COMMON = "Common";
  29192. module2.exports = {
  29193. bracketSpacing: {
  29194. since: "0.0.0",
  29195. category: CATEGORY_COMMON,
  29196. type: "boolean",
  29197. default: true,
  29198. description: "Print spaces between brackets.",
  29199. oppositeDescription: "Do not print spaces between brackets."
  29200. },
  29201. singleQuote: {
  29202. since: "0.0.0",
  29203. category: CATEGORY_COMMON,
  29204. type: "boolean",
  29205. default: false,
  29206. description: "Use single quotes instead of double quotes."
  29207. },
  29208. proseWrap: {
  29209. since: "1.8.2",
  29210. category: CATEGORY_COMMON,
  29211. type: "choice",
  29212. default: [{
  29213. since: "1.8.2",
  29214. value: true
  29215. }, {
  29216. since: "1.9.0",
  29217. value: "preserve"
  29218. }],
  29219. description: "How to wrap prose.",
  29220. choices: [{
  29221. since: "1.9.0",
  29222. value: "always",
  29223. description: "Wrap prose if it exceeds the print width."
  29224. }, {
  29225. since: "1.9.0",
  29226. value: "never",
  29227. description: "Do not wrap prose."
  29228. }, {
  29229. since: "1.9.0",
  29230. value: "preserve",
  29231. description: "Wrap prose as-is."
  29232. }]
  29233. },
  29234. bracketSameLine: {
  29235. since: "2.4.0",
  29236. category: CATEGORY_COMMON,
  29237. type: "boolean",
  29238. default: false,
  29239. description: "Put > of opening tags on the last line instead of on a new line."
  29240. },
  29241. singleAttributePerLine: {
  29242. since: "2.6.0",
  29243. category: CATEGORY_COMMON,
  29244. type: "boolean",
  29245. default: false,
  29246. description: "Enforce single attribute per line in HTML, Vue and JSX."
  29247. }
  29248. };
  29249. }
  29250. });
  29251. var require_options2 = __commonJS2({
  29252. "src/language-js/options.js"(exports2, module2) {
  29253. "use strict";
  29254. var commonOptions = require_common_options();
  29255. var CATEGORY_JAVASCRIPT = "JavaScript";
  29256. module2.exports = {
  29257. arrowParens: {
  29258. since: "1.9.0",
  29259. category: CATEGORY_JAVASCRIPT,
  29260. type: "choice",
  29261. default: [{
  29262. since: "1.9.0",
  29263. value: "avoid"
  29264. }, {
  29265. since: "2.0.0",
  29266. value: "always"
  29267. }],
  29268. description: "Include parentheses around a sole arrow function parameter.",
  29269. choices: [{
  29270. value: "always",
  29271. description: "Always include parens. Example: `(x) => x`"
  29272. }, {
  29273. value: "avoid",
  29274. description: "Omit parens when possible. Example: `x => x`"
  29275. }]
  29276. },
  29277. bracketSameLine: commonOptions.bracketSameLine,
  29278. bracketSpacing: commonOptions.bracketSpacing,
  29279. jsxBracketSameLine: {
  29280. since: "0.17.0",
  29281. category: CATEGORY_JAVASCRIPT,
  29282. type: "boolean",
  29283. description: "Put > on the last line instead of at a new line.",
  29284. deprecated: "2.4.0"
  29285. },
  29286. semi: {
  29287. since: "1.0.0",
  29288. category: CATEGORY_JAVASCRIPT,
  29289. type: "boolean",
  29290. default: true,
  29291. description: "Print semicolons.",
  29292. oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
  29293. },
  29294. singleQuote: commonOptions.singleQuote,
  29295. jsxSingleQuote: {
  29296. since: "1.15.0",
  29297. category: CATEGORY_JAVASCRIPT,
  29298. type: "boolean",
  29299. default: false,
  29300. description: "Use single quotes in JSX."
  29301. },
  29302. quoteProps: {
  29303. since: "1.17.0",
  29304. category: CATEGORY_JAVASCRIPT,
  29305. type: "choice",
  29306. default: "as-needed",
  29307. description: "Change when properties in objects are quoted.",
  29308. choices: [{
  29309. value: "as-needed",
  29310. description: "Only add quotes around object properties where required."
  29311. }, {
  29312. value: "consistent",
  29313. description: "If at least one property in an object requires quotes, quote all properties."
  29314. }, {
  29315. value: "preserve",
  29316. description: "Respect the input use of quotes in object properties."
  29317. }]
  29318. },
  29319. trailingComma: {
  29320. since: "0.0.0",
  29321. category: CATEGORY_JAVASCRIPT,
  29322. type: "choice",
  29323. default: [{
  29324. since: "0.0.0",
  29325. value: false
  29326. }, {
  29327. since: "0.19.0",
  29328. value: "none"
  29329. }, {
  29330. since: "2.0.0",
  29331. value: "es5"
  29332. }],
  29333. description: "Print trailing commas wherever possible when multi-line.",
  29334. choices: [{
  29335. value: "es5",
  29336. description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
  29337. }, {
  29338. value: "none",
  29339. description: "No trailing commas."
  29340. }, {
  29341. value: "all",
  29342. description: "Trailing commas wherever possible (including function arguments)."
  29343. }]
  29344. },
  29345. singleAttributePerLine: commonOptions.singleAttributePerLine
  29346. };
  29347. }
  29348. });
  29349. var require_parsers = __commonJS2({
  29350. "src/language-js/parse/parsers.js"(exports2, module2) {
  29351. "use strict";
  29352. module2.exports = {
  29353. get babel() {
  29354. return require("./parser-babel.js").parsers.babel;
  29355. },
  29356. get "babel-flow"() {
  29357. return require("./parser-babel.js").parsers["babel-flow"];
  29358. },
  29359. get "babel-ts"() {
  29360. return require("./parser-babel.js").parsers["babel-ts"];
  29361. },
  29362. get json() {
  29363. return require("./parser-babel.js").parsers.json;
  29364. },
  29365. get json5() {
  29366. return require("./parser-babel.js").parsers.json5;
  29367. },
  29368. get "json-stringify"() {
  29369. return require("./parser-babel.js").parsers["json-stringify"];
  29370. },
  29371. get __js_expression() {
  29372. return require("./parser-babel.js").parsers.__js_expression;
  29373. },
  29374. get __vue_expression() {
  29375. return require("./parser-babel.js").parsers.__vue_expression;
  29376. },
  29377. get __vue_ts_expression() {
  29378. return require("./parser-babel.js").parsers.__vue_ts_expression;
  29379. },
  29380. get __vue_event_binding() {
  29381. return require("./parser-babel.js").parsers.__vue_event_binding;
  29382. },
  29383. get __vue_ts_event_binding() {
  29384. return require("./parser-babel.js").parsers.__vue_ts_event_binding;
  29385. },
  29386. get flow() {
  29387. return require("./parser-flow.js").parsers.flow;
  29388. },
  29389. get typescript() {
  29390. return require("./parser-typescript.js").parsers.typescript;
  29391. },
  29392. get __ng_action() {
  29393. return require("./parser-angular.js").parsers.__ng_action;
  29394. },
  29395. get __ng_binding() {
  29396. return require("./parser-angular.js").parsers.__ng_binding;
  29397. },
  29398. get __ng_interpolation() {
  29399. return require("./parser-angular.js").parsers.__ng_interpolation;
  29400. },
  29401. get __ng_directive() {
  29402. return require("./parser-angular.js").parsers.__ng_directive;
  29403. },
  29404. get acorn() {
  29405. return require("./parser-espree.js").parsers.acorn;
  29406. },
  29407. get espree() {
  29408. return require("./parser-espree.js").parsers.espree;
  29409. },
  29410. get meriyah() {
  29411. return require("./parser-meriyah.js").parsers.meriyah;
  29412. },
  29413. get __babel_estree() {
  29414. return require("./parser-babel.js").parsers.__babel_estree;
  29415. }
  29416. };
  29417. }
  29418. });
  29419. var require_JavaScript = __commonJS2({
  29420. "node_modules/linguist-languages/data/JavaScript.json"(exports2, module2) {
  29421. module2.exports = {
  29422. name: "JavaScript",
  29423. type: "programming",
  29424. tmScope: "source.js",
  29425. aceMode: "javascript",
  29426. codemirrorMode: "javascript",
  29427. codemirrorMimeType: "text/javascript",
  29428. color: "#f1e05a",
  29429. aliases: ["js", "node"],
  29430. 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"],
  29431. filenames: ["Jakefile"],
  29432. interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"],
  29433. languageId: 183
  29434. };
  29435. }
  29436. });
  29437. var require_TypeScript = __commonJS2({
  29438. "node_modules/linguist-languages/data/TypeScript.json"(exports2, module2) {
  29439. module2.exports = {
  29440. name: "TypeScript",
  29441. type: "programming",
  29442. color: "#3178c6",
  29443. aliases: ["ts"],
  29444. interpreters: ["deno", "ts-node"],
  29445. extensions: [".ts", ".cts", ".mts"],
  29446. tmScope: "source.ts",
  29447. aceMode: "typescript",
  29448. codemirrorMode: "javascript",
  29449. codemirrorMimeType: "application/typescript",
  29450. languageId: 378
  29451. };
  29452. }
  29453. });
  29454. var require_TSX = __commonJS2({
  29455. "node_modules/linguist-languages/data/TSX.json"(exports2, module2) {
  29456. module2.exports = {
  29457. name: "TSX",
  29458. type: "programming",
  29459. color: "#3178c6",
  29460. group: "TypeScript",
  29461. extensions: [".tsx"],
  29462. tmScope: "source.tsx",
  29463. aceMode: "javascript",
  29464. codemirrorMode: "jsx",
  29465. codemirrorMimeType: "text/jsx",
  29466. languageId: 94901924
  29467. };
  29468. }
  29469. });
  29470. var require_JSON = __commonJS2({
  29471. "node_modules/linguist-languages/data/JSON.json"(exports2, module2) {
  29472. module2.exports = {
  29473. name: "JSON",
  29474. type: "data",
  29475. color: "#292929",
  29476. tmScope: "source.json",
  29477. aceMode: "json",
  29478. codemirrorMode: "javascript",
  29479. codemirrorMimeType: "application/json",
  29480. aliases: ["geojson", "jsonl", "topojson"],
  29481. extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"],
  29482. filenames: [".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", "Pipfile.lock", "composer.lock", "mcmod.info"],
  29483. languageId: 174
  29484. };
  29485. }
  29486. });
  29487. var require_JSON_with_Comments = __commonJS2({
  29488. "node_modules/linguist-languages/data/JSON with Comments.json"(exports2, module2) {
  29489. module2.exports = {
  29490. name: "JSON with Comments",
  29491. type: "data",
  29492. color: "#292929",
  29493. group: "JSON",
  29494. tmScope: "source.js",
  29495. aceMode: "javascript",
  29496. codemirrorMode: "javascript",
  29497. codemirrorMimeType: "text/javascript",
  29498. aliases: ["jsonc"],
  29499. 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"],
  29500. filenames: [".babelrc", ".devcontainer.json", ".eslintrc.json", ".jscsrc", ".jshintrc", ".jslintrc", "api-extractor.json", "devcontainer.json", "jsconfig.json", "language-configuration.json", "tsconfig.json", "tslint.json"],
  29501. languageId: 423
  29502. };
  29503. }
  29504. });
  29505. var require_JSON5 = __commonJS2({
  29506. "node_modules/linguist-languages/data/JSON5.json"(exports2, module2) {
  29507. module2.exports = {
  29508. name: "JSON5",
  29509. type: "data",
  29510. color: "#267CB9",
  29511. extensions: [".json5"],
  29512. tmScope: "source.js",
  29513. aceMode: "javascript",
  29514. codemirrorMode: "javascript",
  29515. codemirrorMimeType: "application/json",
  29516. languageId: 175
  29517. };
  29518. }
  29519. });
  29520. var require_language_js = __commonJS2({
  29521. "src/language-js/index.js"(exports2, module2) {
  29522. "use strict";
  29523. var createLanguage = require_create_language();
  29524. var estreePrinter = require_printer_estree();
  29525. var estreeJsonPrinter = require_printer_estree_json();
  29526. var options = require_options2();
  29527. var parsers = require_parsers();
  29528. var languages = [createLanguage(require_JavaScript(), (data) => ({
  29529. since: "0.0.0",
  29530. parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"],
  29531. vscodeLanguageIds: ["javascript", "mongo"],
  29532. interpreters: [...data.interpreters, "zx"],
  29533. extensions: [...data.extensions.filter((extension) => extension !== ".jsx"), ".wxs"]
  29534. })), createLanguage(require_JavaScript(), () => ({
  29535. name: "Flow",
  29536. since: "0.0.0",
  29537. parsers: ["flow", "babel-flow"],
  29538. vscodeLanguageIds: ["javascript"],
  29539. aliases: [],
  29540. filenames: [],
  29541. extensions: [".js.flow"]
  29542. })), createLanguage(require_JavaScript(), () => ({
  29543. name: "JSX",
  29544. since: "0.0.0",
  29545. parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"],
  29546. vscodeLanguageIds: ["javascriptreact"],
  29547. aliases: void 0,
  29548. filenames: void 0,
  29549. extensions: [".jsx"],
  29550. group: "JavaScript",
  29551. interpreters: void 0,
  29552. tmScope: "source.js.jsx",
  29553. aceMode: "javascript",
  29554. codemirrorMode: "jsx",
  29555. codemirrorMimeType: "text/jsx",
  29556. color: void 0
  29557. })), createLanguage(require_TypeScript(), () => ({
  29558. since: "1.4.0",
  29559. parsers: ["typescript", "babel-ts"],
  29560. vscodeLanguageIds: ["typescript"]
  29561. })), createLanguage(require_TSX(), () => ({
  29562. since: "1.4.0",
  29563. parsers: ["typescript", "babel-ts"],
  29564. vscodeLanguageIds: ["typescriptreact"]
  29565. })), createLanguage(require_JSON(), () => ({
  29566. name: "JSON.stringify",
  29567. since: "1.13.0",
  29568. parsers: ["json-stringify"],
  29569. vscodeLanguageIds: ["json"],
  29570. extensions: [".importmap"],
  29571. filenames: ["package.json", "package-lock.json", "composer.json"]
  29572. })), createLanguage(require_JSON(), (data) => ({
  29573. since: "1.5.0",
  29574. parsers: ["json"],
  29575. vscodeLanguageIds: ["json"],
  29576. extensions: data.extensions.filter((extension) => extension !== ".jsonl")
  29577. })), createLanguage(require_JSON_with_Comments(), (data) => ({
  29578. since: "1.5.0",
  29579. parsers: ["json"],
  29580. vscodeLanguageIds: ["jsonc"],
  29581. filenames: [...data.filenames, ".eslintrc", ".swcrc"]
  29582. })), createLanguage(require_JSON5(), () => ({
  29583. since: "1.13.0",
  29584. parsers: ["json5"],
  29585. vscodeLanguageIds: ["json5"]
  29586. }))];
  29587. var printers = {
  29588. estree: estreePrinter,
  29589. "estree-json": estreeJsonPrinter
  29590. };
  29591. module2.exports = {
  29592. languages,
  29593. options,
  29594. printers,
  29595. parsers
  29596. };
  29597. }
  29598. });
  29599. var require_clean2 = __commonJS2({
  29600. "src/language-css/clean.js"(exports2, module2) {
  29601. "use strict";
  29602. var {
  29603. isFrontMatterNode
  29604. } = require_util();
  29605. var getLast = require_get_last();
  29606. var ignoredProperties = /* @__PURE__ */ new Set(["raw", "raws", "sourceIndex", "source", "before", "after", "trailingComma"]);
  29607. function clean(ast, newObj, parent) {
  29608. if (isFrontMatterNode(ast) && ast.lang === "yaml") {
  29609. delete newObj.value;
  29610. }
  29611. if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length > 0) {
  29612. if (parent.nodes[0] === ast || isFrontMatterNode(parent.nodes[0]) && parent.nodes[1] === ast) {
  29613. delete newObj.text;
  29614. if (/^\*\s*@(?:format|prettier)\s*$/.test(ast.text)) {
  29615. return null;
  29616. }
  29617. }
  29618. if (parent.type === "css-root" && getLast(parent.nodes) === ast) {
  29619. return null;
  29620. }
  29621. }
  29622. if (ast.type === "value-root") {
  29623. delete newObj.text;
  29624. }
  29625. if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
  29626. delete newObj.value;
  29627. }
  29628. if (ast.type === "css-rule") {
  29629. delete newObj.params;
  29630. }
  29631. if (ast.type === "selector-combinator") {
  29632. newObj.value = newObj.value.replace(/\s+/g, " ");
  29633. }
  29634. if (ast.type === "media-feature") {
  29635. newObj.value = newObj.value.replace(/ /g, "");
  29636. }
  29637. 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") {
  29638. newObj.value = newObj.value.toLowerCase();
  29639. }
  29640. if (ast.type === "css-decl") {
  29641. newObj.prop = newObj.prop.toLowerCase();
  29642. }
  29643. if (ast.type === "css-atrule" || ast.type === "css-import") {
  29644. newObj.name = newObj.name.toLowerCase();
  29645. }
  29646. if (ast.type === "value-number") {
  29647. newObj.unit = newObj.unit.toLowerCase();
  29648. }
  29649. 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) {
  29650. newObj.value = cleanCSSStrings(newObj.value);
  29651. }
  29652. if (ast.type === "selector-attribute") {
  29653. newObj.attribute = newObj.attribute.trim();
  29654. if (newObj.namespace) {
  29655. if (typeof newObj.namespace === "string") {
  29656. newObj.namespace = newObj.namespace.trim();
  29657. if (newObj.namespace.length === 0) {
  29658. newObj.namespace = true;
  29659. }
  29660. }
  29661. }
  29662. if (newObj.value) {
  29663. newObj.value = newObj.value.trim().replace(/^["']|["']$/g, "");
  29664. delete newObj.quoted;
  29665. }
  29666. }
  29667. 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) {
  29668. newObj.value = newObj.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g, (match, numStr, unit) => {
  29669. const num = Number(numStr);
  29670. return Number.isNaN(num) ? match : num + unit.toLowerCase();
  29671. });
  29672. }
  29673. if (ast.type === "selector-tag") {
  29674. const lowercasedValue = ast.value.toLowerCase();
  29675. if (["from", "to"].includes(lowercasedValue)) {
  29676. newObj.value = lowercasedValue;
  29677. }
  29678. }
  29679. if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
  29680. delete newObj.value;
  29681. }
  29682. if (ast.type === "selector-unknown") {
  29683. delete newObj.value;
  29684. }
  29685. if (ast.type === "value-comma_group") {
  29686. const index = ast.groups.findIndex((node) => node.type === "value-number" && node.unit === "...");
  29687. if (index !== -1) {
  29688. newObj.groups[index].unit = "";
  29689. newObj.groups.splice(index + 1, 0, {
  29690. type: "value-word",
  29691. value: "...",
  29692. isColor: false,
  29693. isHex: false
  29694. });
  29695. }
  29696. }
  29697. }
  29698. clean.ignoredProperties = ignoredProperties;
  29699. function cleanCSSStrings(value) {
  29700. return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1");
  29701. }
  29702. module2.exports = clean;
  29703. }
  29704. });
  29705. var require_print = __commonJS2({
  29706. "src/utils/front-matter/print.js"(exports2, module2) {
  29707. "use strict";
  29708. var {
  29709. builders: {
  29710. hardline,
  29711. markAsRoot
  29712. }
  29713. } = require("./doc.js");
  29714. function print(node, textToDoc) {
  29715. if (node.lang === "yaml") {
  29716. const value = node.value.trim();
  29717. const doc2 = value ? textToDoc(value, {
  29718. parser: "yaml"
  29719. }, {
  29720. stripTrailingHardline: true
  29721. }) : "";
  29722. return markAsRoot([node.startDelimiter, hardline, doc2, doc2 ? hardline : "", node.endDelimiter]);
  29723. }
  29724. }
  29725. module2.exports = print;
  29726. }
  29727. });
  29728. var require_embed2 = __commonJS2({
  29729. "src/language-css/embed.js"(exports2, module2) {
  29730. "use strict";
  29731. var {
  29732. builders: {
  29733. hardline
  29734. }
  29735. } = require("./doc.js");
  29736. var printFrontMatter = require_print();
  29737. function embed(path, print, textToDoc) {
  29738. const node = path.getValue();
  29739. if (node.type === "front-matter") {
  29740. const doc2 = printFrontMatter(node, textToDoc);
  29741. return doc2 ? [doc2, hardline] : "";
  29742. }
  29743. }
  29744. module2.exports = embed;
  29745. }
  29746. });
  29747. var require_parse4 = __commonJS2({
  29748. "src/utils/front-matter/parse.js"(exports2, module2) {
  29749. "use strict";
  29750. var frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})(?<language>[^\\n]*)\\n(?:|(?<value>.*?)\\n)(?<endDelimiter>\\k<startDelimiter>|\\.{3})[^\\S\\n]*(?:\\n|$)", "s");
  29751. function parse(text) {
  29752. const match = text.match(frontMatterRegex);
  29753. if (!match) {
  29754. return {
  29755. content: text
  29756. };
  29757. }
  29758. const {
  29759. startDelimiter,
  29760. language,
  29761. value = "",
  29762. endDelimiter
  29763. } = match.groups;
  29764. let lang = language.trim() || "yaml";
  29765. if (startDelimiter === "+++") {
  29766. lang = "toml";
  29767. }
  29768. if (lang !== "yaml" && startDelimiter !== endDelimiter) {
  29769. return {
  29770. content: text
  29771. };
  29772. }
  29773. const [raw] = match;
  29774. const frontMatter = {
  29775. type: "front-matter",
  29776. lang,
  29777. value,
  29778. startDelimiter,
  29779. endDelimiter,
  29780. raw: raw.replace(/\n$/, "")
  29781. };
  29782. return {
  29783. frontMatter,
  29784. content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
  29785. };
  29786. }
  29787. module2.exports = parse;
  29788. }
  29789. });
  29790. var require_pragma2 = __commonJS2({
  29791. "src/language-css/pragma.js"(exports2, module2) {
  29792. "use strict";
  29793. var jsPragma = require_pragma();
  29794. var parseFrontMatter = require_parse4();
  29795. function hasPragma(text) {
  29796. return jsPragma.hasPragma(parseFrontMatter(text).content);
  29797. }
  29798. function insertPragma(text) {
  29799. const {
  29800. frontMatter,
  29801. content
  29802. } = parseFrontMatter(text);
  29803. return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
  29804. }
  29805. module2.exports = {
  29806. hasPragma,
  29807. insertPragma
  29808. };
  29809. }
  29810. });
  29811. var require_utils8 = __commonJS2({
  29812. "src/language-css/utils/index.js"(exports2, module2) {
  29813. "use strict";
  29814. 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"]);
  29815. function getAncestorCounter(path, typeOrTypes) {
  29816. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  29817. let counter = -1;
  29818. let ancestorNode;
  29819. while (ancestorNode = path.getParentNode(++counter)) {
  29820. if (types.includes(ancestorNode.type)) {
  29821. return counter;
  29822. }
  29823. }
  29824. return -1;
  29825. }
  29826. function getAncestorNode(path, typeOrTypes) {
  29827. const counter = getAncestorCounter(path, typeOrTypes);
  29828. return counter === -1 ? null : path.getParentNode(counter);
  29829. }
  29830. function getPropOfDeclNode(path) {
  29831. var _declAncestorNode$pro;
  29832. const declAncestorNode = getAncestorNode(path, "css-decl");
  29833. return declAncestorNode === null || declAncestorNode === void 0 ? void 0 : (_declAncestorNode$pro = declAncestorNode.prop) === null || _declAncestorNode$pro === void 0 ? void 0 : _declAncestorNode$pro.toLowerCase();
  29834. }
  29835. var wideKeywords = /* @__PURE__ */ new Set(["initial", "inherit", "unset", "revert"]);
  29836. function isWideKeywords(value) {
  29837. return wideKeywords.has(value.toLowerCase());
  29838. }
  29839. function isKeyframeAtRuleKeywords(path, value) {
  29840. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  29841. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
  29842. }
  29843. function maybeToLowerCase(value) {
  29844. return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
  29845. }
  29846. function insideValueFunctionNode(path, functionName) {
  29847. var _funcAncestorNode$val;
  29848. const funcAncestorNode = getAncestorNode(path, "value-func");
  29849. return (funcAncestorNode === null || funcAncestorNode === void 0 ? void 0 : (_funcAncestorNode$val = funcAncestorNode.value) === null || _funcAncestorNode$val === void 0 ? void 0 : _funcAncestorNode$val.toLowerCase()) === functionName;
  29850. }
  29851. function insideICSSRuleNode(path) {
  29852. var _ruleAncestorNode$raw;
  29853. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  29854. const selector = ruleAncestorNode === null || ruleAncestorNode === void 0 ? void 0 : (_ruleAncestorNode$raw = ruleAncestorNode.raws) === null || _ruleAncestorNode$raw === void 0 ? void 0 : _ruleAncestorNode$raw.selector;
  29855. return selector && (selector.startsWith(":import") || selector.startsWith(":export"));
  29856. }
  29857. function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
  29858. const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames) ? atRuleNameOrAtRuleNames : [atRuleNameOrAtRuleNames];
  29859. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  29860. return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
  29861. }
  29862. function insideURLFunctionInImportAtRuleNode(path) {
  29863. const node = path.getValue();
  29864. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  29865. return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) === "import" && node.groups[0].value === "url" && node.groups.length === 2;
  29866. }
  29867. function isURLFunctionNode(node) {
  29868. return node.type === "value-func" && node.value.toLowerCase() === "url";
  29869. }
  29870. function isLastNode(path, node) {
  29871. var _path$getParentNode;
  29872. const nodes = (_path$getParentNode = path.getParentNode()) === null || _path$getParentNode === void 0 ? void 0 : _path$getParentNode.nodes;
  29873. return nodes && nodes.indexOf(node) === nodes.length - 1;
  29874. }
  29875. function isDetachedRulesetDeclarationNode(node) {
  29876. const {
  29877. selector
  29878. } = node;
  29879. if (!selector) {
  29880. return false;
  29881. }
  29882. return typeof selector === "string" && /^@.+:.*$/.test(selector) || selector.value && /^@.+:.*$/.test(selector.value);
  29883. }
  29884. function isForKeywordNode(node) {
  29885. return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
  29886. }
  29887. function isIfElseKeywordNode(node) {
  29888. return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
  29889. }
  29890. function isEachKeywordNode(node) {
  29891. return node.type === "value-word" && node.value === "in";
  29892. }
  29893. function isMultiplicationNode(node) {
  29894. return node.type === "value-operator" && node.value === "*";
  29895. }
  29896. function isDivisionNode(node) {
  29897. return node.type === "value-operator" && node.value === "/";
  29898. }
  29899. function isAdditionNode(node) {
  29900. return node.type === "value-operator" && node.value === "+";
  29901. }
  29902. function isSubtractionNode(node) {
  29903. return node.type === "value-operator" && node.value === "-";
  29904. }
  29905. function isModuloNode(node) {
  29906. return node.type === "value-operator" && node.value === "%";
  29907. }
  29908. function isMathOperatorNode(node) {
  29909. return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
  29910. }
  29911. function isEqualityOperatorNode(node) {
  29912. return node.type === "value-word" && ["==", "!="].includes(node.value);
  29913. }
  29914. function isRelationalOperatorNode(node) {
  29915. return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
  29916. }
  29917. function isSCSSControlDirectiveNode(node) {
  29918. return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
  29919. }
  29920. function isDetachedRulesetCallNode(node) {
  29921. var _node$raws;
  29922. return ((_node$raws = node.raws) === null || _node$raws === void 0 ? void 0 : _node$raws.params) && /^\(\s*\)$/.test(node.raws.params);
  29923. }
  29924. function isTemplatePlaceholderNode(node) {
  29925. return node.name.startsWith("prettier-placeholder");
  29926. }
  29927. function isTemplatePropNode(node) {
  29928. return node.prop.startsWith("@prettier-placeholder");
  29929. }
  29930. function isPostcssSimpleVarNode(currentNode, nextNode) {
  29931. return currentNode.value === "$$" && currentNode.type === "value-func" && (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "value-word" && !nextNode.raws.before;
  29932. }
  29933. function hasComposesNode(node) {
  29934. var _node$value, _node$value$group;
  29935. 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";
  29936. }
  29937. function hasParensAroundNode(node) {
  29938. var _node$value2, _node$value2$group, _node$value2$group$gr;
  29939. 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;
  29940. }
  29941. function hasEmptyRawBefore(node) {
  29942. var _node$raws2;
  29943. return ((_node$raws2 = node.raws) === null || _node$raws2 === void 0 ? void 0 : _node$raws2.before) === "";
  29944. }
  29945. function isKeyValuePairNode(node) {
  29946. var _node$groups, _node$groups$;
  29947. 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";
  29948. }
  29949. function isKeyValuePairInParenGroupNode(node) {
  29950. var _node$groups2;
  29951. return node.type === "value-paren_group" && ((_node$groups2 = node.groups) === null || _node$groups2 === void 0 ? void 0 : _node$groups2[0]) && isKeyValuePairNode(node.groups[0]);
  29952. }
  29953. function isSCSSMapItemNode(path) {
  29954. var _declNode$prop;
  29955. const node = path.getValue();
  29956. if (node.groups.length === 0) {
  29957. return false;
  29958. }
  29959. const parentParentNode = path.getParentNode(1);
  29960. if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
  29961. return false;
  29962. }
  29963. const declNode = getAncestorNode(path, "css-decl");
  29964. if (declNode !== null && declNode !== void 0 && (_declNode$prop = declNode.prop) !== null && _declNode$prop !== void 0 && _declNode$prop.startsWith("$")) {
  29965. return true;
  29966. }
  29967. if (isKeyValuePairInParenGroupNode(parentParentNode)) {
  29968. return true;
  29969. }
  29970. if (parentParentNode.type === "value-func") {
  29971. return true;
  29972. }
  29973. return false;
  29974. }
  29975. function isInlineValueCommentNode(node) {
  29976. return node.type === "value-comment" && node.inline;
  29977. }
  29978. function isHashNode(node) {
  29979. return node.type === "value-word" && node.value === "#";
  29980. }
  29981. function isLeftCurlyBraceNode(node) {
  29982. return node.type === "value-word" && node.value === "{";
  29983. }
  29984. function isRightCurlyBraceNode(node) {
  29985. return node.type === "value-word" && node.value === "}";
  29986. }
  29987. function isWordNode(node) {
  29988. return ["value-word", "value-atword"].includes(node.type);
  29989. }
  29990. function isColonNode(node) {
  29991. return (node === null || node === void 0 ? void 0 : node.type) === "value-colon";
  29992. }
  29993. function isKeyInValuePairNode(node, parentNode) {
  29994. if (!isKeyValuePairNode(parentNode)) {
  29995. return false;
  29996. }
  29997. const {
  29998. groups
  29999. } = parentNode;
  30000. const index = groups.indexOf(node);
  30001. if (index === -1) {
  30002. return false;
  30003. }
  30004. return isColonNode(groups[index + 1]);
  30005. }
  30006. function isMediaAndSupportsKeywords(node) {
  30007. return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
  30008. }
  30009. function isColorAdjusterFuncNode(node) {
  30010. if (node.type !== "value-func") {
  30011. return false;
  30012. }
  30013. return colorAdjusterFunctions.has(node.value.toLowerCase());
  30014. }
  30015. function lastLineHasInlineComment(text) {
  30016. return /\/\//.test(text.split(/[\n\r]/).pop());
  30017. }
  30018. function isAtWordPlaceholderNode(node) {
  30019. return (node === null || node === void 0 ? void 0 : node.type) === "value-atword" && node.value.startsWith("prettier-placeholder-");
  30020. }
  30021. function isConfigurationNode(node, parentNode) {
  30022. var _node$open, _node$close;
  30023. 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")) {
  30024. return false;
  30025. }
  30026. if (parentNode.type === "value-comma_group") {
  30027. const prevIdx = parentNode.groups.indexOf(node) - 1;
  30028. const maybeWithNode = parentNode.groups[prevIdx];
  30029. if ((maybeWithNode === null || maybeWithNode === void 0 ? void 0 : maybeWithNode.type) === "value-word" && maybeWithNode.value === "with") {
  30030. return true;
  30031. }
  30032. }
  30033. return false;
  30034. }
  30035. function isParenGroupNode(node) {
  30036. var _node$open2, _node$close2;
  30037. 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) === ")";
  30038. }
  30039. module2.exports = {
  30040. getAncestorCounter,
  30041. getAncestorNode,
  30042. getPropOfDeclNode,
  30043. maybeToLowerCase,
  30044. insideValueFunctionNode,
  30045. insideICSSRuleNode,
  30046. insideAtRuleNode,
  30047. insideURLFunctionInImportAtRuleNode,
  30048. isKeyframeAtRuleKeywords,
  30049. isWideKeywords,
  30050. isLastNode,
  30051. isSCSSControlDirectiveNode,
  30052. isDetachedRulesetDeclarationNode,
  30053. isRelationalOperatorNode,
  30054. isEqualityOperatorNode,
  30055. isMultiplicationNode,
  30056. isDivisionNode,
  30057. isAdditionNode,
  30058. isSubtractionNode,
  30059. isModuloNode,
  30060. isMathOperatorNode,
  30061. isEachKeywordNode,
  30062. isForKeywordNode,
  30063. isURLFunctionNode,
  30064. isIfElseKeywordNode,
  30065. hasComposesNode,
  30066. hasParensAroundNode,
  30067. hasEmptyRawBefore,
  30068. isDetachedRulesetCallNode,
  30069. isTemplatePlaceholderNode,
  30070. isTemplatePropNode,
  30071. isPostcssSimpleVarNode,
  30072. isKeyValuePairNode,
  30073. isKeyValuePairInParenGroupNode,
  30074. isKeyInValuePairNode,
  30075. isSCSSMapItemNode,
  30076. isInlineValueCommentNode,
  30077. isHashNode,
  30078. isLeftCurlyBraceNode,
  30079. isRightCurlyBraceNode,
  30080. isWordNode,
  30081. isColonNode,
  30082. isMediaAndSupportsKeywords,
  30083. isColorAdjusterFuncNode,
  30084. lastLineHasInlineComment,
  30085. isAtWordPlaceholderNode,
  30086. isConfigurationNode,
  30087. isParenGroupNode
  30088. };
  30089. }
  30090. });
  30091. var require_line_column_to_index = __commonJS2({
  30092. "src/utils/line-column-to-index.js"(exports2, module2) {
  30093. "use strict";
  30094. module2.exports = function(lineColumn, text) {
  30095. let index = 0;
  30096. for (let i = 0; i < lineColumn.line - 1; ++i) {
  30097. index = text.indexOf("\n", index) + 1;
  30098. }
  30099. return index + lineColumn.column;
  30100. };
  30101. }
  30102. });
  30103. var require_loc2 = __commonJS2({
  30104. "src/language-css/loc.js"(exports2, module2) {
  30105. "use strict";
  30106. var {
  30107. skipEverythingButNewLine
  30108. } = require_skip();
  30109. var getLast = require_get_last();
  30110. var lineColumnToIndex = require_line_column_to_index();
  30111. function calculateLocStart(node, text) {
  30112. if (typeof node.sourceIndex === "number") {
  30113. return node.sourceIndex;
  30114. }
  30115. return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
  30116. }
  30117. function calculateLocEnd(node, text) {
  30118. if (node.type === "css-comment" && node.inline) {
  30119. return skipEverythingButNewLine(text, node.source.startOffset);
  30120. }
  30121. const endNode = node.nodes && getLast(node.nodes);
  30122. if (endNode && node.source && !node.source.end) {
  30123. node = endNode;
  30124. }
  30125. if (node.source && node.source.end) {
  30126. return lineColumnToIndex(node.source.end, text);
  30127. }
  30128. return null;
  30129. }
  30130. function calculateLoc(node, text) {
  30131. if (node.source) {
  30132. node.source.startOffset = calculateLocStart(node, text);
  30133. node.source.endOffset = calculateLocEnd(node, text);
  30134. }
  30135. for (const key in node) {
  30136. const child = node[key];
  30137. if (key === "source" || !child || typeof child !== "object") {
  30138. continue;
  30139. }
  30140. if (child.type === "value-root" || child.type === "value-unknown") {
  30141. calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
  30142. } else {
  30143. calculateLoc(child, text);
  30144. }
  30145. }
  30146. }
  30147. function calculateValueNodeLoc(node, rootOffset, text) {
  30148. if (node.source) {
  30149. node.source.startOffset = calculateLocStart(node, text) + rootOffset;
  30150. node.source.endOffset = calculateLocEnd(node, text) + rootOffset;
  30151. }
  30152. for (const key in node) {
  30153. const child = node[key];
  30154. if (key === "source" || !child || typeof child !== "object") {
  30155. continue;
  30156. }
  30157. calculateValueNodeLoc(child, rootOffset, text);
  30158. }
  30159. }
  30160. function getValueRootOffset(node) {
  30161. let result = node.source.startOffset;
  30162. if (typeof node.prop === "string") {
  30163. result += node.prop.length;
  30164. }
  30165. if (node.type === "css-atrule" && typeof node.name === "string") {
  30166. result += 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
  30167. }
  30168. if (node.type !== "css-atrule" && node.raws && typeof node.raws.between === "string") {
  30169. result += node.raws.between.length;
  30170. }
  30171. return result;
  30172. }
  30173. function replaceQuotesInInlineComments(text) {
  30174. let state = "initial";
  30175. let stateToReturnFromQuotes = "initial";
  30176. let inlineCommentStartIndex;
  30177. let inlineCommentContainsQuotes = false;
  30178. const inlineCommentsToReplace = [];
  30179. for (let i = 0; i < text.length; i++) {
  30180. const c = text[i];
  30181. switch (state) {
  30182. case "initial":
  30183. if (c === "'") {
  30184. state = "single-quotes";
  30185. continue;
  30186. }
  30187. if (c === '"') {
  30188. state = "double-quotes";
  30189. continue;
  30190. }
  30191. if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
  30192. state = "url";
  30193. i += 3;
  30194. continue;
  30195. }
  30196. if (c === "*" && text[i - 1] === "/") {
  30197. state = "comment-block";
  30198. continue;
  30199. }
  30200. if (c === "/" && text[i - 1] === "/") {
  30201. state = "comment-inline";
  30202. inlineCommentStartIndex = i - 1;
  30203. continue;
  30204. }
  30205. continue;
  30206. case "single-quotes":
  30207. if (c === "'" && text[i - 1] !== "\\") {
  30208. state = stateToReturnFromQuotes;
  30209. stateToReturnFromQuotes = "initial";
  30210. }
  30211. if (c === "\n" || c === "\r") {
  30212. return text;
  30213. }
  30214. continue;
  30215. case "double-quotes":
  30216. if (c === '"' && text[i - 1] !== "\\") {
  30217. state = stateToReturnFromQuotes;
  30218. stateToReturnFromQuotes = "initial";
  30219. }
  30220. if (c === "\n" || c === "\r") {
  30221. return text;
  30222. }
  30223. continue;
  30224. case "url":
  30225. if (c === ")") {
  30226. state = "initial";
  30227. }
  30228. if (c === "\n" || c === "\r") {
  30229. return text;
  30230. }
  30231. if (c === "'") {
  30232. state = "single-quotes";
  30233. stateToReturnFromQuotes = "url";
  30234. continue;
  30235. }
  30236. if (c === '"') {
  30237. state = "double-quotes";
  30238. stateToReturnFromQuotes = "url";
  30239. continue;
  30240. }
  30241. continue;
  30242. case "comment-block":
  30243. if (c === "/" && text[i - 1] === "*") {
  30244. state = "initial";
  30245. }
  30246. continue;
  30247. case "comment-inline":
  30248. if (c === '"' || c === "'" || c === "*") {
  30249. inlineCommentContainsQuotes = true;
  30250. }
  30251. if (c === "\n" || c === "\r") {
  30252. if (inlineCommentContainsQuotes) {
  30253. inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
  30254. }
  30255. state = "initial";
  30256. inlineCommentContainsQuotes = false;
  30257. }
  30258. continue;
  30259. }
  30260. }
  30261. for (const [start, end] of inlineCommentsToReplace) {
  30262. text = text.slice(0, start) + text.slice(start, end).replace(/["'*]/g, " ") + text.slice(end);
  30263. }
  30264. return text;
  30265. }
  30266. function locStart(node) {
  30267. return node.source.startOffset;
  30268. }
  30269. function locEnd(node) {
  30270. return node.source.endOffset;
  30271. }
  30272. module2.exports = {
  30273. locStart,
  30274. locEnd,
  30275. calculateLoc,
  30276. replaceQuotesInInlineComments
  30277. };
  30278. }
  30279. });
  30280. var require_is_less_parser = __commonJS2({
  30281. "src/language-css/utils/is-less-parser.js"(exports2, module2) {
  30282. "use strict";
  30283. function isLessParser(options) {
  30284. return options.parser === "css" || options.parser === "less";
  30285. }
  30286. module2.exports = isLessParser;
  30287. }
  30288. });
  30289. var require_is_scss = __commonJS2({
  30290. "src/language-css/utils/is-scss.js"(exports2, module2) {
  30291. "use strict";
  30292. function isSCSS(parser, text) {
  30293. const hasExplicitParserChoice = parser === "less" || parser === "scss";
  30294. const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
  30295. return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
  30296. }
  30297. module2.exports = isSCSS;
  30298. }
  30299. });
  30300. var require_css_units_evaluate = __commonJS2({
  30301. "src/language-css/utils/css-units.evaluate.js"(exports2, module2) {
  30302. module2.exports = {
  30303. em: "em",
  30304. rem: "rem",
  30305. ex: "ex",
  30306. rex: "rex",
  30307. cap: "cap",
  30308. rcap: "rcap",
  30309. ch: "ch",
  30310. rch: "rch",
  30311. ic: "ic",
  30312. ric: "ric",
  30313. lh: "lh",
  30314. rlh: "rlh",
  30315. vw: "vw",
  30316. svw: "svw",
  30317. lvw: "lvw",
  30318. dvw: "dvw",
  30319. vh: "vh",
  30320. svh: "svh",
  30321. lvh: "lvh",
  30322. dvh: "dvh",
  30323. vi: "vi",
  30324. svi: "svi",
  30325. lvi: "lvi",
  30326. dvi: "dvi",
  30327. vb: "vb",
  30328. svb: "svb",
  30329. lvb: "lvb",
  30330. dvb: "dvb",
  30331. vmin: "vmin",
  30332. svmin: "svmin",
  30333. lvmin: "lvmin",
  30334. dvmin: "dvmin",
  30335. vmax: "vmax",
  30336. svmax: "svmax",
  30337. lvmax: "lvmax",
  30338. dvmax: "dvmax",
  30339. cm: "cm",
  30340. mm: "mm",
  30341. q: "Q",
  30342. in: "in",
  30343. pt: "pt",
  30344. pc: "pc",
  30345. px: "px",
  30346. deg: "deg",
  30347. grad: "grad",
  30348. rad: "rad",
  30349. turn: "turn",
  30350. s: "s",
  30351. ms: "ms",
  30352. hz: "Hz",
  30353. khz: "kHz",
  30354. dpi: "dpi",
  30355. dpcm: "dpcm",
  30356. dppx: "dppx",
  30357. x: "x"
  30358. };
  30359. }
  30360. });
  30361. var require_print_unit = __commonJS2({
  30362. "src/language-css/utils/print-unit.js"(exports2, module2) {
  30363. "use strict";
  30364. var CSS_UNITS = require_css_units_evaluate();
  30365. function printUnit(unit) {
  30366. const lowercased = unit.toLowerCase();
  30367. return Object.prototype.hasOwnProperty.call(CSS_UNITS, lowercased) ? CSS_UNITS[lowercased] : unit;
  30368. }
  30369. module2.exports = printUnit;
  30370. }
  30371. });
  30372. var require_printer_postcss = __commonJS2({
  30373. "src/language-css/printer-postcss.js"(exports2, module2) {
  30374. "use strict";
  30375. var getLast = require_get_last();
  30376. var {
  30377. printNumber,
  30378. printString,
  30379. hasNewline,
  30380. isFrontMatterNode,
  30381. isNextLineEmpty,
  30382. isNonEmptyArray
  30383. } = require_util();
  30384. var {
  30385. builders: {
  30386. join,
  30387. line,
  30388. hardline,
  30389. softline,
  30390. group,
  30391. fill,
  30392. indent,
  30393. dedent,
  30394. ifBreak,
  30395. breakParent
  30396. },
  30397. utils: {
  30398. removeLines,
  30399. getDocParts
  30400. }
  30401. } = require("./doc.js");
  30402. var clean = require_clean2();
  30403. var embed = require_embed2();
  30404. var {
  30405. insertPragma
  30406. } = require_pragma2();
  30407. var {
  30408. getAncestorNode,
  30409. getPropOfDeclNode,
  30410. maybeToLowerCase,
  30411. insideValueFunctionNode,
  30412. insideICSSRuleNode,
  30413. insideAtRuleNode,
  30414. insideURLFunctionInImportAtRuleNode,
  30415. isKeyframeAtRuleKeywords,
  30416. isWideKeywords,
  30417. isLastNode,
  30418. isSCSSControlDirectiveNode,
  30419. isDetachedRulesetDeclarationNode,
  30420. isRelationalOperatorNode,
  30421. isEqualityOperatorNode,
  30422. isMultiplicationNode,
  30423. isDivisionNode,
  30424. isAdditionNode,
  30425. isSubtractionNode,
  30426. isMathOperatorNode,
  30427. isEachKeywordNode,
  30428. isForKeywordNode,
  30429. isURLFunctionNode,
  30430. isIfElseKeywordNode,
  30431. hasComposesNode,
  30432. hasParensAroundNode,
  30433. hasEmptyRawBefore,
  30434. isKeyValuePairNode,
  30435. isKeyInValuePairNode,
  30436. isDetachedRulesetCallNode,
  30437. isTemplatePlaceholderNode,
  30438. isTemplatePropNode,
  30439. isPostcssSimpleVarNode,
  30440. isSCSSMapItemNode,
  30441. isInlineValueCommentNode,
  30442. isHashNode,
  30443. isLeftCurlyBraceNode,
  30444. isRightCurlyBraceNode,
  30445. isWordNode,
  30446. isColonNode,
  30447. isMediaAndSupportsKeywords,
  30448. isColorAdjusterFuncNode,
  30449. lastLineHasInlineComment,
  30450. isAtWordPlaceholderNode,
  30451. isConfigurationNode,
  30452. isParenGroupNode
  30453. } = require_utils8();
  30454. var {
  30455. locStart,
  30456. locEnd
  30457. } = require_loc2();
  30458. var isLessParser = require_is_less_parser();
  30459. var isSCSS = require_is_scss();
  30460. var printUnit = require_print_unit();
  30461. function shouldPrintComma(options) {
  30462. return options.trailingComma === "es5" || options.trailingComma === "all";
  30463. }
  30464. function genericPrint(path, options, print) {
  30465. const node = path.getValue();
  30466. if (!node) {
  30467. return "";
  30468. }
  30469. if (typeof node === "string") {
  30470. return node;
  30471. }
  30472. switch (node.type) {
  30473. case "front-matter":
  30474. return [node.raw, hardline];
  30475. case "css-root": {
  30476. const nodes = printNodeSequence(path, options, print);
  30477. const after = node.raws.after.trim();
  30478. return [nodes, after ? ` ${after}` : "", getDocParts(nodes).length > 0 ? hardline : ""];
  30479. }
  30480. case "css-comment": {
  30481. const isInlineComment = node.inline || node.raws.inline;
  30482. const text = options.originalText.slice(locStart(node), locEnd(node));
  30483. return isInlineComment ? text.trimEnd() : text;
  30484. }
  30485. case "css-rule": {
  30486. 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) ? ";" : ""] : ";"];
  30487. }
  30488. case "css-decl": {
  30489. const parentNode = path.getParentNode();
  30490. const {
  30491. between: rawBetween
  30492. } = node.raws;
  30493. const trimmedBetween = rawBetween.trim();
  30494. const isColon = trimmedBetween === ":";
  30495. let value = hasComposesNode(node) ? removeLines(print("value")) : print("value");
  30496. if (!isColon && lastLineHasInlineComment(trimmedBetween)) {
  30497. value = indent([hardline, dedent(value)]);
  30498. }
  30499. return [node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop), trimmedBetween.startsWith("//") ? " " : "", trimmedBetween, node.extend ? "" : " ", isLessParser(options) && node.extend && node.selector ? ["extend(", print("selector"), ")"] : "", value, node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? [" {", indent([softline, printNodeSequence(path, options, print)]), softline, "}"] : isTemplatePropNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode(path, node) ? ifBreak(";") : ";"];
  30500. }
  30501. case "css-atrule": {
  30502. const parentNode = path.getParentNode();
  30503. const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";";
  30504. if (isLessParser(options)) {
  30505. if (node.mixin) {
  30506. return [print("selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  30507. }
  30508. if (node.function) {
  30509. return [node.name, print("params"), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
  30510. }
  30511. if (node.variable) {
  30512. 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 ? "" : ";"];
  30513. }
  30514. }
  30515. 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 ? "" : ";"];
  30516. }
  30517. case "media-query-list": {
  30518. const parts = [];
  30519. path.each((childPath) => {
  30520. const node2 = childPath.getValue();
  30521. if (node2.type === "media-query" && node2.value === "") {
  30522. return;
  30523. }
  30524. parts.push(print());
  30525. }, "nodes");
  30526. return group(indent(join(line, parts)));
  30527. }
  30528. case "media-query": {
  30529. return [join(" ", path.map(print, "nodes")), isLastNode(path, node) ? "" : ","];
  30530. }
  30531. case "media-type": {
  30532. return adjustNumbers(adjustStrings(node.value, options));
  30533. }
  30534. case "media-feature-expression": {
  30535. if (!node.nodes) {
  30536. return node.value;
  30537. }
  30538. return ["(", ...path.map(print, "nodes"), ")"];
  30539. }
  30540. case "media-feature": {
  30541. return maybeToLowerCase(adjustStrings(node.value.replace(/ +/g, " "), options));
  30542. }
  30543. case "media-colon": {
  30544. return [node.value, " "];
  30545. }
  30546. case "media-value": {
  30547. return adjustNumbers(adjustStrings(node.value, options));
  30548. }
  30549. case "media-keyword": {
  30550. return adjustStrings(node.value, options);
  30551. }
  30552. case "media-url": {
  30553. return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/g, ")"), options);
  30554. }
  30555. case "media-unknown": {
  30556. return node.value;
  30557. }
  30558. case "selector-root": {
  30559. 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"))]);
  30560. }
  30561. case "selector-selector": {
  30562. return group(indent(path.map(print, "nodes")));
  30563. }
  30564. case "selector-comment": {
  30565. return node.value;
  30566. }
  30567. case "selector-string": {
  30568. return adjustStrings(node.value, options);
  30569. }
  30570. case "selector-tag": {
  30571. const parentNode = path.getParentNode();
  30572. const index = parentNode && parentNode.nodes.indexOf(node);
  30573. const prevNode = index && parentNode.nodes[index - 1];
  30574. 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)];
  30575. }
  30576. case "selector-id": {
  30577. return ["#", node.value];
  30578. }
  30579. case "selector-class": {
  30580. return [".", adjustNumbers(adjustStrings(node.value, options))];
  30581. }
  30582. case "selector-attribute": {
  30583. return ["[", node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.attribute.trim(), node.operator ? node.operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"];
  30584. }
  30585. case "selector-combinator": {
  30586. if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
  30587. const parentNode = path.getParentNode();
  30588. const leading2 = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line;
  30589. return [leading2, node.value, isLastNode(path, node) ? "" : " "];
  30590. }
  30591. const leading = node.value.trim().startsWith("(") ? line : "";
  30592. const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line;
  30593. return [leading, value];
  30594. }
  30595. case "selector-universal": {
  30596. return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.value];
  30597. }
  30598. case "selector-pseudo": {
  30599. return [maybeToLowerCase(node.value), isNonEmptyArray(node.nodes) ? ["(", join(", ", path.map(print, "nodes")), ")"] : ""];
  30600. }
  30601. case "selector-nesting": {
  30602. return node.value;
  30603. }
  30604. case "selector-unknown": {
  30605. const ruleAncestorNode = getAncestorNode(path, "css-rule");
  30606. if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
  30607. return adjustNumbers(adjustStrings(maybeToLowerCase(node.value), options));
  30608. }
  30609. const parentNode = path.getParentNode();
  30610. if (parentNode.raws && parentNode.raws.selector) {
  30611. const start = locStart(parentNode);
  30612. const end = start + parentNode.raws.selector.length;
  30613. return options.originalText.slice(start, end).trim();
  30614. }
  30615. const grandParent = path.getParentNode(1);
  30616. if (parentNode.type === "value-paren_group" && grandParent && grandParent.type === "value-func" && grandParent.value === "selector") {
  30617. const start = locEnd(parentNode.open) + 1;
  30618. const end = locStart(parentNode.close);
  30619. const selector = options.originalText.slice(start, end).trim();
  30620. return lastLineHasInlineComment(selector) ? [breakParent, selector] : selector;
  30621. }
  30622. return node.value;
  30623. }
  30624. case "value-value":
  30625. case "value-root": {
  30626. return print("group");
  30627. }
  30628. case "value-comment": {
  30629. return options.originalText.slice(locStart(node), locEnd(node));
  30630. }
  30631. case "value-comma_group": {
  30632. const parentNode = path.getParentNode();
  30633. const parentParentNode = path.getParentNode(1);
  30634. const declAncestorProp = getPropOfDeclNode(path);
  30635. const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
  30636. const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
  30637. const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
  30638. const hasInlineComment = node.groups.some((node2) => isInlineValueCommentNode(node2));
  30639. const printed = path.map(print, "groups");
  30640. const parts = [];
  30641. const insideURLFunction = insideValueFunctionNode(path, "url");
  30642. let insideSCSSInterpolationInString = false;
  30643. let didBreak = false;
  30644. for (let i = 0; i < node.groups.length; ++i) {
  30645. parts.push(printed[i]);
  30646. const iPrevNode = node.groups[i - 1];
  30647. const iNode = node.groups[i];
  30648. const iNextNode = node.groups[i + 1];
  30649. const iNextNextNode = node.groups[i + 2];
  30650. if (insideURLFunction) {
  30651. if (iNextNode && isAdditionNode(iNextNode) || isAdditionNode(iNode)) {
  30652. parts.push(" ");
  30653. }
  30654. continue;
  30655. }
  30656. 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 === "*") {
  30657. continue;
  30658. }
  30659. if (!iNextNode) {
  30660. continue;
  30661. }
  30662. if (iNode.type === "value-word" && iNode.value.endsWith("-") && isAtWordPlaceholderNode(iNextNode)) {
  30663. continue;
  30664. }
  30665. const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
  30666. const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
  30667. if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
  30668. insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
  30669. continue;
  30670. }
  30671. if (insideSCSSInterpolationInString) {
  30672. continue;
  30673. }
  30674. if (isColonNode(iNode) || isColonNode(iNextNode)) {
  30675. continue;
  30676. }
  30677. if (iNode.type === "value-atword" && iNode.value === "") {
  30678. continue;
  30679. }
  30680. if (iNode.value === "~") {
  30681. continue;
  30682. }
  30683. if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
  30684. continue;
  30685. }
  30686. if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
  30687. continue;
  30688. }
  30689. if (iNode.value === "\\") {
  30690. continue;
  30691. }
  30692. if (isPostcssSimpleVarNode(iNode, iNextNode)) {
  30693. continue;
  30694. }
  30695. if (isHashNode(iNode) || isLeftCurlyBraceNode(iNode) || isRightCurlyBraceNode(iNextNode) || isLeftCurlyBraceNode(iNextNode) && hasEmptyRawBefore(iNextNode) || isRightCurlyBraceNode(iNode) && hasEmptyRawBefore(iNextNode)) {
  30696. continue;
  30697. }
  30698. if (iNode.value === "--" && isHashNode(iNextNode)) {
  30699. continue;
  30700. }
  30701. const isMathOperator = isMathOperatorNode(iNode);
  30702. const isNextMathOperator = isMathOperatorNode(iNextNode);
  30703. if ((isMathOperator && isHashNode(iNextNode) || isNextMathOperator && isRightCurlyBraceNode(iNode)) && hasEmptyRawBefore(iNextNode)) {
  30704. continue;
  30705. }
  30706. if (!iPrevNode && isDivisionNode(iNode)) {
  30707. continue;
  30708. }
  30709. if (insideValueFunctionNode(path, "calc") && (isAdditionNode(iNode) || isAdditionNode(iNextNode) || isSubtractionNode(iNode) || isSubtractionNode(iNextNode)) && hasEmptyRawBefore(iNextNode)) {
  30710. continue;
  30711. }
  30712. const isColorAdjusterNode = (isAdditionNode(iNode) || isSubtractionNode(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode(parentParentNode) && !hasEmptyRawBefore(iNextNode);
  30713. const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode(iNextNextNode) || iNode.type === "value-func" || isWordNode(iNode);
  30714. const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode(iPrevNode);
  30715. 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)))) {
  30716. continue;
  30717. }
  30718. if (isInlineValueCommentNode(iNode)) {
  30719. if (parentNode.type === "value-paren_group") {
  30720. parts.push(dedent(hardline));
  30721. continue;
  30722. }
  30723. parts.push(hardline);
  30724. continue;
  30725. }
  30726. if (isControlDirective && (isEqualityOperatorNode(iNextNode) || isRelationalOperatorNode(iNextNode) || isIfElseKeywordNode(iNextNode) || isEachKeywordNode(iNode) || isForKeywordNode(iNode))) {
  30727. parts.push(" ");
  30728. continue;
  30729. }
  30730. if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
  30731. parts.push(" ");
  30732. continue;
  30733. }
  30734. if (isGridValue) {
  30735. if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
  30736. parts.push(hardline);
  30737. didBreak = true;
  30738. } else {
  30739. parts.push(" ");
  30740. }
  30741. continue;
  30742. }
  30743. if (isNextMathOperator) {
  30744. parts.push(" ");
  30745. continue;
  30746. }
  30747. if (iNextNode && iNextNode.value === "...") {
  30748. continue;
  30749. }
  30750. if (isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && locEnd(iNode) === locStart(iNextNode)) {
  30751. continue;
  30752. }
  30753. if (isAtWordPlaceholderNode(iNode) && isParenGroupNode(iNextNode) && locEnd(iNode) === locStart(iNextNode.open)) {
  30754. parts.push(softline);
  30755. continue;
  30756. }
  30757. if (iNode.value === "with" && isParenGroupNode(iNextNode)) {
  30758. parts.push(" ");
  30759. continue;
  30760. }
  30761. parts.push(line);
  30762. }
  30763. if (hasInlineComment) {
  30764. parts.push(breakParent);
  30765. }
  30766. if (didBreak) {
  30767. parts.unshift(hardline);
  30768. }
  30769. if (isControlDirective) {
  30770. return group(indent(parts));
  30771. }
  30772. if (insideURLFunctionInImportAtRuleNode(path)) {
  30773. return group(fill(parts));
  30774. }
  30775. return group(indent(fill(parts)));
  30776. }
  30777. case "value-paren_group": {
  30778. const parentNode = path.getParentNode();
  30779. 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:"))) {
  30780. return [node.open ? print("open") : "", join(",", path.map(print, "groups")), node.close ? print("close") : ""];
  30781. }
  30782. if (!node.open) {
  30783. const printed2 = path.map(print, "groups");
  30784. const res = [];
  30785. for (let i = 0; i < printed2.length; i++) {
  30786. if (i !== 0) {
  30787. res.push([",", line]);
  30788. }
  30789. res.push(printed2[i]);
  30790. }
  30791. return group(indent(fill(res)));
  30792. }
  30793. const isSCSSMapItem = isSCSSMapItemNode(path);
  30794. const lastItem = getLast(node.groups);
  30795. const isLastItemComment = lastItem && lastItem.type === "value-comment";
  30796. const isKey = isKeyInValuePairNode(node, parentNode);
  30797. const isConfiguration = isConfigurationNode(node, parentNode);
  30798. const shouldBreak = isConfiguration || isSCSSMapItem && !isKey;
  30799. const shouldDedent = isConfiguration || isKey;
  30800. const printed = group([node.open ? print("open") : "", indent([softline, join([line], path.map((childPath, index) => {
  30801. const child = childPath.getValue();
  30802. const isLast = index === node.groups.length - 1;
  30803. const printed2 = [print(), isLast ? "" : ","];
  30804. 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") {
  30805. const parts = getDocParts(printed2[0].contents.contents);
  30806. parts[1] = group(parts[1]);
  30807. return group(dedent(printed2));
  30808. }
  30809. if (!isLast && child.type === "value-comma_group" && isNonEmptyArray(child.groups)) {
  30810. const last = getLast(child.groups);
  30811. if (last.source && isNextLineEmpty(options.originalText, last, locEnd)) {
  30812. printed2.push(hardline);
  30813. }
  30814. }
  30815. return printed2;
  30816. }, "groups"))]), ifBreak(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline, node.close ? print("close") : ""], {
  30817. shouldBreak
  30818. });
  30819. return shouldDedent ? dedent(printed) : printed;
  30820. }
  30821. case "value-func": {
  30822. return [node.value, insideAtRuleNode(path, "supports") && isMediaAndSupportsKeywords(node) ? " " : "", print("group")];
  30823. }
  30824. case "value-paren": {
  30825. return node.value;
  30826. }
  30827. case "value-number": {
  30828. return [printCssNumber(node.value), printUnit(node.unit)];
  30829. }
  30830. case "value-operator": {
  30831. return node.value;
  30832. }
  30833. case "value-word": {
  30834. if (node.isColor && node.isHex || isWideKeywords(node.value)) {
  30835. return node.value.toLowerCase();
  30836. }
  30837. return node.value;
  30838. }
  30839. case "value-colon": {
  30840. const parentNode = path.getParentNode();
  30841. const index = parentNode && parentNode.groups.indexOf(node);
  30842. const prevNode = index && parentNode.groups[index - 1];
  30843. return [node.value, prevNode && typeof prevNode.value === "string" && getLast(prevNode.value) === "\\" || insideValueFunctionNode(path, "url") ? "" : line];
  30844. }
  30845. case "value-comma": {
  30846. return [node.value, " "];
  30847. }
  30848. case "value-string": {
  30849. return printString(node.raws.quote + node.value + node.raws.quote, options);
  30850. }
  30851. case "value-atword": {
  30852. return ["@", node.value];
  30853. }
  30854. case "value-unicode-range": {
  30855. return node.value;
  30856. }
  30857. case "value-unknown": {
  30858. return node.value;
  30859. }
  30860. default:
  30861. throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`);
  30862. }
  30863. }
  30864. function printNodeSequence(path, options, print) {
  30865. const parts = [];
  30866. path.each((pathChild, i, nodes) => {
  30867. const prevNode = nodes[i - 1];
  30868. if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
  30869. const childNode = pathChild.getValue();
  30870. parts.push(options.originalText.slice(locStart(childNode), locEnd(childNode)));
  30871. } else {
  30872. parts.push(print());
  30873. }
  30874. if (i !== nodes.length - 1) {
  30875. if (nodes[i + 1].type === "css-comment" && !hasNewline(options.originalText, locStart(nodes[i + 1]), {
  30876. backwards: true
  30877. }) && !isFrontMatterNode(nodes[i]) || nodes[i + 1].type === "css-atrule" && nodes[i + 1].name === "else" && nodes[i].type !== "css-comment") {
  30878. parts.push(" ");
  30879. } else {
  30880. parts.push(options.__isHTMLStyleAttribute ? line : hardline);
  30881. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd) && !isFrontMatterNode(nodes[i])) {
  30882. parts.push(hardline);
  30883. }
  30884. }
  30885. }
  30886. }, "nodes");
  30887. return parts;
  30888. }
  30889. var STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
  30890. var NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
  30891. var STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
  30892. var WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
  30893. var ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX.source + `|(${WORD_PART_REGEX.source})?(${NUMBER_REGEX.source})(${STANDARD_UNIT_REGEX.source})?`, "g");
  30894. function adjustStrings(value, options) {
  30895. return value.replace(STRING_REGEX, (match) => printString(match, options));
  30896. }
  30897. function quoteAttributeValue(value, options) {
  30898. const quote = options.singleQuote ? "'" : '"';
  30899. return value.includes('"') || value.includes("'") ? value : quote + value + quote;
  30900. }
  30901. function adjustNumbers(value) {
  30902. return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase(unit || "") : match);
  30903. }
  30904. function printCssNumber(rawNumber) {
  30905. return printNumber(rawNumber).replace(/\.0(?=$|e)/, "");
  30906. }
  30907. module2.exports = {
  30908. print: genericPrint,
  30909. embed,
  30910. insertPragma,
  30911. massageAstNode: clean
  30912. };
  30913. }
  30914. });
  30915. var require_options3 = __commonJS2({
  30916. "src/language-css/options.js"(exports2, module2) {
  30917. "use strict";
  30918. var commonOptions = require_common_options();
  30919. module2.exports = {
  30920. singleQuote: commonOptions.singleQuote
  30921. };
  30922. }
  30923. });
  30924. var require_parsers2 = __commonJS2({
  30925. "src/language-css/parsers.js"(exports2, module2) {
  30926. "use strict";
  30927. module2.exports = {
  30928. get css() {
  30929. return require("./parser-postcss.js").parsers.css;
  30930. },
  30931. get less() {
  30932. return require("./parser-postcss.js").parsers.less;
  30933. },
  30934. get scss() {
  30935. return require("./parser-postcss.js").parsers.scss;
  30936. }
  30937. };
  30938. }
  30939. });
  30940. var require_CSS = __commonJS2({
  30941. "node_modules/linguist-languages/data/CSS.json"(exports2, module2) {
  30942. module2.exports = {
  30943. name: "CSS",
  30944. type: "markup",
  30945. tmScope: "source.css",
  30946. aceMode: "css",
  30947. codemirrorMode: "css",
  30948. codemirrorMimeType: "text/css",
  30949. color: "#563d7c",
  30950. extensions: [".css"],
  30951. languageId: 50
  30952. };
  30953. }
  30954. });
  30955. var require_PostCSS = __commonJS2({
  30956. "node_modules/linguist-languages/data/PostCSS.json"(exports2, module2) {
  30957. module2.exports = {
  30958. name: "PostCSS",
  30959. type: "markup",
  30960. color: "#dc3a0c",
  30961. tmScope: "source.postcss",
  30962. group: "CSS",
  30963. extensions: [".pcss", ".postcss"],
  30964. aceMode: "text",
  30965. languageId: 262764437
  30966. };
  30967. }
  30968. });
  30969. var require_Less = __commonJS2({
  30970. "node_modules/linguist-languages/data/Less.json"(exports2, module2) {
  30971. module2.exports = {
  30972. name: "Less",
  30973. type: "markup",
  30974. color: "#1d365d",
  30975. aliases: ["less-css"],
  30976. extensions: [".less"],
  30977. tmScope: "source.css.less",
  30978. aceMode: "less",
  30979. codemirrorMode: "css",
  30980. codemirrorMimeType: "text/css",
  30981. languageId: 198
  30982. };
  30983. }
  30984. });
  30985. var require_SCSS = __commonJS2({
  30986. "node_modules/linguist-languages/data/SCSS.json"(exports2, module2) {
  30987. module2.exports = {
  30988. name: "SCSS",
  30989. type: "markup",
  30990. color: "#c6538c",
  30991. tmScope: "source.css.scss",
  30992. aceMode: "scss",
  30993. codemirrorMode: "css",
  30994. codemirrorMimeType: "text/x-scss",
  30995. extensions: [".scss"],
  30996. languageId: 329
  30997. };
  30998. }
  30999. });
  31000. var require_language_css = __commonJS2({
  31001. "src/language-css/index.js"(exports2, module2) {
  31002. "use strict";
  31003. var createLanguage = require_create_language();
  31004. var printer = require_printer_postcss();
  31005. var options = require_options3();
  31006. var parsers = require_parsers2();
  31007. var languages = [createLanguage(require_CSS(), (data) => ({
  31008. since: "1.4.0",
  31009. parsers: ["css"],
  31010. vscodeLanguageIds: ["css"],
  31011. extensions: [...data.extensions, ".wxss"]
  31012. })), createLanguage(require_PostCSS(), () => ({
  31013. since: "1.4.0",
  31014. parsers: ["css"],
  31015. vscodeLanguageIds: ["postcss"]
  31016. })), createLanguage(require_Less(), () => ({
  31017. since: "1.4.0",
  31018. parsers: ["less"],
  31019. vscodeLanguageIds: ["less"]
  31020. })), createLanguage(require_SCSS(), () => ({
  31021. since: "1.4.0",
  31022. parsers: ["scss"],
  31023. vscodeLanguageIds: ["scss"]
  31024. }))];
  31025. var printers = {
  31026. postcss: printer
  31027. };
  31028. module2.exports = {
  31029. languages,
  31030. options,
  31031. printers,
  31032. parsers
  31033. };
  31034. }
  31035. });
  31036. var require_loc3 = __commonJS2({
  31037. "src/language-handlebars/loc.js"(exports2, module2) {
  31038. "use strict";
  31039. function locStart(node) {
  31040. return node.loc.start.offset;
  31041. }
  31042. function locEnd(node) {
  31043. return node.loc.end.offset;
  31044. }
  31045. module2.exports = {
  31046. locStart,
  31047. locEnd
  31048. };
  31049. }
  31050. });
  31051. var require_clean3 = __commonJS2({
  31052. "src/language-handlebars/clean.js"(exports2, module2) {
  31053. "use strict";
  31054. function clean(ast, newNode) {
  31055. if (ast.type === "TextNode") {
  31056. const trimmed = ast.chars.trim();
  31057. if (!trimmed) {
  31058. return null;
  31059. }
  31060. newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
  31061. }
  31062. if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
  31063. delete newNode.value;
  31064. }
  31065. }
  31066. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "selfClosing"]);
  31067. module2.exports = clean;
  31068. }
  31069. });
  31070. var require_html_void_elements = __commonJS2({
  31071. "vendors/html-void-elements.json"(exports2, module2) {
  31072. module2.exports = {
  31073. htmlVoidElements: ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta", "nextid", "param", "source", "track", "wbr"]
  31074. };
  31075. }
  31076. });
  31077. var require_utils9 = __commonJS2({
  31078. "src/language-handlebars/utils.js"(exports2, module2) {
  31079. "use strict";
  31080. var {
  31081. htmlVoidElements
  31082. } = require_html_void_elements();
  31083. var getLast = require_get_last();
  31084. function isLastNodeOfSiblings(path) {
  31085. const node = path.getValue();
  31086. const parentNode = path.getParentNode(0);
  31087. if (isParentOfSomeType(path, ["ElementNode"]) && getLast(parentNode.children) === node) {
  31088. return true;
  31089. }
  31090. if (isParentOfSomeType(path, ["Block"]) && getLast(parentNode.body) === node) {
  31091. return true;
  31092. }
  31093. return false;
  31094. }
  31095. function isUppercase(string) {
  31096. return string.toUpperCase() === string;
  31097. }
  31098. function isGlimmerComponent(node) {
  31099. return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && !node.tag.startsWith(":") && (isUppercase(node.tag[0]) || node.tag.includes("."));
  31100. }
  31101. var voidTags = new Set(htmlVoidElements);
  31102. function isVoid(node) {
  31103. return voidTags.has(node.tag) || isGlimmerComponent(node) && node.children.every((node2) => isWhitespaceNode(node2));
  31104. }
  31105. function isWhitespaceNode(node) {
  31106. return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
  31107. }
  31108. function isNodeOfSomeType(node, types) {
  31109. return node && types.includes(node.type);
  31110. }
  31111. function isParentOfSomeType(path, types) {
  31112. const parentNode = path.getParentNode(0);
  31113. return isNodeOfSomeType(parentNode, types);
  31114. }
  31115. function isPreviousNodeOfSomeType(path, types) {
  31116. const previousNode = getPreviousNode(path);
  31117. return isNodeOfSomeType(previousNode, types);
  31118. }
  31119. function isNextNodeOfSomeType(path, types) {
  31120. const nextNode = getNextNode(path);
  31121. return isNodeOfSomeType(nextNode, types);
  31122. }
  31123. function getSiblingNode(path, offset) {
  31124. var _path$getParentNode2, _ref7, _ref8, _parentNode$children;
  31125. const node = path.getValue();
  31126. const parentNode = (_path$getParentNode2 = path.getParentNode(0)) !== null && _path$getParentNode2 !== void 0 ? _path$getParentNode2 : {};
  31127. 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 : [];
  31128. const index = children.indexOf(node);
  31129. return index !== -1 && children[index + offset];
  31130. }
  31131. function getPreviousNode(path, lookBack = 1) {
  31132. return getSiblingNode(path, -lookBack);
  31133. }
  31134. function getNextNode(path) {
  31135. return getSiblingNode(path, 1);
  31136. }
  31137. function isPrettierIgnoreNode(node) {
  31138. return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
  31139. }
  31140. function hasPrettierIgnore(path) {
  31141. const node = path.getValue();
  31142. const previousPreviousNode = getPreviousNode(path, 2);
  31143. return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
  31144. }
  31145. module2.exports = {
  31146. getNextNode,
  31147. getPreviousNode,
  31148. hasPrettierIgnore,
  31149. isLastNodeOfSiblings,
  31150. isNextNodeOfSomeType,
  31151. isNodeOfSomeType,
  31152. isParentOfSomeType,
  31153. isPreviousNodeOfSomeType,
  31154. isVoid,
  31155. isWhitespaceNode
  31156. };
  31157. }
  31158. });
  31159. var require_printer_glimmer = __commonJS2({
  31160. "src/language-handlebars/printer-glimmer.js"(exports2, module2) {
  31161. "use strict";
  31162. var {
  31163. builders: {
  31164. dedent,
  31165. fill,
  31166. group,
  31167. hardline,
  31168. ifBreak,
  31169. indent,
  31170. join,
  31171. line,
  31172. softline
  31173. },
  31174. utils: {
  31175. getDocParts,
  31176. replaceTextEndOfLine
  31177. }
  31178. } = require("./doc.js");
  31179. var {
  31180. getPreferredQuote,
  31181. isNonEmptyArray
  31182. } = require_util();
  31183. var {
  31184. locStart,
  31185. locEnd
  31186. } = require_loc3();
  31187. var clean = require_clean3();
  31188. var {
  31189. getNextNode,
  31190. getPreviousNode,
  31191. hasPrettierIgnore,
  31192. isLastNodeOfSiblings,
  31193. isNextNodeOfSomeType,
  31194. isNodeOfSomeType,
  31195. isParentOfSomeType,
  31196. isPreviousNodeOfSomeType,
  31197. isVoid,
  31198. isWhitespaceNode
  31199. } = require_utils9();
  31200. var NEWLINES_TO_PRESERVE_MAX = 2;
  31201. function print(path, options, print2) {
  31202. const node = path.getValue();
  31203. if (!node) {
  31204. return "";
  31205. }
  31206. if (hasPrettierIgnore(path)) {
  31207. return options.originalText.slice(locStart(node), locEnd(node));
  31208. }
  31209. const favoriteQuote = options.singleQuote ? "'" : '"';
  31210. switch (node.type) {
  31211. case "Block":
  31212. case "Program":
  31213. case "Template": {
  31214. return group(path.map(print2, "body"));
  31215. }
  31216. case "ElementNode": {
  31217. const startingTag = group(printStartingTag(path, print2));
  31218. const escapeNextElementNode = options.htmlWhitespaceSensitivity === "ignore" && isNextNodeOfSomeType(path, ["ElementNode"]) ? softline : "";
  31219. if (isVoid(node)) {
  31220. return [startingTag, escapeNextElementNode];
  31221. }
  31222. const endingTag = ["</", node.tag, ">"];
  31223. if (node.children.length === 0) {
  31224. return [startingTag, indent(endingTag), escapeNextElementNode];
  31225. }
  31226. if (options.htmlWhitespaceSensitivity === "ignore") {
  31227. return [startingTag, indent(printChildren(path, options, print2)), hardline, indent(endingTag), escapeNextElementNode];
  31228. }
  31229. return [startingTag, indent(group(printChildren(path, options, print2))), indent(endingTag), escapeNextElementNode];
  31230. }
  31231. case "BlockStatement": {
  31232. const pp = path.getParentNode(1);
  31233. const isElseIf = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === node && pp.inverse.body[0].path.parts[0] === "if";
  31234. if (isElseIf) {
  31235. return [printElseIfBlock(path, print2), printProgram(path, print2, options), printInverse(path, print2, options)];
  31236. }
  31237. return [printOpenBlock(path, print2), group([printProgram(path, print2, options), printInverse(path, print2, options), printCloseBlock(path, print2, options)])];
  31238. }
  31239. case "ElementModifierStatement": {
  31240. return group(["{{", printPathAndParams(path, print2), "}}"]);
  31241. }
  31242. case "MustacheStatement": {
  31243. return group([printOpeningMustache(node), printPathAndParams(path, print2), printClosingMustache(node)]);
  31244. }
  31245. case "SubExpression": {
  31246. return group(["(", printSubExpressionPathAndParams(path, print2), softline, ")"]);
  31247. }
  31248. case "AttrNode": {
  31249. const isText = node.value.type === "TextNode";
  31250. const isEmptyText = isText && node.value.chars === "";
  31251. if (isEmptyText && locStart(node.value) === locEnd(node.value)) {
  31252. return node.name;
  31253. }
  31254. 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 : "";
  31255. const valueDoc = print2("value");
  31256. return [node.name, "=", quote, node.name === "class" && quote ? group(indent(valueDoc)) : valueDoc, quote];
  31257. }
  31258. case "ConcatStatement": {
  31259. return path.map(print2, "parts");
  31260. }
  31261. case "Hash": {
  31262. return join(line, path.map(print2, "pairs"));
  31263. }
  31264. case "HashPair": {
  31265. return [node.key, "=", print2("value")];
  31266. }
  31267. case "TextNode": {
  31268. let text = node.chars.replace(/{{/g, "\\{{");
  31269. const attrName = getCurrentAttributeName(path);
  31270. if (attrName) {
  31271. if (attrName === "class") {
  31272. const formattedClasses = text.trim().split(/\s+/).join(" ");
  31273. let leadingSpace2 = false;
  31274. let trailingSpace2 = false;
  31275. if (isParentOfSomeType(path, ["ConcatStatement"])) {
  31276. if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text)) {
  31277. leadingSpace2 = true;
  31278. }
  31279. if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text) && formattedClasses !== "") {
  31280. trailingSpace2 = true;
  31281. }
  31282. }
  31283. return [leadingSpace2 ? line : "", formattedClasses, trailingSpace2 ? line : ""];
  31284. }
  31285. return replaceTextEndOfLine(text);
  31286. }
  31287. const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
  31288. const isWhitespaceOnly = whitespacesOnlyRE.test(text);
  31289. const isFirstElement = !getPreviousNode(path);
  31290. const isLastElement = !getNextNode(path);
  31291. if (options.htmlWhitespaceSensitivity !== "ignore") {
  31292. const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
  31293. const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
  31294. const shouldTrimTrailingNewlines = isLastElement && isParentOfSomeType(path, ["Template"]);
  31295. const shouldTrimLeadingNewlines = isFirstElement && isParentOfSomeType(path, ["Template"]);
  31296. if (isWhitespaceOnly) {
  31297. if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
  31298. return "";
  31299. }
  31300. let breaks = [line];
  31301. const newlines = countNewLines(text);
  31302. if (newlines) {
  31303. breaks = generateHardlines(newlines);
  31304. }
  31305. if (isLastNodeOfSiblings(path)) {
  31306. breaks = breaks.map((newline) => dedent(newline));
  31307. }
  31308. return breaks;
  31309. }
  31310. const [lead] = text.match(leadingWhitespacesRE);
  31311. const [tail] = text.match(trailingWhitespacesRE);
  31312. let leadBreaks = [];
  31313. if (lead) {
  31314. leadBreaks = [line];
  31315. const leadingNewlines = countNewLines(lead);
  31316. if (leadingNewlines) {
  31317. leadBreaks = generateHardlines(leadingNewlines);
  31318. }
  31319. text = text.replace(leadingWhitespacesRE, "");
  31320. }
  31321. let trailBreaks = [];
  31322. if (tail) {
  31323. if (!shouldTrimTrailingNewlines) {
  31324. trailBreaks = [line];
  31325. const trailingNewlines = countNewLines(tail);
  31326. if (trailingNewlines) {
  31327. trailBreaks = generateHardlines(trailingNewlines);
  31328. }
  31329. if (isLastNodeOfSiblings(path)) {
  31330. trailBreaks = trailBreaks.map((hardline2) => dedent(hardline2));
  31331. }
  31332. }
  31333. text = text.replace(trailingWhitespacesRE, "");
  31334. }
  31335. return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
  31336. }
  31337. const lineBreaksCount = countNewLines(text);
  31338. let leadingLineBreaksCount = countLeadingNewLines(text);
  31339. let trailingLineBreaksCount = countTrailingNewLines(text);
  31340. if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
  31341. return "";
  31342. }
  31343. if (isWhitespaceOnly && lineBreaksCount) {
  31344. leadingLineBreaksCount = Math.min(lineBreaksCount, NEWLINES_TO_PRESERVE_MAX);
  31345. trailingLineBreaksCount = 0;
  31346. } else {
  31347. if (isNextNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  31348. trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
  31349. }
  31350. if (isPreviousNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
  31351. leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
  31352. }
  31353. }
  31354. let leadingSpace = "";
  31355. let trailingSpace = "";
  31356. if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType(path, ["MustacheStatement"])) {
  31357. trailingSpace = " ";
  31358. }
  31359. if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
  31360. leadingSpace = " ";
  31361. }
  31362. if (isFirstElement) {
  31363. leadingLineBreaksCount = 0;
  31364. leadingSpace = "";
  31365. }
  31366. if (isLastElement) {
  31367. trailingLineBreaksCount = 0;
  31368. trailingSpace = "";
  31369. }
  31370. text = text.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
  31371. return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(text)), ...generateHardlines(trailingLineBreaksCount)];
  31372. }
  31373. case "MustacheCommentStatement": {
  31374. const start = locStart(node);
  31375. const end = locEnd(node);
  31376. const isLeftWhiteSpaceSensitive = options.originalText.charAt(start + 2) === "~";
  31377. const isRightWhitespaceSensitive = options.originalText.charAt(end - 3) === "~";
  31378. const dashes = node.value.includes("}}") ? "--" : "";
  31379. return ["{{", isLeftWhiteSpaceSensitive ? "~" : "", "!", dashes, node.value, dashes, isRightWhitespaceSensitive ? "~" : "", "}}"];
  31380. }
  31381. case "PathExpression": {
  31382. return node.original;
  31383. }
  31384. case "BooleanLiteral": {
  31385. return String(node.value);
  31386. }
  31387. case "CommentStatement": {
  31388. return ["<!--", node.value, "-->"];
  31389. }
  31390. case "StringLiteral": {
  31391. if (needsOppositeQuote(path)) {
  31392. const printFavoriteQuote = !options.singleQuote ? "'" : '"';
  31393. return printStringLiteral(node.value, printFavoriteQuote);
  31394. }
  31395. return printStringLiteral(node.value, favoriteQuote);
  31396. }
  31397. case "NumberLiteral": {
  31398. return String(node.value);
  31399. }
  31400. case "UndefinedLiteral": {
  31401. return "undefined";
  31402. }
  31403. case "NullLiteral": {
  31404. return "null";
  31405. }
  31406. default:
  31407. throw new Error("unknown glimmer type: " + JSON.stringify(node.type));
  31408. }
  31409. }
  31410. function sortByLoc(a, b) {
  31411. return locStart(a) - locStart(b);
  31412. }
  31413. function printStartingTag(path, print2) {
  31414. const node = path.getValue();
  31415. const types = ["attributes", "modifiers", "comments"].filter((property) => isNonEmptyArray(node[property]));
  31416. const attributes = types.flatMap((type) => node[type]).sort(sortByLoc);
  31417. for (const attributeType of types) {
  31418. path.each((attributePath) => {
  31419. const index = attributes.indexOf(attributePath.getValue());
  31420. attributes.splice(index, 1, [line, print2()]);
  31421. }, attributeType);
  31422. }
  31423. if (isNonEmptyArray(node.blockParams)) {
  31424. attributes.push(line, printBlockParams(node));
  31425. }
  31426. return ["<", node.tag, indent(attributes), printStartingTagEndMarker(node)];
  31427. }
  31428. function printChildren(path, options, print2) {
  31429. const node = path.getValue();
  31430. const isEmpty = node.children.every((node2) => isWhitespaceNode(node2));
  31431. if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
  31432. return "";
  31433. }
  31434. return path.map((childPath, childIndex) => {
  31435. const printedChild = print2();
  31436. if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
  31437. return [softline, printedChild];
  31438. }
  31439. return printedChild;
  31440. }, "children");
  31441. }
  31442. function printStartingTagEndMarker(node) {
  31443. if (isVoid(node)) {
  31444. return ifBreak([softline, "/>"], [" />", softline]);
  31445. }
  31446. return ifBreak([softline, ">"], ">");
  31447. }
  31448. function printOpeningMustache(node) {
  31449. const mustache = node.escaped === false ? "{{{" : "{{";
  31450. const strip = node.strip && node.strip.open ? "~" : "";
  31451. return [mustache, strip];
  31452. }
  31453. function printClosingMustache(node) {
  31454. const mustache = node.escaped === false ? "}}}" : "}}";
  31455. const strip = node.strip && node.strip.close ? "~" : "";
  31456. return [strip, mustache];
  31457. }
  31458. function printOpeningBlockOpeningMustache(node) {
  31459. const opening = printOpeningMustache(node);
  31460. const strip = node.openStrip.open ? "~" : "";
  31461. return [opening, strip, "#"];
  31462. }
  31463. function printOpeningBlockClosingMustache(node) {
  31464. const closing = printClosingMustache(node);
  31465. const strip = node.openStrip.close ? "~" : "";
  31466. return [strip, closing];
  31467. }
  31468. function printClosingBlockOpeningMustache(node) {
  31469. const opening = printOpeningMustache(node);
  31470. const strip = node.closeStrip.open ? "~" : "";
  31471. return [opening, strip, "/"];
  31472. }
  31473. function printClosingBlockClosingMustache(node) {
  31474. const closing = printClosingMustache(node);
  31475. const strip = node.closeStrip.close ? "~" : "";
  31476. return [strip, closing];
  31477. }
  31478. function printInverseBlockOpeningMustache(node) {
  31479. const opening = printOpeningMustache(node);
  31480. const strip = node.inverseStrip.open ? "~" : "";
  31481. return [opening, strip];
  31482. }
  31483. function printInverseBlockClosingMustache(node) {
  31484. const closing = printClosingMustache(node);
  31485. const strip = node.inverseStrip.close ? "~" : "";
  31486. return [strip, closing];
  31487. }
  31488. function printOpenBlock(path, print2) {
  31489. const node = path.getValue();
  31490. const openingMustache = printOpeningBlockOpeningMustache(node);
  31491. const closingMustache = printOpeningBlockClosingMustache(node);
  31492. const attributes = [printPath(path, print2)];
  31493. const params = printParams(path, print2);
  31494. if (params) {
  31495. attributes.push(line, params);
  31496. }
  31497. if (isNonEmptyArray(node.program.blockParams)) {
  31498. const block = printBlockParams(node.program);
  31499. attributes.push(line, block);
  31500. }
  31501. return group([openingMustache, indent(attributes), softline, closingMustache]);
  31502. }
  31503. function printElseBlock(node, options) {
  31504. return [options.htmlWhitespaceSensitivity === "ignore" ? hardline : "", printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)];
  31505. }
  31506. function printElseIfBlock(path, print2) {
  31507. const parentNode = path.getParentNode(1);
  31508. return [printInverseBlockOpeningMustache(parentNode), "else if ", printParams(path, print2), printInverseBlockClosingMustache(parentNode)];
  31509. }
  31510. function printCloseBlock(path, print2, options) {
  31511. const node = path.getValue();
  31512. if (options.htmlWhitespaceSensitivity === "ignore") {
  31513. const escape = blockStatementHasOnlyWhitespaceInProgram(node) ? softline : hardline;
  31514. return [escape, printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  31515. }
  31516. return [printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
  31517. }
  31518. function blockStatementHasOnlyWhitespaceInProgram(node) {
  31519. return isNodeOfSomeType(node, ["BlockStatement"]) && node.program.body.every((node2) => isWhitespaceNode(node2));
  31520. }
  31521. function blockStatementHasElseIf(node) {
  31522. return blockStatementHasElse(node) && node.inverse.body.length === 1 && isNodeOfSomeType(node.inverse.body[0], ["BlockStatement"]) && node.inverse.body[0].path.parts[0] === "if";
  31523. }
  31524. function blockStatementHasElse(node) {
  31525. return isNodeOfSomeType(node, ["BlockStatement"]) && node.inverse;
  31526. }
  31527. function printProgram(path, print2, options) {
  31528. const node = path.getValue();
  31529. if (blockStatementHasOnlyWhitespaceInProgram(node)) {
  31530. return "";
  31531. }
  31532. const program = print2("program");
  31533. if (options.htmlWhitespaceSensitivity === "ignore") {
  31534. return indent([hardline, program]);
  31535. }
  31536. return indent(program);
  31537. }
  31538. function printInverse(path, print2, options) {
  31539. const node = path.getValue();
  31540. const inverse = print2("inverse");
  31541. const printed = options.htmlWhitespaceSensitivity === "ignore" ? [hardline, inverse] : inverse;
  31542. if (blockStatementHasElseIf(node)) {
  31543. return printed;
  31544. }
  31545. if (blockStatementHasElse(node)) {
  31546. return [printElseBlock(node, options), indent(printed)];
  31547. }
  31548. return "";
  31549. }
  31550. function getTextValueParts(value) {
  31551. return getDocParts(join(line, splitByHtmlWhitespace(value)));
  31552. }
  31553. function splitByHtmlWhitespace(string) {
  31554. return string.split(/[\t\n\f\r ]+/);
  31555. }
  31556. function getCurrentAttributeName(path) {
  31557. for (let depth = 0; depth < 2; depth++) {
  31558. const parentNode = path.getParentNode(depth);
  31559. if (parentNode && parentNode.type === "AttrNode") {
  31560. return parentNode.name.toLowerCase();
  31561. }
  31562. }
  31563. }
  31564. function countNewLines(string) {
  31565. string = typeof string === "string" ? string : "";
  31566. return string.split("\n").length - 1;
  31567. }
  31568. function countLeadingNewLines(string) {
  31569. string = typeof string === "string" ? string : "";
  31570. const newLines = (string.match(/^([^\S\n\r]*[\n\r])+/g) || [])[0] || "";
  31571. return countNewLines(newLines);
  31572. }
  31573. function countTrailingNewLines(string) {
  31574. string = typeof string === "string" ? string : "";
  31575. const newLines = (string.match(/([\n\r][^\S\n\r]*)+$/g) || [])[0] || "";
  31576. return countNewLines(newLines);
  31577. }
  31578. function generateHardlines(number = 0) {
  31579. return Array.from({
  31580. length: Math.min(number, NEWLINES_TO_PRESERVE_MAX)
  31581. }).fill(hardline);
  31582. }
  31583. function printStringLiteral(stringLiteral, favoriteQuote) {
  31584. const {
  31585. quote,
  31586. regex
  31587. } = getPreferredQuote(stringLiteral, favoriteQuote);
  31588. return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
  31589. }
  31590. function needsOppositeQuote(path) {
  31591. let index = 0;
  31592. let parentNode = path.getParentNode(index);
  31593. while (parentNode && isNodeOfSomeType(parentNode, ["SubExpression"])) {
  31594. index++;
  31595. parentNode = path.getParentNode(index);
  31596. }
  31597. if (parentNode && isNodeOfSomeType(path.getParentNode(index + 1), ["ConcatStatement"]) && isNodeOfSomeType(path.getParentNode(index + 2), ["AttrNode"])) {
  31598. return true;
  31599. }
  31600. return false;
  31601. }
  31602. function printSubExpressionPathAndParams(path, print2) {
  31603. const printed = printPath(path, print2);
  31604. const params = printParams(path, print2);
  31605. if (!params) {
  31606. return printed;
  31607. }
  31608. return indent([printed, line, group(params)]);
  31609. }
  31610. function printPathAndParams(path, print2) {
  31611. const p = printPath(path, print2);
  31612. const params = printParams(path, print2);
  31613. if (!params) {
  31614. return p;
  31615. }
  31616. return [indent([p, line, params]), softline];
  31617. }
  31618. function printPath(path, print2) {
  31619. return print2("path");
  31620. }
  31621. function printParams(path, print2) {
  31622. const node = path.getValue();
  31623. const parts = [];
  31624. if (node.params.length > 0) {
  31625. const params = path.map(print2, "params");
  31626. parts.push(...params);
  31627. }
  31628. if (node.hash && node.hash.pairs.length > 0) {
  31629. const hash = print2("hash");
  31630. parts.push(hash);
  31631. }
  31632. if (parts.length === 0) {
  31633. return "";
  31634. }
  31635. return join(line, parts);
  31636. }
  31637. function printBlockParams(node) {
  31638. return ["as |", node.blockParams.join(" "), "|"];
  31639. }
  31640. module2.exports = {
  31641. print,
  31642. massageAstNode: clean
  31643. };
  31644. }
  31645. });
  31646. var require_parsers3 = __commonJS2({
  31647. "src/language-handlebars/parsers.js"(exports2, module2) {
  31648. "use strict";
  31649. module2.exports = {
  31650. get glimmer() {
  31651. return require("./parser-glimmer.js").parsers.glimmer;
  31652. }
  31653. };
  31654. }
  31655. });
  31656. var require_Handlebars = __commonJS2({
  31657. "node_modules/linguist-languages/data/Handlebars.json"(exports2, module2) {
  31658. module2.exports = {
  31659. name: "Handlebars",
  31660. type: "markup",
  31661. color: "#f7931e",
  31662. aliases: ["hbs", "htmlbars"],
  31663. extensions: [".handlebars", ".hbs"],
  31664. tmScope: "text.html.handlebars",
  31665. aceMode: "handlebars",
  31666. languageId: 155
  31667. };
  31668. }
  31669. });
  31670. var require_language_handlebars = __commonJS2({
  31671. "src/language-handlebars/index.js"(exports2, module2) {
  31672. "use strict";
  31673. var createLanguage = require_create_language();
  31674. var printer = require_printer_glimmer();
  31675. var parsers = require_parsers3();
  31676. var languages = [createLanguage(require_Handlebars(), () => ({
  31677. since: "2.3.0",
  31678. parsers: ["glimmer"],
  31679. vscodeLanguageIds: ["handlebars"]
  31680. }))];
  31681. var printers = {
  31682. glimmer: printer
  31683. };
  31684. module2.exports = {
  31685. languages,
  31686. printers,
  31687. parsers
  31688. };
  31689. }
  31690. });
  31691. var require_pragma3 = __commonJS2({
  31692. "src/language-graphql/pragma.js"(exports2, module2) {
  31693. "use strict";
  31694. function hasPragma(text) {
  31695. return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text);
  31696. }
  31697. function insertPragma(text) {
  31698. return "# @format\n\n" + text;
  31699. }
  31700. module2.exports = {
  31701. hasPragma,
  31702. insertPragma
  31703. };
  31704. }
  31705. });
  31706. var require_loc4 = __commonJS2({
  31707. "src/language-graphql/loc.js"(exports2, module2) {
  31708. "use strict";
  31709. function locStart(node) {
  31710. if (typeof node.start === "number") {
  31711. return node.start;
  31712. }
  31713. return node.loc && node.loc.start;
  31714. }
  31715. function locEnd(node) {
  31716. if (typeof node.end === "number") {
  31717. return node.end;
  31718. }
  31719. return node.loc && node.loc.end;
  31720. }
  31721. module2.exports = {
  31722. locStart,
  31723. locEnd
  31724. };
  31725. }
  31726. });
  31727. var require_printer_graphql = __commonJS2({
  31728. "src/language-graphql/printer-graphql.js"(exports2, module2) {
  31729. "use strict";
  31730. var {
  31731. builders: {
  31732. join,
  31733. hardline,
  31734. line,
  31735. softline,
  31736. group,
  31737. indent,
  31738. ifBreak
  31739. }
  31740. } = require("./doc.js");
  31741. var {
  31742. isNextLineEmpty,
  31743. isNonEmptyArray
  31744. } = require_util();
  31745. var {
  31746. insertPragma
  31747. } = require_pragma3();
  31748. var {
  31749. locStart,
  31750. locEnd
  31751. } = require_loc4();
  31752. function genericPrint(path, options, print) {
  31753. const node = path.getValue();
  31754. if (!node) {
  31755. return "";
  31756. }
  31757. if (typeof node === "string") {
  31758. return node;
  31759. }
  31760. switch (node.kind) {
  31761. case "Document": {
  31762. const parts = [];
  31763. path.each((pathChild, index, definitions) => {
  31764. parts.push(print());
  31765. if (index !== definitions.length - 1) {
  31766. parts.push(hardline);
  31767. if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd)) {
  31768. parts.push(hardline);
  31769. }
  31770. }
  31771. }, "definitions");
  31772. return [...parts, hardline];
  31773. }
  31774. case "OperationDefinition": {
  31775. const hasOperation = options.originalText[locStart(node)] !== "{";
  31776. const hasName = Boolean(node.name);
  31777. 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")];
  31778. }
  31779. case "FragmentDefinition": {
  31780. 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")];
  31781. }
  31782. case "SelectionSet": {
  31783. return ["{", indent([hardline, join(hardline, printSequence(path, options, print, "selections"))]), hardline, "}"];
  31784. }
  31785. case "Field": {
  31786. 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")]);
  31787. }
  31788. case "Name": {
  31789. return node.value;
  31790. }
  31791. case "StringValue": {
  31792. if (node.block) {
  31793. const lines = node.value.replace(/"""/g, "\\$&").split("\n");
  31794. if (lines.length === 1) {
  31795. lines[0] = lines[0].trim();
  31796. }
  31797. if (lines.every((line2) => line2 === "")) {
  31798. lines.length = 0;
  31799. }
  31800. return join(hardline, ['"""', ...lines, '"""']);
  31801. }
  31802. return ['"', node.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"'];
  31803. }
  31804. case "IntValue":
  31805. case "FloatValue":
  31806. case "EnumValue": {
  31807. return node.value;
  31808. }
  31809. case "BooleanValue": {
  31810. return node.value ? "true" : "false";
  31811. }
  31812. case "NullValue": {
  31813. return "null";
  31814. }
  31815. case "Variable": {
  31816. return ["$", print("name")];
  31817. }
  31818. case "ListValue": {
  31819. return group(["[", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "values"))]), softline, "]"]);
  31820. }
  31821. case "ObjectValue": {
  31822. 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 ? " " : ""), "}"]);
  31823. }
  31824. case "ObjectField":
  31825. case "Argument": {
  31826. return [print("name"), ": ", print("value")];
  31827. }
  31828. case "Directive": {
  31829. return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : ""];
  31830. }
  31831. case "NamedType": {
  31832. return print("name");
  31833. }
  31834. case "VariableDefinition": {
  31835. return [print("variable"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  31836. }
  31837. case "ObjectTypeExtension":
  31838. case "ObjectTypeDefinition": {
  31839. 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, "}"] : ""];
  31840. }
  31841. case "FieldDefinition": {
  31842. 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)];
  31843. }
  31844. case "DirectiveDefinition": {
  31845. 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"))];
  31846. }
  31847. case "EnumTypeExtension":
  31848. case "EnumTypeDefinition": {
  31849. 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, "}"] : ""];
  31850. }
  31851. case "EnumValueDefinition": {
  31852. return [print("description"), node.description ? hardline : "", print("name"), printDirectives(path, print, node)];
  31853. }
  31854. case "InputValueDefinition": {
  31855. return [print("description"), node.description ? node.description.block ? hardline : line : "", print("name"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
  31856. }
  31857. case "InputObjectTypeExtension":
  31858. case "InputObjectTypeDefinition": {
  31859. 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, "}"] : ""];
  31860. }
  31861. case "SchemaExtension": {
  31862. return ["extend schema", printDirectives(path, print, node), ...node.operationTypes.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]), hardline, "}"] : []];
  31863. }
  31864. case "SchemaDefinition": {
  31865. 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, "}"];
  31866. }
  31867. case "OperationTypeDefinition": {
  31868. return [print("operation"), ": ", print("type")];
  31869. }
  31870. case "InterfaceTypeExtension":
  31871. case "InterfaceTypeDefinition": {
  31872. 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, "}"] : ""];
  31873. }
  31874. case "FragmentSpread": {
  31875. return ["...", print("name"), printDirectives(path, print, node)];
  31876. }
  31877. case "InlineFragment": {
  31878. return ["...", node.typeCondition ? [" on ", print("typeCondition")] : "", printDirectives(path, print, node), " ", print("selectionSet")];
  31879. }
  31880. case "UnionTypeExtension":
  31881. case "UnionTypeDefinition": {
  31882. 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"))])] : ""])]);
  31883. }
  31884. case "ScalarTypeExtension":
  31885. case "ScalarTypeDefinition": {
  31886. return [print("description"), node.description ? hardline : "", node.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", print("name"), printDirectives(path, print, node)];
  31887. }
  31888. case "NonNullType": {
  31889. return [print("type"), "!"];
  31890. }
  31891. case "ListType": {
  31892. return ["[", print("type"), "]"];
  31893. }
  31894. default:
  31895. throw new Error("unknown graphql type: " + JSON.stringify(node.kind));
  31896. }
  31897. }
  31898. function printDirectives(path, print, node) {
  31899. if (node.directives.length === 0) {
  31900. return "";
  31901. }
  31902. const printed = join(line, path.map(print, "directives"));
  31903. if (node.kind === "FragmentDefinition" || node.kind === "OperationDefinition") {
  31904. return group([line, printed]);
  31905. }
  31906. return [" ", group(indent([softline, printed]))];
  31907. }
  31908. function printSequence(path, options, print, property) {
  31909. return path.map((path2, index, sequence) => {
  31910. const printed = print();
  31911. if (index < sequence.length - 1 && isNextLineEmpty(options.originalText, path2.getValue(), locEnd)) {
  31912. return [printed, hardline];
  31913. }
  31914. return printed;
  31915. }, property);
  31916. }
  31917. function canAttachComment(node) {
  31918. return node.kind && node.kind !== "Comment";
  31919. }
  31920. function printComment(commentPath) {
  31921. const comment = commentPath.getValue();
  31922. if (comment.kind === "Comment") {
  31923. return "#" + comment.value.trimEnd();
  31924. }
  31925. throw new Error("Not a comment: " + JSON.stringify(comment));
  31926. }
  31927. function printInterfaces(path, options, print) {
  31928. const node = path.getNode();
  31929. const parts = [];
  31930. const {
  31931. interfaces
  31932. } = node;
  31933. const printed = path.map((node2) => print(node2), "interfaces");
  31934. for (let index = 0; index < interfaces.length; index++) {
  31935. const interfaceNode = interfaces[index];
  31936. parts.push(printed[index]);
  31937. const nextInterfaceNode = interfaces[index + 1];
  31938. if (nextInterfaceNode) {
  31939. const textBetween = options.originalText.slice(interfaceNode.loc.end, nextInterfaceNode.loc.start);
  31940. const hasComment = textBetween.includes("#");
  31941. const separator = textBetween.replace(/#.*/g, "").trim();
  31942. parts.push(separator === "," ? "," : " &", hasComment ? line : " ");
  31943. }
  31944. }
  31945. return parts;
  31946. }
  31947. function clean(node, newNode) {
  31948. if (node.kind === "StringValue" && node.block && !node.value.includes("\n")) {
  31949. newNode.value = newNode.value.trim();
  31950. }
  31951. }
  31952. clean.ignoredProperties = /* @__PURE__ */ new Set(["loc", "comments"]);
  31953. function hasPrettierIgnore(path) {
  31954. var _node$comments;
  31955. const node = path.getValue();
  31956. 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");
  31957. }
  31958. module2.exports = {
  31959. print: genericPrint,
  31960. massageAstNode: clean,
  31961. hasPrettierIgnore,
  31962. insertPragma,
  31963. printComment,
  31964. canAttachComment
  31965. };
  31966. }
  31967. });
  31968. var require_options4 = __commonJS2({
  31969. "src/language-graphql/options.js"(exports2, module2) {
  31970. "use strict";
  31971. var commonOptions = require_common_options();
  31972. module2.exports = {
  31973. bracketSpacing: commonOptions.bracketSpacing
  31974. };
  31975. }
  31976. });
  31977. var require_parsers4 = __commonJS2({
  31978. "src/language-graphql/parsers.js"(exports2, module2) {
  31979. "use strict";
  31980. module2.exports = {
  31981. get graphql() {
  31982. return require("./parser-graphql.js").parsers.graphql;
  31983. }
  31984. };
  31985. }
  31986. });
  31987. var require_GraphQL = __commonJS2({
  31988. "node_modules/linguist-languages/data/GraphQL.json"(exports2, module2) {
  31989. module2.exports = {
  31990. name: "GraphQL",
  31991. type: "data",
  31992. color: "#e10098",
  31993. extensions: [".graphql", ".gql", ".graphqls"],
  31994. tmScope: "source.graphql",
  31995. aceMode: "text",
  31996. languageId: 139
  31997. };
  31998. }
  31999. });
  32000. var require_language_graphql = __commonJS2({
  32001. "src/language-graphql/index.js"(exports2, module2) {
  32002. "use strict";
  32003. var createLanguage = require_create_language();
  32004. var printer = require_printer_graphql();
  32005. var options = require_options4();
  32006. var parsers = require_parsers4();
  32007. var languages = [createLanguage(require_GraphQL(), () => ({
  32008. since: "1.5.0",
  32009. parsers: ["graphql"],
  32010. vscodeLanguageIds: ["graphql"]
  32011. }))];
  32012. var printers = {
  32013. graphql: printer
  32014. };
  32015. module2.exports = {
  32016. languages,
  32017. options,
  32018. printers,
  32019. parsers
  32020. };
  32021. }
  32022. });
  32023. var require_loc5 = __commonJS2({
  32024. "src/language-markdown/loc.js"(exports2, module2) {
  32025. "use strict";
  32026. function locStart(node) {
  32027. return node.position.start.offset;
  32028. }
  32029. function locEnd(node) {
  32030. return node.position.end.offset;
  32031. }
  32032. module2.exports = {
  32033. locStart,
  32034. locEnd
  32035. };
  32036. }
  32037. });
  32038. var require_constants_evaluate = __commonJS2({
  32039. "src/language-markdown/constants.evaluate.js"(exports2, module2) {
  32040. module2.exports = {
  32041. 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])?",
  32042. 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]",
  32043. 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]"
  32044. };
  32045. }
  32046. });
  32047. var require_utils10 = __commonJS2({
  32048. "src/language-markdown/utils.js"(exports2, module2) {
  32049. "use strict";
  32050. var {
  32051. getLast
  32052. } = require_util();
  32053. var {
  32054. locStart,
  32055. locEnd
  32056. } = require_loc5();
  32057. var {
  32058. cjkPattern,
  32059. kPattern,
  32060. punctuationPattern
  32061. } = require_constants_evaluate();
  32062. var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
  32063. var INLINE_NODE_WRAPPER_TYPES = [...INLINE_NODE_TYPES, "tableCell", "paragraph", "heading"];
  32064. var kRegex = new RegExp(kPattern);
  32065. var punctuationRegex = new RegExp(punctuationPattern);
  32066. function splitText(text, options) {
  32067. const KIND_NON_CJK = "non-cjk";
  32068. const KIND_CJ_LETTER = "cj-letter";
  32069. const KIND_K_LETTER = "k-letter";
  32070. const KIND_CJK_PUNCTUATION = "cjk-punctuation";
  32071. const nodes = [];
  32072. const tokens = (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})
  32073. (${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
  32074. for (const [index, token] of tokens.entries()) {
  32075. if (index % 2 === 1) {
  32076. nodes.push({
  32077. type: "whitespace",
  32078. value: /\n/.test(token) ? "\n" : " "
  32079. });
  32080. continue;
  32081. }
  32082. if ((index === 0 || index === tokens.length - 1) && token === "") {
  32083. continue;
  32084. }
  32085. const innerTokens = token.split(new RegExp(`(${cjkPattern})`));
  32086. for (const [innerIndex, innerToken] of innerTokens.entries()) {
  32087. if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
  32088. continue;
  32089. }
  32090. if (innerIndex % 2 === 0) {
  32091. if (innerToken !== "") {
  32092. appendNode({
  32093. type: "word",
  32094. value: innerToken,
  32095. kind: KIND_NON_CJK,
  32096. hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
  32097. hasTrailingPunctuation: punctuationRegex.test(getLast(innerToken))
  32098. });
  32099. }
  32100. continue;
  32101. }
  32102. appendNode(punctuationRegex.test(innerToken) ? {
  32103. type: "word",
  32104. value: innerToken,
  32105. kind: KIND_CJK_PUNCTUATION,
  32106. hasLeadingPunctuation: true,
  32107. hasTrailingPunctuation: true
  32108. } : {
  32109. type: "word",
  32110. value: innerToken,
  32111. kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
  32112. hasLeadingPunctuation: false,
  32113. hasTrailingPunctuation: false
  32114. });
  32115. }
  32116. }
  32117. return nodes;
  32118. function appendNode(node) {
  32119. const lastNode = getLast(nodes);
  32120. if (lastNode && lastNode.type === "word") {
  32121. 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) {
  32122. nodes.push({
  32123. type: "whitespace",
  32124. value: " "
  32125. });
  32126. } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && ![lastNode.value, node.value].some((value) => /\u3000/.test(value))) {
  32127. nodes.push({
  32128. type: "whitespace",
  32129. value: ""
  32130. });
  32131. }
  32132. }
  32133. nodes.push(node);
  32134. function isBetween(kind1, kind2) {
  32135. return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
  32136. }
  32137. }
  32138. }
  32139. function getOrderedListItemInfo(orderListItem, originalText) {
  32140. const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
  32141. return {
  32142. numberText,
  32143. marker,
  32144. leadingSpaces
  32145. };
  32146. }
  32147. function hasGitDiffFriendlyOrderedList(node, options) {
  32148. if (!node.ordered) {
  32149. return false;
  32150. }
  32151. if (node.children.length < 2) {
  32152. return false;
  32153. }
  32154. const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
  32155. const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
  32156. if (firstNumber === 0 && node.children.length > 2) {
  32157. const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
  32158. return secondNumber === 1 && thirdNumber === 1;
  32159. }
  32160. return secondNumber === 1;
  32161. }
  32162. function getFencedCodeBlockValue(node, originalText) {
  32163. const {
  32164. value
  32165. } = node;
  32166. if (node.position.end.offset === originalText.length && value.endsWith("\n") && originalText.endsWith("\n")) {
  32167. return value.slice(0, -1);
  32168. }
  32169. return value;
  32170. }
  32171. function mapAst(ast, handler) {
  32172. return function preorder(node, index, parentStack) {
  32173. const newNode = Object.assign({}, handler(node, index, parentStack));
  32174. if (newNode.children) {
  32175. newNode.children = newNode.children.map((child, index2) => preorder(child, index2, [newNode, ...parentStack]));
  32176. }
  32177. return newNode;
  32178. }(ast, null, []);
  32179. }
  32180. function isAutolink(node) {
  32181. if ((node === null || node === void 0 ? void 0 : node.type) !== "link" || node.children.length !== 1) {
  32182. return false;
  32183. }
  32184. const [child] = node.children;
  32185. return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
  32186. }
  32187. module2.exports = {
  32188. mapAst,
  32189. splitText,
  32190. punctuationPattern,
  32191. getFencedCodeBlockValue,
  32192. getOrderedListItemInfo,
  32193. hasGitDiffFriendlyOrderedList,
  32194. INLINE_NODE_TYPES,
  32195. INLINE_NODE_WRAPPER_TYPES,
  32196. isAutolink
  32197. };
  32198. }
  32199. });
  32200. var require_embed3 = __commonJS2({
  32201. "src/language-markdown/embed.js"(exports2, module2) {
  32202. "use strict";
  32203. var {
  32204. inferParserByLanguage,
  32205. getMaxContinuousCount
  32206. } = require_util();
  32207. var {
  32208. builders: {
  32209. hardline,
  32210. markAsRoot
  32211. },
  32212. utils: {
  32213. replaceEndOfLine
  32214. }
  32215. } = require("./doc.js");
  32216. var printFrontMatter = require_print();
  32217. var {
  32218. getFencedCodeBlockValue
  32219. } = require_utils10();
  32220. function embed(path, print, textToDoc, options) {
  32221. const node = path.getValue();
  32222. if (node.type === "code" && node.lang !== null) {
  32223. const parser = inferParserByLanguage(node.lang, options);
  32224. if (parser) {
  32225. const styleUnit = options.__inJsTemplate ? "~" : "`";
  32226. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  32227. const newOptions = {
  32228. parser
  32229. };
  32230. if (node.lang === "tsx") {
  32231. newOptions.filepath = "dummy.tsx";
  32232. }
  32233. const doc2 = textToDoc(getFencedCodeBlockValue(node, options.originalText), newOptions, {
  32234. stripTrailingHardline: true
  32235. });
  32236. return markAsRoot([style, node.lang, node.meta ? " " + node.meta : "", hardline, replaceEndOfLine(doc2), hardline, style]);
  32237. }
  32238. }
  32239. switch (node.type) {
  32240. case "front-matter":
  32241. return printFrontMatter(node, textToDoc);
  32242. case "importExport":
  32243. return [textToDoc(node.value, {
  32244. parser: "babel"
  32245. }, {
  32246. stripTrailingHardline: true
  32247. }), hardline];
  32248. case "jsx":
  32249. return textToDoc(`<$>${node.value}</$>`, {
  32250. parser: "__js_expression",
  32251. rootMarker: "mdx"
  32252. }, {
  32253. stripTrailingHardline: true
  32254. });
  32255. }
  32256. return null;
  32257. }
  32258. module2.exports = embed;
  32259. }
  32260. });
  32261. var require_pragma4 = __commonJS2({
  32262. "src/language-markdown/pragma.js"(exports2, module2) {
  32263. "use strict";
  32264. var parseFrontMatter = require_parse4();
  32265. var pragmas = ["format", "prettier"];
  32266. function startWithPragma(text) {
  32267. const pragma = `@(${pragmas.join("|")})`;
  32268. const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?
  32269. [\\s\\S]*(^|
  32270. )[^\\S
  32271. ]*${pragma}[^\\S
  32272. ]*($|
  32273. )[\\s\\S]*
  32274. .*-->`].join("|"), "m");
  32275. const matched = text.match(regex);
  32276. return (matched === null || matched === void 0 ? void 0 : matched.index) === 0;
  32277. }
  32278. module2.exports = {
  32279. startWithPragma,
  32280. hasPragma: (text) => startWithPragma(parseFrontMatter(text).content.trimStart()),
  32281. insertPragma: (text) => {
  32282. const extracted = parseFrontMatter(text);
  32283. const pragma = `<!-- @${pragmas[0]} -->`;
  32284. return extracted.frontMatter ? `${extracted.frontMatter.raw}
  32285. ${pragma}
  32286. ${extracted.content}` : `${pragma}
  32287. ${extracted.content}`;
  32288. }
  32289. };
  32290. }
  32291. });
  32292. var require_print_preprocess2 = __commonJS2({
  32293. "src/language-markdown/print-preprocess.js"(exports2, module2) {
  32294. "use strict";
  32295. var getLast = require_get_last();
  32296. var {
  32297. getOrderedListItemInfo,
  32298. mapAst,
  32299. splitText
  32300. } = require_utils10();
  32301. var isSingleCharRegex = /^.$/su;
  32302. function preprocess(ast, options) {
  32303. ast = restoreUnescapedCharacter(ast, options);
  32304. ast = mergeContinuousTexts(ast);
  32305. ast = transformInlineCode(ast);
  32306. ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
  32307. ast = markAlignedList(ast, options);
  32308. ast = splitTextIntoSentences(ast, options);
  32309. ast = transformImportExport(ast);
  32310. ast = mergeContinuousImportExport(ast);
  32311. return ast;
  32312. }
  32313. function transformImportExport(ast) {
  32314. return mapAst(ast, (node) => {
  32315. if (node.type !== "import" && node.type !== "export") {
  32316. return node;
  32317. }
  32318. return Object.assign(Object.assign({}, node), {}, {
  32319. type: "importExport"
  32320. });
  32321. });
  32322. }
  32323. function transformInlineCode(ast) {
  32324. return mapAst(ast, (node) => {
  32325. if (node.type !== "inlineCode") {
  32326. return node;
  32327. }
  32328. return Object.assign(Object.assign({}, node), {}, {
  32329. value: node.value.replace(/\s+/g, " ")
  32330. });
  32331. });
  32332. }
  32333. function restoreUnescapedCharacter(ast, options) {
  32334. 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), {}, {
  32335. value: options.originalText.slice(node.position.start.offset, node.position.end.offset)
  32336. }));
  32337. }
  32338. function mergeContinuousImportExport(ast) {
  32339. return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
  32340. type: "importExport",
  32341. value: prevNode.value + "\n\n" + node.value,
  32342. position: {
  32343. start: prevNode.position.start,
  32344. end: node.position.end
  32345. }
  32346. }));
  32347. }
  32348. function mergeChildren(ast, shouldMerge, mergeNode) {
  32349. return mapAst(ast, (node) => {
  32350. if (!node.children) {
  32351. return node;
  32352. }
  32353. const children = node.children.reduce((current, child) => {
  32354. const lastChild = getLast(current);
  32355. if (lastChild && shouldMerge(lastChild, child)) {
  32356. current.splice(-1, 1, mergeNode(lastChild, child));
  32357. } else {
  32358. current.push(child);
  32359. }
  32360. return current;
  32361. }, []);
  32362. return Object.assign(Object.assign({}, node), {}, {
  32363. children
  32364. });
  32365. });
  32366. }
  32367. function mergeContinuousTexts(ast) {
  32368. return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
  32369. type: "text",
  32370. value: prevNode.value + node.value,
  32371. position: {
  32372. start: prevNode.position.start,
  32373. end: node.position.end
  32374. }
  32375. }));
  32376. }
  32377. function splitTextIntoSentences(ast, options) {
  32378. return mapAst(ast, (node, index, [parentNode]) => {
  32379. if (node.type !== "text") {
  32380. return node;
  32381. }
  32382. let {
  32383. value
  32384. } = node;
  32385. if (parentNode.type === "paragraph") {
  32386. if (index === 0) {
  32387. value = value.trimStart();
  32388. }
  32389. if (index === parentNode.children.length - 1) {
  32390. value = value.trimEnd();
  32391. }
  32392. }
  32393. return {
  32394. type: "sentence",
  32395. position: node.position,
  32396. children: splitText(value, options)
  32397. };
  32398. });
  32399. }
  32400. function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
  32401. return mapAst(ast, (node, index, parentStack) => {
  32402. if (node.type === "code") {
  32403. const isIndented = /^\n?(?: {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
  32404. node.isIndented = isIndented;
  32405. if (isIndented) {
  32406. for (let i = 0; i < parentStack.length; i++) {
  32407. const parent = parentStack[i];
  32408. if (parent.hasIndentedCodeblock) {
  32409. break;
  32410. }
  32411. if (parent.type === "list") {
  32412. parent.hasIndentedCodeblock = true;
  32413. }
  32414. }
  32415. }
  32416. }
  32417. return node;
  32418. });
  32419. }
  32420. function markAlignedList(ast, options) {
  32421. return mapAst(ast, (node, index, parentStack) => {
  32422. if (node.type === "list" && node.children.length > 0) {
  32423. for (let i = 0; i < parentStack.length; i++) {
  32424. const parent = parentStack[i];
  32425. if (parent.type === "list" && !parent.isAligned) {
  32426. node.isAligned = false;
  32427. return node;
  32428. }
  32429. }
  32430. node.isAligned = isAligned(node);
  32431. }
  32432. return node;
  32433. });
  32434. function getListItemStart(listItem) {
  32435. return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
  32436. }
  32437. function isAligned(list) {
  32438. if (!list.ordered) {
  32439. return true;
  32440. }
  32441. const [firstItem, secondItem] = list.children;
  32442. const firstInfo = getOrderedListItemInfo(firstItem, options.originalText);
  32443. if (firstInfo.leadingSpaces.length > 1) {
  32444. return true;
  32445. }
  32446. const firstStart = getListItemStart(firstItem);
  32447. if (firstStart === -1) {
  32448. return false;
  32449. }
  32450. if (list.children.length === 1) {
  32451. return firstStart % options.tabWidth === 0;
  32452. }
  32453. const secondStart = getListItemStart(secondItem);
  32454. if (firstStart !== secondStart) {
  32455. return false;
  32456. }
  32457. if (firstStart % options.tabWidth === 0) {
  32458. return true;
  32459. }
  32460. const secondInfo = getOrderedListItemInfo(secondItem, options.originalText);
  32461. return secondInfo.leadingSpaces.length > 1;
  32462. }
  32463. }
  32464. module2.exports = preprocess;
  32465. }
  32466. });
  32467. var require_clean4 = __commonJS2({
  32468. "src/language-markdown/clean.js"(exports2, module2) {
  32469. "use strict";
  32470. var {
  32471. isFrontMatterNode
  32472. } = require_util();
  32473. var {
  32474. startWithPragma
  32475. } = require_pragma4();
  32476. var ignoredProperties = /* @__PURE__ */ new Set(["position", "raw"]);
  32477. function clean(ast, newObj, parent) {
  32478. if (ast.type === "front-matter" || ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
  32479. delete newObj.value;
  32480. }
  32481. if (ast.type === "list") {
  32482. delete newObj.isAligned;
  32483. }
  32484. if (ast.type === "list" || ast.type === "listItem") {
  32485. delete newObj.spread;
  32486. delete newObj.loose;
  32487. }
  32488. if (ast.type === "text") {
  32489. return null;
  32490. }
  32491. if (ast.type === "inlineCode") {
  32492. newObj.value = ast.value.replace(/[\t\n ]+/g, " ");
  32493. }
  32494. if (ast.type === "wikiLink") {
  32495. newObj.value = ast.value.trim().replace(/[\t\n]+/g, " ");
  32496. }
  32497. if (ast.type === "definition" || ast.type === "linkReference") {
  32498. newObj.label = ast.label.trim().replace(/[\t\n ]+/g, " ").toLowerCase();
  32499. }
  32500. if ((ast.type === "definition" || ast.type === "link" || ast.type === "image") && ast.title) {
  32501. newObj.title = ast.title.replace(/\\(["')])/g, "$1");
  32502. }
  32503. 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)) {
  32504. return null;
  32505. }
  32506. }
  32507. clean.ignoredProperties = ignoredProperties;
  32508. module2.exports = clean;
  32509. }
  32510. });
  32511. var require_printer_markdown = __commonJS2({
  32512. "src/language-markdown/printer-markdown.js"(exports2, module2) {
  32513. "use strict";
  32514. var {
  32515. getLast,
  32516. getMinNotPresentContinuousCount,
  32517. getMaxContinuousCount,
  32518. getStringWidth,
  32519. isNonEmptyArray
  32520. } = require_util();
  32521. var {
  32522. builders: {
  32523. breakParent,
  32524. join,
  32525. line,
  32526. literalline,
  32527. markAsRoot,
  32528. hardline,
  32529. softline,
  32530. ifBreak,
  32531. fill,
  32532. align,
  32533. indent,
  32534. group,
  32535. hardlineWithoutBreakParent
  32536. },
  32537. utils: {
  32538. normalizeDoc,
  32539. replaceTextEndOfLine
  32540. },
  32541. printer: {
  32542. printDocToString
  32543. }
  32544. } = require("./doc.js");
  32545. var embed = require_embed3();
  32546. var {
  32547. insertPragma
  32548. } = require_pragma4();
  32549. var {
  32550. locStart,
  32551. locEnd
  32552. } = require_loc5();
  32553. var preprocess = require_print_preprocess2();
  32554. var clean = require_clean4();
  32555. var {
  32556. getFencedCodeBlockValue,
  32557. hasGitDiffFriendlyOrderedList,
  32558. splitText,
  32559. punctuationPattern,
  32560. INLINE_NODE_TYPES,
  32561. INLINE_NODE_WRAPPER_TYPES,
  32562. isAutolink
  32563. } = require_utils10();
  32564. var TRAILING_HARDLINE_NODES = /* @__PURE__ */ new Set(["importExport"]);
  32565. var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link", "wikiLink"];
  32566. var SIBLING_NODE_TYPES = /* @__PURE__ */ new Set(["listItem", "definition", "footnoteDefinition"]);
  32567. function genericPrint(path, options, print) {
  32568. const node = path.getValue();
  32569. if (shouldRemainTheSameContent(path)) {
  32570. 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));
  32571. }
  32572. switch (node.type) {
  32573. case "front-matter":
  32574. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  32575. case "root":
  32576. if (node.children.length === 0) {
  32577. return "";
  32578. }
  32579. return [normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode(node).type) ? hardline : ""];
  32580. case "paragraph":
  32581. return printChildren(path, options, print, {
  32582. postprocessor: fill
  32583. });
  32584. case "sentence":
  32585. return printChildren(path, options, print);
  32586. case "word": {
  32587. let escapedValue = node.value.replace(/\*/g, "\\$&").replace(new RegExp([`(^|${punctuationPattern})(_+)`, `(_+)(${punctuationPattern}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_"));
  32588. const isFirstSentence = (node2, name, index) => node2.type === "sentence" && index === 0;
  32589. const isLastChildAutolink = (node2, name, index) => isAutolink(node2.children[index - 1]);
  32590. if (escapedValue !== node.value && (path.match(void 0, isFirstSentence, isLastChildAutolink) || path.match(void 0, isFirstSentence, (node2, name, index) => node2.type === "emphasis" && index === 0, isLastChildAutolink))) {
  32591. escapedValue = escapedValue.replace(/^(\\?[*_])+/, (prefix) => prefix.replace(/\\/g, ""));
  32592. }
  32593. return escapedValue;
  32594. }
  32595. case "whitespace": {
  32596. const parentNode = path.getParentNode();
  32597. const index = parentNode.children.indexOf(node);
  32598. const nextNode = parentNode.children[index + 1];
  32599. const proseWrap = nextNode && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(nextNode.value) ? "never" : options.proseWrap;
  32600. return printLine(path, node.value, {
  32601. proseWrap
  32602. });
  32603. }
  32604. case "emphasis": {
  32605. let style;
  32606. if (isAutolink(node.children[0])) {
  32607. style = options.originalText[node.position.start.offset];
  32608. } else {
  32609. const parentNode = path.getParentNode();
  32610. const index = parentNode.children.indexOf(node);
  32611. const prevNode = parentNode.children[index - 1];
  32612. const nextNode = parentNode.children[index + 1];
  32613. 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;
  32614. style = hasPrevOrNextWord || getAncestorNode(path, "emphasis") ? "*" : "_";
  32615. }
  32616. return [style, printChildren(path, options, print), style];
  32617. }
  32618. case "strong":
  32619. return ["**", printChildren(path, options, print), "**"];
  32620. case "delete":
  32621. return ["~~", printChildren(path, options, print), "~~"];
  32622. case "inlineCode": {
  32623. const backtickCount = getMinNotPresentContinuousCount(node.value, "`");
  32624. const style = "`".repeat(backtickCount || 1);
  32625. const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
  32626. return [style, gap, node.value, gap, style];
  32627. }
  32628. case "wikiLink": {
  32629. let contents = "";
  32630. if (options.proseWrap === "preserve") {
  32631. contents = node.value;
  32632. } else {
  32633. contents = node.value.replace(/[\t\n]+/g, " ");
  32634. }
  32635. return ["[[", contents, "]]"];
  32636. }
  32637. case "link":
  32638. switch (options.originalText[node.position.start.offset]) {
  32639. case "<": {
  32640. const mailto = "mailto:";
  32641. 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;
  32642. return ["<", url, ">"];
  32643. }
  32644. case "[":
  32645. return ["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  32646. default:
  32647. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  32648. }
  32649. case "image":
  32650. return ["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
  32651. case "blockquote":
  32652. return ["> ", align("> ", printChildren(path, options, print))];
  32653. case "heading":
  32654. return ["#".repeat(node.depth) + " ", printChildren(path, options, print)];
  32655. case "code": {
  32656. if (node.isIndented) {
  32657. const alignment = " ".repeat(4);
  32658. return align(alignment, [alignment, ...replaceTextEndOfLine(node.value, hardline)]);
  32659. }
  32660. const styleUnit = options.__inJsTemplate ? "~" : "`";
  32661. const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
  32662. return [style, node.lang || "", node.meta ? " " + node.meta : "", hardline, ...replaceTextEndOfLine(getFencedCodeBlockValue(node, options.originalText), hardline), hardline, style];
  32663. }
  32664. case "html": {
  32665. const parentNode = path.getParentNode();
  32666. const value = parentNode.type === "root" && getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
  32667. const isHtmlComment = /^<!--.*-->$/s.test(value);
  32668. return replaceTextEndOfLine(value, isHtmlComment ? hardline : markAsRoot(literalline));
  32669. }
  32670. case "list": {
  32671. const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
  32672. const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(node, options);
  32673. return printChildren(path, options, print, {
  32674. processor: (childPath, index) => {
  32675. const prefix = getPrefix();
  32676. const childNode = childPath.getValue();
  32677. if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
  32678. return [prefix, printListItem(childPath, options, print, prefix)];
  32679. }
  32680. return [prefix, align(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))];
  32681. function getPrefix() {
  32682. const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
  32683. return node.isAligned || node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
  32684. }
  32685. }
  32686. });
  32687. }
  32688. case "thematicBreak": {
  32689. const counter = getAncestorCounter(path, "list");
  32690. if (counter === -1) {
  32691. return "---";
  32692. }
  32693. const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
  32694. return nthSiblingIndex % 2 === 0 ? "***" : "---";
  32695. }
  32696. case "linkReference":
  32697. return ["[", printChildren(path, options, print), "]", node.referenceType === "full" ? ["[", node.identifier, "]"] : node.referenceType === "collapsed" ? "[]" : ""];
  32698. case "imageReference":
  32699. switch (node.referenceType) {
  32700. case "full":
  32701. return ["![", node.alt || "", "][", node.identifier, "]"];
  32702. default:
  32703. return ["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""];
  32704. }
  32705. case "definition": {
  32706. const lineOrSpace = options.proseWrap === "always" ? line : " ";
  32707. return group(["[", node.identifier, "]:", indent([lineOrSpace, printUrl(node.url), node.title === null ? "" : [lineOrSpace, printTitle(node.title, options, false)]])]);
  32708. }
  32709. case "footnote":
  32710. return ["[^", printChildren(path, options, print), "]"];
  32711. case "footnoteReference":
  32712. return ["[^", node.identifier, "]"];
  32713. case "footnoteDefinition": {
  32714. const nextNode = path.getParentNode().children[path.getName() + 1];
  32715. 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);
  32716. return ["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren(path, options, print) : group([align(" ".repeat(4), printChildren(path, options, print, {
  32717. processor: (childPath, index) => index === 0 ? group([softline, print()]) : print()
  32718. })), nextNode && nextNode.type === "footnoteDefinition" ? softline : ""])];
  32719. }
  32720. case "table":
  32721. return printTable(path, options, print);
  32722. case "tableCell":
  32723. return printChildren(path, options, print);
  32724. case "break":
  32725. return /\s/.test(options.originalText[node.position.start.offset]) ? [" ", markAsRoot(literalline)] : ["\\", hardline];
  32726. case "liquidNode":
  32727. return replaceTextEndOfLine(node.value, hardline);
  32728. case "importExport":
  32729. return [node.value, hardline];
  32730. case "esComment":
  32731. return ["{/* ", node.value, " */}"];
  32732. case "jsx":
  32733. return node.value;
  32734. case "math":
  32735. return ["$$", hardline, node.value ? [...replaceTextEndOfLine(node.value, hardline), hardline] : "", "$$"];
  32736. case "inlineMath": {
  32737. return options.originalText.slice(locStart(node), locEnd(node));
  32738. }
  32739. case "tableRow":
  32740. case "listItem":
  32741. default:
  32742. throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`);
  32743. }
  32744. }
  32745. function printListItem(path, options, print, listPrefix) {
  32746. const node = path.getValue();
  32747. const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
  32748. return [prefix, printChildren(path, options, print, {
  32749. processor: (childPath, index) => {
  32750. if (index === 0 && childPath.getValue().type !== "list") {
  32751. return align(" ".repeat(prefix.length), print());
  32752. }
  32753. const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3));
  32754. return [alignment, align(alignment, print())];
  32755. }
  32756. })];
  32757. }
  32758. function alignListPrefix(prefix, options) {
  32759. const additionalSpaces = getAdditionalSpaces();
  32760. return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces);
  32761. function getAdditionalSpaces() {
  32762. const restSpaces = prefix.length % options.tabWidth;
  32763. return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
  32764. }
  32765. }
  32766. function getNthListSiblingIndex(node, parentNode) {
  32767. return getNthSiblingIndex(node, parentNode, (siblingNode) => siblingNode.ordered === node.ordered);
  32768. }
  32769. function getNthSiblingIndex(node, parentNode, condition) {
  32770. let index = -1;
  32771. for (const childNode of parentNode.children) {
  32772. if (childNode.type === node.type && condition(childNode)) {
  32773. index++;
  32774. } else {
  32775. index = -1;
  32776. }
  32777. if (childNode === node) {
  32778. return index;
  32779. }
  32780. }
  32781. }
  32782. function getAncestorCounter(path, typeOrTypes) {
  32783. const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
  32784. let counter = -1;
  32785. let ancestorNode;
  32786. while (ancestorNode = path.getParentNode(++counter)) {
  32787. if (types.includes(ancestorNode.type)) {
  32788. return counter;
  32789. }
  32790. }
  32791. return -1;
  32792. }
  32793. function getAncestorNode(path, typeOrTypes) {
  32794. const counter = getAncestorCounter(path, typeOrTypes);
  32795. return counter === -1 ? null : path.getParentNode(counter);
  32796. }
  32797. function printLine(path, value, options) {
  32798. if (options.proseWrap === "preserve" && value === "\n") {
  32799. return hardline;
  32800. }
  32801. const isBreakable = options.proseWrap === "always" && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
  32802. return value !== "" ? isBreakable ? line : " " : isBreakable ? softline : "";
  32803. }
  32804. function printTable(path, options, print) {
  32805. const node = path.getValue();
  32806. const columnMaxWidths = [];
  32807. const contents = path.map((rowPath) => rowPath.map((cellPath, columnIndex) => {
  32808. const text = printDocToString(print(), options).formatted;
  32809. const width = getStringWidth(text);
  32810. columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, width);
  32811. return {
  32812. text,
  32813. width
  32814. };
  32815. }, "children"), "children");
  32816. const alignedTable = printTableContents(false);
  32817. if (options.proseWrap !== "never") {
  32818. return [breakParent, alignedTable];
  32819. }
  32820. const compactTable = printTableContents(true);
  32821. return [breakParent, group(ifBreak(compactTable, alignedTable))];
  32822. function printTableContents(isCompact) {
  32823. const parts = [printRow(contents[0], isCompact), printAlign(isCompact)];
  32824. if (contents.length > 1) {
  32825. parts.push(join(hardlineWithoutBreakParent, contents.slice(1).map((rowContents) => printRow(rowContents, isCompact))));
  32826. }
  32827. return join(hardlineWithoutBreakParent, parts);
  32828. }
  32829. function printAlign(isCompact) {
  32830. const align2 = columnMaxWidths.map((width, index) => {
  32831. const align3 = node.align[index];
  32832. const first = align3 === "center" || align3 === "left" ? ":" : "-";
  32833. const last = align3 === "center" || align3 === "right" ? ":" : "-";
  32834. const middle = isCompact ? "-" : "-".repeat(width - 2);
  32835. return `${first}${middle}${last}`;
  32836. });
  32837. return `| ${align2.join(" | ")} |`;
  32838. }
  32839. function printRow(rowContents, isCompact) {
  32840. const columns = rowContents.map(({
  32841. text,
  32842. width
  32843. }, columnIndex) => {
  32844. if (isCompact) {
  32845. return text;
  32846. }
  32847. const spaces = columnMaxWidths[columnIndex] - width;
  32848. const align2 = node.align[columnIndex];
  32849. let before = 0;
  32850. if (align2 === "right") {
  32851. before = spaces;
  32852. } else if (align2 === "center") {
  32853. before = Math.floor(spaces / 2);
  32854. }
  32855. const after = spaces - before;
  32856. return `${" ".repeat(before)}${text}${" ".repeat(after)}`;
  32857. });
  32858. return `| ${columns.join(" | ")} |`;
  32859. }
  32860. }
  32861. function printRoot(path, options, print) {
  32862. const ignoreRanges = [];
  32863. let ignoreStart = null;
  32864. const {
  32865. children
  32866. } = path.getValue();
  32867. for (const [index, childNode] of children.entries()) {
  32868. switch (isPrettierIgnore(childNode)) {
  32869. case "start":
  32870. if (ignoreStart === null) {
  32871. ignoreStart = {
  32872. index,
  32873. offset: childNode.position.end.offset
  32874. };
  32875. }
  32876. break;
  32877. case "end":
  32878. if (ignoreStart !== null) {
  32879. ignoreRanges.push({
  32880. start: ignoreStart,
  32881. end: {
  32882. index,
  32883. offset: childNode.position.start.offset
  32884. }
  32885. });
  32886. ignoreStart = null;
  32887. }
  32888. break;
  32889. default:
  32890. break;
  32891. }
  32892. }
  32893. return printChildren(path, options, print, {
  32894. processor: (childPath, index) => {
  32895. if (ignoreRanges.length > 0) {
  32896. const ignoreRange = ignoreRanges[0];
  32897. if (index === ignoreRange.start.index) {
  32898. return [children[ignoreRange.start.index].value, options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), children[ignoreRange.end.index].value];
  32899. }
  32900. if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
  32901. return false;
  32902. }
  32903. if (index === ignoreRange.end.index) {
  32904. ignoreRanges.shift();
  32905. return false;
  32906. }
  32907. }
  32908. return print();
  32909. }
  32910. });
  32911. }
  32912. function printChildren(path, options, print, events = {}) {
  32913. const {
  32914. postprocessor
  32915. } = events;
  32916. const processor = events.processor || (() => print());
  32917. const node = path.getValue();
  32918. const parts = [];
  32919. let lastChildNode;
  32920. path.each((childPath, index) => {
  32921. const childNode = childPath.getValue();
  32922. const result = processor(childPath, index);
  32923. if (result !== false) {
  32924. const data = {
  32925. parts,
  32926. prevNode: lastChildNode,
  32927. parentNode: node,
  32928. options
  32929. };
  32930. if (shouldPrePrintHardline(childNode, data)) {
  32931. parts.push(hardline);
  32932. if (lastChildNode && TRAILING_HARDLINE_NODES.has(lastChildNode.type)) {
  32933. if (shouldPrePrintTripleHardline(childNode, data)) {
  32934. parts.push(hardline);
  32935. }
  32936. } else {
  32937. if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
  32938. parts.push(hardline);
  32939. }
  32940. if (shouldPrePrintTripleHardline(childNode, data)) {
  32941. parts.push(hardline);
  32942. }
  32943. }
  32944. }
  32945. parts.push(result);
  32946. lastChildNode = childNode;
  32947. }
  32948. }, "children");
  32949. return postprocessor ? postprocessor(parts) : parts;
  32950. }
  32951. function getLastDescendantNode(node) {
  32952. let current = node;
  32953. while (isNonEmptyArray(current.children)) {
  32954. current = getLast(current.children);
  32955. }
  32956. return current;
  32957. }
  32958. function isPrettierIgnore(node) {
  32959. let match;
  32960. if (node.type === "html") {
  32961. match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
  32962. } else {
  32963. let comment;
  32964. if (node.type === "esComment") {
  32965. comment = node;
  32966. } else if (node.type === "paragraph" && node.children.length === 1 && node.children[0].type === "esComment") {
  32967. comment = node.children[0];
  32968. }
  32969. if (comment) {
  32970. match = comment.value.match(/^prettier-ignore(?:-(start|end))?$/);
  32971. }
  32972. }
  32973. return match ? match[1] || "next" : false;
  32974. }
  32975. function shouldPrePrintHardline(node, data) {
  32976. const isFirstNode = data.parts.length === 0;
  32977. const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
  32978. const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
  32979. return !isFirstNode && !isInlineNode && !isInlineHTML;
  32980. }
  32981. function shouldPrePrintDoubleHardline(node, data) {
  32982. var _data$prevNode, _data$prevNode2, _data$prevNode3;
  32983. const isSequence = (data.prevNode && data.prevNode.type) === node.type;
  32984. const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
  32985. const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
  32986. const isPrevNodeLooseListItem = ((_data$prevNode = data.prevNode) === null || _data$prevNode === void 0 ? void 0 : _data$prevNode.type) === "listItem" && data.prevNode.loose;
  32987. const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
  32988. 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;
  32989. 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;
  32990. return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
  32991. }
  32992. function shouldPrePrintTripleHardline(node, data) {
  32993. const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
  32994. const isIndentedCode = node.type === "code" && node.isIndented;
  32995. return isPrevNodeList && isIndentedCode;
  32996. }
  32997. function shouldRemainTheSameContent(path) {
  32998. const ancestorNode = getAncestorNode(path, ["linkReference", "imageReference"]);
  32999. return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
  33000. }
  33001. function printUrl(url, dangerousCharOrChars = []) {
  33002. const dangerousChars = [" ", ...Array.isArray(dangerousCharOrChars) ? dangerousCharOrChars : [dangerousCharOrChars]];
  33003. return new RegExp(dangerousChars.map((x) => `\\${x}`).join("|")).test(url) ? `<${url}>` : url;
  33004. }
  33005. function printTitle(title, options, printSpace = true) {
  33006. if (!title) {
  33007. return "";
  33008. }
  33009. if (printSpace) {
  33010. return " " + printTitle(title, options, false);
  33011. }
  33012. title = title.replace(/\\(["')])/g, "$1");
  33013. if (title.includes('"') && title.includes("'") && !title.includes(")")) {
  33014. return `(${title})`;
  33015. }
  33016. const singleCount = title.split("'").length - 1;
  33017. const doubleCount = title.split('"').length - 1;
  33018. const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
  33019. title = title.replace(/\\/, "\\\\");
  33020. title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
  33021. return `${quote}${title}${quote}`;
  33022. }
  33023. function clamp(value, min, max) {
  33024. return value < min ? min : value > max ? max : value;
  33025. }
  33026. function hasPrettierIgnore(path) {
  33027. const index = Number(path.getName());
  33028. if (index === 0) {
  33029. return false;
  33030. }
  33031. const prevNode = path.getParentNode().children[index - 1];
  33032. return isPrettierIgnore(prevNode) === "next";
  33033. }
  33034. module2.exports = {
  33035. preprocess,
  33036. print: genericPrint,
  33037. embed,
  33038. massageAstNode: clean,
  33039. hasPrettierIgnore,
  33040. insertPragma
  33041. };
  33042. }
  33043. });
  33044. var require_options5 = __commonJS2({
  33045. "src/language-markdown/options.js"(exports2, module2) {
  33046. "use strict";
  33047. var commonOptions = require_common_options();
  33048. module2.exports = {
  33049. proseWrap: commonOptions.proseWrap,
  33050. singleQuote: commonOptions.singleQuote
  33051. };
  33052. }
  33053. });
  33054. var require_parsers5 = __commonJS2({
  33055. "src/language-markdown/parsers.js"(exports2, module2) {
  33056. "use strict";
  33057. module2.exports = {
  33058. get remark() {
  33059. return require("./parser-markdown.js").parsers.remark;
  33060. },
  33061. get markdown() {
  33062. return require("./parser-markdown.js").parsers.remark;
  33063. },
  33064. get mdx() {
  33065. return require("./parser-markdown.js").parsers.mdx;
  33066. }
  33067. };
  33068. }
  33069. });
  33070. var require_Markdown = __commonJS2({
  33071. "node_modules/linguist-languages/data/Markdown.json"(exports2, module2) {
  33072. module2.exports = {
  33073. name: "Markdown",
  33074. type: "prose",
  33075. color: "#083fa1",
  33076. aliases: ["pandoc"],
  33077. aceMode: "markdown",
  33078. codemirrorMode: "gfm",
  33079. codemirrorMimeType: "text/x-gfm",
  33080. wrap: true,
  33081. extensions: [".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"],
  33082. filenames: ["contents.lr"],
  33083. tmScope: "source.gfm",
  33084. languageId: 222
  33085. };
  33086. }
  33087. });
  33088. var require_language_markdown = __commonJS2({
  33089. "src/language-markdown/index.js"(exports2, module2) {
  33090. "use strict";
  33091. var createLanguage = require_create_language();
  33092. var printer = require_printer_markdown();
  33093. var options = require_options5();
  33094. var parsers = require_parsers5();
  33095. var languages = [createLanguage(require_Markdown(), (data) => ({
  33096. since: "1.8.0",
  33097. parsers: ["markdown"],
  33098. vscodeLanguageIds: ["markdown"],
  33099. filenames: [...data.filenames, "README"],
  33100. extensions: data.extensions.filter((extension) => extension !== ".mdx")
  33101. })), createLanguage(require_Markdown(), () => ({
  33102. name: "MDX",
  33103. since: "1.15.0",
  33104. parsers: ["mdx"],
  33105. vscodeLanguageIds: ["mdx"],
  33106. filenames: [],
  33107. extensions: [".mdx"]
  33108. }))];
  33109. var printers = {
  33110. mdast: printer
  33111. };
  33112. module2.exports = {
  33113. languages,
  33114. options,
  33115. printers,
  33116. parsers
  33117. };
  33118. }
  33119. });
  33120. var require_clean5 = __commonJS2({
  33121. "src/language-html/clean.js"(exports2, module2) {
  33122. "use strict";
  33123. var {
  33124. isFrontMatterNode
  33125. } = require_util();
  33126. var ignoredProperties = /* @__PURE__ */ new Set(["sourceSpan", "startSourceSpan", "endSourceSpan", "nameSpan", "valueSpan"]);
  33127. function clean(ast, newNode) {
  33128. if (ast.type === "text" || ast.type === "comment") {
  33129. return null;
  33130. }
  33131. if (isFrontMatterNode(ast) || ast.type === "yaml" || ast.type === "toml") {
  33132. return null;
  33133. }
  33134. if (ast.type === "attribute") {
  33135. delete newNode.value;
  33136. }
  33137. if (ast.type === "docType") {
  33138. delete newNode.value;
  33139. }
  33140. }
  33141. clean.ignoredProperties = ignoredProperties;
  33142. module2.exports = clean;
  33143. }
  33144. });
  33145. var require_constants_evaluate2 = __commonJS2({
  33146. "src/language-html/constants.evaluate.js"(exports2, module2) {
  33147. module2.exports = {
  33148. CSS_DISPLAY_TAGS: {
  33149. area: "none",
  33150. base: "none",
  33151. basefont: "none",
  33152. datalist: "none",
  33153. head: "none",
  33154. link: "none",
  33155. meta: "none",
  33156. noembed: "none",
  33157. noframes: "none",
  33158. param: "block",
  33159. rp: "none",
  33160. script: "block",
  33161. source: "block",
  33162. style: "none",
  33163. template: "inline",
  33164. track: "block",
  33165. title: "none",
  33166. html: "block",
  33167. body: "block",
  33168. address: "block",
  33169. blockquote: "block",
  33170. center: "block",
  33171. div: "block",
  33172. figure: "block",
  33173. figcaption: "block",
  33174. footer: "block",
  33175. form: "block",
  33176. header: "block",
  33177. hr: "block",
  33178. legend: "block",
  33179. listing: "block",
  33180. main: "block",
  33181. p: "block",
  33182. plaintext: "block",
  33183. pre: "block",
  33184. xmp: "block",
  33185. slot: "contents",
  33186. ruby: "ruby",
  33187. rt: "ruby-text",
  33188. article: "block",
  33189. aside: "block",
  33190. h1: "block",
  33191. h2: "block",
  33192. h3: "block",
  33193. h4: "block",
  33194. h5: "block",
  33195. h6: "block",
  33196. hgroup: "block",
  33197. nav: "block",
  33198. section: "block",
  33199. dir: "block",
  33200. dd: "block",
  33201. dl: "block",
  33202. dt: "block",
  33203. ol: "block",
  33204. ul: "block",
  33205. li: "list-item",
  33206. table: "table",
  33207. caption: "table-caption",
  33208. colgroup: "table-column-group",
  33209. col: "table-column",
  33210. thead: "table-header-group",
  33211. tbody: "table-row-group",
  33212. tfoot: "table-footer-group",
  33213. tr: "table-row",
  33214. td: "table-cell",
  33215. th: "table-cell",
  33216. fieldset: "block",
  33217. button: "inline-block",
  33218. details: "block",
  33219. summary: "block",
  33220. dialog: "block",
  33221. meter: "inline-block",
  33222. progress: "inline-block",
  33223. object: "inline-block",
  33224. video: "inline-block",
  33225. audio: "inline-block",
  33226. select: "inline-block",
  33227. option: "block",
  33228. optgroup: "block"
  33229. },
  33230. CSS_DISPLAY_DEFAULT: "inline",
  33231. CSS_WHITE_SPACE_TAGS: {
  33232. listing: "pre",
  33233. plaintext: "pre",
  33234. pre: "pre",
  33235. xmp: "pre",
  33236. nobr: "nowrap",
  33237. table: "initial",
  33238. textarea: "pre-wrap"
  33239. },
  33240. CSS_WHITE_SPACE_DEFAULT: "normal"
  33241. };
  33242. }
  33243. });
  33244. var require_is_unknown_namespace = __commonJS2({
  33245. "src/language-html/utils/is-unknown-namespace.js"(exports2, module2) {
  33246. "use strict";
  33247. function isUnknownNamespace(node) {
  33248. return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
  33249. }
  33250. module2.exports = isUnknownNamespace;
  33251. }
  33252. });
  33253. var require_utils11 = __commonJS2({
  33254. "src/language-html/utils/index.js"(exports2, module2) {
  33255. "use strict";
  33256. var {
  33257. inferParserByLanguage,
  33258. isFrontMatterNode
  33259. } = require_util();
  33260. var {
  33261. builders: {
  33262. line,
  33263. hardline,
  33264. join
  33265. },
  33266. utils: {
  33267. getDocParts,
  33268. replaceTextEndOfLine
  33269. }
  33270. } = require("./doc.js");
  33271. var {
  33272. CSS_DISPLAY_TAGS,
  33273. CSS_DISPLAY_DEFAULT,
  33274. CSS_WHITE_SPACE_TAGS,
  33275. CSS_WHITE_SPACE_DEFAULT
  33276. } = require_constants_evaluate2();
  33277. var isUnknownNamespace = require_is_unknown_namespace();
  33278. var HTML_WHITESPACE = /* @__PURE__ */ new Set([" ", "\n", "\f", "\r", " "]);
  33279. var htmlTrimStart = (string) => string.replace(/^[\t\n\f\r ]+/, "");
  33280. var htmlTrimEnd = (string) => string.replace(/[\t\n\f\r ]+$/, "");
  33281. var htmlTrim = (string) => htmlTrimStart(htmlTrimEnd(string));
  33282. var htmlTrimLeadingBlankLines = (string) => string.replace(/^[\t\f\r ]*\n/g, "");
  33283. var htmlTrimPreserveIndentation = (string) => htmlTrimLeadingBlankLines(htmlTrimEnd(string));
  33284. var splitByHtmlWhitespace = (string) => string.split(/[\t\n\f\r ]+/);
  33285. var getLeadingHtmlWhitespace = (string) => string.match(/^[\t\n\f\r ]*/)[0];
  33286. var getLeadingAndTrailingHtmlWhitespace = (string) => {
  33287. const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
  33288. return {
  33289. leadingWhitespace,
  33290. trailingWhitespace,
  33291. text
  33292. };
  33293. };
  33294. var hasHtmlWhitespace = (string) => /[\t\n\f\r ]/.test(string);
  33295. function shouldPreserveContent(node, options) {
  33296. if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
  33297. return true;
  33298. }
  33299. if (node.type === "ieConditionalComment" && !node.complete) {
  33300. return true;
  33301. }
  33302. if (isPreLikeNode(node) && node.children.some((child) => child.type !== "text" && child.type !== "interpolation")) {
  33303. return true;
  33304. }
  33305. if (isVueNonHtmlBlock(node, options) && !isScriptLikeTag(node) && node.type !== "interpolation") {
  33306. return true;
  33307. }
  33308. return false;
  33309. }
  33310. function hasPrettierIgnore(node) {
  33311. if (node.type === "attribute") {
  33312. return false;
  33313. }
  33314. if (!node.parent) {
  33315. return false;
  33316. }
  33317. if (!node.prev) {
  33318. return false;
  33319. }
  33320. return isPrettierIgnore(node.prev);
  33321. }
  33322. function isPrettierIgnore(node) {
  33323. return node.type === "comment" && node.value.trim() === "prettier-ignore";
  33324. }
  33325. function isTextLikeNode(node) {
  33326. return node.type === "text" || node.type === "comment";
  33327. }
  33328. function isScriptLikeTag(node) {
  33329. return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
  33330. }
  33331. function canHaveInterpolation(node) {
  33332. return node.children && !isScriptLikeTag(node);
  33333. }
  33334. function isWhitespaceSensitiveNode(node) {
  33335. return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
  33336. }
  33337. function isIndentationSensitiveNode(node) {
  33338. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  33339. }
  33340. function isLeadingSpaceSensitiveNode(node, options) {
  33341. const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
  33342. if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
  33343. return node.type === "interpolation";
  33344. }
  33345. return isLeadingSpaceSensitive;
  33346. function _isLeadingSpaceSensitiveNode() {
  33347. if (isFrontMatterNode(node)) {
  33348. return false;
  33349. }
  33350. if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
  33351. return true;
  33352. }
  33353. if (!node.parent || node.parent.cssDisplay === "none") {
  33354. return false;
  33355. }
  33356. if (isPreLikeNode(node.parent)) {
  33357. return true;
  33358. }
  33359. if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  33360. return false;
  33361. }
  33362. if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
  33363. return false;
  33364. }
  33365. return true;
  33366. }
  33367. }
  33368. function isTrailingSpaceSensitiveNode(node, options) {
  33369. if (isFrontMatterNode(node)) {
  33370. return false;
  33371. }
  33372. if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
  33373. return true;
  33374. }
  33375. if (!node.parent || node.parent.cssDisplay === "none") {
  33376. return false;
  33377. }
  33378. if (isPreLikeNode(node.parent)) {
  33379. return true;
  33380. }
  33381. if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
  33382. return false;
  33383. }
  33384. if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
  33385. return false;
  33386. }
  33387. return true;
  33388. }
  33389. function isDanglingSpaceSensitiveNode(node) {
  33390. return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
  33391. }
  33392. function forceNextEmptyLine(node) {
  33393. return isFrontMatterNode(node) || node.next && node.sourceSpan.end && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
  33394. }
  33395. function forceBreakContent(node) {
  33396. 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));
  33397. }
  33398. function forceBreakChildren(node) {
  33399. return node.type === "element" && node.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
  33400. }
  33401. function preferHardlineAsLeadingSpaces(node) {
  33402. return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
  33403. }
  33404. function preferHardlineAsTrailingSpaces(node) {
  33405. return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
  33406. }
  33407. function hasSurroundingLineBreak(node) {
  33408. return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
  33409. }
  33410. function hasLeadingLineBreak(node) {
  33411. 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);
  33412. }
  33413. function hasTrailingLineBreak(node) {
  33414. 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);
  33415. }
  33416. function preferHardlineAsSurroundingSpaces(node) {
  33417. switch (node.type) {
  33418. case "ieConditionalComment":
  33419. case "comment":
  33420. case "directive":
  33421. return true;
  33422. case "element":
  33423. return ["script", "select"].includes(node.name);
  33424. }
  33425. return false;
  33426. }
  33427. function getLastDescendant(node) {
  33428. return node.lastChild ? getLastDescendant(node.lastChild) : node;
  33429. }
  33430. function hasNonTextChild(node) {
  33431. return node.children && node.children.some((child) => child.type !== "text");
  33432. }
  33433. function _inferScriptParser(node) {
  33434. const {
  33435. type,
  33436. lang
  33437. } = node.attrMap;
  33438. if (type === "module" || type === "text/javascript" || type === "text/babel" || type === "application/javascript" || lang === "jsx") {
  33439. return "babel";
  33440. }
  33441. if (type === "application/x-typescript" || lang === "ts" || lang === "tsx") {
  33442. return "typescript";
  33443. }
  33444. if (type === "text/markdown") {
  33445. return "markdown";
  33446. }
  33447. if (type === "text/html") {
  33448. return "html";
  33449. }
  33450. if (type && (type.endsWith("json") || type.endsWith("importmap")) || type === "speculationrules") {
  33451. return "json";
  33452. }
  33453. if (type === "text/x-handlebars-template") {
  33454. return "glimmer";
  33455. }
  33456. }
  33457. function inferStyleParser(node, options) {
  33458. const {
  33459. lang
  33460. } = node.attrMap;
  33461. if (!lang || lang === "postcss" || lang === "css") {
  33462. return "css";
  33463. }
  33464. if (lang === "scss") {
  33465. return "scss";
  33466. }
  33467. if (lang === "less") {
  33468. return "less";
  33469. }
  33470. if (lang === "stylus") {
  33471. return inferParserByLanguage("stylus", options);
  33472. }
  33473. }
  33474. function inferScriptParser(node, options) {
  33475. if (node.name === "script" && !node.attrMap.src) {
  33476. if (!node.attrMap.lang && !node.attrMap.type) {
  33477. return "babel";
  33478. }
  33479. return _inferScriptParser(node);
  33480. }
  33481. if (node.name === "style") {
  33482. return inferStyleParser(node, options);
  33483. }
  33484. if (options && isVueNonHtmlBlock(node, options)) {
  33485. return _inferScriptParser(node) || !("src" in node.attrMap) && inferParserByLanguage(node.attrMap.lang, options);
  33486. }
  33487. }
  33488. function isBlockLikeCssDisplay(cssDisplay) {
  33489. return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
  33490. }
  33491. function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  33492. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  33493. }
  33494. function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  33495. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  33496. }
  33497. function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
  33498. return !isBlockLikeCssDisplay(cssDisplay);
  33499. }
  33500. function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
  33501. return !isBlockLikeCssDisplay(cssDisplay);
  33502. }
  33503. function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
  33504. return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
  33505. }
  33506. function isPreLikeNode(node) {
  33507. return getNodeCssStyleWhiteSpace(node).startsWith("pre");
  33508. }
  33509. function countParents(path, predicate) {
  33510. let counter = 0;
  33511. for (let i = path.stack.length - 1; i >= 0; i--) {
  33512. const value = path.stack[i];
  33513. if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
  33514. counter++;
  33515. }
  33516. }
  33517. return counter;
  33518. }
  33519. function hasParent(node, fn) {
  33520. let current = node;
  33521. while (current) {
  33522. if (fn(current)) {
  33523. return true;
  33524. }
  33525. current = current.parent;
  33526. }
  33527. return false;
  33528. }
  33529. function getNodeCssStyleDisplay(node, options) {
  33530. if (node.prev && node.prev.type === "comment") {
  33531. const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
  33532. if (match) {
  33533. return match[1];
  33534. }
  33535. }
  33536. let isInSvgForeignObject = false;
  33537. if (node.type === "element" && node.namespace === "svg") {
  33538. if (hasParent(node, (parent) => parent.fullName === "svg:foreignObject")) {
  33539. isInSvgForeignObject = true;
  33540. } else {
  33541. return node.name === "svg" ? "inline-block" : "block";
  33542. }
  33543. }
  33544. switch (options.htmlWhitespaceSensitivity) {
  33545. case "strict":
  33546. return "inline";
  33547. case "ignore":
  33548. return "block";
  33549. default: {
  33550. if (options.parser === "vue" && node.parent && node.parent.type === "root") {
  33551. return "block";
  33552. }
  33553. return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
  33554. }
  33555. }
  33556. }
  33557. function getNodeCssStyleWhiteSpace(node) {
  33558. return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
  33559. }
  33560. function getMinIndentation(text) {
  33561. let minIndentation = Number.POSITIVE_INFINITY;
  33562. for (const lineText of text.split("\n")) {
  33563. if (lineText.length === 0) {
  33564. continue;
  33565. }
  33566. if (!HTML_WHITESPACE.has(lineText[0])) {
  33567. return 0;
  33568. }
  33569. const indentation = getLeadingHtmlWhitespace(lineText).length;
  33570. if (lineText.length === indentation) {
  33571. continue;
  33572. }
  33573. if (indentation < minIndentation) {
  33574. minIndentation = indentation;
  33575. }
  33576. }
  33577. return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
  33578. }
  33579. function dedentString(text, minIndent = getMinIndentation(text)) {
  33580. return minIndent === 0 ? text : text.split("\n").map((lineText) => lineText.slice(minIndent)).join("\n");
  33581. }
  33582. function countChars(text, char) {
  33583. let counter = 0;
  33584. for (let i = 0; i < text.length; i++) {
  33585. if (text[i] === char) {
  33586. counter++;
  33587. }
  33588. }
  33589. return counter;
  33590. }
  33591. function unescapeQuoteEntities(text) {
  33592. return text.replace(/&apos;/g, "'").replace(/&quot;/g, '"');
  33593. }
  33594. var vueRootElementsSet = /* @__PURE__ */ new Set(["template", "style", "script"]);
  33595. function isVueCustomBlock(node, options) {
  33596. return isVueSfcBlock(node, options) && !vueRootElementsSet.has(node.fullName);
  33597. }
  33598. function isVueSfcBlock(node, options) {
  33599. return options.parser === "vue" && node.type === "element" && node.parent.type === "root" && node.fullName.toLowerCase() !== "html";
  33600. }
  33601. function isVueNonHtmlBlock(node, options) {
  33602. return isVueSfcBlock(node, options) && (isVueCustomBlock(node, options) || node.attrMap.lang && node.attrMap.lang !== "html");
  33603. }
  33604. function isVueSlotAttribute(attribute) {
  33605. const attributeName = attribute.fullName;
  33606. return attributeName.charAt(0) === "#" || attributeName === "slot-scope" || attributeName === "v-slot" || attributeName.startsWith("v-slot:");
  33607. }
  33608. function isVueSfcBindingsAttribute(attribute, options) {
  33609. const element = attribute.parent;
  33610. if (!isVueSfcBlock(element, options)) {
  33611. return false;
  33612. }
  33613. const tagName = element.fullName;
  33614. const attributeName = attribute.fullName;
  33615. return tagName === "script" && attributeName === "setup" || tagName === "style" && attributeName === "vars";
  33616. }
  33617. function getTextValueParts(node, value = node.value) {
  33618. return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceTextEndOfLine(value) : replaceTextEndOfLine(dedentString(htmlTrimPreserveIndentation(value)), hardline) : getDocParts(join(line, splitByHtmlWhitespace(value)));
  33619. }
  33620. function isVueScriptTag(node, options) {
  33621. return isVueSfcBlock(node, options) && node.name === "script";
  33622. }
  33623. module2.exports = {
  33624. htmlTrim,
  33625. htmlTrimPreserveIndentation,
  33626. hasHtmlWhitespace,
  33627. getLeadingAndTrailingHtmlWhitespace,
  33628. canHaveInterpolation,
  33629. countChars,
  33630. countParents,
  33631. dedentString,
  33632. forceBreakChildren,
  33633. forceBreakContent,
  33634. forceNextEmptyLine,
  33635. getLastDescendant,
  33636. getNodeCssStyleDisplay,
  33637. getNodeCssStyleWhiteSpace,
  33638. hasPrettierIgnore,
  33639. inferScriptParser,
  33640. isVueCustomBlock,
  33641. isVueNonHtmlBlock,
  33642. isVueScriptTag,
  33643. isVueSlotAttribute,
  33644. isVueSfcBindingsAttribute,
  33645. isVueSfcBlock,
  33646. isDanglingSpaceSensitiveNode,
  33647. isIndentationSensitiveNode,
  33648. isLeadingSpaceSensitiveNode,
  33649. isPreLikeNode,
  33650. isScriptLikeTag,
  33651. isTextLikeNode,
  33652. isTrailingSpaceSensitiveNode,
  33653. isWhitespaceSensitiveNode,
  33654. isUnknownNamespace,
  33655. preferHardlineAsLeadingSpaces,
  33656. preferHardlineAsTrailingSpaces,
  33657. shouldPreserveContent,
  33658. unescapeQuoteEntities,
  33659. getTextValueParts
  33660. };
  33661. }
  33662. });
  33663. var require_chars = __commonJS2({
  33664. "node_modules/angular-html-parser/lib/compiler/src/chars.js"(exports2) {
  33665. "use strict";
  33666. Object.defineProperty(exports2, "__esModule", {
  33667. value: true
  33668. });
  33669. exports2.$EOF = 0;
  33670. exports2.$BSPACE = 8;
  33671. exports2.$TAB = 9;
  33672. exports2.$LF = 10;
  33673. exports2.$VTAB = 11;
  33674. exports2.$FF = 12;
  33675. exports2.$CR = 13;
  33676. exports2.$SPACE = 32;
  33677. exports2.$BANG = 33;
  33678. exports2.$DQ = 34;
  33679. exports2.$HASH = 35;
  33680. exports2.$$ = 36;
  33681. exports2.$PERCENT = 37;
  33682. exports2.$AMPERSAND = 38;
  33683. exports2.$SQ = 39;
  33684. exports2.$LPAREN = 40;
  33685. exports2.$RPAREN = 41;
  33686. exports2.$STAR = 42;
  33687. exports2.$PLUS = 43;
  33688. exports2.$COMMA = 44;
  33689. exports2.$MINUS = 45;
  33690. exports2.$PERIOD = 46;
  33691. exports2.$SLASH = 47;
  33692. exports2.$COLON = 58;
  33693. exports2.$SEMICOLON = 59;
  33694. exports2.$LT = 60;
  33695. exports2.$EQ = 61;
  33696. exports2.$GT = 62;
  33697. exports2.$QUESTION = 63;
  33698. exports2.$0 = 48;
  33699. exports2.$7 = 55;
  33700. exports2.$9 = 57;
  33701. exports2.$A = 65;
  33702. exports2.$E = 69;
  33703. exports2.$F = 70;
  33704. exports2.$X = 88;
  33705. exports2.$Z = 90;
  33706. exports2.$LBRACKET = 91;
  33707. exports2.$BACKSLASH = 92;
  33708. exports2.$RBRACKET = 93;
  33709. exports2.$CARET = 94;
  33710. exports2.$_ = 95;
  33711. exports2.$a = 97;
  33712. exports2.$b = 98;
  33713. exports2.$e = 101;
  33714. exports2.$f = 102;
  33715. exports2.$n = 110;
  33716. exports2.$r = 114;
  33717. exports2.$t = 116;
  33718. exports2.$u = 117;
  33719. exports2.$v = 118;
  33720. exports2.$x = 120;
  33721. exports2.$z = 122;
  33722. exports2.$LBRACE = 123;
  33723. exports2.$BAR = 124;
  33724. exports2.$RBRACE = 125;
  33725. exports2.$NBSP = 160;
  33726. exports2.$PIPE = 124;
  33727. exports2.$TILDA = 126;
  33728. exports2.$AT = 64;
  33729. exports2.$BT = 96;
  33730. function isWhitespace(code) {
  33731. return code >= exports2.$TAB && code <= exports2.$SPACE || code == exports2.$NBSP;
  33732. }
  33733. exports2.isWhitespace = isWhitespace;
  33734. function isDigit(code) {
  33735. return exports2.$0 <= code && code <= exports2.$9;
  33736. }
  33737. exports2.isDigit = isDigit;
  33738. function isAsciiLetter(code) {
  33739. return code >= exports2.$a && code <= exports2.$z || code >= exports2.$A && code <= exports2.$Z;
  33740. }
  33741. exports2.isAsciiLetter = isAsciiLetter;
  33742. function isAsciiHexDigit(code) {
  33743. return code >= exports2.$a && code <= exports2.$f || code >= exports2.$A && code <= exports2.$F || isDigit(code);
  33744. }
  33745. exports2.isAsciiHexDigit = isAsciiHexDigit;
  33746. function isNewLine(code) {
  33747. return code === exports2.$LF || code === exports2.$CR;
  33748. }
  33749. exports2.isNewLine = isNewLine;
  33750. function isOctalDigit(code) {
  33751. return exports2.$0 <= code && code <= exports2.$7;
  33752. }
  33753. exports2.isOctalDigit = isOctalDigit;
  33754. }
  33755. });
  33756. var require_static_symbol = __commonJS2({
  33757. "node_modules/angular-html-parser/lib/compiler/src/aot/static_symbol.js"(exports2) {
  33758. "use strict";
  33759. Object.defineProperty(exports2, "__esModule", {
  33760. value: true
  33761. });
  33762. var StaticSymbol = class {
  33763. constructor(filePath, name, members) {
  33764. this.filePath = filePath;
  33765. this.name = name;
  33766. this.members = members;
  33767. }
  33768. assertNoMembers() {
  33769. if (this.members.length) {
  33770. throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`);
  33771. }
  33772. }
  33773. };
  33774. exports2.StaticSymbol = StaticSymbol;
  33775. var StaticSymbolCache = class {
  33776. constructor() {
  33777. this.cache = /* @__PURE__ */ new Map();
  33778. }
  33779. get(declarationFile, name, members) {
  33780. members = members || [];
  33781. const memberSuffix = members.length ? `.${members.join(".")}` : "";
  33782. const key = `"${declarationFile}".${name}${memberSuffix}`;
  33783. let result = this.cache.get(key);
  33784. if (!result) {
  33785. result = new StaticSymbol(declarationFile, name, members);
  33786. this.cache.set(key, result);
  33787. }
  33788. return result;
  33789. }
  33790. };
  33791. exports2.StaticSymbolCache = StaticSymbolCache;
  33792. }
  33793. });
  33794. var require_util3 = __commonJS2({
  33795. "node_modules/angular-html-parser/lib/compiler/src/util.js"(exports2) {
  33796. "use strict";
  33797. Object.defineProperty(exports2, "__esModule", {
  33798. value: true
  33799. });
  33800. var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
  33801. function dashCaseToCamelCase(input) {
  33802. return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
  33803. }
  33804. exports2.dashCaseToCamelCase = dashCaseToCamelCase;
  33805. function splitAtColon(input, defaultValues) {
  33806. return _splitAt(input, ":", defaultValues);
  33807. }
  33808. exports2.splitAtColon = splitAtColon;
  33809. function splitAtPeriod(input, defaultValues) {
  33810. return _splitAt(input, ".", defaultValues);
  33811. }
  33812. exports2.splitAtPeriod = splitAtPeriod;
  33813. function _splitAt(input, character, defaultValues) {
  33814. const characterIndex = input.indexOf(character);
  33815. if (characterIndex == -1)
  33816. return defaultValues;
  33817. return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
  33818. }
  33819. function visitValue(value, visitor, context) {
  33820. if (Array.isArray(value)) {
  33821. return visitor.visitArray(value, context);
  33822. }
  33823. if (isStrictStringMap(value)) {
  33824. return visitor.visitStringMap(value, context);
  33825. }
  33826. if (value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean") {
  33827. return visitor.visitPrimitive(value, context);
  33828. }
  33829. return visitor.visitOther(value, context);
  33830. }
  33831. exports2.visitValue = visitValue;
  33832. function isDefined(val) {
  33833. return val !== null && val !== void 0;
  33834. }
  33835. exports2.isDefined = isDefined;
  33836. function noUndefined(val) {
  33837. return val === void 0 ? null : val;
  33838. }
  33839. exports2.noUndefined = noUndefined;
  33840. var ValueTransformer = class {
  33841. visitArray(arr, context) {
  33842. return arr.map((value) => visitValue(value, this, context));
  33843. }
  33844. visitStringMap(map, context) {
  33845. const result = {};
  33846. Object.keys(map).forEach((key) => {
  33847. result[key] = visitValue(map[key], this, context);
  33848. });
  33849. return result;
  33850. }
  33851. visitPrimitive(value, context) {
  33852. return value;
  33853. }
  33854. visitOther(value, context) {
  33855. return value;
  33856. }
  33857. };
  33858. exports2.ValueTransformer = ValueTransformer;
  33859. exports2.SyncAsync = {
  33860. assertSync: (value) => {
  33861. if (isPromise(value)) {
  33862. throw new Error(`Illegal state: value cannot be a promise`);
  33863. }
  33864. return value;
  33865. },
  33866. then: (value, cb) => {
  33867. return isPromise(value) ? value.then(cb) : cb(value);
  33868. },
  33869. all: (syncAsyncValues) => {
  33870. return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
  33871. }
  33872. };
  33873. function error(msg) {
  33874. throw new Error(`Internal Error: ${msg}`);
  33875. }
  33876. exports2.error = error;
  33877. function syntaxError(msg, parseErrors) {
  33878. const error2 = Error(msg);
  33879. error2[ERROR_SYNTAX_ERROR] = true;
  33880. if (parseErrors)
  33881. error2[ERROR_PARSE_ERRORS] = parseErrors;
  33882. return error2;
  33883. }
  33884. exports2.syntaxError = syntaxError;
  33885. var ERROR_SYNTAX_ERROR = "ngSyntaxError";
  33886. var ERROR_PARSE_ERRORS = "ngParseErrors";
  33887. function isSyntaxError(error2) {
  33888. return error2[ERROR_SYNTAX_ERROR];
  33889. }
  33890. exports2.isSyntaxError = isSyntaxError;
  33891. function getParseErrors(error2) {
  33892. return error2[ERROR_PARSE_ERRORS] || [];
  33893. }
  33894. exports2.getParseErrors = getParseErrors;
  33895. function escapeRegExp(s) {
  33896. return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
  33897. }
  33898. exports2.escapeRegExp = escapeRegExp;
  33899. var STRING_MAP_PROTO = Object.getPrototypeOf({});
  33900. function isStrictStringMap(obj) {
  33901. return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
  33902. }
  33903. function utf8Encode(str) {
  33904. let encoded = "";
  33905. for (let index = 0; index < str.length; index++) {
  33906. let codePoint = str.charCodeAt(index);
  33907. if (codePoint >= 55296 && codePoint <= 56319 && str.length > index + 1) {
  33908. const low = str.charCodeAt(index + 1);
  33909. if (low >= 56320 && low <= 57343) {
  33910. index++;
  33911. codePoint = (codePoint - 55296 << 10) + low - 56320 + 65536;
  33912. }
  33913. }
  33914. if (codePoint <= 127) {
  33915. encoded += String.fromCharCode(codePoint);
  33916. } else if (codePoint <= 2047) {
  33917. encoded += String.fromCharCode(codePoint >> 6 & 31 | 192, codePoint & 63 | 128);
  33918. } else if (codePoint <= 65535) {
  33919. encoded += String.fromCharCode(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  33920. } else if (codePoint <= 2097151) {
  33921. encoded += String.fromCharCode(codePoint >> 18 & 7 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
  33922. }
  33923. }
  33924. return encoded;
  33925. }
  33926. exports2.utf8Encode = utf8Encode;
  33927. function stringify(token) {
  33928. if (typeof token === "string") {
  33929. return token;
  33930. }
  33931. if (token instanceof Array) {
  33932. return "[" + token.map(stringify).join(", ") + "]";
  33933. }
  33934. if (token == null) {
  33935. return "" + token;
  33936. }
  33937. if (token.overriddenName) {
  33938. return `${token.overriddenName}`;
  33939. }
  33940. if (token.name) {
  33941. return `${token.name}`;
  33942. }
  33943. if (!token.toString) {
  33944. return "object";
  33945. }
  33946. const res = token.toString();
  33947. if (res == null) {
  33948. return "" + res;
  33949. }
  33950. const newLineIndex = res.indexOf("\n");
  33951. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  33952. }
  33953. exports2.stringify = stringify;
  33954. function resolveForwardRef(type) {
  33955. if (typeof type === "function" && type.hasOwnProperty("__forward_ref__")) {
  33956. return type();
  33957. } else {
  33958. return type;
  33959. }
  33960. }
  33961. exports2.resolveForwardRef = resolveForwardRef;
  33962. function isPromise(obj) {
  33963. return !!obj && typeof obj.then === "function";
  33964. }
  33965. exports2.isPromise = isPromise;
  33966. var Version = class {
  33967. constructor(full) {
  33968. this.full = full;
  33969. const splits = full.split(".");
  33970. this.major = splits[0];
  33971. this.minor = splits[1];
  33972. this.patch = splits.slice(2).join(".");
  33973. }
  33974. };
  33975. exports2.Version = Version;
  33976. var __window = typeof window !== "undefined" && window;
  33977. var __self = typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self;
  33978. var __global = typeof global !== "undefined" && global;
  33979. var _global = __global || __window || __self;
  33980. exports2.global = _global;
  33981. }
  33982. });
  33983. var require_compile_metadata = __commonJS2({
  33984. "node_modules/angular-html-parser/lib/compiler/src/compile_metadata.js"(exports2) {
  33985. "use strict";
  33986. Object.defineProperty(exports2, "__esModule", {
  33987. value: true
  33988. });
  33989. var static_symbol_1 = require_static_symbol();
  33990. var util_1 = require_util3();
  33991. var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  33992. function sanitizeIdentifier(name) {
  33993. return name.replace(/\W/g, "_");
  33994. }
  33995. exports2.sanitizeIdentifier = sanitizeIdentifier;
  33996. var _anonymousTypeIndex = 0;
  33997. function identifierName(compileIdentifier) {
  33998. if (!compileIdentifier || !compileIdentifier.reference) {
  33999. return null;
  34000. }
  34001. const ref = compileIdentifier.reference;
  34002. if (ref instanceof static_symbol_1.StaticSymbol) {
  34003. return ref.name;
  34004. }
  34005. if (ref["__anonymousType"]) {
  34006. return ref["__anonymousType"];
  34007. }
  34008. let identifier = util_1.stringify(ref);
  34009. if (identifier.indexOf("(") >= 0) {
  34010. identifier = `anonymous_${_anonymousTypeIndex++}`;
  34011. ref["__anonymousType"] = identifier;
  34012. } else {
  34013. identifier = sanitizeIdentifier(identifier);
  34014. }
  34015. return identifier;
  34016. }
  34017. exports2.identifierName = identifierName;
  34018. function identifierModuleUrl(compileIdentifier) {
  34019. const ref = compileIdentifier.reference;
  34020. if (ref instanceof static_symbol_1.StaticSymbol) {
  34021. return ref.filePath;
  34022. }
  34023. return `./${util_1.stringify(ref)}`;
  34024. }
  34025. exports2.identifierModuleUrl = identifierModuleUrl;
  34026. function viewClassName(compType, embeddedTemplateIndex) {
  34027. return `View_${identifierName({
  34028. reference: compType
  34029. })}_${embeddedTemplateIndex}`;
  34030. }
  34031. exports2.viewClassName = viewClassName;
  34032. function rendererTypeName(compType) {
  34033. return `RenderType_${identifierName({
  34034. reference: compType
  34035. })}`;
  34036. }
  34037. exports2.rendererTypeName = rendererTypeName;
  34038. function hostViewClassName(compType) {
  34039. return `HostView_${identifierName({
  34040. reference: compType
  34041. })}`;
  34042. }
  34043. exports2.hostViewClassName = hostViewClassName;
  34044. function componentFactoryName(compType) {
  34045. return `${identifierName({
  34046. reference: compType
  34047. })}NgFactory`;
  34048. }
  34049. exports2.componentFactoryName = componentFactoryName;
  34050. var CompileSummaryKind;
  34051. (function(CompileSummaryKind2) {
  34052. CompileSummaryKind2[CompileSummaryKind2["Pipe"] = 0] = "Pipe";
  34053. CompileSummaryKind2[CompileSummaryKind2["Directive"] = 1] = "Directive";
  34054. CompileSummaryKind2[CompileSummaryKind2["NgModule"] = 2] = "NgModule";
  34055. CompileSummaryKind2[CompileSummaryKind2["Injectable"] = 3] = "Injectable";
  34056. })(CompileSummaryKind = exports2.CompileSummaryKind || (exports2.CompileSummaryKind = {}));
  34057. function tokenName(token) {
  34058. return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
  34059. }
  34060. exports2.tokenName = tokenName;
  34061. function tokenReference(token) {
  34062. if (token.identifier != null) {
  34063. return token.identifier.reference;
  34064. } else {
  34065. return token.value;
  34066. }
  34067. }
  34068. exports2.tokenReference = tokenReference;
  34069. var CompileStylesheetMetadata = class {
  34070. constructor({
  34071. moduleUrl,
  34072. styles,
  34073. styleUrls
  34074. } = {}) {
  34075. this.moduleUrl = moduleUrl || null;
  34076. this.styles = _normalizeArray(styles);
  34077. this.styleUrls = _normalizeArray(styleUrls);
  34078. }
  34079. };
  34080. exports2.CompileStylesheetMetadata = CompileStylesheetMetadata;
  34081. var CompileTemplateMetadata = class {
  34082. constructor({
  34083. encapsulation,
  34084. template,
  34085. templateUrl,
  34086. htmlAst,
  34087. styles,
  34088. styleUrls,
  34089. externalStylesheets,
  34090. animations,
  34091. ngContentSelectors,
  34092. interpolation,
  34093. isInline,
  34094. preserveWhitespaces
  34095. }) {
  34096. this.encapsulation = encapsulation;
  34097. this.template = template;
  34098. this.templateUrl = templateUrl;
  34099. this.htmlAst = htmlAst;
  34100. this.styles = _normalizeArray(styles);
  34101. this.styleUrls = _normalizeArray(styleUrls);
  34102. this.externalStylesheets = _normalizeArray(externalStylesheets);
  34103. this.animations = animations ? flatten(animations) : [];
  34104. this.ngContentSelectors = ngContentSelectors || [];
  34105. if (interpolation && interpolation.length != 2) {
  34106. throw new Error(`'interpolation' should have a start and an end symbol.`);
  34107. }
  34108. this.interpolation = interpolation;
  34109. this.isInline = isInline;
  34110. this.preserveWhitespaces = preserveWhitespaces;
  34111. }
  34112. toSummary() {
  34113. return {
  34114. ngContentSelectors: this.ngContentSelectors,
  34115. encapsulation: this.encapsulation,
  34116. styles: this.styles,
  34117. animations: this.animations
  34118. };
  34119. }
  34120. };
  34121. exports2.CompileTemplateMetadata = CompileTemplateMetadata;
  34122. var CompileDirectiveMetadata = class {
  34123. static create({
  34124. isHost,
  34125. type,
  34126. isComponent,
  34127. selector,
  34128. exportAs,
  34129. changeDetection,
  34130. inputs,
  34131. outputs,
  34132. host,
  34133. providers,
  34134. viewProviders,
  34135. queries,
  34136. guards,
  34137. viewQueries,
  34138. entryComponents,
  34139. template,
  34140. componentViewType,
  34141. rendererType,
  34142. componentFactory
  34143. }) {
  34144. const hostListeners = {};
  34145. const hostProperties = {};
  34146. const hostAttributes = {};
  34147. if (host != null) {
  34148. Object.keys(host).forEach((key) => {
  34149. const value = host[key];
  34150. const matches = key.match(HOST_REG_EXP);
  34151. if (matches === null) {
  34152. hostAttributes[key] = value;
  34153. } else if (matches[1] != null) {
  34154. hostProperties[matches[1]] = value;
  34155. } else if (matches[2] != null) {
  34156. hostListeners[matches[2]] = value;
  34157. }
  34158. });
  34159. }
  34160. const inputsMap = {};
  34161. if (inputs != null) {
  34162. inputs.forEach((bindConfig) => {
  34163. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  34164. inputsMap[parts[0]] = parts[1];
  34165. });
  34166. }
  34167. const outputsMap = {};
  34168. if (outputs != null) {
  34169. outputs.forEach((bindConfig) => {
  34170. const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
  34171. outputsMap[parts[0]] = parts[1];
  34172. });
  34173. }
  34174. return new CompileDirectiveMetadata({
  34175. isHost,
  34176. type,
  34177. isComponent: !!isComponent,
  34178. selector,
  34179. exportAs,
  34180. changeDetection,
  34181. inputs: inputsMap,
  34182. outputs: outputsMap,
  34183. hostListeners,
  34184. hostProperties,
  34185. hostAttributes,
  34186. providers,
  34187. viewProviders,
  34188. queries,
  34189. guards,
  34190. viewQueries,
  34191. entryComponents,
  34192. template,
  34193. componentViewType,
  34194. rendererType,
  34195. componentFactory
  34196. });
  34197. }
  34198. constructor({
  34199. isHost,
  34200. type,
  34201. isComponent,
  34202. selector,
  34203. exportAs,
  34204. changeDetection,
  34205. inputs,
  34206. outputs,
  34207. hostListeners,
  34208. hostProperties,
  34209. hostAttributes,
  34210. providers,
  34211. viewProviders,
  34212. queries,
  34213. guards,
  34214. viewQueries,
  34215. entryComponents,
  34216. template,
  34217. componentViewType,
  34218. rendererType,
  34219. componentFactory
  34220. }) {
  34221. this.isHost = !!isHost;
  34222. this.type = type;
  34223. this.isComponent = isComponent;
  34224. this.selector = selector;
  34225. this.exportAs = exportAs;
  34226. this.changeDetection = changeDetection;
  34227. this.inputs = inputs;
  34228. this.outputs = outputs;
  34229. this.hostListeners = hostListeners;
  34230. this.hostProperties = hostProperties;
  34231. this.hostAttributes = hostAttributes;
  34232. this.providers = _normalizeArray(providers);
  34233. this.viewProviders = _normalizeArray(viewProviders);
  34234. this.queries = _normalizeArray(queries);
  34235. this.guards = guards;
  34236. this.viewQueries = _normalizeArray(viewQueries);
  34237. this.entryComponents = _normalizeArray(entryComponents);
  34238. this.template = template;
  34239. this.componentViewType = componentViewType;
  34240. this.rendererType = rendererType;
  34241. this.componentFactory = componentFactory;
  34242. }
  34243. toSummary() {
  34244. return {
  34245. summaryKind: CompileSummaryKind.Directive,
  34246. type: this.type,
  34247. isComponent: this.isComponent,
  34248. selector: this.selector,
  34249. exportAs: this.exportAs,
  34250. inputs: this.inputs,
  34251. outputs: this.outputs,
  34252. hostListeners: this.hostListeners,
  34253. hostProperties: this.hostProperties,
  34254. hostAttributes: this.hostAttributes,
  34255. providers: this.providers,
  34256. viewProviders: this.viewProviders,
  34257. queries: this.queries,
  34258. guards: this.guards,
  34259. viewQueries: this.viewQueries,
  34260. entryComponents: this.entryComponents,
  34261. changeDetection: this.changeDetection,
  34262. template: this.template && this.template.toSummary(),
  34263. componentViewType: this.componentViewType,
  34264. rendererType: this.rendererType,
  34265. componentFactory: this.componentFactory
  34266. };
  34267. }
  34268. };
  34269. exports2.CompileDirectiveMetadata = CompileDirectiveMetadata;
  34270. var CompilePipeMetadata = class {
  34271. constructor({
  34272. type,
  34273. name,
  34274. pure
  34275. }) {
  34276. this.type = type;
  34277. this.name = name;
  34278. this.pure = !!pure;
  34279. }
  34280. toSummary() {
  34281. return {
  34282. summaryKind: CompileSummaryKind.Pipe,
  34283. type: this.type,
  34284. name: this.name,
  34285. pure: this.pure
  34286. };
  34287. }
  34288. };
  34289. exports2.CompilePipeMetadata = CompilePipeMetadata;
  34290. var CompileShallowModuleMetadata = class {
  34291. };
  34292. exports2.CompileShallowModuleMetadata = CompileShallowModuleMetadata;
  34293. var CompileNgModuleMetadata = class {
  34294. constructor({
  34295. type,
  34296. providers,
  34297. declaredDirectives,
  34298. exportedDirectives,
  34299. declaredPipes,
  34300. exportedPipes,
  34301. entryComponents,
  34302. bootstrapComponents,
  34303. importedModules,
  34304. exportedModules,
  34305. schemas,
  34306. transitiveModule,
  34307. id
  34308. }) {
  34309. this.type = type || null;
  34310. this.declaredDirectives = _normalizeArray(declaredDirectives);
  34311. this.exportedDirectives = _normalizeArray(exportedDirectives);
  34312. this.declaredPipes = _normalizeArray(declaredPipes);
  34313. this.exportedPipes = _normalizeArray(exportedPipes);
  34314. this.providers = _normalizeArray(providers);
  34315. this.entryComponents = _normalizeArray(entryComponents);
  34316. this.bootstrapComponents = _normalizeArray(bootstrapComponents);
  34317. this.importedModules = _normalizeArray(importedModules);
  34318. this.exportedModules = _normalizeArray(exportedModules);
  34319. this.schemas = _normalizeArray(schemas);
  34320. this.id = id || null;
  34321. this.transitiveModule = transitiveModule || null;
  34322. }
  34323. toSummary() {
  34324. const module3 = this.transitiveModule;
  34325. return {
  34326. summaryKind: CompileSummaryKind.NgModule,
  34327. type: this.type,
  34328. entryComponents: module3.entryComponents,
  34329. providers: module3.providers,
  34330. modules: module3.modules,
  34331. exportedDirectives: module3.exportedDirectives,
  34332. exportedPipes: module3.exportedPipes
  34333. };
  34334. }
  34335. };
  34336. exports2.CompileNgModuleMetadata = CompileNgModuleMetadata;
  34337. var TransitiveCompileNgModuleMetadata = class {
  34338. constructor() {
  34339. this.directivesSet = /* @__PURE__ */ new Set();
  34340. this.directives = [];
  34341. this.exportedDirectivesSet = /* @__PURE__ */ new Set();
  34342. this.exportedDirectives = [];
  34343. this.pipesSet = /* @__PURE__ */ new Set();
  34344. this.pipes = [];
  34345. this.exportedPipesSet = /* @__PURE__ */ new Set();
  34346. this.exportedPipes = [];
  34347. this.modulesSet = /* @__PURE__ */ new Set();
  34348. this.modules = [];
  34349. this.entryComponentsSet = /* @__PURE__ */ new Set();
  34350. this.entryComponents = [];
  34351. this.providers = [];
  34352. }
  34353. addProvider(provider, module3) {
  34354. this.providers.push({
  34355. provider,
  34356. module: module3
  34357. });
  34358. }
  34359. addDirective(id) {
  34360. if (!this.directivesSet.has(id.reference)) {
  34361. this.directivesSet.add(id.reference);
  34362. this.directives.push(id);
  34363. }
  34364. }
  34365. addExportedDirective(id) {
  34366. if (!this.exportedDirectivesSet.has(id.reference)) {
  34367. this.exportedDirectivesSet.add(id.reference);
  34368. this.exportedDirectives.push(id);
  34369. }
  34370. }
  34371. addPipe(id) {
  34372. if (!this.pipesSet.has(id.reference)) {
  34373. this.pipesSet.add(id.reference);
  34374. this.pipes.push(id);
  34375. }
  34376. }
  34377. addExportedPipe(id) {
  34378. if (!this.exportedPipesSet.has(id.reference)) {
  34379. this.exportedPipesSet.add(id.reference);
  34380. this.exportedPipes.push(id);
  34381. }
  34382. }
  34383. addModule(id) {
  34384. if (!this.modulesSet.has(id.reference)) {
  34385. this.modulesSet.add(id.reference);
  34386. this.modules.push(id);
  34387. }
  34388. }
  34389. addEntryComponent(ec) {
  34390. if (!this.entryComponentsSet.has(ec.componentType)) {
  34391. this.entryComponentsSet.add(ec.componentType);
  34392. this.entryComponents.push(ec);
  34393. }
  34394. }
  34395. };
  34396. exports2.TransitiveCompileNgModuleMetadata = TransitiveCompileNgModuleMetadata;
  34397. function _normalizeArray(obj) {
  34398. return obj || [];
  34399. }
  34400. var ProviderMeta = class {
  34401. constructor(token, {
  34402. useClass,
  34403. useValue,
  34404. useExisting,
  34405. useFactory,
  34406. deps,
  34407. multi
  34408. }) {
  34409. this.token = token;
  34410. this.useClass = useClass || null;
  34411. this.useValue = useValue;
  34412. this.useExisting = useExisting;
  34413. this.useFactory = useFactory || null;
  34414. this.dependencies = deps || null;
  34415. this.multi = !!multi;
  34416. }
  34417. };
  34418. exports2.ProviderMeta = ProviderMeta;
  34419. function flatten(list) {
  34420. return list.reduce((flat, item) => {
  34421. const flatItem = Array.isArray(item) ? flatten(item) : item;
  34422. return flat.concat(flatItem);
  34423. }, []);
  34424. }
  34425. exports2.flatten = flatten;
  34426. function jitSourceUrl(url) {
  34427. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, "ng:///");
  34428. }
  34429. function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
  34430. let url;
  34431. if (templateMeta.isInline) {
  34432. if (compMeta.type.reference instanceof static_symbol_1.StaticSymbol) {
  34433. url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
  34434. } else {
  34435. url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
  34436. }
  34437. } else {
  34438. url = templateMeta.templateUrl;
  34439. }
  34440. return compMeta.type.reference instanceof static_symbol_1.StaticSymbol ? url : jitSourceUrl(url);
  34441. }
  34442. exports2.templateSourceUrl = templateSourceUrl;
  34443. function sharedStylesheetJitUrl(meta, id) {
  34444. const pathParts = meta.moduleUrl.split(/\/\\/g);
  34445. const baseName = pathParts[pathParts.length - 1];
  34446. return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`);
  34447. }
  34448. exports2.sharedStylesheetJitUrl = sharedStylesheetJitUrl;
  34449. function ngModuleJitUrl(moduleMeta) {
  34450. return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`);
  34451. }
  34452. exports2.ngModuleJitUrl = ngModuleJitUrl;
  34453. function templateJitUrl(ngModuleType, compMeta) {
  34454. return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`);
  34455. }
  34456. exports2.templateJitUrl = templateJitUrl;
  34457. }
  34458. });
  34459. var require_parse_util = __commonJS2({
  34460. "node_modules/angular-html-parser/lib/compiler/src/parse_util.js"(exports2) {
  34461. "use strict";
  34462. Object.defineProperty(exports2, "__esModule", {
  34463. value: true
  34464. });
  34465. var chars = require_chars();
  34466. var compile_metadata_1 = require_compile_metadata();
  34467. var ParseLocation = class {
  34468. constructor(file, offset, line, col) {
  34469. this.file = file;
  34470. this.offset = offset;
  34471. this.line = line;
  34472. this.col = col;
  34473. }
  34474. toString() {
  34475. return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
  34476. }
  34477. moveBy(delta) {
  34478. const source = this.file.content;
  34479. const len = source.length;
  34480. let offset = this.offset;
  34481. let line = this.line;
  34482. let col = this.col;
  34483. while (offset > 0 && delta < 0) {
  34484. offset--;
  34485. delta++;
  34486. const ch = source.charCodeAt(offset);
  34487. if (ch == chars.$LF) {
  34488. line--;
  34489. const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode(chars.$LF));
  34490. col = priorLine > 0 ? offset - priorLine : offset;
  34491. } else {
  34492. col--;
  34493. }
  34494. }
  34495. while (offset < len && delta > 0) {
  34496. const ch = source.charCodeAt(offset);
  34497. offset++;
  34498. delta--;
  34499. if (ch == chars.$LF) {
  34500. line++;
  34501. col = 0;
  34502. } else {
  34503. col++;
  34504. }
  34505. }
  34506. return new ParseLocation(this.file, offset, line, col);
  34507. }
  34508. getContext(maxChars, maxLines) {
  34509. const content = this.file.content;
  34510. let startOffset = this.offset;
  34511. if (startOffset != null) {
  34512. if (startOffset > content.length - 1) {
  34513. startOffset = content.length - 1;
  34514. }
  34515. let endOffset = startOffset;
  34516. let ctxChars = 0;
  34517. let ctxLines = 0;
  34518. while (ctxChars < maxChars && startOffset > 0) {
  34519. startOffset--;
  34520. ctxChars++;
  34521. if (content[startOffset] == "\n") {
  34522. if (++ctxLines == maxLines) {
  34523. break;
  34524. }
  34525. }
  34526. }
  34527. ctxChars = 0;
  34528. ctxLines = 0;
  34529. while (ctxChars < maxChars && endOffset < content.length - 1) {
  34530. endOffset++;
  34531. ctxChars++;
  34532. if (content[endOffset] == "\n") {
  34533. if (++ctxLines == maxLines) {
  34534. break;
  34535. }
  34536. }
  34537. }
  34538. return {
  34539. before: content.substring(startOffset, this.offset),
  34540. after: content.substring(this.offset, endOffset + 1)
  34541. };
  34542. }
  34543. return null;
  34544. }
  34545. };
  34546. exports2.ParseLocation = ParseLocation;
  34547. var ParseSourceFile = class {
  34548. constructor(content, url) {
  34549. this.content = content;
  34550. this.url = url;
  34551. }
  34552. };
  34553. exports2.ParseSourceFile = ParseSourceFile;
  34554. var ParseSourceSpan = class {
  34555. constructor(start, end, details = null) {
  34556. this.start = start;
  34557. this.end = end;
  34558. this.details = details;
  34559. }
  34560. toString() {
  34561. return this.start.file.content.substring(this.start.offset, this.end.offset);
  34562. }
  34563. };
  34564. exports2.ParseSourceSpan = ParseSourceSpan;
  34565. exports2.EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile("", ""), 0, 0, 0);
  34566. exports2.EMPTY_SOURCE_SPAN = new ParseSourceSpan(exports2.EMPTY_PARSE_LOCATION, exports2.EMPTY_PARSE_LOCATION);
  34567. var ParseErrorLevel;
  34568. (function(ParseErrorLevel2) {
  34569. ParseErrorLevel2[ParseErrorLevel2["WARNING"] = 0] = "WARNING";
  34570. ParseErrorLevel2[ParseErrorLevel2["ERROR"] = 1] = "ERROR";
  34571. })(ParseErrorLevel = exports2.ParseErrorLevel || (exports2.ParseErrorLevel = {}));
  34572. var ParseError = class {
  34573. constructor(span, msg, level = ParseErrorLevel.ERROR) {
  34574. this.span = span;
  34575. this.msg = msg;
  34576. this.level = level;
  34577. }
  34578. contextualMessage() {
  34579. const ctx = this.span.start.getContext(100, 3);
  34580. return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
  34581. }
  34582. toString() {
  34583. const details = this.span.details ? `, ${this.span.details}` : "";
  34584. return `${this.contextualMessage()}: ${this.span.start}${details}`;
  34585. }
  34586. };
  34587. exports2.ParseError = ParseError;
  34588. function typeSourceSpan(kind, type) {
  34589. const moduleUrl = compile_metadata_1.identifierModuleUrl(type);
  34590. const sourceFileName = moduleUrl != null ? `in ${kind} ${compile_metadata_1.identifierName(type)} in ${moduleUrl}` : `in ${kind} ${compile_metadata_1.identifierName(type)}`;
  34591. const sourceFile = new ParseSourceFile("", sourceFileName);
  34592. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  34593. }
  34594. exports2.typeSourceSpan = typeSourceSpan;
  34595. function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
  34596. const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
  34597. const sourceFile = new ParseSourceFile("", sourceFileName);
  34598. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  34599. }
  34600. exports2.r3JitTypeSourceSpan = r3JitTypeSourceSpan;
  34601. }
  34602. });
  34603. var require_print_preprocess3 = __commonJS2({
  34604. "src/language-html/print-preprocess.js"(exports2, module2) {
  34605. "use strict";
  34606. var {
  34607. ParseSourceSpan
  34608. } = require_parse_util();
  34609. var {
  34610. htmlTrim,
  34611. getLeadingAndTrailingHtmlWhitespace,
  34612. hasHtmlWhitespace,
  34613. canHaveInterpolation,
  34614. getNodeCssStyleDisplay,
  34615. isDanglingSpaceSensitiveNode,
  34616. isIndentationSensitiveNode,
  34617. isLeadingSpaceSensitiveNode,
  34618. isTrailingSpaceSensitiveNode,
  34619. isWhitespaceSensitiveNode,
  34620. isVueScriptTag
  34621. } = require_utils11();
  34622. var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIfConditionalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText, markTsScript];
  34623. function preprocess(ast, options) {
  34624. for (const fn of PREPROCESS_PIPELINE) {
  34625. fn(ast, options);
  34626. }
  34627. return ast;
  34628. }
  34629. function removeIgnorableFirstLf(ast) {
  34630. ast.walk((node) => {
  34631. if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
  34632. const text = node.children[0];
  34633. if (text.value.length === 1) {
  34634. node.removeChild(text);
  34635. } else {
  34636. text.value = text.value.slice(1);
  34637. }
  34638. }
  34639. });
  34640. }
  34641. function mergeIfConditionalStartEndCommentIntoElementOpeningTag(ast) {
  34642. 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;
  34643. ast.walk((node) => {
  34644. if (node.children) {
  34645. for (let i = 0; i < node.children.length; i++) {
  34646. const child = node.children[i];
  34647. if (!isTarget(child)) {
  34648. continue;
  34649. }
  34650. const ieConditionalStartComment = child.prev;
  34651. const ieConditionalEndComment = child.firstChild;
  34652. node.removeChild(ieConditionalStartComment);
  34653. i--;
  34654. const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
  34655. const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
  34656. child.condition = ieConditionalStartComment.condition;
  34657. child.sourceSpan = sourceSpan;
  34658. child.startSourceSpan = startSourceSpan;
  34659. child.removeChild(ieConditionalEndComment);
  34660. }
  34661. }
  34662. });
  34663. }
  34664. function mergeNodeIntoText(ast, shouldMerge, getValue) {
  34665. ast.walk((node) => {
  34666. if (node.children) {
  34667. for (let i = 0; i < node.children.length; i++) {
  34668. const child = node.children[i];
  34669. if (child.type !== "text" && !shouldMerge(child)) {
  34670. continue;
  34671. }
  34672. if (child.type !== "text") {
  34673. child.type = "text";
  34674. child.value = getValue(child);
  34675. }
  34676. const prevChild = child.prev;
  34677. if (!prevChild || prevChild.type !== "text") {
  34678. continue;
  34679. }
  34680. prevChild.value += child.value;
  34681. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, child.sourceSpan.end);
  34682. node.removeChild(child);
  34683. i--;
  34684. }
  34685. }
  34686. });
  34687. }
  34688. function mergeCdataIntoText(ast) {
  34689. return mergeNodeIntoText(ast, (node) => node.type === "cdata", (node) => `<![CDATA[${node.value}]]>`);
  34690. }
  34691. function mergeSimpleElementIntoText(ast) {
  34692. 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";
  34693. ast.walk((node) => {
  34694. if (node.children) {
  34695. for (let i = 0; i < node.children.length; i++) {
  34696. const child = node.children[i];
  34697. if (!isSimpleElement(child)) {
  34698. continue;
  34699. }
  34700. const prevChild = child.prev;
  34701. const nextChild = child.next;
  34702. prevChild.value += `<${child.rawName}>` + child.firstChild.value + `</${child.rawName}>` + nextChild.value;
  34703. prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, nextChild.sourceSpan.end);
  34704. prevChild.isTrailingSpaceSensitive = nextChild.isTrailingSpaceSensitive;
  34705. prevChild.hasTrailingSpaces = nextChild.hasTrailingSpaces;
  34706. node.removeChild(child);
  34707. i--;
  34708. node.removeChild(nextChild);
  34709. }
  34710. }
  34711. });
  34712. }
  34713. function extractInterpolation(ast, options) {
  34714. if (options.parser === "html") {
  34715. return;
  34716. }
  34717. const interpolationRegex = /{{(.+?)}}/s;
  34718. ast.walk((node) => {
  34719. if (!canHaveInterpolation(node)) {
  34720. return;
  34721. }
  34722. for (const child of node.children) {
  34723. if (child.type !== "text") {
  34724. continue;
  34725. }
  34726. let startSourceSpan = child.sourceSpan.start;
  34727. let endSourceSpan = null;
  34728. const components = child.value.split(interpolationRegex);
  34729. for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
  34730. const value = components[i];
  34731. if (i % 2 === 0) {
  34732. endSourceSpan = startSourceSpan.moveBy(value.length);
  34733. if (value.length > 0) {
  34734. node.insertChildBefore(child, {
  34735. type: "text",
  34736. value,
  34737. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
  34738. });
  34739. }
  34740. continue;
  34741. }
  34742. endSourceSpan = startSourceSpan.moveBy(value.length + 4);
  34743. node.insertChildBefore(child, {
  34744. type: "interpolation",
  34745. sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
  34746. children: value.length === 0 ? [] : [{
  34747. type: "text",
  34748. value,
  34749. sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
  34750. }]
  34751. });
  34752. }
  34753. node.removeChild(child);
  34754. }
  34755. });
  34756. }
  34757. function extractWhitespaces(ast) {
  34758. ast.walk((node) => {
  34759. if (!node.children) {
  34760. return;
  34761. }
  34762. if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim(node.children[0].value).length === 0) {
  34763. node.hasDanglingSpaces = node.children.length > 0;
  34764. node.children = [];
  34765. return;
  34766. }
  34767. const isWhitespaceSensitive = isWhitespaceSensitiveNode(node);
  34768. const isIndentationSensitive = isIndentationSensitiveNode(node);
  34769. if (!isWhitespaceSensitive) {
  34770. for (let i = 0; i < node.children.length; i++) {
  34771. const child = node.children[i];
  34772. if (child.type !== "text") {
  34773. continue;
  34774. }
  34775. const {
  34776. leadingWhitespace,
  34777. text,
  34778. trailingWhitespace
  34779. } = getLeadingAndTrailingHtmlWhitespace(child.value);
  34780. const prevChild = child.prev;
  34781. const nextChild = child.next;
  34782. if (!text) {
  34783. node.removeChild(child);
  34784. i--;
  34785. if (leadingWhitespace || trailingWhitespace) {
  34786. if (prevChild) {
  34787. prevChild.hasTrailingSpaces = true;
  34788. }
  34789. if (nextChild) {
  34790. nextChild.hasLeadingSpaces = true;
  34791. }
  34792. }
  34793. } else {
  34794. child.value = text;
  34795. child.sourceSpan = new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length));
  34796. if (leadingWhitespace) {
  34797. if (prevChild) {
  34798. prevChild.hasTrailingSpaces = true;
  34799. }
  34800. child.hasLeadingSpaces = true;
  34801. }
  34802. if (trailingWhitespace) {
  34803. child.hasTrailingSpaces = true;
  34804. if (nextChild) {
  34805. nextChild.hasLeadingSpaces = true;
  34806. }
  34807. }
  34808. }
  34809. }
  34810. }
  34811. node.isWhitespaceSensitive = isWhitespaceSensitive;
  34812. node.isIndentationSensitive = isIndentationSensitive;
  34813. });
  34814. }
  34815. function addIsSelfClosing(ast) {
  34816. ast.walk((node) => {
  34817. node.isSelfClosing = !node.children || node.type === "element" && (node.tagDefinition.isVoid || node.startSourceSpan === node.endSourceSpan);
  34818. });
  34819. }
  34820. function addHasHtmComponentClosingTag(ast, options) {
  34821. ast.walk((node) => {
  34822. if (node.type !== "element") {
  34823. return;
  34824. }
  34825. node.hasHtmComponentClosingTag = node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset));
  34826. });
  34827. }
  34828. function addCssDisplay(ast, options) {
  34829. ast.walk((node) => {
  34830. node.cssDisplay = getNodeCssStyleDisplay(node, options);
  34831. });
  34832. }
  34833. function addIsSpaceSensitive(ast, options) {
  34834. ast.walk((node) => {
  34835. const {
  34836. children
  34837. } = node;
  34838. if (!children) {
  34839. return;
  34840. }
  34841. if (children.length === 0) {
  34842. node.isDanglingSpaceSensitive = isDanglingSpaceSensitiveNode(node);
  34843. return;
  34844. }
  34845. for (const child of children) {
  34846. child.isLeadingSpaceSensitive = isLeadingSpaceSensitiveNode(child, options);
  34847. child.isTrailingSpaceSensitive = isTrailingSpaceSensitiveNode(child, options);
  34848. }
  34849. for (let index = 0; index < children.length; index++) {
  34850. const child = children[index];
  34851. child.isLeadingSpaceSensitive = index === 0 ? child.isLeadingSpaceSensitive : child.prev.isTrailingSpaceSensitive && child.isLeadingSpaceSensitive;
  34852. child.isTrailingSpaceSensitive = index === children.length - 1 ? child.isTrailingSpaceSensitive : child.next.isLeadingSpaceSensitive && child.isTrailingSpaceSensitive;
  34853. }
  34854. });
  34855. }
  34856. function markTsScript(ast, options) {
  34857. if (options.parser === "vue") {
  34858. const vueScriptTag = ast.children.find((child) => isVueScriptTag(child, options));
  34859. if (!vueScriptTag) {
  34860. return;
  34861. }
  34862. const {
  34863. lang
  34864. } = vueScriptTag.attrMap;
  34865. if (lang === "ts" || lang === "typescript") {
  34866. options.__should_parse_vue_template_with_ts = true;
  34867. }
  34868. }
  34869. }
  34870. module2.exports = preprocess;
  34871. }
  34872. });
  34873. var require_pragma5 = __commonJS2({
  34874. "src/language-html/pragma.js"(exports2, module2) {
  34875. "use strict";
  34876. function hasPragma(text) {
  34877. return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text);
  34878. }
  34879. function insertPragma(text) {
  34880. return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
  34881. }
  34882. module2.exports = {
  34883. hasPragma,
  34884. insertPragma
  34885. };
  34886. }
  34887. });
  34888. var require_loc6 = __commonJS2({
  34889. "src/language-html/loc.js"(exports2, module2) {
  34890. "use strict";
  34891. function locStart(node) {
  34892. return node.sourceSpan.start.offset;
  34893. }
  34894. function locEnd(node) {
  34895. return node.sourceSpan.end.offset;
  34896. }
  34897. module2.exports = {
  34898. locStart,
  34899. locEnd
  34900. };
  34901. }
  34902. });
  34903. var require_tag = __commonJS2({
  34904. "src/language-html/print/tag.js"(exports2, module2) {
  34905. "use strict";
  34906. var assert = require("assert");
  34907. var {
  34908. isNonEmptyArray
  34909. } = require_util();
  34910. var {
  34911. builders: {
  34912. indent,
  34913. join,
  34914. line,
  34915. softline,
  34916. hardline
  34917. },
  34918. utils: {
  34919. replaceTextEndOfLine
  34920. }
  34921. } = require("./doc.js");
  34922. var {
  34923. locStart,
  34924. locEnd
  34925. } = require_loc6();
  34926. var {
  34927. isTextLikeNode,
  34928. getLastDescendant,
  34929. isPreLikeNode,
  34930. hasPrettierIgnore,
  34931. shouldPreserveContent,
  34932. isVueSfcBlock
  34933. } = require_utils11();
  34934. function printClosingTag(node, options) {
  34935. return [node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)];
  34936. }
  34937. function printClosingTagStart(node, options) {
  34938. return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : [printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)];
  34939. }
  34940. function printClosingTagEnd(node, options) {
  34941. return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : [printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)];
  34942. }
  34943. function printClosingTagPrefix(node, options) {
  34944. return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
  34945. }
  34946. function printClosingTagSuffix(node, options) {
  34947. return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
  34948. }
  34949. function printClosingTagStartMarker(node, options) {
  34950. assert(!node.isSelfClosing);
  34951. if (shouldNotPrintClosingTag(node, options)) {
  34952. return "";
  34953. }
  34954. switch (node.type) {
  34955. case "ieConditionalComment":
  34956. return "<!";
  34957. case "element":
  34958. if (node.hasHtmComponentClosingTag) {
  34959. return "<//";
  34960. }
  34961. default:
  34962. return `</${node.rawName}`;
  34963. }
  34964. }
  34965. function printClosingTagEndMarker(node, options) {
  34966. if (shouldNotPrintClosingTag(node, options)) {
  34967. return "";
  34968. }
  34969. switch (node.type) {
  34970. case "ieConditionalComment":
  34971. case "ieConditionalEndComment":
  34972. return "[endif]-->";
  34973. case "ieConditionalStartComment":
  34974. return "]><!-->";
  34975. case "interpolation":
  34976. return "}}";
  34977. case "element":
  34978. if (node.isSelfClosing) {
  34979. return "/>";
  34980. }
  34981. default:
  34982. return ">";
  34983. }
  34984. }
  34985. function shouldNotPrintClosingTag(node, options) {
  34986. return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore(node) || shouldPreserveContent(node.parent, options));
  34987. }
  34988. function needsToBorrowPrevClosingTagEndMarker(node) {
  34989. return node.prev && node.prev.type !== "docType" && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  34990. }
  34991. function needsToBorrowLastChildClosingTagEndMarker(node) {
  34992. return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild)) && !isPreLikeNode(node);
  34993. }
  34994. function needsToBorrowParentClosingTagStartMarker(node) {
  34995. return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
  34996. }
  34997. function needsToBorrowNextOpeningTagStartMarker(node) {
  34998. return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
  34999. }
  35000. function getPrettierIgnoreAttributeCommentData(value) {
  35001. const match = value.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);
  35002. if (!match) {
  35003. return false;
  35004. }
  35005. if (!match[1]) {
  35006. return true;
  35007. }
  35008. return match[1].split(/\s+/);
  35009. }
  35010. function needsToBorrowParentOpeningTagEndMarker(node) {
  35011. return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
  35012. }
  35013. function printAttributes(path, options, print) {
  35014. const node = path.getValue();
  35015. if (!isNonEmptyArray(node.attrs)) {
  35016. return node.isSelfClosing ? " " : "";
  35017. }
  35018. const ignoreAttributeData = node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData(node.prev.value);
  35019. const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? (attribute) => ignoreAttributeData.includes(attribute.rawName) : () => false;
  35020. const printedAttributes = path.map((attributePath) => {
  35021. const attribute = attributePath.getValue();
  35022. return hasPrettierIgnoreAttribute(attribute) ? replaceTextEndOfLine(options.originalText.slice(locStart(attribute), locEnd(attribute))) : print();
  35023. }, "attrs");
  35024. const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
  35025. const shouldPrintAttributePerLine = options.singleAttributePerLine && node.attrs.length > 1 && !isVueSfcBlock(node, options);
  35026. const attributeLine = shouldPrintAttributePerLine ? hardline : line;
  35027. const parts = [indent([forceNotToBreakAttrContent ? " " : line, join(attributeLine, printedAttributes)])];
  35028. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) || node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) || forceNotToBreakAttrContent) {
  35029. parts.push(node.isSelfClosing ? " " : "");
  35030. } else {
  35031. parts.push(options.bracketSameLine ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? line : softline);
  35032. }
  35033. return parts;
  35034. }
  35035. function printOpeningTagEnd(node) {
  35036. return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
  35037. }
  35038. function printOpeningTag(path, options, print) {
  35039. const node = path.getValue();
  35040. return [printOpeningTagStart(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)];
  35041. }
  35042. function printOpeningTagStart(node, options) {
  35043. return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : [printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)];
  35044. }
  35045. function printOpeningTagPrefix(node, options) {
  35046. return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
  35047. }
  35048. function printOpeningTagStartMarker(node) {
  35049. switch (node.type) {
  35050. case "ieConditionalComment":
  35051. case "ieConditionalStartComment":
  35052. return `<!--[if ${node.condition}`;
  35053. case "ieConditionalEndComment":
  35054. return "<!--<!";
  35055. case "interpolation":
  35056. return "{{";
  35057. case "docType":
  35058. return "<!DOCTYPE";
  35059. case "element":
  35060. if (node.condition) {
  35061. return `<!--[if ${node.condition}]><!--><${node.rawName}`;
  35062. }
  35063. default:
  35064. return `<${node.rawName}`;
  35065. }
  35066. }
  35067. function printOpeningTagEndMarker(node) {
  35068. assert(!node.isSelfClosing);
  35069. switch (node.type) {
  35070. case "ieConditionalComment":
  35071. return "]>";
  35072. case "element":
  35073. if (node.condition) {
  35074. return "><!--<![endif]-->";
  35075. }
  35076. default:
  35077. return ">";
  35078. }
  35079. }
  35080. module2.exports = {
  35081. printClosingTag,
  35082. printClosingTagStart,
  35083. printClosingTagStartMarker,
  35084. printClosingTagEndMarker,
  35085. printClosingTagSuffix,
  35086. printClosingTagEnd,
  35087. needsToBorrowLastChildClosingTagEndMarker,
  35088. needsToBorrowParentClosingTagStartMarker,
  35089. needsToBorrowPrevClosingTagEndMarker,
  35090. printOpeningTag,
  35091. printOpeningTagStart,
  35092. printOpeningTagPrefix,
  35093. printOpeningTagStartMarker,
  35094. printOpeningTagEndMarker,
  35095. needsToBorrowNextOpeningTagStartMarker,
  35096. needsToBorrowParentOpeningTagEndMarker
  35097. };
  35098. }
  35099. });
  35100. var require_parse_srcset = __commonJS2({
  35101. "node_modules/parse-srcset/src/parse-srcset.js"(exports2, module2) {
  35102. (function(root, factory) {
  35103. if (typeof define === "function" && define.amd) {
  35104. define([], factory);
  35105. } else if (typeof module2 === "object" && module2.exports) {
  35106. module2.exports = factory();
  35107. } else {
  35108. root.parseSrcset = factory();
  35109. }
  35110. })(exports2, function() {
  35111. return function(input, options) {
  35112. var logger = options && options.logger || console;
  35113. function isSpace(c2) {
  35114. return c2 === " " || c2 === " " || c2 === "\n" || c2 === "\f" || c2 === "\r";
  35115. }
  35116. function collectCharacters(regEx) {
  35117. var chars, match = regEx.exec(input.substring(pos));
  35118. if (match) {
  35119. chars = match[0];
  35120. pos += chars.length;
  35121. return chars;
  35122. }
  35123. }
  35124. 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 = [];
  35125. while (true) {
  35126. collectCharacters(regexLeadingCommasOrSpaces);
  35127. if (pos >= inputLength) {
  35128. return candidates;
  35129. }
  35130. url = collectCharacters(regexLeadingNotSpaces);
  35131. descriptors = [];
  35132. if (url.slice(-1) === ",") {
  35133. url = url.replace(regexTrailingCommas, "");
  35134. parseDescriptors();
  35135. } else {
  35136. tokenize();
  35137. }
  35138. }
  35139. function tokenize() {
  35140. collectCharacters(regexLeadingSpaces);
  35141. currentDescriptor = "";
  35142. state = "in descriptor";
  35143. while (true) {
  35144. c = input.charAt(pos);
  35145. if (state === "in descriptor") {
  35146. if (isSpace(c)) {
  35147. if (currentDescriptor) {
  35148. descriptors.push(currentDescriptor);
  35149. currentDescriptor = "";
  35150. state = "after descriptor";
  35151. }
  35152. } else if (c === ",") {
  35153. pos += 1;
  35154. if (currentDescriptor) {
  35155. descriptors.push(currentDescriptor);
  35156. }
  35157. parseDescriptors();
  35158. return;
  35159. } else if (c === "(") {
  35160. currentDescriptor = currentDescriptor + c;
  35161. state = "in parens";
  35162. } else if (c === "") {
  35163. if (currentDescriptor) {
  35164. descriptors.push(currentDescriptor);
  35165. }
  35166. parseDescriptors();
  35167. return;
  35168. } else {
  35169. currentDescriptor = currentDescriptor + c;
  35170. }
  35171. } else if (state === "in parens") {
  35172. if (c === ")") {
  35173. currentDescriptor = currentDescriptor + c;
  35174. state = "in descriptor";
  35175. } else if (c === "") {
  35176. descriptors.push(currentDescriptor);
  35177. parseDescriptors();
  35178. return;
  35179. } else {
  35180. currentDescriptor = currentDescriptor + c;
  35181. }
  35182. } else if (state === "after descriptor") {
  35183. if (isSpace(c)) {
  35184. } else if (c === "") {
  35185. parseDescriptors();
  35186. return;
  35187. } else {
  35188. state = "in descriptor";
  35189. pos -= 1;
  35190. }
  35191. }
  35192. pos += 1;
  35193. }
  35194. }
  35195. function parseDescriptors() {
  35196. var pError = false, w, d, h, i, candidate = {}, desc, lastChar, value, intVal, floatVal;
  35197. for (i = 0; i < descriptors.length; i++) {
  35198. desc = descriptors[i];
  35199. lastChar = desc[desc.length - 1];
  35200. value = desc.substring(0, desc.length - 1);
  35201. intVal = parseInt(value, 10);
  35202. floatVal = parseFloat(value);
  35203. if (regexNonNegativeInteger.test(value) && lastChar === "w") {
  35204. if (w || d) {
  35205. pError = true;
  35206. }
  35207. if (intVal === 0) {
  35208. pError = true;
  35209. } else {
  35210. w = intVal;
  35211. }
  35212. } else if (regexFloatingPoint.test(value) && lastChar === "x") {
  35213. if (w || d || h) {
  35214. pError = true;
  35215. }
  35216. if (floatVal < 0) {
  35217. pError = true;
  35218. } else {
  35219. d = floatVal;
  35220. }
  35221. } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
  35222. if (h || d) {
  35223. pError = true;
  35224. }
  35225. if (intVal === 0) {
  35226. pError = true;
  35227. } else {
  35228. h = intVal;
  35229. }
  35230. } else {
  35231. pError = true;
  35232. }
  35233. }
  35234. if (!pError) {
  35235. candidate.url = url;
  35236. if (w) {
  35237. candidate.w = w;
  35238. }
  35239. if (d) {
  35240. candidate.d = d;
  35241. }
  35242. if (h) {
  35243. candidate.h = h;
  35244. }
  35245. candidates.push(candidate);
  35246. } else if (logger && logger.error) {
  35247. logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
  35248. }
  35249. }
  35250. };
  35251. });
  35252. }
  35253. });
  35254. var require_syntax_attribute = __commonJS2({
  35255. "src/language-html/syntax-attribute.js"(exports2, module2) {
  35256. "use strict";
  35257. var parseSrcset = require_parse_srcset();
  35258. var {
  35259. builders: {
  35260. ifBreak,
  35261. join,
  35262. line
  35263. }
  35264. } = require("./doc.js");
  35265. function printImgSrcset(value) {
  35266. const srcset = parseSrcset(value, {
  35267. logger: {
  35268. error(message) {
  35269. throw new Error(message);
  35270. }
  35271. }
  35272. });
  35273. const hasW = srcset.some(({
  35274. w
  35275. }) => w);
  35276. const hasH = srcset.some(({
  35277. h
  35278. }) => h);
  35279. const hasX = srcset.some(({
  35280. d
  35281. }) => d);
  35282. if (hasW + hasH + hasX > 1) {
  35283. throw new Error("Mixed descriptor in srcset is not supported");
  35284. }
  35285. const key = hasW ? "w" : hasH ? "h" : "d";
  35286. const unit = hasW ? "w" : hasH ? "h" : "x";
  35287. const getMax = (values) => Math.max(...values);
  35288. const urls = srcset.map((src) => src.url);
  35289. const maxUrlLength = getMax(urls.map((url) => url.length));
  35290. const descriptors = srcset.map((src) => src[key]).map((descriptor) => descriptor ? descriptor.toString() : "");
  35291. const descriptorLeftLengths = descriptors.map((descriptor) => {
  35292. const index = descriptor.indexOf(".");
  35293. return index === -1 ? descriptor.length : index;
  35294. });
  35295. const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
  35296. return join([",", line], urls.map((url, index) => {
  35297. const parts = [url];
  35298. const descriptor = descriptors[index];
  35299. if (descriptor) {
  35300. const urlPadding = maxUrlLength - url.length + 1;
  35301. const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
  35302. const alignment = " ".repeat(urlPadding + descriptorPadding);
  35303. parts.push(ifBreak(alignment, " "), descriptor + unit);
  35304. }
  35305. return parts;
  35306. }));
  35307. }
  35308. function printClassNames(value) {
  35309. return value.trim().split(/\s+/).join(" ");
  35310. }
  35311. module2.exports = {
  35312. printImgSrcset,
  35313. printClassNames
  35314. };
  35315. }
  35316. });
  35317. var require_syntax_vue = __commonJS2({
  35318. "src/language-html/syntax-vue.js"(exports2, module2) {
  35319. "use strict";
  35320. var {
  35321. builders: {
  35322. group
  35323. }
  35324. } = require("./doc.js");
  35325. function printVueFor(value, textToDoc) {
  35326. const {
  35327. left,
  35328. operator,
  35329. right
  35330. } = parseVueFor(value);
  35331. return [group(textToDoc(`function _(${left}) {}`, {
  35332. parser: "babel",
  35333. __isVueForBindingLeft: true
  35334. })), " ", operator, " ", textToDoc(right, {
  35335. parser: "__js_expression"
  35336. }, {
  35337. stripTrailingHardline: true
  35338. })];
  35339. }
  35340. function parseVueFor(value) {
  35341. const forAliasRE = /(.*?)\s+(in|of)\s+(.*)/s;
  35342. const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/;
  35343. const stripParensRE = /^\(|\)$/g;
  35344. const inMatch = value.match(forAliasRE);
  35345. if (!inMatch) {
  35346. return;
  35347. }
  35348. const res = {};
  35349. res.for = inMatch[3].trim();
  35350. if (!res.for) {
  35351. return;
  35352. }
  35353. const alias = inMatch[1].trim().replace(stripParensRE, "");
  35354. const iteratorMatch = alias.match(forIteratorRE);
  35355. if (iteratorMatch) {
  35356. res.alias = alias.replace(forIteratorRE, "");
  35357. res.iterator1 = iteratorMatch[1].trim();
  35358. if (iteratorMatch[2]) {
  35359. res.iterator2 = iteratorMatch[2].trim();
  35360. }
  35361. } else {
  35362. res.alias = alias;
  35363. }
  35364. const left = [res.alias, res.iterator1, res.iterator2];
  35365. if (left.some((part, index) => !part && (index === 0 || left.slice(index + 1).some(Boolean)))) {
  35366. return;
  35367. }
  35368. return {
  35369. left: left.filter(Boolean).join(","),
  35370. operator: inMatch[2],
  35371. right: res.for
  35372. };
  35373. }
  35374. function printVueBindings(value, textToDoc) {
  35375. return textToDoc(`function _(${value}) {}`, {
  35376. parser: "babel",
  35377. __isVueBindings: true
  35378. });
  35379. }
  35380. function isVueEventBindingExpression(eventBindingValue) {
  35381. const fnExpRE = /^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/;
  35382. const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
  35383. const value = eventBindingValue.trim();
  35384. return fnExpRE.test(value) || simplePathRE.test(value);
  35385. }
  35386. module2.exports = {
  35387. isVueEventBindingExpression,
  35388. printVueFor,
  35389. printVueBindings
  35390. };
  35391. }
  35392. });
  35393. var require_get_node_content = __commonJS2({
  35394. "src/language-html/get-node-content.js"(exports2, module2) {
  35395. "use strict";
  35396. var {
  35397. needsToBorrowParentClosingTagStartMarker,
  35398. printClosingTagStartMarker,
  35399. needsToBorrowLastChildClosingTagEndMarker,
  35400. printClosingTagEndMarker,
  35401. needsToBorrowParentOpeningTagEndMarker,
  35402. printOpeningTagEndMarker
  35403. } = require_tag();
  35404. function getNodeContent(node, options) {
  35405. let start = node.startSourceSpan.end.offset;
  35406. if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild)) {
  35407. start -= printOpeningTagEndMarker(node).length;
  35408. }
  35409. let end = node.endSourceSpan.start.offset;
  35410. if (node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild)) {
  35411. end += printClosingTagStartMarker(node, options).length;
  35412. } else if (needsToBorrowLastChildClosingTagEndMarker(node)) {
  35413. end -= printClosingTagEndMarker(node.lastChild, options).length;
  35414. }
  35415. return options.originalText.slice(start, end);
  35416. }
  35417. module2.exports = getNodeContent;
  35418. }
  35419. });
  35420. var require_embed4 = __commonJS2({
  35421. "src/language-html/embed.js"(exports2, module2) {
  35422. "use strict";
  35423. var {
  35424. builders: {
  35425. breakParent,
  35426. group,
  35427. hardline,
  35428. indent,
  35429. line,
  35430. fill,
  35431. softline
  35432. },
  35433. utils: {
  35434. mapDoc,
  35435. replaceTextEndOfLine
  35436. }
  35437. } = require("./doc.js");
  35438. var printFrontMatter = require_print();
  35439. var {
  35440. printClosingTag,
  35441. printClosingTagSuffix,
  35442. needsToBorrowPrevClosingTagEndMarker,
  35443. printOpeningTagPrefix,
  35444. printOpeningTag
  35445. } = require_tag();
  35446. var {
  35447. printImgSrcset,
  35448. printClassNames
  35449. } = require_syntax_attribute();
  35450. var {
  35451. printVueFor,
  35452. printVueBindings,
  35453. isVueEventBindingExpression
  35454. } = require_syntax_vue();
  35455. var {
  35456. isScriptLikeTag,
  35457. isVueNonHtmlBlock,
  35458. inferScriptParser,
  35459. htmlTrimPreserveIndentation,
  35460. dedentString,
  35461. unescapeQuoteEntities,
  35462. isVueSlotAttribute,
  35463. isVueSfcBindingsAttribute,
  35464. getTextValueParts
  35465. } = require_utils11();
  35466. var getNodeContent = require_get_node_content();
  35467. function printEmbeddedAttributeValue(node, htmlTextToDoc, options) {
  35468. const isKeyMatched = (patterns) => new RegExp(patterns.join("|")).test(node.fullName);
  35469. const getValue = () => unescapeQuoteEntities(node.value);
  35470. let shouldHug = false;
  35471. const __onHtmlBindingRoot = (root, options2) => {
  35472. 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;
  35473. if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options2.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
  35474. shouldHug = true;
  35475. }
  35476. };
  35477. const printHug = (doc2) => group(doc2);
  35478. const printExpand = (doc2, canHaveTrailingWhitespace = true) => group([indent([softline, doc2]), canHaveTrailingWhitespace ? softline : ""]);
  35479. const printMaybeHug = (doc2) => shouldHug ? printHug(doc2) : printExpand(doc2);
  35480. const attributeTextToDoc = (code, opts) => htmlTextToDoc(code, Object.assign({
  35481. __onHtmlBindingRoot,
  35482. __embeddedInHtml: true
  35483. }, opts));
  35484. if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
  35485. return printExpand(printImgSrcset(getValue()));
  35486. }
  35487. if (node.fullName === "class" && !options.parentParser) {
  35488. const value = getValue();
  35489. if (!value.includes("{{")) {
  35490. return printClassNames(value);
  35491. }
  35492. }
  35493. if (node.fullName === "style" && !options.parentParser) {
  35494. const value = getValue();
  35495. if (!value.includes("{{")) {
  35496. return printExpand(attributeTextToDoc(value, {
  35497. parser: "css",
  35498. __isHTMLStyleAttribute: true
  35499. }));
  35500. }
  35501. }
  35502. if (options.parser === "vue") {
  35503. if (node.fullName === "v-for") {
  35504. return printVueFor(getValue(), attributeTextToDoc);
  35505. }
  35506. if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
  35507. return printVueBindings(getValue(), attributeTextToDoc);
  35508. }
  35509. const vueEventBindingPatterns = ["^@", "^v-on:"];
  35510. const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
  35511. const jsExpressionBindingPatterns = ["^v-"];
  35512. if (isKeyMatched(vueEventBindingPatterns)) {
  35513. const value = getValue();
  35514. const parser = isVueEventBindingExpression(value) ? "__js_expression" : options.__should_parse_vue_template_with_ts ? "__vue_ts_event_binding" : "__vue_event_binding";
  35515. return printMaybeHug(attributeTextToDoc(value, {
  35516. parser
  35517. }));
  35518. }
  35519. if (isKeyMatched(vueExpressionBindingPatterns)) {
  35520. return printMaybeHug(attributeTextToDoc(getValue(), {
  35521. parser: "__vue_expression"
  35522. }));
  35523. }
  35524. if (isKeyMatched(jsExpressionBindingPatterns)) {
  35525. return printMaybeHug(attributeTextToDoc(getValue(), {
  35526. parser: "__js_expression"
  35527. }));
  35528. }
  35529. }
  35530. if (options.parser === "angular") {
  35531. const ngTextToDoc = (code, opts) => attributeTextToDoc(code, Object.assign(Object.assign({}, opts), {}, {
  35532. trailingComma: "none"
  35533. }));
  35534. const ngDirectiveBindingPatterns = ["^\\*"];
  35535. const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
  35536. const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", "^ng-(if|show|hide|class|style)$"];
  35537. const ngI18nPatterns = ["^i18n(-.+)?$"];
  35538. if (isKeyMatched(ngStatementBindingPatterns)) {
  35539. return printMaybeHug(ngTextToDoc(getValue(), {
  35540. parser: "__ng_action"
  35541. }));
  35542. }
  35543. if (isKeyMatched(ngExpressionBindingPatterns)) {
  35544. return printMaybeHug(ngTextToDoc(getValue(), {
  35545. parser: "__ng_binding"
  35546. }));
  35547. }
  35548. if (isKeyMatched(ngI18nPatterns)) {
  35549. const value2 = getValue().trim();
  35550. return printExpand(fill(getTextValueParts(node, value2)), !value2.includes("@@"));
  35551. }
  35552. if (isKeyMatched(ngDirectiveBindingPatterns)) {
  35553. return printMaybeHug(ngTextToDoc(getValue(), {
  35554. parser: "__ng_directive"
  35555. }));
  35556. }
  35557. const interpolationRegex = /{{(.+?)}}/s;
  35558. const value = getValue();
  35559. if (interpolationRegex.test(value)) {
  35560. const parts = [];
  35561. for (const [index, part] of value.split(interpolationRegex).entries()) {
  35562. if (index % 2 === 0) {
  35563. parts.push(replaceTextEndOfLine(part));
  35564. } else {
  35565. try {
  35566. parts.push(group(["{{", indent([line, ngTextToDoc(part, {
  35567. parser: "__ng_interpolation",
  35568. __isInHtmlInterpolation: true
  35569. })]), line, "}}"]));
  35570. } catch {
  35571. parts.push("{{", replaceTextEndOfLine(part), "}}");
  35572. }
  35573. }
  35574. }
  35575. return group(parts);
  35576. }
  35577. }
  35578. return null;
  35579. }
  35580. function embed(path, print, textToDoc, options) {
  35581. const node = path.getValue();
  35582. switch (node.type) {
  35583. case "element": {
  35584. if (isScriptLikeTag(node) || node.type === "interpolation") {
  35585. return;
  35586. }
  35587. if (!node.isSelfClosing && isVueNonHtmlBlock(node, options)) {
  35588. const parser = inferScriptParser(node, options);
  35589. if (!parser) {
  35590. return;
  35591. }
  35592. const content = getNodeContent(node, options);
  35593. let isEmpty = /^\s*$/.test(content);
  35594. let doc2 = "";
  35595. if (!isEmpty) {
  35596. doc2 = textToDoc(htmlTrimPreserveIndentation(content), {
  35597. parser,
  35598. __embeddedInHtml: true
  35599. }, {
  35600. stripTrailingHardline: true
  35601. });
  35602. isEmpty = doc2 === "";
  35603. }
  35604. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), isEmpty ? "" : hardline, doc2, isEmpty ? "" : hardline, printClosingTag(node, options), printClosingTagSuffix(node, options)];
  35605. }
  35606. break;
  35607. }
  35608. case "text": {
  35609. if (isScriptLikeTag(node.parent)) {
  35610. const parser = inferScriptParser(node.parent, options);
  35611. if (parser) {
  35612. const value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*\n/, "")) : node.value;
  35613. const textToDocOptions = {
  35614. parser,
  35615. __embeddedInHtml: true
  35616. };
  35617. if (options.parser === "html" && parser === "babel") {
  35618. let sourceType = "script";
  35619. const {
  35620. attrMap
  35621. } = node.parent;
  35622. if (attrMap && (attrMap.type === "module" || attrMap.type === "text/babel" && attrMap["data-type"] === "module")) {
  35623. sourceType = "module";
  35624. }
  35625. textToDocOptions.__babelSourceType = sourceType;
  35626. }
  35627. return [breakParent, printOpeningTagPrefix(node, options), textToDoc(value, textToDocOptions, {
  35628. stripTrailingHardline: true
  35629. }), printClosingTagSuffix(node, options)];
  35630. }
  35631. } else if (node.parent.type === "interpolation") {
  35632. const textToDocOptions = {
  35633. __isInHtmlInterpolation: true,
  35634. __embeddedInHtml: true
  35635. };
  35636. if (options.parser === "angular") {
  35637. textToDocOptions.parser = "__ng_interpolation";
  35638. textToDocOptions.trailingComma = "none";
  35639. } else if (options.parser === "vue") {
  35640. textToDocOptions.parser = options.__should_parse_vue_template_with_ts ? "__vue_ts_expression" : "__vue_expression";
  35641. } else {
  35642. textToDocOptions.parser = "__js_expression";
  35643. }
  35644. return [indent([line, textToDoc(node.value, textToDocOptions, {
  35645. stripTrailingHardline: true
  35646. })]), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line];
  35647. }
  35648. break;
  35649. }
  35650. case "attribute": {
  35651. if (!node.value) {
  35652. break;
  35653. }
  35654. if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  35655. return [node.rawName, "=", node.value];
  35656. }
  35657. if (options.parser === "lwc") {
  35658. const interpolationRegex = /^{.*}$/s;
  35659. if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
  35660. return [node.rawName, "=", node.value];
  35661. }
  35662. }
  35663. const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => textToDoc(code, Object.assign({
  35664. __isInHtmlAttribute: true,
  35665. __embeddedInHtml: true
  35666. }, opts), {
  35667. stripTrailingHardline: true
  35668. }), options);
  35669. if (embeddedAttributeValueDoc) {
  35670. return [node.rawName, '="', group(mapDoc(embeddedAttributeValueDoc, (doc2) => typeof doc2 === "string" ? doc2.replace(/"/g, "&quot;") : doc2)), '"'];
  35671. }
  35672. break;
  35673. }
  35674. case "front-matter":
  35675. return printFrontMatter(node, textToDoc);
  35676. }
  35677. }
  35678. module2.exports = embed;
  35679. }
  35680. });
  35681. var require_children = __commonJS2({
  35682. "src/language-html/print/children.js"(exports2, module2) {
  35683. "use strict";
  35684. var {
  35685. builders: {
  35686. breakParent,
  35687. group,
  35688. ifBreak,
  35689. line,
  35690. softline,
  35691. hardline
  35692. },
  35693. utils: {
  35694. replaceTextEndOfLine
  35695. }
  35696. } = require("./doc.js");
  35697. var {
  35698. locStart,
  35699. locEnd
  35700. } = require_loc6();
  35701. var {
  35702. forceBreakChildren,
  35703. forceNextEmptyLine,
  35704. isTextLikeNode,
  35705. hasPrettierIgnore,
  35706. preferHardlineAsLeadingSpaces
  35707. } = require_utils11();
  35708. var {
  35709. printOpeningTagPrefix,
  35710. needsToBorrowNextOpeningTagStartMarker,
  35711. printOpeningTagStartMarker,
  35712. needsToBorrowPrevClosingTagEndMarker,
  35713. printClosingTagEndMarker,
  35714. printClosingTagSuffix,
  35715. needsToBorrowParentClosingTagStartMarker
  35716. } = require_tag();
  35717. function printChild(childPath, options, print) {
  35718. const child = childPath.getValue();
  35719. if (hasPrettierIgnore(child)) {
  35720. 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)];
  35721. }
  35722. return print();
  35723. }
  35724. function printBetweenLine(prevNode, nextNode) {
  35725. 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;
  35726. }
  35727. function printChildren(path, options, print) {
  35728. const node = path.getValue();
  35729. if (forceBreakChildren(node)) {
  35730. return [breakParent, ...path.map((childPath) => {
  35731. const childNode = childPath.getValue();
  35732. const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
  35733. return [!prevBetweenLine ? "" : [prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline : ""], printChild(childPath, options, print)];
  35734. }, "children")];
  35735. }
  35736. const groupIds = node.children.map(() => Symbol(""));
  35737. return path.map((childPath, childIndex) => {
  35738. const childNode = childPath.getValue();
  35739. if (isTextLikeNode(childNode)) {
  35740. if (childNode.prev && isTextLikeNode(childNode.prev)) {
  35741. const prevBetweenLine2 = printBetweenLine(childNode.prev, childNode);
  35742. if (prevBetweenLine2) {
  35743. if (forceNextEmptyLine(childNode.prev)) {
  35744. return [hardline, hardline, printChild(childPath, options, print)];
  35745. }
  35746. return [prevBetweenLine2, printChild(childPath, options, print)];
  35747. }
  35748. }
  35749. return printChild(childPath, options, print);
  35750. }
  35751. const prevParts = [];
  35752. const leadingParts = [];
  35753. const trailingParts = [];
  35754. const nextParts = [];
  35755. const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
  35756. const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
  35757. if (prevBetweenLine) {
  35758. if (forceNextEmptyLine(childNode.prev)) {
  35759. prevParts.push(hardline, hardline);
  35760. } else if (prevBetweenLine === hardline) {
  35761. prevParts.push(hardline);
  35762. } else {
  35763. if (isTextLikeNode(childNode.prev)) {
  35764. leadingParts.push(prevBetweenLine);
  35765. } else {
  35766. leadingParts.push(ifBreak("", softline, {
  35767. groupId: groupIds[childIndex - 1]
  35768. }));
  35769. }
  35770. }
  35771. }
  35772. if (nextBetweenLine) {
  35773. if (forceNextEmptyLine(childNode)) {
  35774. if (isTextLikeNode(childNode.next)) {
  35775. nextParts.push(hardline, hardline);
  35776. }
  35777. } else if (nextBetweenLine === hardline) {
  35778. if (isTextLikeNode(childNode.next)) {
  35779. nextParts.push(hardline);
  35780. }
  35781. } else {
  35782. trailingParts.push(nextBetweenLine);
  35783. }
  35784. }
  35785. return [...prevParts, group([...leadingParts, group([printChild(childPath, options, print), ...trailingParts], {
  35786. id: groupIds[childIndex]
  35787. })]), ...nextParts];
  35788. }, "children");
  35789. }
  35790. module2.exports = {
  35791. printChildren
  35792. };
  35793. }
  35794. });
  35795. var require_element = __commonJS2({
  35796. "src/language-html/print/element.js"(exports2, module2) {
  35797. "use strict";
  35798. var {
  35799. builders: {
  35800. breakParent,
  35801. dedentToRoot,
  35802. group,
  35803. ifBreak,
  35804. indentIfBreak,
  35805. indent,
  35806. line,
  35807. softline
  35808. },
  35809. utils: {
  35810. replaceTextEndOfLine
  35811. }
  35812. } = require("./doc.js");
  35813. var getNodeContent = require_get_node_content();
  35814. var {
  35815. shouldPreserveContent,
  35816. isScriptLikeTag,
  35817. isVueCustomBlock,
  35818. countParents,
  35819. forceBreakContent
  35820. } = require_utils11();
  35821. var {
  35822. printOpeningTagPrefix,
  35823. printOpeningTag,
  35824. printClosingTagSuffix,
  35825. printClosingTag,
  35826. needsToBorrowPrevClosingTagEndMarker,
  35827. needsToBorrowLastChildClosingTagEndMarker
  35828. } = require_tag();
  35829. var {
  35830. printChildren
  35831. } = require_children();
  35832. function printElement(path, options, print) {
  35833. const node = path.getValue();
  35834. if (shouldPreserveContent(node, options)) {
  35835. return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), ...replaceTextEndOfLine(getNodeContent(node, options)), ...printClosingTag(node, options), printClosingTagSuffix(node, options)];
  35836. }
  35837. const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
  35838. const attrGroupId = Symbol("element-attr-group-id");
  35839. const printTag = (doc2) => group([group(printOpeningTag(path, options, print), {
  35840. id: attrGroupId
  35841. }), doc2, printClosingTag(node, options)]);
  35842. const printChildrenDoc = (childrenDoc) => {
  35843. if (shouldHugContent) {
  35844. return indentIfBreak(childrenDoc, {
  35845. groupId: attrGroupId
  35846. });
  35847. }
  35848. if ((isScriptLikeTag(node) || isVueCustomBlock(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle) {
  35849. return childrenDoc;
  35850. }
  35851. return indent(childrenDoc);
  35852. };
  35853. const printLineBeforeChildren = () => {
  35854. if (shouldHugContent) {
  35855. return ifBreak(softline, "", {
  35856. groupId: attrGroupId
  35857. });
  35858. }
  35859. if (node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive) {
  35860. return line;
  35861. }
  35862. if (node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) {
  35863. return dedentToRoot(softline);
  35864. }
  35865. return softline;
  35866. };
  35867. const printLineAfterChildren = () => {
  35868. const needsToBorrow = node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent);
  35869. if (needsToBorrow) {
  35870. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  35871. return " ";
  35872. }
  35873. return "";
  35874. }
  35875. if (shouldHugContent) {
  35876. return ifBreak(softline, "", {
  35877. groupId: attrGroupId
  35878. });
  35879. }
  35880. if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
  35881. return line;
  35882. }
  35883. 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)) {
  35884. return "";
  35885. }
  35886. return softline;
  35887. };
  35888. if (node.children.length === 0) {
  35889. return printTag(node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line : "");
  35890. }
  35891. return printTag([forceBreakContent(node) ? breakParent : "", printChildrenDoc([printLineBeforeChildren(), printChildren(path, options, print)]), printLineAfterChildren()]);
  35892. }
  35893. module2.exports = {
  35894. printElement
  35895. };
  35896. }
  35897. });
  35898. var require_printer_html = __commonJS2({
  35899. "src/language-html/printer-html.js"(exports2, module2) {
  35900. "use strict";
  35901. var {
  35902. builders: {
  35903. fill,
  35904. group,
  35905. hardline,
  35906. literalline
  35907. },
  35908. utils: {
  35909. cleanDoc,
  35910. getDocParts,
  35911. isConcat,
  35912. replaceTextEndOfLine
  35913. }
  35914. } = require("./doc.js");
  35915. var clean = require_clean5();
  35916. var {
  35917. countChars,
  35918. unescapeQuoteEntities,
  35919. getTextValueParts
  35920. } = require_utils11();
  35921. var preprocess = require_print_preprocess3();
  35922. var {
  35923. insertPragma
  35924. } = require_pragma5();
  35925. var {
  35926. locStart,
  35927. locEnd
  35928. } = require_loc6();
  35929. var embed = require_embed4();
  35930. var {
  35931. printClosingTagSuffix,
  35932. printClosingTagEnd,
  35933. printOpeningTagPrefix,
  35934. printOpeningTagStart
  35935. } = require_tag();
  35936. var {
  35937. printElement
  35938. } = require_element();
  35939. var {
  35940. printChildren
  35941. } = require_children();
  35942. function genericPrint(path, options, print) {
  35943. const node = path.getValue();
  35944. switch (node.type) {
  35945. case "front-matter":
  35946. return replaceTextEndOfLine(node.raw);
  35947. case "root":
  35948. if (options.__onHtmlRoot) {
  35949. options.__onHtmlRoot(node);
  35950. }
  35951. return [group(printChildren(path, options, print)), hardline];
  35952. case "element":
  35953. case "ieConditionalComment": {
  35954. return printElement(path, options, print);
  35955. }
  35956. case "ieConditionalStartComment":
  35957. case "ieConditionalEndComment":
  35958. return [printOpeningTagStart(node), printClosingTagEnd(node)];
  35959. case "interpolation":
  35960. return [printOpeningTagStart(node, options), ...path.map(print, "children"), printClosingTagEnd(node, options)];
  35961. case "text": {
  35962. if (node.parent.type === "interpolation") {
  35963. const trailingNewlineRegex = /\n[^\S\n]*$/;
  35964. const hasTrailingNewline = trailingNewlineRegex.test(node.value);
  35965. const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
  35966. return [...replaceTextEndOfLine(value), hasTrailingNewline ? hardline : ""];
  35967. }
  35968. const printed = cleanDoc([printOpeningTagPrefix(node, options), ...getTextValueParts(node), printClosingTagSuffix(node, options)]);
  35969. if (isConcat(printed) || printed.type === "fill") {
  35970. return fill(getDocParts(printed));
  35971. }
  35972. return printed;
  35973. }
  35974. case "docType":
  35975. return [group([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")]), printClosingTagEnd(node, options)];
  35976. case "comment": {
  35977. return [printOpeningTagPrefix(node, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(node), locEnd(node)), literalline), printClosingTagSuffix(node, options)];
  35978. }
  35979. case "attribute": {
  35980. if (node.value === null) {
  35981. return node.rawName;
  35982. }
  35983. const value = unescapeQuoteEntities(node.value);
  35984. const singleQuoteCount = countChars(value, "'");
  35985. const doubleQuoteCount = countChars(value, '"');
  35986. const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
  35987. return [node.rawName, "=", quote, ...replaceTextEndOfLine(quote === '"' ? value.replace(/"/g, "&quot;") : value.replace(/'/g, "&apos;")), quote];
  35988. }
  35989. default:
  35990. throw new Error(`Unexpected node type ${node.type}`);
  35991. }
  35992. }
  35993. module2.exports = {
  35994. preprocess,
  35995. print: genericPrint,
  35996. insertPragma,
  35997. massageAstNode: clean,
  35998. embed
  35999. };
  36000. }
  36001. });
  36002. var require_options6 = __commonJS2({
  36003. "src/language-html/options.js"(exports2, module2) {
  36004. "use strict";
  36005. var commonOptions = require_common_options();
  36006. var CATEGORY_HTML = "HTML";
  36007. module2.exports = {
  36008. bracketSameLine: commonOptions.bracketSameLine,
  36009. htmlWhitespaceSensitivity: {
  36010. since: "1.15.0",
  36011. category: CATEGORY_HTML,
  36012. type: "choice",
  36013. default: "css",
  36014. description: "How to handle whitespaces in HTML.",
  36015. choices: [{
  36016. value: "css",
  36017. description: "Respect the default value of CSS display property."
  36018. }, {
  36019. value: "strict",
  36020. description: "Whitespaces are considered sensitive."
  36021. }, {
  36022. value: "ignore",
  36023. description: "Whitespaces are considered insensitive."
  36024. }]
  36025. },
  36026. singleAttributePerLine: commonOptions.singleAttributePerLine,
  36027. vueIndentScriptAndStyle: {
  36028. since: "1.19.0",
  36029. category: CATEGORY_HTML,
  36030. type: "boolean",
  36031. default: false,
  36032. description: "Indent script and style tags in Vue files."
  36033. }
  36034. };
  36035. }
  36036. });
  36037. var require_parsers6 = __commonJS2({
  36038. "src/language-html/parsers.js"(exports2, module2) {
  36039. "use strict";
  36040. module2.exports = {
  36041. get html() {
  36042. return require("./parser-html.js").parsers.html;
  36043. },
  36044. get vue() {
  36045. return require("./parser-html.js").parsers.vue;
  36046. },
  36047. get angular() {
  36048. return require("./parser-html.js").parsers.angular;
  36049. },
  36050. get lwc() {
  36051. return require("./parser-html.js").parsers.lwc;
  36052. }
  36053. };
  36054. }
  36055. });
  36056. var require_HTML = __commonJS2({
  36057. "node_modules/linguist-languages/data/HTML.json"(exports2, module2) {
  36058. module2.exports = {
  36059. name: "HTML",
  36060. type: "markup",
  36061. tmScope: "text.html.basic",
  36062. aceMode: "html",
  36063. codemirrorMode: "htmlmixed",
  36064. codemirrorMimeType: "text/html",
  36065. color: "#e34c26",
  36066. aliases: ["xhtml"],
  36067. extensions: [".html", ".hta", ".htm", ".html.hl", ".inc", ".xht", ".xhtml"],
  36068. languageId: 146
  36069. };
  36070. }
  36071. });
  36072. var require_Vue = __commonJS2({
  36073. "node_modules/linguist-languages/data/Vue.json"(exports2, module2) {
  36074. module2.exports = {
  36075. name: "Vue",
  36076. type: "markup",
  36077. color: "#41b883",
  36078. extensions: [".vue"],
  36079. tmScope: "text.html.vue",
  36080. aceMode: "html",
  36081. languageId: 391
  36082. };
  36083. }
  36084. });
  36085. var require_language_html = __commonJS2({
  36086. "src/language-html/index.js"(exports2, module2) {
  36087. "use strict";
  36088. var createLanguage = require_create_language();
  36089. var printer = require_printer_html();
  36090. var options = require_options6();
  36091. var parsers = require_parsers6();
  36092. var languages = [createLanguage(require_HTML(), () => ({
  36093. name: "Angular",
  36094. since: "1.15.0",
  36095. parsers: ["angular"],
  36096. vscodeLanguageIds: ["html"],
  36097. extensions: [".component.html"],
  36098. filenames: []
  36099. })), createLanguage(require_HTML(), (data) => ({
  36100. since: "1.15.0",
  36101. parsers: ["html"],
  36102. vscodeLanguageIds: ["html"],
  36103. extensions: [...data.extensions, ".mjml"]
  36104. })), createLanguage(require_HTML(), () => ({
  36105. name: "Lightning Web Components",
  36106. since: "1.17.0",
  36107. parsers: ["lwc"],
  36108. vscodeLanguageIds: ["html"],
  36109. extensions: [],
  36110. filenames: []
  36111. })), createLanguage(require_Vue(), () => ({
  36112. since: "1.10.0",
  36113. parsers: ["vue"],
  36114. vscodeLanguageIds: ["vue"]
  36115. }))];
  36116. var printers = {
  36117. html: printer
  36118. };
  36119. module2.exports = {
  36120. languages,
  36121. printers,
  36122. options,
  36123. parsers
  36124. };
  36125. }
  36126. });
  36127. var require_pragma6 = __commonJS2({
  36128. "src/language-yaml/pragma.js"(exports2, module2) {
  36129. "use strict";
  36130. function isPragma(text) {
  36131. return /^\s*@(?:prettier|format)\s*$/.test(text);
  36132. }
  36133. function hasPragma(text) {
  36134. return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text);
  36135. }
  36136. function insertPragma(text) {
  36137. return `# @format
  36138. ${text}`;
  36139. }
  36140. module2.exports = {
  36141. isPragma,
  36142. hasPragma,
  36143. insertPragma
  36144. };
  36145. }
  36146. });
  36147. var require_loc7 = __commonJS2({
  36148. "src/language-yaml/loc.js"(exports2, module2) {
  36149. "use strict";
  36150. function locStart(node) {
  36151. return node.position.start.offset;
  36152. }
  36153. function locEnd(node) {
  36154. return node.position.end.offset;
  36155. }
  36156. module2.exports = {
  36157. locStart,
  36158. locEnd
  36159. };
  36160. }
  36161. });
  36162. var require_embed5 = __commonJS2({
  36163. "src/language-yaml/embed.js"(exports2, module2) {
  36164. "use strict";
  36165. function embed(path, print, textToDoc, options) {
  36166. const node = path.getValue();
  36167. if (node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint)rc$/.test(options.filepath)) {
  36168. return textToDoc(options.originalText, Object.assign(Object.assign({}, options), {}, {
  36169. parser: "json"
  36170. }));
  36171. }
  36172. }
  36173. module2.exports = embed;
  36174. }
  36175. });
  36176. var require_utils12 = __commonJS2({
  36177. "src/language-yaml/utils.js"(exports2, module2) {
  36178. "use strict";
  36179. var {
  36180. getLast,
  36181. isNonEmptyArray
  36182. } = require_util();
  36183. function getAncestorCount(path, filter) {
  36184. let counter = 0;
  36185. const pathStackLength = path.stack.length - 1;
  36186. for (let i = 0; i < pathStackLength; i++) {
  36187. const value = path.stack[i];
  36188. if (isNode(value) && filter(value)) {
  36189. counter++;
  36190. }
  36191. }
  36192. return counter;
  36193. }
  36194. function isNode(value, types) {
  36195. return value && typeof value.type === "string" && (!types || types.includes(value.type));
  36196. }
  36197. function mapNode(node, callback, parent) {
  36198. return callback("children" in node ? Object.assign(Object.assign({}, node), {}, {
  36199. children: node.children.map((childNode) => mapNode(childNode, callback, node))
  36200. }) : node, parent);
  36201. }
  36202. function defineShortcut(x, key, getter) {
  36203. Object.defineProperty(x, key, {
  36204. get: getter,
  36205. enumerable: false
  36206. });
  36207. }
  36208. function isNextLineEmpty(node, text) {
  36209. let newlineCount = 0;
  36210. const textLength = text.length;
  36211. for (let i = node.position.end.offset - 1; i < textLength; i++) {
  36212. const char = text[i];
  36213. if (char === "\n") {
  36214. newlineCount++;
  36215. }
  36216. if (newlineCount === 1 && /\S/.test(char)) {
  36217. return false;
  36218. }
  36219. if (newlineCount === 2) {
  36220. return true;
  36221. }
  36222. }
  36223. return false;
  36224. }
  36225. function isLastDescendantNode(path) {
  36226. const node = path.getValue();
  36227. switch (node.type) {
  36228. case "tag":
  36229. case "anchor":
  36230. case "comment":
  36231. return false;
  36232. }
  36233. const pathStackLength = path.stack.length;
  36234. for (let i = 1; i < pathStackLength; i++) {
  36235. const item = path.stack[i];
  36236. const parentItem = path.stack[i - 1];
  36237. if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
  36238. return false;
  36239. }
  36240. }
  36241. return true;
  36242. }
  36243. function getLastDescendantNode(node) {
  36244. return isNonEmptyArray(node.children) ? getLastDescendantNode(getLast(node.children)) : node;
  36245. }
  36246. function isPrettierIgnore(comment) {
  36247. return comment.value.trim() === "prettier-ignore";
  36248. }
  36249. function hasPrettierIgnore(path) {
  36250. const node = path.getValue();
  36251. if (node.type === "documentBody") {
  36252. const document = path.getParentNode();
  36253. return hasEndComments(document.head) && isPrettierIgnore(getLast(document.head.endComments));
  36254. }
  36255. return hasLeadingComments(node) && isPrettierIgnore(getLast(node.leadingComments));
  36256. }
  36257. function isEmptyNode(node) {
  36258. return !isNonEmptyArray(node.children) && !hasComments(node);
  36259. }
  36260. function hasComments(node) {
  36261. return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment(node) || hasEndComments(node);
  36262. }
  36263. function hasLeadingComments(node) {
  36264. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.leadingComments);
  36265. }
  36266. function hasMiddleComments(node) {
  36267. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.middleComments);
  36268. }
  36269. function hasIndicatorComment(node) {
  36270. return node === null || node === void 0 ? void 0 : node.indicatorComment;
  36271. }
  36272. function hasTrailingComment(node) {
  36273. return node === null || node === void 0 ? void 0 : node.trailingComment;
  36274. }
  36275. function hasEndComments(node) {
  36276. return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.endComments);
  36277. }
  36278. function splitWithSingleSpace(text) {
  36279. const parts = [];
  36280. let lastPart;
  36281. for (const part of text.split(/( +)/)) {
  36282. if (part !== " ") {
  36283. if (lastPart === " ") {
  36284. parts.push(part);
  36285. } else {
  36286. parts.push((parts.pop() || "") + part);
  36287. }
  36288. } else if (lastPart === void 0) {
  36289. parts.unshift("");
  36290. }
  36291. lastPart = part;
  36292. }
  36293. if (lastPart === " ") {
  36294. parts.push((parts.pop() || "") + " ");
  36295. }
  36296. if (parts[0] === "") {
  36297. parts.shift();
  36298. parts.unshift(" " + (parts.shift() || ""));
  36299. }
  36300. return parts;
  36301. }
  36302. function getFlowScalarLineContents(nodeType, content, options) {
  36303. 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());
  36304. if (options.proseWrap === "preserve") {
  36305. return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]);
  36306. }
  36307. 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);
  36308. }
  36309. function getBlockValueLineContents(node, {
  36310. parentIndent,
  36311. isLastDescendant,
  36312. options
  36313. }) {
  36314. 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];
  36315. let leadingSpaceCount;
  36316. if (node.indent === null) {
  36317. const matches = content.match(/^(?<leadingSpace> *)[^\n\r ]/m);
  36318. leadingSpaceCount = matches ? matches.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
  36319. } else {
  36320. leadingSpaceCount = node.indent - 1 + parentIndent;
  36321. }
  36322. const rawLineContents = content.split("\n").map((lineContent) => lineContent.slice(leadingSpaceCount));
  36323. if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
  36324. return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]));
  36325. }
  36326. 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));
  36327. function removeUnnecessaryTrailingNewlines(lineContents) {
  36328. if (node.chomping === "keep") {
  36329. return getLast(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
  36330. }
  36331. let trailingNewlineCount = 0;
  36332. for (let i = lineContents.length - 1; i >= 0; i--) {
  36333. if (lineContents[i].length === 0) {
  36334. trailingNewlineCount++;
  36335. } else {
  36336. break;
  36337. }
  36338. }
  36339. return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
  36340. }
  36341. }
  36342. function isInlineNode(node) {
  36343. if (!node) {
  36344. return true;
  36345. }
  36346. switch (node.type) {
  36347. case "plain":
  36348. case "quoteDouble":
  36349. case "quoteSingle":
  36350. case "alias":
  36351. case "flowMapping":
  36352. case "flowSequence":
  36353. return true;
  36354. default:
  36355. return false;
  36356. }
  36357. }
  36358. module2.exports = {
  36359. getLast,
  36360. getAncestorCount,
  36361. isNode,
  36362. isEmptyNode,
  36363. isInlineNode,
  36364. mapNode,
  36365. defineShortcut,
  36366. isNextLineEmpty,
  36367. isLastDescendantNode,
  36368. getBlockValueLineContents,
  36369. getFlowScalarLineContents,
  36370. getLastDescendantNode,
  36371. hasPrettierIgnore,
  36372. hasLeadingComments,
  36373. hasMiddleComments,
  36374. hasIndicatorComment,
  36375. hasTrailingComment,
  36376. hasEndComments
  36377. };
  36378. }
  36379. });
  36380. var require_print_preprocess4 = __commonJS2({
  36381. "src/language-yaml/print-preprocess.js"(exports2, module2) {
  36382. "use strict";
  36383. var {
  36384. defineShortcut,
  36385. mapNode
  36386. } = require_utils12();
  36387. function preprocess(ast) {
  36388. return mapNode(ast, defineShortcuts);
  36389. }
  36390. function defineShortcuts(node) {
  36391. switch (node.type) {
  36392. case "document":
  36393. defineShortcut(node, "head", () => node.children[0]);
  36394. defineShortcut(node, "body", () => node.children[1]);
  36395. break;
  36396. case "documentBody":
  36397. case "sequenceItem":
  36398. case "flowSequenceItem":
  36399. case "mappingKey":
  36400. case "mappingValue":
  36401. defineShortcut(node, "content", () => node.children[0]);
  36402. break;
  36403. case "mappingItem":
  36404. case "flowMappingItem":
  36405. defineShortcut(node, "key", () => node.children[0]);
  36406. defineShortcut(node, "value", () => node.children[1]);
  36407. break;
  36408. }
  36409. return node;
  36410. }
  36411. module2.exports = preprocess;
  36412. }
  36413. });
  36414. var require_misc2 = __commonJS2({
  36415. "src/language-yaml/print/misc.js"(exports2, module2) {
  36416. "use strict";
  36417. var {
  36418. builders: {
  36419. softline,
  36420. align
  36421. }
  36422. } = require("./doc.js");
  36423. var {
  36424. hasEndComments,
  36425. isNextLineEmpty,
  36426. isNode
  36427. } = require_utils12();
  36428. var printedEmptyLineCache = /* @__PURE__ */ new WeakMap();
  36429. function printNextEmptyLine(path, originalText) {
  36430. const node = path.getValue();
  36431. const root = path.stack[0];
  36432. let isNextEmptyLinePrintedSet;
  36433. if (printedEmptyLineCache.has(root)) {
  36434. isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root);
  36435. } else {
  36436. isNextEmptyLinePrintedSet = /* @__PURE__ */ new Set();
  36437. printedEmptyLineCache.set(root, isNextEmptyLinePrintedSet);
  36438. }
  36439. if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
  36440. isNextEmptyLinePrintedSet.add(node.position.end.line);
  36441. if (isNextLineEmpty(node, originalText) && !shouldPrintEndComments(path.getParentNode())) {
  36442. return softline;
  36443. }
  36444. }
  36445. return "";
  36446. }
  36447. function shouldPrintEndComments(node) {
  36448. return hasEndComments(node) && !isNode(node, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
  36449. }
  36450. function alignWithSpaces(width, doc2) {
  36451. return align(" ".repeat(width), doc2);
  36452. }
  36453. module2.exports = {
  36454. alignWithSpaces,
  36455. shouldPrintEndComments,
  36456. printNextEmptyLine
  36457. };
  36458. }
  36459. });
  36460. var require_flow_mapping_sequence = __commonJS2({
  36461. "src/language-yaml/print/flow-mapping-sequence.js"(exports2, module2) {
  36462. "use strict";
  36463. var {
  36464. builders: {
  36465. ifBreak,
  36466. line,
  36467. softline,
  36468. hardline,
  36469. join
  36470. }
  36471. } = require("./doc.js");
  36472. var {
  36473. isEmptyNode,
  36474. getLast,
  36475. hasEndComments
  36476. } = require_utils12();
  36477. var {
  36478. printNextEmptyLine,
  36479. alignWithSpaces
  36480. } = require_misc2();
  36481. function printFlowMapping(path, print, options) {
  36482. const node = path.getValue();
  36483. const isMapping = node.type === "flowMapping";
  36484. const openMarker = isMapping ? "{" : "[";
  36485. const closeMarker = isMapping ? "}" : "]";
  36486. let bracketSpacing = softline;
  36487. if (isMapping && node.children.length > 0 && options.bracketSpacing) {
  36488. bracketSpacing = line;
  36489. }
  36490. const lastItem = getLast(node.children);
  36491. const isLastItemEmptyMappingItem = lastItem && lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
  36492. 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];
  36493. }
  36494. function printChildren(path, print, options) {
  36495. const node = path.getValue();
  36496. 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");
  36497. return parts;
  36498. }
  36499. module2.exports = {
  36500. printFlowMapping,
  36501. printFlowSequence: printFlowMapping
  36502. };
  36503. }
  36504. });
  36505. var require_mapping_item = __commonJS2({
  36506. "src/language-yaml/print/mapping-item.js"(exports2, module2) {
  36507. "use strict";
  36508. var {
  36509. builders: {
  36510. conditionalGroup,
  36511. group,
  36512. hardline,
  36513. ifBreak,
  36514. join,
  36515. line
  36516. }
  36517. } = require("./doc.js");
  36518. var {
  36519. hasLeadingComments,
  36520. hasMiddleComments,
  36521. hasTrailingComment,
  36522. hasEndComments,
  36523. isNode,
  36524. isEmptyNode,
  36525. isInlineNode
  36526. } = require_utils12();
  36527. var {
  36528. alignWithSpaces
  36529. } = require_misc2();
  36530. function printMappingItem(node, parentNode, path, print, options) {
  36531. const {
  36532. key,
  36533. value
  36534. } = node;
  36535. const isEmptyMappingKey = isEmptyNode(key);
  36536. const isEmptyMappingValue = isEmptyNode(value);
  36537. if (isEmptyMappingKey && isEmptyMappingValue) {
  36538. return ": ";
  36539. }
  36540. const printedKey = print("key");
  36541. const spaceBeforeColon = needsSpaceInFrontOfMappingValue(node) ? " " : "";
  36542. if (isEmptyMappingValue) {
  36543. if (node.type === "flowMappingItem" && parentNode.type === "flowMapping") {
  36544. return printedKey;
  36545. }
  36546. if (node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasTrailingComment(key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set")) {
  36547. return [printedKey, spaceBeforeColon, ":"];
  36548. }
  36549. return ["? ", alignWithSpaces(2, printedKey)];
  36550. }
  36551. const printedValue = print("value");
  36552. if (isEmptyMappingKey) {
  36553. return [": ", alignWithSpaces(2, printedValue)];
  36554. }
  36555. if (hasLeadingComments(value) || !isInlineNode(key.content)) {
  36556. return ["? ", alignWithSpaces(2, printedKey), hardline, join("", path.map(print, "value", "leadingComments").map((comment) => [comment, hardline])), ": ", alignWithSpaces(2, printedValue)];
  36557. }
  36558. 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)) {
  36559. return [printedKey, spaceBeforeColon, ": ", printedValue];
  36560. }
  36561. const groupId = Symbol("mappingKey");
  36562. const groupedKey = group([ifBreak("? "), group(alignWithSpaces(2, printedKey), {
  36563. id: groupId
  36564. })]);
  36565. const explicitMappingValue = [hardline, ": ", alignWithSpaces(2, printedValue)];
  36566. const implicitMappingValueParts = [spaceBeforeColon, ":"];
  36567. 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) {
  36568. implicitMappingValueParts.push(hardline);
  36569. } else if (value.content) {
  36570. implicitMappingValueParts.push(line);
  36571. }
  36572. implicitMappingValueParts.push(printedValue);
  36573. const implicitMappingValue = alignWithSpaces(options.tabWidth, implicitMappingValueParts);
  36574. if (isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasEndComments(key)) {
  36575. return conditionalGroup([[printedKey, implicitMappingValue]]);
  36576. }
  36577. return conditionalGroup([[groupedKey, ifBreak(explicitMappingValue, implicitMappingValue, {
  36578. groupId
  36579. })]]);
  36580. }
  36581. function isAbsolutelyPrintedAsSingleLineNode(node, options) {
  36582. if (!node) {
  36583. return true;
  36584. }
  36585. switch (node.type) {
  36586. case "plain":
  36587. case "quoteSingle":
  36588. case "quoteDouble":
  36589. break;
  36590. case "alias":
  36591. return true;
  36592. default:
  36593. return false;
  36594. }
  36595. if (options.proseWrap === "preserve") {
  36596. return node.position.start.line === node.position.end.line;
  36597. }
  36598. if (/\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
  36599. return false;
  36600. }
  36601. switch (options.proseWrap) {
  36602. case "never":
  36603. return !node.value.includes("\n");
  36604. case "always":
  36605. return !/[\n ]/.test(node.value);
  36606. default:
  36607. return false;
  36608. }
  36609. }
  36610. function needsSpaceInFrontOfMappingValue(node) {
  36611. return node.key.content && node.key.content.type === "alias";
  36612. }
  36613. function isSingleLineNode(node) {
  36614. if (!node) {
  36615. return true;
  36616. }
  36617. switch (node.type) {
  36618. case "plain":
  36619. case "quoteDouble":
  36620. case "quoteSingle":
  36621. return node.position.start.line === node.position.end.line;
  36622. case "alias":
  36623. return true;
  36624. default:
  36625. return false;
  36626. }
  36627. }
  36628. module2.exports = printMappingItem;
  36629. }
  36630. });
  36631. var require_block2 = __commonJS2({
  36632. "src/language-yaml/print/block.js"(exports2, module2) {
  36633. "use strict";
  36634. var {
  36635. builders: {
  36636. dedent,
  36637. dedentToRoot,
  36638. fill,
  36639. hardline,
  36640. join,
  36641. line,
  36642. literalline,
  36643. markAsRoot
  36644. },
  36645. utils: {
  36646. getDocParts
  36647. }
  36648. } = require("./doc.js");
  36649. var {
  36650. getAncestorCount,
  36651. getBlockValueLineContents,
  36652. hasIndicatorComment,
  36653. isLastDescendantNode,
  36654. isNode
  36655. } = require_utils12();
  36656. var {
  36657. alignWithSpaces
  36658. } = require_misc2();
  36659. function printBlock(path, print, options) {
  36660. const node = path.getValue();
  36661. const parentIndent = getAncestorCount(path, (ancestorNode) => isNode(ancestorNode, ["sequence", "mapping"]));
  36662. const isLastDescendant = isLastDescendantNode(path);
  36663. const parts = [node.type === "blockFolded" ? ">" : "|"];
  36664. if (node.indent !== null) {
  36665. parts.push(node.indent.toString());
  36666. }
  36667. if (node.chomping !== "clip") {
  36668. parts.push(node.chomping === "keep" ? "+" : "-");
  36669. }
  36670. if (hasIndicatorComment(node)) {
  36671. parts.push(" ", print("indicatorComment"));
  36672. }
  36673. const lineContents = getBlockValueLineContents(node, {
  36674. parentIndent,
  36675. isLastDescendant,
  36676. options
  36677. });
  36678. const contentsParts = [];
  36679. for (const [index, lineWords] of lineContents.entries()) {
  36680. if (index === 0) {
  36681. contentsParts.push(hardline);
  36682. }
  36683. contentsParts.push(fill(getDocParts(join(line, lineWords))));
  36684. if (index !== lineContents.length - 1) {
  36685. contentsParts.push(lineWords.length === 0 ? hardline : markAsRoot(literalline));
  36686. } else if (node.chomping === "keep" && isLastDescendant) {
  36687. contentsParts.push(dedentToRoot(lineWords.length === 0 ? hardline : literalline));
  36688. }
  36689. }
  36690. if (node.indent === null) {
  36691. parts.push(dedent(alignWithSpaces(options.tabWidth, contentsParts)));
  36692. } else {
  36693. parts.push(dedentToRoot(alignWithSpaces(node.indent - 1 + parentIndent, contentsParts)));
  36694. }
  36695. return parts;
  36696. }
  36697. module2.exports = printBlock;
  36698. }
  36699. });
  36700. var require_printer_yaml = __commonJS2({
  36701. "src/language-yaml/printer-yaml.js"(exports2, module2) {
  36702. "use strict";
  36703. var {
  36704. builders: {
  36705. breakParent,
  36706. fill,
  36707. group,
  36708. hardline,
  36709. join,
  36710. line,
  36711. lineSuffix,
  36712. literalline
  36713. },
  36714. utils: {
  36715. getDocParts,
  36716. replaceTextEndOfLine
  36717. }
  36718. } = require("./doc.js");
  36719. var {
  36720. isPreviousLineEmpty
  36721. } = require_util();
  36722. var {
  36723. insertPragma,
  36724. isPragma
  36725. } = require_pragma6();
  36726. var {
  36727. locStart
  36728. } = require_loc7();
  36729. var embed = require_embed5();
  36730. var {
  36731. getFlowScalarLineContents,
  36732. getLastDescendantNode,
  36733. hasLeadingComments,
  36734. hasMiddleComments,
  36735. hasTrailingComment,
  36736. hasEndComments,
  36737. hasPrettierIgnore,
  36738. isLastDescendantNode,
  36739. isNode,
  36740. isInlineNode
  36741. } = require_utils12();
  36742. var preprocess = require_print_preprocess4();
  36743. var {
  36744. alignWithSpaces,
  36745. printNextEmptyLine,
  36746. shouldPrintEndComments
  36747. } = require_misc2();
  36748. var {
  36749. printFlowMapping,
  36750. printFlowSequence
  36751. } = require_flow_mapping_sequence();
  36752. var printMappingItem = require_mapping_item();
  36753. var printBlock = require_block2();
  36754. function genericPrint(path, options, print) {
  36755. const node = path.getValue();
  36756. const parts = [];
  36757. if (node.type !== "mappingValue" && hasLeadingComments(node)) {
  36758. parts.push([join(hardline, path.map(print, "leadingComments")), hardline]);
  36759. }
  36760. const {
  36761. tag,
  36762. anchor
  36763. } = node;
  36764. if (tag) {
  36765. parts.push(print("tag"));
  36766. }
  36767. if (tag && anchor) {
  36768. parts.push(" ");
  36769. }
  36770. if (anchor) {
  36771. parts.push(print("anchor"));
  36772. }
  36773. let nextEmptyLine = "";
  36774. if (isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path)) {
  36775. nextEmptyLine = printNextEmptyLine(path, options.originalText);
  36776. }
  36777. if (tag || anchor) {
  36778. if (isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node)) {
  36779. parts.push(hardline);
  36780. } else {
  36781. parts.push(" ");
  36782. }
  36783. }
  36784. if (hasMiddleComments(node)) {
  36785. parts.push([node.middleComments.length === 1 ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline]);
  36786. }
  36787. const parentNode = path.getParentNode();
  36788. if (hasPrettierIgnore(path)) {
  36789. parts.push(replaceTextEndOfLine(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline));
  36790. } else {
  36791. parts.push(group(printNode(node, parentNode, path, options, print)));
  36792. }
  36793. if (hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])) {
  36794. parts.push(lineSuffix([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent, print("trailingComment")]));
  36795. }
  36796. if (shouldPrintEndComments(node)) {
  36797. parts.push(alignWithSpaces(node.type === "sequenceItem" ? 2 : 0, [hardline, join(hardline, path.map((path2) => [isPreviousLineEmpty(options.originalText, path2.getValue(), locStart) ? hardline : "", print()], "endComments"))]));
  36798. }
  36799. parts.push(nextEmptyLine);
  36800. return parts;
  36801. }
  36802. function printNode(node, parentNode, path, options, print) {
  36803. switch (node.type) {
  36804. case "root": {
  36805. const {
  36806. children
  36807. } = node;
  36808. const parts = [];
  36809. path.each((childPath, index) => {
  36810. const document = children[index];
  36811. const nextDocument = children[index + 1];
  36812. if (index !== 0) {
  36813. parts.push(hardline);
  36814. }
  36815. parts.push(print());
  36816. if (shouldPrintDocumentEndMarker(document, nextDocument)) {
  36817. parts.push(hardline, "...");
  36818. if (hasTrailingComment(document)) {
  36819. parts.push(" ", print("trailingComment"));
  36820. }
  36821. } else if (nextDocument && !hasTrailingComment(nextDocument.head)) {
  36822. parts.push(hardline, "---");
  36823. }
  36824. }, "children");
  36825. const lastDescendantNode = getLastDescendantNode(node);
  36826. if (!isNode(lastDescendantNode, ["blockLiteral", "blockFolded"]) || lastDescendantNode.chomping !== "keep") {
  36827. parts.push(hardline);
  36828. }
  36829. return parts;
  36830. }
  36831. case "document": {
  36832. const nextDocument = parentNode.children[path.getName() + 1];
  36833. const parts = [];
  36834. if (shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head") {
  36835. if (node.head.children.length > 0 || node.head.endComments.length > 0) {
  36836. parts.push(print("head"));
  36837. }
  36838. if (hasTrailingComment(node.head)) {
  36839. parts.push(["---", " ", print(["head", "trailingComment"])]);
  36840. } else {
  36841. parts.push("---");
  36842. }
  36843. }
  36844. if (shouldPrintDocumentBody(node)) {
  36845. parts.push(print("body"));
  36846. }
  36847. return join(hardline, parts);
  36848. }
  36849. case "documentHead":
  36850. return join(hardline, [...path.map(print, "children"), ...path.map(print, "endComments")]);
  36851. case "documentBody": {
  36852. const {
  36853. children,
  36854. endComments
  36855. } = node;
  36856. let separator = "";
  36857. if (children.length > 0 && endComments.length > 0) {
  36858. const lastDescendantNode = getLastDescendantNode(node);
  36859. if (isNode(lastDescendantNode, ["blockFolded", "blockLiteral"])) {
  36860. if (lastDescendantNode.chomping !== "keep") {
  36861. separator = [hardline, hardline];
  36862. }
  36863. } else {
  36864. separator = hardline;
  36865. }
  36866. }
  36867. return [join(hardline, path.map(print, "children")), separator, join(hardline, path.map(print, "endComments"))];
  36868. }
  36869. case "directive":
  36870. return ["%", join(" ", [node.name, ...node.parameters])];
  36871. case "comment":
  36872. return ["#", node.value];
  36873. case "alias":
  36874. return ["*", node.value];
  36875. case "tag":
  36876. return options.originalText.slice(node.position.start.offset, node.position.end.offset);
  36877. case "anchor":
  36878. return ["&", node.value];
  36879. case "plain":
  36880. return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
  36881. case "quoteDouble":
  36882. case "quoteSingle": {
  36883. const singleQuote = "'";
  36884. const doubleQuote = '"';
  36885. const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
  36886. if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
  36887. const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
  36888. return [originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote];
  36889. }
  36890. if (raw.includes(doubleQuote)) {
  36891. return [singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw.replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote];
  36892. }
  36893. if (raw.includes(singleQuote)) {
  36894. return [doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? raw.replace(/''/g, singleQuote) : raw, options), doubleQuote];
  36895. }
  36896. const quote = options.singleQuote ? singleQuote : doubleQuote;
  36897. return [quote, printFlowScalarContent(node.type, raw, options), quote];
  36898. }
  36899. case "blockFolded":
  36900. case "blockLiteral": {
  36901. return printBlock(path, print, options);
  36902. }
  36903. case "mapping":
  36904. case "sequence":
  36905. return join(hardline, path.map(print, "children"));
  36906. case "sequenceItem":
  36907. return ["- ", alignWithSpaces(2, node.content ? print("content") : "")];
  36908. case "mappingKey":
  36909. case "mappingValue":
  36910. return !node.content ? "" : print("content");
  36911. case "mappingItem":
  36912. case "flowMappingItem": {
  36913. return printMappingItem(node, parentNode, path, print, options);
  36914. }
  36915. case "flowMapping":
  36916. return printFlowMapping(path, print, options);
  36917. case "flowSequence":
  36918. return printFlowSequence(path, print, options);
  36919. case "flowSequenceItem":
  36920. return print("content");
  36921. default:
  36922. throw new Error(`Unexpected node type ${node.type}`);
  36923. }
  36924. }
  36925. function shouldPrintDocumentBody(document) {
  36926. return document.body.children.length > 0 || hasEndComments(document.body);
  36927. }
  36928. function shouldPrintDocumentEndMarker(document, nextDocument) {
  36929. return hasTrailingComment(document) || nextDocument && (nextDocument.head.children.length > 0 || hasEndComments(nextDocument.head));
  36930. }
  36931. function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
  36932. if (root.children[0] === document && /---(?:\s|$)/.test(options.originalText.slice(locStart(document), locStart(document) + 4)) || document.head.children.length > 0 || hasEndComments(document.head) || hasTrailingComment(document.head)) {
  36933. return "head";
  36934. }
  36935. if (shouldPrintDocumentEndMarker(document, nextDocument)) {
  36936. return false;
  36937. }
  36938. return nextDocument ? "root" : false;
  36939. }
  36940. function printFlowScalarContent(nodeType, content, options) {
  36941. const lineContents = getFlowScalarLineContents(nodeType, content, options);
  36942. return join(hardline, lineContents.map((lineContentWords) => fill(getDocParts(join(line, lineContentWords)))));
  36943. }
  36944. function clean(node, newNode) {
  36945. if (isNode(newNode)) {
  36946. delete newNode.position;
  36947. switch (newNode.type) {
  36948. case "comment":
  36949. if (isPragma(newNode.value)) {
  36950. return null;
  36951. }
  36952. break;
  36953. case "quoteDouble":
  36954. case "quoteSingle":
  36955. newNode.type = "quote";
  36956. break;
  36957. }
  36958. }
  36959. }
  36960. module2.exports = {
  36961. preprocess,
  36962. embed,
  36963. print: genericPrint,
  36964. massageAstNode: clean,
  36965. insertPragma
  36966. };
  36967. }
  36968. });
  36969. var require_options7 = __commonJS2({
  36970. "src/language-yaml/options.js"(exports2, module2) {
  36971. "use strict";
  36972. var commonOptions = require_common_options();
  36973. module2.exports = {
  36974. bracketSpacing: commonOptions.bracketSpacing,
  36975. singleQuote: commonOptions.singleQuote,
  36976. proseWrap: commonOptions.proseWrap
  36977. };
  36978. }
  36979. });
  36980. var require_parsers7 = __commonJS2({
  36981. "src/language-yaml/parsers.js"(exports2, module2) {
  36982. "use strict";
  36983. module2.exports = {
  36984. get yaml() {
  36985. return require("./parser-yaml.js").parsers.yaml;
  36986. }
  36987. };
  36988. }
  36989. });
  36990. var require_YAML = __commonJS2({
  36991. "node_modules/linguist-languages/data/YAML.json"(exports2, module2) {
  36992. module2.exports = {
  36993. name: "YAML",
  36994. type: "data",
  36995. color: "#cb171e",
  36996. tmScope: "source.yaml",
  36997. aliases: ["yml"],
  36998. extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"],
  36999. filenames: [".clang-format", ".clang-tidy", ".gemrc", "CITATION.cff", "glide.lock", "yarn.lock"],
  37000. aceMode: "yaml",
  37001. codemirrorMode: "yaml",
  37002. codemirrorMimeType: "text/x-yaml",
  37003. languageId: 407
  37004. };
  37005. }
  37006. });
  37007. var require_language_yaml = __commonJS2({
  37008. "src/language-yaml/index.js"(exports2, module2) {
  37009. "use strict";
  37010. var createLanguage = require_create_language();
  37011. var printer = require_printer_yaml();
  37012. var options = require_options7();
  37013. var parsers = require_parsers7();
  37014. var languages = [createLanguage(require_YAML(), (data) => ({
  37015. since: "1.14.0",
  37016. parsers: ["yaml"],
  37017. vscodeLanguageIds: ["yaml", "ansible", "home-assistant"],
  37018. filenames: [...data.filenames.filter((filename) => filename !== "yarn.lock"), ".prettierrc", ".stylelintrc"]
  37019. }))];
  37020. module2.exports = {
  37021. languages,
  37022. printers: {
  37023. yaml: printer
  37024. },
  37025. options,
  37026. parsers
  37027. };
  37028. }
  37029. });
  37030. var require_languages = __commonJS2({
  37031. "src/languages.js"(exports2, module2) {
  37032. "use strict";
  37033. module2.exports = [require_language_js(), require_language_css(), require_language_handlebars(), require_language_graphql(), require_language_markdown(), require_language_html(), require_language_yaml()];
  37034. }
  37035. });
  37036. var require_load_plugins = __commonJS2({
  37037. "src/common/load-plugins.js"(exports2, module2) {
  37038. "use strict";
  37039. var fs = require("fs");
  37040. var path = require("path");
  37041. var fastGlob = require_out4();
  37042. var partition = require_partition();
  37043. var uniqByKey = require_uniq_by_key();
  37044. var internalPlugins = require_languages();
  37045. var {
  37046. default: mem2,
  37047. memClear: memClear2
  37048. } = (init_dist(), __toCommonJS(dist_exports));
  37049. var thirdParty = require("./third-party.js");
  37050. var resolve = require_resolve2();
  37051. var memoizedLoad = mem2(load, {
  37052. cacheKey: JSON.stringify
  37053. });
  37054. var memoizedSearch = mem2(findPluginsInNodeModules);
  37055. var clearCache = () => {
  37056. memClear2(memoizedLoad);
  37057. memClear2(memoizedSearch);
  37058. };
  37059. function load(plugins2, pluginSearchDirs) {
  37060. if (!plugins2) {
  37061. plugins2 = [];
  37062. }
  37063. if (pluginSearchDirs === false) {
  37064. pluginSearchDirs = [];
  37065. } else {
  37066. pluginSearchDirs = pluginSearchDirs || [];
  37067. if (pluginSearchDirs.length === 0) {
  37068. const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
  37069. if (autoLoadDir) {
  37070. pluginSearchDirs = [autoLoadDir];
  37071. }
  37072. }
  37073. }
  37074. const [externalPluginNames, externalPluginInstances] = partition(plugins2, (plugin) => typeof plugin === "string");
  37075. const externalManualLoadPluginInfos = externalPluginNames.map((pluginName) => {
  37076. let requirePath;
  37077. try {
  37078. requirePath = resolve(path.resolve(process.cwd(), pluginName));
  37079. } catch {
  37080. requirePath = resolve(pluginName, {
  37081. paths: [process.cwd()]
  37082. });
  37083. }
  37084. return {
  37085. name: pluginName,
  37086. requirePath
  37087. };
  37088. });
  37089. const externalAutoLoadPluginInfos = pluginSearchDirs.flatMap((pluginSearchDir) => {
  37090. const resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
  37091. const nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules");
  37092. if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
  37093. throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
  37094. }
  37095. return memoizedSearch(nodeModulesDir).map((pluginName) => ({
  37096. name: pluginName,
  37097. requirePath: resolve(pluginName, {
  37098. paths: [resolvedPluginSearchDir]
  37099. })
  37100. }));
  37101. });
  37102. const externalPlugins = [...uniqByKey([...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos], "requirePath").map((externalPluginInfo) => Object.assign({
  37103. name: externalPluginInfo.name
  37104. }, require(externalPluginInfo.requirePath))), ...externalPluginInstances];
  37105. return [...internalPlugins, ...externalPlugins];
  37106. }
  37107. function findPluginsInNodeModules(nodeModulesDir) {
  37108. const pluginPackageJsonPaths = fastGlob.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
  37109. cwd: nodeModulesDir
  37110. });
  37111. return pluginPackageJsonPaths.map(path.dirname);
  37112. }
  37113. function isDirectory(dir) {
  37114. try {
  37115. return fs.statSync(dir).isDirectory();
  37116. } catch {
  37117. return false;
  37118. }
  37119. }
  37120. module2.exports = {
  37121. loadPlugins: memoizedLoad,
  37122. clearCache
  37123. };
  37124. }
  37125. });
  37126. var {
  37127. version
  37128. } = require("./package.json");
  37129. var core = require_core();
  37130. var {
  37131. getSupportInfo
  37132. } = require_support();
  37133. var getFileInfo = require_get_file_info();
  37134. var sharedUtil = require_util_shared();
  37135. var plugins = require_load_plugins();
  37136. var config = require_resolve_config();
  37137. var doc = require("./doc.js");
  37138. function _withPlugins(fn, optsArgIdx = 1) {
  37139. return (...args) => {
  37140. const opts = args[optsArgIdx] || {};
  37141. args[optsArgIdx] = Object.assign(Object.assign({}, opts), {}, {
  37142. plugins: plugins.loadPlugins(opts.plugins, opts.pluginSearchDirs)
  37143. });
  37144. return fn(...args);
  37145. };
  37146. }
  37147. function withPlugins(fn, optsArgIdx) {
  37148. const resultingFn = _withPlugins(fn, optsArgIdx);
  37149. if (fn.sync) {
  37150. resultingFn.sync = _withPlugins(fn.sync, optsArgIdx);
  37151. }
  37152. return resultingFn;
  37153. }
  37154. var formatWithCursor = withPlugins(core.formatWithCursor);
  37155. module.exports = {
  37156. formatWithCursor,
  37157. format(text, opts) {
  37158. return formatWithCursor(text, opts).formatted;
  37159. },
  37160. check(text, opts) {
  37161. const {
  37162. formatted
  37163. } = formatWithCursor(text, opts);
  37164. return formatted === text;
  37165. },
  37166. doc,
  37167. resolveConfig: config.resolveConfig,
  37168. resolveConfigFile: config.resolveConfigFile,
  37169. clearConfigCache() {
  37170. config.clearCache();
  37171. plugins.clearCache();
  37172. },
  37173. getFileInfo: withPlugins(getFileInfo),
  37174. getSupportInfo: withPlugins(getSupportInfo, 0),
  37175. version,
  37176. util: sharedUtil,
  37177. __internal: {
  37178. errors: require_errors(),
  37179. coreOptions: require_core_options(),
  37180. createIgnorer: require_create_ignorer(),
  37181. optionsModule: require_options(),
  37182. optionsNormalizer: require_options_normalizer(),
  37183. utils: {
  37184. arrayify: require_arrayify(),
  37185. getLast: require_get_last(),
  37186. partition: require_partition(),
  37187. isNonEmptyArray: require_util().isNonEmptyArray
  37188. }
  37189. },
  37190. __debug: {
  37191. parse: withPlugins(core.parse),
  37192. formatAST: withPlugins(core.formatAST),
  37193. formatDoc: withPlugins(core.formatDoc),
  37194. printToDoc: withPlugins(core.printToDoc),
  37195. printDocToString: withPlugins(core.printDocToString)
  37196. }
  37197. };