12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848 |
- /*!
- Stencil Dev Server Process v4.20.0 | MIT Licensed | https://stenciljs.com
- */
- "use strict";
- var __create = Object.create;
- var __defProp = Object.defineProperty;
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
- var __getOwnPropNames = Object.getOwnPropertyNames;
- var __getProtoOf = Object.getPrototypeOf;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __commonJS = (cb, mod) => function __require() {
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
- };
- var __export = (target, all) => {
- for (var name in all)
- __defProp(target, name, { get: all[name], enumerable: true });
- };
- var __copyProps = (to, from, except, desc) => {
- if (from && typeof from === "object" || typeof from === "function") {
- for (let key of __getOwnPropNames(from))
- if (!__hasOwnProp.call(to, key) && key !== except)
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
- }
- return to;
- };
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
- // If the importer is in node compatibility mode or this is not an ESM
- // file that has been converted to a CommonJS file using a Babel-
- // compatible transform (i.e. "__esModule" has not been set), then set
- // "default" to the CommonJS "module.exports" for node compatibility.
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
- mod
- ));
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
- // node_modules/is-wsl/node_modules/is-docker/index.js
- var require_is_docker = __commonJS({
- "node_modules/is-wsl/node_modules/is-docker/index.js"(exports2, module2) {
- "use strict";
- var fs7 = require("fs");
- var isDocker2;
- function hasDockerEnv2() {
- try {
- fs7.statSync("/.dockerenv");
- return true;
- } catch (_) {
- return false;
- }
- }
- function hasDockerCGroup2() {
- try {
- return fs7.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
- } catch (_) {
- return false;
- }
- }
- module2.exports = () => {
- if (isDocker2 === void 0) {
- isDocker2 = hasDockerEnv2() || hasDockerCGroup2();
- }
- return isDocker2;
- };
- }
- });
- // node_modules/is-wsl/index.js
- var require_is_wsl = __commonJS({
- "node_modules/is-wsl/index.js"(exports2, module2) {
- "use strict";
- var os3 = require("os");
- var fs7 = require("fs");
- var isDocker2 = require_is_docker();
- var isWsl2 = () => {
- if (process.platform !== "linux") {
- return false;
- }
- if (os3.release().toLowerCase().includes("microsoft")) {
- if (isDocker2()) {
- return false;
- }
- return true;
- }
- try {
- return fs7.readFileSync("/proc/version", "utf8").toLowerCase().includes("microsoft") ? !isDocker2() : false;
- } catch (_) {
- return false;
- }
- };
- if (process.env.__IS_WSL_TEST__) {
- module2.exports = isWsl2;
- } else {
- module2.exports = isWsl2();
- }
- }
- });
- // node_modules/big-integer/BigInteger.js
- var require_BigInteger = __commonJS({
- "node_modules/big-integer/BigInteger.js"(exports2, module2) {
- var bigInt = function(undefined2) {
- "use strict";
- var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz";
- var supportsNativeBigInt = typeof BigInt === "function";
- function Integer(v, radix, alphabet, caseSensitive) {
- if (typeof v === "undefined") return Integer[0];
- if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive);
- return parseValue(v);
- }
- function BigInteger(value, sign) {
- this.value = value;
- this.sign = sign;
- this.isSmall = false;
- }
- BigInteger.prototype = Object.create(Integer.prototype);
- function SmallInteger(value) {
- this.value = value;
- this.sign = value < 0;
- this.isSmall = true;
- }
- SmallInteger.prototype = Object.create(Integer.prototype);
- function NativeBigInt(value) {
- this.value = value;
- }
- NativeBigInt.prototype = Object.create(Integer.prototype);
- function isPrecise(n) {
- return -MAX_INT < n && n < MAX_INT;
- }
- function smallToArray(n) {
- if (n < 1e7)
- return [n];
- if (n < 1e14)
- return [n % 1e7, Math.floor(n / 1e7)];
- return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)];
- }
- function arrayToSmall(arr) {
- trim(arr);
- var length = arr.length;
- if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) {
- switch (length) {
- case 0:
- return 0;
- case 1:
- return arr[0];
- case 2:
- return arr[0] + arr[1] * BASE;
- default:
- return arr[0] + (arr[1] + arr[2] * BASE) * BASE;
- }
- }
- return arr;
- }
- function trim(v) {
- var i2 = v.length;
- while (v[--i2] === 0) ;
- v.length = i2 + 1;
- }
- function createArray(length) {
- var x = new Array(length);
- var i2 = -1;
- while (++i2 < length) {
- x[i2] = 0;
- }
- return x;
- }
- function truncate(n) {
- if (n > 0) return Math.floor(n);
- return Math.ceil(n);
- }
- function add(a, b) {
- var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i2;
- for (i2 = 0; i2 < l_b; i2++) {
- sum = a[i2] + b[i2] + carry;
- carry = sum >= base ? 1 : 0;
- r[i2] = sum - carry * base;
- }
- while (i2 < l_a) {
- sum = a[i2] + carry;
- carry = sum === base ? 1 : 0;
- r[i2++] = sum - carry * base;
- }
- if (carry > 0) r.push(carry);
- return r;
- }
- function addAny(a, b) {
- if (a.length >= b.length) return add(a, b);
- return add(b, a);
- }
- function addSmall(a, carry) {
- var l = a.length, r = new Array(l), base = BASE, sum, i2;
- for (i2 = 0; i2 < l; i2++) {
- sum = a[i2] - base + carry;
- carry = Math.floor(sum / base);
- r[i2] = sum - carry * base;
- carry += 1;
- }
- while (carry > 0) {
- r[i2++] = carry % base;
- carry = Math.floor(carry / base);
- }
- return r;
- }
- BigInteger.prototype.add = function(v) {
- var n = parseValue(v);
- if (this.sign !== n.sign) {
- return this.subtract(n.negate());
- }
- var a = this.value, b = n.value;
- if (n.isSmall) {
- return new BigInteger(addSmall(a, Math.abs(b)), this.sign);
- }
- return new BigInteger(addAny(a, b), this.sign);
- };
- BigInteger.prototype.plus = BigInteger.prototype.add;
- SmallInteger.prototype.add = function(v) {
- var n = parseValue(v);
- var a = this.value;
- if (a < 0 !== n.sign) {
- return this.subtract(n.negate());
- }
- var b = n.value;
- if (n.isSmall) {
- if (isPrecise(a + b)) return new SmallInteger(a + b);
- b = smallToArray(Math.abs(b));
- }
- return new BigInteger(addSmall(b, Math.abs(a)), a < 0);
- };
- SmallInteger.prototype.plus = SmallInteger.prototype.add;
- NativeBigInt.prototype.add = function(v) {
- return new NativeBigInt(this.value + parseValue(v).value);
- };
- NativeBigInt.prototype.plus = NativeBigInt.prototype.add;
- function subtract(a, b) {
- var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i2, difference;
- for (i2 = 0; i2 < b_l; i2++) {
- difference = a[i2] - borrow - b[i2];
- if (difference < 0) {
- difference += base;
- borrow = 1;
- } else borrow = 0;
- r[i2] = difference;
- }
- for (i2 = b_l; i2 < a_l; i2++) {
- difference = a[i2] - borrow;
- if (difference < 0) difference += base;
- else {
- r[i2++] = difference;
- break;
- }
- r[i2] = difference;
- }
- for (; i2 < a_l; i2++) {
- r[i2] = a[i2];
- }
- trim(r);
- return r;
- }
- function subtractAny(a, b, sign) {
- var value;
- if (compareAbs(a, b) >= 0) {
- value = subtract(a, b);
- } else {
- value = subtract(b, a);
- sign = !sign;
- }
- value = arrayToSmall(value);
- if (typeof value === "number") {
- if (sign) value = -value;
- return new SmallInteger(value);
- }
- return new BigInteger(value, sign);
- }
- function subtractSmall(a, b, sign) {
- var l = a.length, r = new Array(l), carry = -b, base = BASE, i2, difference;
- for (i2 = 0; i2 < l; i2++) {
- difference = a[i2] + carry;
- carry = Math.floor(difference / base);
- difference %= base;
- r[i2] = difference < 0 ? difference + base : difference;
- }
- r = arrayToSmall(r);
- if (typeof r === "number") {
- if (sign) r = -r;
- return new SmallInteger(r);
- }
- return new BigInteger(r, sign);
- }
- BigInteger.prototype.subtract = function(v) {
- var n = parseValue(v);
- if (this.sign !== n.sign) {
- return this.add(n.negate());
- }
- var a = this.value, b = n.value;
- if (n.isSmall)
- return subtractSmall(a, Math.abs(b), this.sign);
- return subtractAny(a, b, this.sign);
- };
- BigInteger.prototype.minus = BigInteger.prototype.subtract;
- SmallInteger.prototype.subtract = function(v) {
- var n = parseValue(v);
- var a = this.value;
- if (a < 0 !== n.sign) {
- return this.add(n.negate());
- }
- var b = n.value;
- if (n.isSmall) {
- return new SmallInteger(a - b);
- }
- return subtractSmall(b, Math.abs(a), a >= 0);
- };
- SmallInteger.prototype.minus = SmallInteger.prototype.subtract;
- NativeBigInt.prototype.subtract = function(v) {
- return new NativeBigInt(this.value - parseValue(v).value);
- };
- NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract;
- BigInteger.prototype.negate = function() {
- return new BigInteger(this.value, !this.sign);
- };
- SmallInteger.prototype.negate = function() {
- var sign = this.sign;
- var small = new SmallInteger(-this.value);
- small.sign = !sign;
- return small;
- };
- NativeBigInt.prototype.negate = function() {
- return new NativeBigInt(-this.value);
- };
- BigInteger.prototype.abs = function() {
- return new BigInteger(this.value, false);
- };
- SmallInteger.prototype.abs = function() {
- return new SmallInteger(Math.abs(this.value));
- };
- NativeBigInt.prototype.abs = function() {
- return new NativeBigInt(this.value >= 0 ? this.value : -this.value);
- };
- function multiplyLong(a, b) {
- var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE, product, carry, i2, a_i, b_j;
- for (i2 = 0; i2 < a_l; ++i2) {
- a_i = a[i2];
- for (var j = 0; j < b_l; ++j) {
- b_j = b[j];
- product = a_i * b_j + r[i2 + j];
- carry = Math.floor(product / base);
- r[i2 + j] = product - carry * base;
- r[i2 + j + 1] += carry;
- }
- }
- trim(r);
- return r;
- }
- function multiplySmall(a, b) {
- var l = a.length, r = new Array(l), base = BASE, carry = 0, product, i2;
- for (i2 = 0; i2 < l; i2++) {
- product = a[i2] * b + carry;
- carry = Math.floor(product / base);
- r[i2] = product - carry * base;
- }
- while (carry > 0) {
- r[i2++] = carry % base;
- carry = Math.floor(carry / base);
- }
- return r;
- }
- function shiftLeft(x, n) {
- var r = [];
- while (n-- > 0) r.push(0);
- return r.concat(x);
- }
- function multiplyKaratsuba(x, y) {
- var n = Math.max(x.length, y.length);
- if (n <= 30) return multiplyLong(x, y);
- n = Math.ceil(n / 2);
- var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n);
- var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d));
- var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n));
- trim(product);
- return product;
- }
- function useKaratsuba(l1, l2) {
- return -0.012 * l1 - 0.012 * l2 + 15e-6 * l1 * l2 > 0;
- }
- BigInteger.prototype.multiply = function(v) {
- var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs;
- if (n.isSmall) {
- if (b === 0) return Integer[0];
- if (b === 1) return this;
- if (b === -1) return this.negate();
- abs = Math.abs(b);
- if (abs < BASE) {
- return new BigInteger(multiplySmall(a, abs), sign);
- }
- b = smallToArray(abs);
- }
- if (useKaratsuba(a.length, b.length))
- return new BigInteger(multiplyKaratsuba(a, b), sign);
- return new BigInteger(multiplyLong(a, b), sign);
- };
- BigInteger.prototype.times = BigInteger.prototype.multiply;
- function multiplySmallAndArray(a, b, sign) {
- if (a < BASE) {
- return new BigInteger(multiplySmall(b, a), sign);
- }
- return new BigInteger(multiplyLong(b, smallToArray(a)), sign);
- }
- SmallInteger.prototype._multiplyBySmall = function(a) {
- if (isPrecise(a.value * this.value)) {
- return new SmallInteger(a.value * this.value);
- }
- return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign);
- };
- BigInteger.prototype._multiplyBySmall = function(a) {
- if (a.value === 0) return Integer[0];
- if (a.value === 1) return this;
- if (a.value === -1) return this.negate();
- return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign);
- };
- SmallInteger.prototype.multiply = function(v) {
- return parseValue(v)._multiplyBySmall(this);
- };
- SmallInteger.prototype.times = SmallInteger.prototype.multiply;
- NativeBigInt.prototype.multiply = function(v) {
- return new NativeBigInt(this.value * parseValue(v).value);
- };
- NativeBigInt.prototype.times = NativeBigInt.prototype.multiply;
- function square(a) {
- var l = a.length, r = createArray(l + l), base = BASE, product, carry, i2, a_i, a_j;
- for (i2 = 0; i2 < l; i2++) {
- a_i = a[i2];
- carry = 0 - a_i * a_i;
- for (var j = i2; j < l; j++) {
- a_j = a[j];
- product = 2 * (a_i * a_j) + r[i2 + j] + carry;
- carry = Math.floor(product / base);
- r[i2 + j] = product - carry * base;
- }
- r[i2 + l] = carry;
- }
- trim(r);
- return r;
- }
- BigInteger.prototype.square = function() {
- return new BigInteger(square(this.value), false);
- };
- SmallInteger.prototype.square = function() {
- var value = this.value * this.value;
- if (isPrecise(value)) return new SmallInteger(value);
- return new BigInteger(square(smallToArray(Math.abs(this.value))), false);
- };
- NativeBigInt.prototype.square = function(v) {
- return new NativeBigInt(this.value * this.value);
- };
- function divMod1(a, b) {
- var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i2, l, q;
- if (remainder.length <= a_l) remainder.push(0);
- divisor.push(0);
- divisorMostSignificantDigit = divisor[b_l - 1];
- for (shift = a_l - b_l; shift >= 0; shift--) {
- quotientDigit = base - 1;
- if (remainder[shift + b_l] !== divisorMostSignificantDigit) {
- quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit);
- }
- carry = 0;
- borrow = 0;
- l = divisor.length;
- for (i2 = 0; i2 < l; i2++) {
- carry += quotientDigit * divisor[i2];
- q = Math.floor(carry / base);
- borrow += remainder[shift + i2] - (carry - q * base);
- carry = q;
- if (borrow < 0) {
- remainder[shift + i2] = borrow + base;
- borrow = -1;
- } else {
- remainder[shift + i2] = borrow;
- borrow = 0;
- }
- }
- while (borrow !== 0) {
- quotientDigit -= 1;
- carry = 0;
- for (i2 = 0; i2 < l; i2++) {
- carry += remainder[shift + i2] - base + divisor[i2];
- if (carry < 0) {
- remainder[shift + i2] = carry + base;
- carry = 0;
- } else {
- remainder[shift + i2] = carry;
- carry = 1;
- }
- }
- borrow += carry;
- }
- result[shift] = quotientDigit;
- }
- remainder = divModSmall(remainder, lambda)[0];
- return [arrayToSmall(result), arrayToSmall(remainder)];
- }
- function divMod2(a, b) {
- var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check;
- while (a_l) {
- part.unshift(a[--a_l]);
- trim(part);
- if (compareAbs(part, b) < 0) {
- result.push(0);
- continue;
- }
- xlen = part.length;
- highx = part[xlen - 1] * base + part[xlen - 2];
- highy = b[b_l - 1] * base + b[b_l - 2];
- if (xlen > b_l) {
- highx = (highx + 1) * base;
- }
- guess = Math.ceil(highx / highy);
- do {
- check = multiplySmall(b, guess);
- if (compareAbs(check, part) <= 0) break;
- guess--;
- } while (guess);
- result.push(guess);
- part = subtract(part, check);
- }
- result.reverse();
- return [arrayToSmall(result), arrayToSmall(part)];
- }
- function divModSmall(value, lambda) {
- var length = value.length, quotient = createArray(length), base = BASE, i2, q, remainder, divisor;
- remainder = 0;
- for (i2 = length - 1; i2 >= 0; --i2) {
- divisor = remainder * base + value[i2];
- q = truncate(divisor / lambda);
- remainder = divisor - q * lambda;
- quotient[i2] = q | 0;
- }
- return [quotient, remainder | 0];
- }
- function divModAny(self, v) {
- var value, n = parseValue(v);
- if (supportsNativeBigInt) {
- return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)];
- }
- var a = self.value, b = n.value;
- var quotient;
- if (b === 0) throw new Error("Cannot divide by zero");
- if (self.isSmall) {
- if (n.isSmall) {
- return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)];
- }
- return [Integer[0], self];
- }
- if (n.isSmall) {
- if (b === 1) return [self, Integer[0]];
- if (b == -1) return [self.negate(), Integer[0]];
- var abs = Math.abs(b);
- if (abs < BASE) {
- value = divModSmall(a, abs);
- quotient = arrayToSmall(value[0]);
- var remainder = value[1];
- if (self.sign) remainder = -remainder;
- if (typeof quotient === "number") {
- if (self.sign !== n.sign) quotient = -quotient;
- return [new SmallInteger(quotient), new SmallInteger(remainder)];
- }
- return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)];
- }
- b = smallToArray(abs);
- }
- var comparison = compareAbs(a, b);
- if (comparison === -1) return [Integer[0], self];
- if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]];
- if (a.length + b.length <= 200)
- value = divMod1(a, b);
- else value = divMod2(a, b);
- quotient = value[0];
- var qSign = self.sign !== n.sign, mod = value[1], mSign = self.sign;
- if (typeof quotient === "number") {
- if (qSign) quotient = -quotient;
- quotient = new SmallInteger(quotient);
- } else quotient = new BigInteger(quotient, qSign);
- if (typeof mod === "number") {
- if (mSign) mod = -mod;
- mod = new SmallInteger(mod);
- } else mod = new BigInteger(mod, mSign);
- return [quotient, mod];
- }
- BigInteger.prototype.divmod = function(v) {
- var result = divModAny(this, v);
- return {
- quotient: result[0],
- remainder: result[1]
- };
- };
- NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod;
- BigInteger.prototype.divide = function(v) {
- return divModAny(this, v)[0];
- };
- NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function(v) {
- return new NativeBigInt(this.value / parseValue(v).value);
- };
- SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide;
- BigInteger.prototype.mod = function(v) {
- return divModAny(this, v)[1];
- };
- NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function(v) {
- return new NativeBigInt(this.value % parseValue(v).value);
- };
- SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod;
- BigInteger.prototype.pow = function(v) {
- var n = parseValue(v), a = this.value, b = n.value, value, x, y;
- if (b === 0) return Integer[1];
- if (a === 0) return Integer[0];
- if (a === 1) return Integer[1];
- if (a === -1) return n.isEven() ? Integer[1] : Integer[-1];
- if (n.sign) {
- return Integer[0];
- }
- if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large.");
- if (this.isSmall) {
- if (isPrecise(value = Math.pow(a, b)))
- return new SmallInteger(truncate(value));
- }
- x = this;
- y = Integer[1];
- while (true) {
- if (b & true) {
- y = y.times(x);
- --b;
- }
- if (b === 0) break;
- b /= 2;
- x = x.square();
- }
- return y;
- };
- SmallInteger.prototype.pow = BigInteger.prototype.pow;
- NativeBigInt.prototype.pow = function(v) {
- var n = parseValue(v);
- var a = this.value, b = n.value;
- var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2);
- if (b === _0) return Integer[1];
- if (a === _0) return Integer[0];
- if (a === _1) return Integer[1];
- if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1];
- if (n.isNegative()) return new NativeBigInt(_0);
- var x = this;
- var y = Integer[1];
- while (true) {
- if ((b & _1) === _1) {
- y = y.times(x);
- --b;
- }
- if (b === _0) break;
- b /= _2;
- x = x.square();
- }
- return y;
- };
- BigInteger.prototype.modPow = function(exp, mod) {
- exp = parseValue(exp);
- mod = parseValue(mod);
- if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0");
- var r = Integer[1], base = this.mod(mod);
- if (exp.isNegative()) {
- exp = exp.multiply(Integer[-1]);
- base = base.modInv(mod);
- }
- while (exp.isPositive()) {
- if (base.isZero()) return Integer[0];
- if (exp.isOdd()) r = r.multiply(base).mod(mod);
- exp = exp.divide(2);
- base = base.square().mod(mod);
- }
- return r;
- };
- NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow;
- function compareAbs(a, b) {
- if (a.length !== b.length) {
- return a.length > b.length ? 1 : -1;
- }
- for (var i2 = a.length - 1; i2 >= 0; i2--) {
- if (a[i2] !== b[i2]) return a[i2] > b[i2] ? 1 : -1;
- }
- return 0;
- }
- BigInteger.prototype.compareAbs = function(v) {
- var n = parseValue(v), a = this.value, b = n.value;
- if (n.isSmall) return 1;
- return compareAbs(a, b);
- };
- SmallInteger.prototype.compareAbs = function(v) {
- var n = parseValue(v), a = Math.abs(this.value), b = n.value;
- if (n.isSmall) {
- b = Math.abs(b);
- return a === b ? 0 : a > b ? 1 : -1;
- }
- return -1;
- };
- NativeBigInt.prototype.compareAbs = function(v) {
- var a = this.value;
- var b = parseValue(v).value;
- a = a >= 0 ? a : -a;
- b = b >= 0 ? b : -b;
- return a === b ? 0 : a > b ? 1 : -1;
- };
- BigInteger.prototype.compare = function(v) {
- if (v === Infinity) {
- return -1;
- }
- if (v === -Infinity) {
- return 1;
- }
- var n = parseValue(v), a = this.value, b = n.value;
- if (this.sign !== n.sign) {
- return n.sign ? 1 : -1;
- }
- if (n.isSmall) {
- return this.sign ? -1 : 1;
- }
- return compareAbs(a, b) * (this.sign ? -1 : 1);
- };
- BigInteger.prototype.compareTo = BigInteger.prototype.compare;
- SmallInteger.prototype.compare = function(v) {
- if (v === Infinity) {
- return -1;
- }
- if (v === -Infinity) {
- return 1;
- }
- var n = parseValue(v), a = this.value, b = n.value;
- if (n.isSmall) {
- return a == b ? 0 : a > b ? 1 : -1;
- }
- if (a < 0 !== n.sign) {
- return a < 0 ? -1 : 1;
- }
- return a < 0 ? 1 : -1;
- };
- SmallInteger.prototype.compareTo = SmallInteger.prototype.compare;
- NativeBigInt.prototype.compare = function(v) {
- if (v === Infinity) {
- return -1;
- }
- if (v === -Infinity) {
- return 1;
- }
- var a = this.value;
- var b = parseValue(v).value;
- return a === b ? 0 : a > b ? 1 : -1;
- };
- NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare;
- BigInteger.prototype.equals = function(v) {
- return this.compare(v) === 0;
- };
- NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals;
- BigInteger.prototype.notEquals = function(v) {
- return this.compare(v) !== 0;
- };
- NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals;
- BigInteger.prototype.greater = function(v) {
- return this.compare(v) > 0;
- };
- NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater;
- BigInteger.prototype.lesser = function(v) {
- return this.compare(v) < 0;
- };
- NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser;
- BigInteger.prototype.greaterOrEquals = function(v) {
- return this.compare(v) >= 0;
- };
- NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals;
- BigInteger.prototype.lesserOrEquals = function(v) {
- return this.compare(v) <= 0;
- };
- NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals;
- BigInteger.prototype.isEven = function() {
- return (this.value[0] & 1) === 0;
- };
- SmallInteger.prototype.isEven = function() {
- return (this.value & 1) === 0;
- };
- NativeBigInt.prototype.isEven = function() {
- return (this.value & BigInt(1)) === BigInt(0);
- };
- BigInteger.prototype.isOdd = function() {
- return (this.value[0] & 1) === 1;
- };
- SmallInteger.prototype.isOdd = function() {
- return (this.value & 1) === 1;
- };
- NativeBigInt.prototype.isOdd = function() {
- return (this.value & BigInt(1)) === BigInt(1);
- };
- BigInteger.prototype.isPositive = function() {
- return !this.sign;
- };
- SmallInteger.prototype.isPositive = function() {
- return this.value > 0;
- };
- NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive;
- BigInteger.prototype.isNegative = function() {
- return this.sign;
- };
- SmallInteger.prototype.isNegative = function() {
- return this.value < 0;
- };
- NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative;
- BigInteger.prototype.isUnit = function() {
- return false;
- };
- SmallInteger.prototype.isUnit = function() {
- return Math.abs(this.value) === 1;
- };
- NativeBigInt.prototype.isUnit = function() {
- return this.abs().value === BigInt(1);
- };
- BigInteger.prototype.isZero = function() {
- return false;
- };
- SmallInteger.prototype.isZero = function() {
- return this.value === 0;
- };
- NativeBigInt.prototype.isZero = function() {
- return this.value === BigInt(0);
- };
- BigInteger.prototype.isDivisibleBy = function(v) {
- var n = parseValue(v);
- if (n.isZero()) return false;
- if (n.isUnit()) return true;
- if (n.compareAbs(2) === 0) return this.isEven();
- return this.mod(n).isZero();
- };
- NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy;
- function isBasicPrime(v) {
- var n = v.abs();
- if (n.isUnit()) return false;
- if (n.equals(2) || n.equals(3) || n.equals(5)) return true;
- if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false;
- if (n.lesser(49)) return true;
- }
- function millerRabinTest(n, a) {
- var nPrev = n.prev(), b = nPrev, r = 0, d, t, i2, x;
- while (b.isEven()) b = b.divide(2), r++;
- next: for (i2 = 0; i2 < a.length; i2++) {
- if (n.lesser(a[i2])) continue;
- x = bigInt(a[i2]).modPow(b, n);
- if (x.isUnit() || x.equals(nPrev)) continue;
- for (d = r - 1; d != 0; d--) {
- x = x.square().mod(n);
- if (x.isUnit()) return false;
- if (x.equals(nPrev)) continue next;
- }
- return false;
- }
- return true;
- }
- BigInteger.prototype.isPrime = function(strict) {
- var isPrime = isBasicPrime(this);
- if (isPrime !== undefined2) return isPrime;
- var n = this.abs();
- var bits = n.bitLength();
- if (bits <= 64)
- return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]);
- var logN = Math.log(2) * bits.toJSNumber();
- var t = Math.ceil(strict === true ? 2 * Math.pow(logN, 2) : logN);
- for (var a = [], i2 = 0; i2 < t; i2++) {
- a.push(bigInt(i2 + 2));
- }
- return millerRabinTest(n, a);
- };
- NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime;
- BigInteger.prototype.isProbablePrime = function(iterations, rng) {
- var isPrime = isBasicPrime(this);
- if (isPrime !== undefined2) return isPrime;
- var n = this.abs();
- var t = iterations === undefined2 ? 5 : iterations;
- for (var a = [], i2 = 0; i2 < t; i2++) {
- a.push(bigInt.randBetween(2, n.minus(2), rng));
- }
- return millerRabinTest(n, a);
- };
- NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime;
- BigInteger.prototype.modInv = function(n) {
- var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR;
- while (!newR.isZero()) {
- q = r.divide(newR);
- lastT = t;
- lastR = r;
- t = newT;
- r = newR;
- newT = lastT.subtract(q.multiply(newT));
- newR = lastR.subtract(q.multiply(newR));
- }
- if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime");
- if (t.compare(0) === -1) {
- t = t.add(n);
- }
- if (this.isNegative()) {
- return t.negate();
- }
- return t;
- };
- NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv;
- BigInteger.prototype.next = function() {
- var value = this.value;
- if (this.sign) {
- return subtractSmall(value, 1, this.sign);
- }
- return new BigInteger(addSmall(value, 1), this.sign);
- };
- SmallInteger.prototype.next = function() {
- var value = this.value;
- if (value + 1 < MAX_INT) return new SmallInteger(value + 1);
- return new BigInteger(MAX_INT_ARR, false);
- };
- NativeBigInt.prototype.next = function() {
- return new NativeBigInt(this.value + BigInt(1));
- };
- BigInteger.prototype.prev = function() {
- var value = this.value;
- if (this.sign) {
- return new BigInteger(addSmall(value, 1), true);
- }
- return subtractSmall(value, 1, this.sign);
- };
- SmallInteger.prototype.prev = function() {
- var value = this.value;
- if (value - 1 > -MAX_INT) return new SmallInteger(value - 1);
- return new BigInteger(MAX_INT_ARR, true);
- };
- NativeBigInt.prototype.prev = function() {
- return new NativeBigInt(this.value - BigInt(1));
- };
- var powersOfTwo = [1];
- while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]);
- var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1];
- function shift_isSmall(n) {
- return Math.abs(n) <= BASE;
- }
- BigInteger.prototype.shiftLeft = function(v) {
- var n = parseValue(v).toJSNumber();
- if (!shift_isSmall(n)) {
- throw new Error(String(n) + " is too large for shifting.");
- }
- if (n < 0) return this.shiftRight(-n);
- var result = this;
- if (result.isZero()) return result;
- while (n >= powers2Length) {
- result = result.multiply(highestPower2);
- n -= powers2Length - 1;
- }
- return result.multiply(powersOfTwo[n]);
- };
- NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft;
- BigInteger.prototype.shiftRight = function(v) {
- var remQuo;
- var n = parseValue(v).toJSNumber();
- if (!shift_isSmall(n)) {
- throw new Error(String(n) + " is too large for shifting.");
- }
- if (n < 0) return this.shiftLeft(-n);
- var result = this;
- while (n >= powers2Length) {
- if (result.isZero() || result.isNegative() && result.isUnit()) return result;
- remQuo = divModAny(result, highestPower2);
- result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
- n -= powers2Length - 1;
- }
- remQuo = divModAny(result, powersOfTwo[n]);
- return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0];
- };
- NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight;
- function bitwise(x, y, fn) {
- y = parseValue(y);
- var xSign = x.isNegative(), ySign = y.isNegative();
- var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y;
- var xDigit = 0, yDigit = 0;
- var xDivMod = null, yDivMod = null;
- var result = [];
- while (!xRem.isZero() || !yRem.isZero()) {
- xDivMod = divModAny(xRem, highestPower2);
- xDigit = xDivMod[1].toJSNumber();
- if (xSign) {
- xDigit = highestPower2 - 1 - xDigit;
- }
- yDivMod = divModAny(yRem, highestPower2);
- yDigit = yDivMod[1].toJSNumber();
- if (ySign) {
- yDigit = highestPower2 - 1 - yDigit;
- }
- xRem = xDivMod[0];
- yRem = yDivMod[0];
- result.push(fn(xDigit, yDigit));
- }
- var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0);
- for (var i2 = result.length - 1; i2 >= 0; i2 -= 1) {
- sum = sum.multiply(highestPower2).add(bigInt(result[i2]));
- }
- return sum;
- }
- BigInteger.prototype.not = function() {
- return this.negate().prev();
- };
- NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not;
- BigInteger.prototype.and = function(n) {
- return bitwise(this, n, function(a, b) {
- return a & b;
- });
- };
- NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and;
- BigInteger.prototype.or = function(n) {
- return bitwise(this, n, function(a, b) {
- return a | b;
- });
- };
- NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or;
- BigInteger.prototype.xor = function(n) {
- return bitwise(this, n, function(a, b) {
- return a ^ b;
- });
- };
- NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor;
- var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I;
- function roughLOB(n) {
- var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI;
- return x & -x;
- }
- function integerLogarithm(value, base) {
- if (base.compareTo(value) <= 0) {
- var tmp = integerLogarithm(value, base.square(base));
- var p = tmp.p;
- var e = tmp.e;
- var t = p.multiply(base);
- return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p, e: e * 2 };
- }
- return { p: bigInt(1), e: 0 };
- }
- BigInteger.prototype.bitLength = function() {
- var n = this;
- if (n.compareTo(bigInt(0)) < 0) {
- n = n.negate().subtract(bigInt(1));
- }
- if (n.compareTo(bigInt(0)) === 0) {
- return bigInt(0);
- }
- return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1));
- };
- NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength;
- function max(a, b) {
- a = parseValue(a);
- b = parseValue(b);
- return a.greater(b) ? a : b;
- }
- function min(a, b) {
- a = parseValue(a);
- b = parseValue(b);
- return a.lesser(b) ? a : b;
- }
- function gcd(a, b) {
- a = parseValue(a).abs();
- b = parseValue(b).abs();
- if (a.equals(b)) return a;
- if (a.isZero()) return b;
- if (b.isZero()) return a;
- var c = Integer[1], d, t;
- while (a.isEven() && b.isEven()) {
- d = min(roughLOB(a), roughLOB(b));
- a = a.divide(d);
- b = b.divide(d);
- c = c.multiply(d);
- }
- while (a.isEven()) {
- a = a.divide(roughLOB(a));
- }
- do {
- while (b.isEven()) {
- b = b.divide(roughLOB(b));
- }
- if (a.greater(b)) {
- t = b;
- b = a;
- a = t;
- }
- b = b.subtract(a);
- } while (!b.isZero());
- return c.isUnit() ? a : a.multiply(c);
- }
- function lcm(a, b) {
- a = parseValue(a).abs();
- b = parseValue(b).abs();
- return a.divide(gcd(a, b)).multiply(b);
- }
- function randBetween(a, b, rng) {
- a = parseValue(a);
- b = parseValue(b);
- var usedRNG = rng || Math.random;
- var low = min(a, b), high = max(a, b);
- var range = high.subtract(low).add(1);
- if (range.isSmall) return low.add(Math.floor(usedRNG() * range));
- var digits = toBase(range, BASE).value;
- var result = [], restricted = true;
- for (var i2 = 0; i2 < digits.length; i2++) {
- var top = restricted ? digits[i2] + (i2 + 1 < digits.length ? digits[i2 + 1] / BASE : 0) : BASE;
- var digit = truncate(usedRNG() * top);
- result.push(digit);
- if (digit < digits[i2]) restricted = false;
- }
- return low.add(Integer.fromArray(result, BASE, false));
- }
- var parseBase = function(text, base, alphabet, caseSensitive) {
- alphabet = alphabet || DEFAULT_ALPHABET;
- text = String(text);
- if (!caseSensitive) {
- text = text.toLowerCase();
- alphabet = alphabet.toLowerCase();
- }
- var length = text.length;
- var i2;
- var absBase = Math.abs(base);
- var alphabetValues = {};
- for (i2 = 0; i2 < alphabet.length; i2++) {
- alphabetValues[alphabet[i2]] = i2;
- }
- for (i2 = 0; i2 < length; i2++) {
- var c = text[i2];
- if (c === "-") continue;
- if (c in alphabetValues) {
- if (alphabetValues[c] >= absBase) {
- if (c === "1" && absBase === 1) continue;
- throw new Error(c + " is not a valid digit in base " + base + ".");
- }
- }
- }
- base = parseValue(base);
- var digits = [];
- var isNegative = text[0] === "-";
- for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) {
- var c = text[i2];
- if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
- else if (c === "<") {
- var start = i2;
- do {
- i2++;
- } while (text[i2] !== ">" && i2 < text.length);
- digits.push(parseValue(text.slice(start + 1, i2)));
- } else throw new Error(c + " is not a valid character");
- }
- return parseBaseFromArray(digits, base, isNegative);
- };
- function parseBaseFromArray(digits, base, isNegative) {
- var val = Integer[0], pow = Integer[1], i2;
- for (i2 = digits.length - 1; i2 >= 0; i2--) {
- val = val.add(digits[i2].times(pow));
- pow = pow.times(base);
- }
- return isNegative ? val.negate() : val;
- }
- function stringify(digit, alphabet) {
- alphabet = alphabet || DEFAULT_ALPHABET;
- if (digit < alphabet.length) {
- return alphabet[digit];
- }
- return "<" + digit + ">";
- }
- function toBase(n, base) {
- base = bigInt(base);
- if (base.isZero()) {
- if (n.isZero()) return { value: [0], isNegative: false };
- throw new Error("Cannot convert nonzero numbers to base 0.");
- }
- if (base.equals(-1)) {
- if (n.isZero()) return { value: [0], isNegative: false };
- if (n.isNegative())
- return {
- value: [].concat.apply(
- [],
- Array.apply(null, Array(-n.toJSNumber())).map(Array.prototype.valueOf, [1, 0])
- ),
- isNegative: false
- };
- var arr = Array.apply(null, Array(n.toJSNumber() - 1)).map(Array.prototype.valueOf, [0, 1]);
- arr.unshift([1]);
- return {
- value: [].concat.apply([], arr),
- isNegative: false
- };
- }
- var neg = false;
- if (n.isNegative() && base.isPositive()) {
- neg = true;
- n = n.abs();
- }
- if (base.isUnit()) {
- if (n.isZero()) return { value: [0], isNegative: false };
- return {
- value: Array.apply(null, Array(n.toJSNumber())).map(Number.prototype.valueOf, 1),
- isNegative: neg
- };
- }
- var out = [];
- var left = n, divmod;
- while (left.isNegative() || left.compareAbs(base) >= 0) {
- divmod = left.divmod(base);
- left = divmod.quotient;
- var digit = divmod.remainder;
- if (digit.isNegative()) {
- digit = base.minus(digit).abs();
- left = left.next();
- }
- out.push(digit.toJSNumber());
- }
- out.push(left.toJSNumber());
- return { value: out.reverse(), isNegative: neg };
- }
- function toBaseString(n, base, alphabet) {
- var arr = toBase(n, base);
- return (arr.isNegative ? "-" : "") + arr.value.map(function(x) {
- return stringify(x, alphabet);
- }).join("");
- }
- BigInteger.prototype.toArray = function(radix) {
- return toBase(this, radix);
- };
- SmallInteger.prototype.toArray = function(radix) {
- return toBase(this, radix);
- };
- NativeBigInt.prototype.toArray = function(radix) {
- return toBase(this, radix);
- };
- BigInteger.prototype.toString = function(radix, alphabet) {
- if (radix === undefined2) radix = 10;
- if (radix !== 10 || alphabet) return toBaseString(this, radix, alphabet);
- var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit;
- while (--l >= 0) {
- digit = String(v[l]);
- str += zeros.slice(digit.length) + digit;
- }
- var sign = this.sign ? "-" : "";
- return sign + str;
- };
- SmallInteger.prototype.toString = function(radix, alphabet) {
- if (radix === undefined2) radix = 10;
- if (radix != 10 || alphabet) return toBaseString(this, radix, alphabet);
- return String(this.value);
- };
- NativeBigInt.prototype.toString = SmallInteger.prototype.toString;
- NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function() {
- return this.toString();
- };
- BigInteger.prototype.valueOf = function() {
- return parseInt(this.toString(), 10);
- };
- BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf;
- SmallInteger.prototype.valueOf = function() {
- return this.value;
- };
- SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf;
- NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function() {
- return parseInt(this.toString(), 10);
- };
- function parseStringValue(v) {
- if (isPrecise(+v)) {
- var x = +v;
- if (x === truncate(x))
- return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x);
- throw new Error("Invalid integer: " + v);
- }
- var sign = v[0] === "-";
- if (sign) v = v.slice(1);
- var split = v.split(/e/i);
- if (split.length > 2) throw new Error("Invalid integer: " + split.join("e"));
- if (split.length === 2) {
- var exp = split[1];
- if (exp[0] === "+") exp = exp.slice(1);
- exp = +exp;
- if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
- var text = split[0];
- var decimalPlace = text.indexOf(".");
- if (decimalPlace >= 0) {
- exp -= text.length - decimalPlace - 1;
- text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
- }
- if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
- text += new Array(exp + 1).join("0");
- v = text;
- }
- var isValid = /^([0-9][0-9]*)$/.test(v);
- if (!isValid) throw new Error("Invalid integer: " + v);
- if (supportsNativeBigInt) {
- return new NativeBigInt(BigInt(sign ? "-" + v : v));
- }
- var r = [], max2 = v.length, l = LOG_BASE, min2 = max2 - l;
- while (max2 > 0) {
- r.push(+v.slice(min2, max2));
- min2 -= l;
- if (min2 < 0) min2 = 0;
- max2 -= l;
- }
- trim(r);
- return new BigInteger(r, sign);
- }
- function parseNumberValue(v) {
- if (supportsNativeBigInt) {
- return new NativeBigInt(BigInt(v));
- }
- if (isPrecise(v)) {
- if (v !== truncate(v)) throw new Error(v + " is not an integer.");
- return new SmallInteger(v);
- }
- return parseStringValue(v.toString());
- }
- function parseValue(v) {
- if (typeof v === "number") {
- return parseNumberValue(v);
- }
- if (typeof v === "string") {
- return parseStringValue(v);
- }
- if (typeof v === "bigint") {
- return new NativeBigInt(v);
- }
- return v;
- }
- for (var i = 0; i < 1e3; i++) {
- Integer[i] = parseValue(i);
- if (i > 0) Integer[-i] = parseValue(-i);
- }
- Integer.one = Integer[1];
- Integer.zero = Integer[0];
- Integer.minusOne = Integer[-1];
- Integer.max = max;
- Integer.min = min;
- Integer.gcd = gcd;
- Integer.lcm = lcm;
- Integer.isInstance = function(x) {
- return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt;
- };
- Integer.randBetween = randBetween;
- Integer.fromArray = function(digits, base, isNegative) {
- return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative);
- };
- return Integer;
- }();
- if (typeof module2 !== "undefined" && module2.hasOwnProperty("exports")) {
- module2.exports = bigInt;
- }
- if (typeof define === "function" && define.amd) {
- define(function() {
- return bigInt;
- });
- }
- }
- });
- // node_modules/bplist-parser/bplistParser.js
- var require_bplistParser = __commonJS({
- "node_modules/bplist-parser/bplistParser.js"(exports2) {
- "use strict";
- var fs7 = require("fs");
- var bigInt = require_BigInteger();
- var debug = false;
- exports2.maxObjectSize = 100 * 1e3 * 1e3;
- exports2.maxObjectCount = 32768;
- var EPOCH = 9783072e5;
- var UID = exports2.UID = function(id) {
- this.UID = id;
- };
- var parseFile = exports2.parseFile = function(fileNameOrBuffer, callback) {
- return new Promise(function(resolve, reject) {
- function tryParseBuffer(buffer) {
- let err2 = null;
- let result;
- try {
- result = parseBuffer(buffer);
- resolve(result);
- } catch (ex) {
- err2 = ex;
- reject(err2);
- } finally {
- if (callback) callback(err2, result);
- }
- }
- if (Buffer.isBuffer(fileNameOrBuffer)) {
- return tryParseBuffer(fileNameOrBuffer);
- }
- fs7.readFile(fileNameOrBuffer, function(err2, data) {
- if (err2) {
- reject(err2);
- return callback(err2);
- }
- tryParseBuffer(data);
- });
- });
- };
- var parseBuffer = exports2.parseBuffer = function(buffer) {
- const header = buffer.slice(0, "bplist".length).toString("utf8");
- if (header !== "bplist") {
- throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
- }
- const trailer = buffer.slice(buffer.length - 32, buffer.length);
- const offsetSize = trailer.readUInt8(6);
- if (debug) {
- console.log("offsetSize: " + offsetSize);
- }
- const objectRefSize = trailer.readUInt8(7);
- if (debug) {
- console.log("objectRefSize: " + objectRefSize);
- }
- const numObjects = readUInt64BE(trailer, 8);
- if (debug) {
- console.log("numObjects: " + numObjects);
- }
- const topObject = readUInt64BE(trailer, 16);
- if (debug) {
- console.log("topObject: " + topObject);
- }
- const offsetTableOffset = readUInt64BE(trailer, 24);
- if (debug) {
- console.log("offsetTableOffset: " + offsetTableOffset);
- }
- if (numObjects > exports2.maxObjectCount) {
- throw new Error("maxObjectCount exceeded");
- }
- const offsetTable = [];
- for (let i = 0; i < numObjects; i++) {
- const offsetBytes = buffer.slice(offsetTableOffset + i * offsetSize, offsetTableOffset + (i + 1) * offsetSize);
- offsetTable[i] = readUInt(offsetBytes, 0);
- if (debug) {
- console.log("Offset for Object #" + i + " is " + offsetTable[i] + " [" + offsetTable[i].toString(16) + "]");
- }
- }
- function parseObject(tableOffset) {
- const offset = offsetTable[tableOffset];
- const type = buffer[offset];
- const objType = (type & 240) >> 4;
- const objInfo = type & 15;
- switch (objType) {
- case 0:
- return parseSimple();
- case 1:
- return parseInteger();
- case 8:
- return parseUID();
- case 2:
- return parseReal();
- case 3:
- return parseDate();
- case 4:
- return parseData2();
- case 5:
- return parsePlistString();
- case 6:
- return parsePlistString(true);
- case 10:
- return parseArray();
- case 13:
- return parseDictionary();
- default:
- throw new Error("Unhandled type 0x" + objType.toString(16));
- }
- function parseSimple() {
- switch (objInfo) {
- case 0:
- return null;
- case 8:
- return false;
- case 9:
- return true;
- case 15:
- return null;
- default:
- throw new Error("Unhandled simple type 0x" + objType.toString(16));
- }
- }
- function bufferToHexString(buffer2) {
- let str = "";
- let i;
- for (i = 0; i < buffer2.length; i++) {
- if (buffer2[i] != 0) {
- break;
- }
- }
- for (; i < buffer2.length; i++) {
- const part = "00" + buffer2[i].toString(16);
- str += part.substr(part.length - 2);
- }
- return str;
- }
- function parseInteger() {
- const length = Math.pow(2, objInfo);
- if (objInfo == 4) {
- const data = buffer.slice(offset + 1, offset + 1 + length);
- const str = bufferToHexString(data);
- return bigInt(str, 16);
- }
- if (objInfo == 3) {
- return buffer.readInt32BE(offset + 1);
- }
- if (length < exports2.maxObjectSize) {
- return readUInt(buffer.slice(offset + 1, offset + 1 + length));
- }
- throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports2.maxObjectSize + " are available.");
- }
- function parseUID() {
- const length = objInfo + 1;
- if (length < exports2.maxObjectSize) {
- return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length)));
- }
- throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports2.maxObjectSize + " are available.");
- }
- function parseReal() {
- const length = Math.pow(2, objInfo);
- if (length < exports2.maxObjectSize) {
- const realBuffer = buffer.slice(offset + 1, offset + 1 + length);
- if (length === 4) {
- return realBuffer.readFloatBE(0);
- }
- if (length === 8) {
- return realBuffer.readDoubleBE(0);
- }
- } else {
- throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports2.maxObjectSize + " are available.");
- }
- }
- function parseDate() {
- if (objInfo != 3) {
- console.error("Unknown date type :" + objInfo + ". Parsing anyway...");
- }
- const dateBuffer = buffer.slice(offset + 1, offset + 9);
- return new Date(EPOCH + 1e3 * dateBuffer.readDoubleBE(0));
- }
- function parseData2() {
- let dataoffset = 1;
- let length = objInfo;
- if (objInfo == 15) {
- const int_type = buffer[offset + 1];
- const intType = (int_type & 240) / 16;
- if (intType != 1) {
- console.error("0x4: UNEXPECTED LENGTH-INT TYPE! " + intType);
- }
- const intInfo = int_type & 15;
- const intLength = Math.pow(2, intInfo);
- dataoffset = 2 + intLength;
- if (intLength < 3) {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- } else {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- }
- }
- if (length < exports2.maxObjectSize) {
- return buffer.slice(offset + dataoffset, offset + dataoffset + length);
- }
- throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports2.maxObjectSize + " are available.");
- }
- function parsePlistString(isUtf16) {
- isUtf16 = isUtf16 || 0;
- let enc = "utf8";
- let length = objInfo;
- let stroffset = 1;
- if (objInfo == 15) {
- const int_type = buffer[offset + 1];
- const intType = (int_type & 240) / 16;
- if (intType != 1) {
- console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
- }
- const intInfo = int_type & 15;
- const intLength = Math.pow(2, intInfo);
- stroffset = 2 + intLength;
- if (intLength < 3) {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- } else {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- }
- }
- length *= isUtf16 + 1;
- if (length < exports2.maxObjectSize) {
- let plistString = Buffer.from(buffer.slice(offset + stroffset, offset + stroffset + length));
- if (isUtf16) {
- plistString = swapBytes(plistString);
- enc = "ucs2";
- }
- return plistString.toString(enc);
- }
- throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports2.maxObjectSize + " are available.");
- }
- function parseArray() {
- let length = objInfo;
- let arrayoffset = 1;
- if (objInfo == 15) {
- const int_type = buffer[offset + 1];
- const intType = (int_type & 240) / 16;
- if (intType != 1) {
- console.error("0xa: UNEXPECTED LENGTH-INT TYPE! " + intType);
- }
- const intInfo = int_type & 15;
- const intLength = Math.pow(2, intInfo);
- arrayoffset = 2 + intLength;
- if (intLength < 3) {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- } else {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- }
- }
- if (length * objectRefSize > exports2.maxObjectSize) {
- throw new Error("To little heap space available!");
- }
- const array = [];
- for (let i = 0; i < length; i++) {
- const objRef = readUInt(buffer.slice(offset + arrayoffset + i * objectRefSize, offset + arrayoffset + (i + 1) * objectRefSize));
- array[i] = parseObject(objRef);
- }
- return array;
- }
- function parseDictionary() {
- let length = objInfo;
- let dictoffset = 1;
- if (objInfo == 15) {
- const int_type = buffer[offset + 1];
- const intType = (int_type & 240) / 16;
- if (intType != 1) {
- console.error("0xD: UNEXPECTED LENGTH-INT TYPE! " + intType);
- }
- const intInfo = int_type & 15;
- const intLength = Math.pow(2, intInfo);
- dictoffset = 2 + intLength;
- if (intLength < 3) {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- } else {
- length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));
- }
- }
- if (length * 2 * objectRefSize > exports2.maxObjectSize) {
- throw new Error("To little heap space available!");
- }
- if (debug) {
- console.log("Parsing dictionary #" + tableOffset);
- }
- const dict = {};
- for (let i = 0; i < length; i++) {
- const keyRef = readUInt(buffer.slice(offset + dictoffset + i * objectRefSize, offset + dictoffset + (i + 1) * objectRefSize));
- const valRef = readUInt(buffer.slice(offset + dictoffset + length * objectRefSize + i * objectRefSize, offset + dictoffset + length * objectRefSize + (i + 1) * objectRefSize));
- const key = parseObject(keyRef);
- const val = parseObject(valRef);
- if (debug) {
- console.log(" DICT #" + tableOffset + ": Mapped " + key + " to " + val);
- }
- dict[key] = val;
- }
- return dict;
- }
- }
- return [parseObject(topObject)];
- };
- function readUInt(buffer, start) {
- start = start || 0;
- let l = 0;
- for (let i = start; i < buffer.length; i++) {
- l <<= 8;
- l |= buffer[i] & 255;
- }
- return l;
- }
- function readUInt64BE(buffer, start) {
- const data = buffer.slice(start, start + 8);
- return data.readUInt32BE(4, 8);
- }
- function swapBytes(buffer) {
- const len = buffer.length;
- for (let i = 0; i < len; i += 2) {
- const a = buffer[i];
- buffer[i] = buffer[i + 1];
- buffer[i + 1] = a;
- }
- return buffer;
- }
- }
- });
- // node_modules/untildify/index.js
- var require_untildify = __commonJS({
- "node_modules/untildify/index.js"(exports2, module2) {
- "use strict";
- var os3 = require("os");
- var homeDirectory = os3.homedir();
- module2.exports = (pathWithTilde) => {
- if (typeof pathWithTilde !== "string") {
- throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`);
- }
- return homeDirectory ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory) : pathWithTilde;
- };
- }
- });
- // node_modules/isexe/windows.js
- var require_windows = __commonJS({
- "node_modules/isexe/windows.js"(exports2, module2) {
- module2.exports = isexe;
- isexe.sync = sync;
- var fs7 = require("fs");
- function checkPathExt(path11, options) {
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
- if (!pathext) {
- return true;
- }
- pathext = pathext.split(";");
- if (pathext.indexOf("") !== -1) {
- return true;
- }
- for (var i = 0; i < pathext.length; i++) {
- var p = pathext[i].toLowerCase();
- if (p && path11.substr(-p.length).toLowerCase() === p) {
- return true;
- }
- }
- return false;
- }
- function checkStat(stat, path11, options) {
- if (!stat.isSymbolicLink() && !stat.isFile()) {
- return false;
- }
- return checkPathExt(path11, options);
- }
- function isexe(path11, options, cb) {
- fs7.stat(path11, function(er, stat) {
- cb(er, er ? false : checkStat(stat, path11, options));
- });
- }
- function sync(path11, options) {
- return checkStat(fs7.statSync(path11), path11, options);
- }
- }
- });
- // node_modules/isexe/mode.js
- var require_mode = __commonJS({
- "node_modules/isexe/mode.js"(exports2, module2) {
- module2.exports = isexe;
- isexe.sync = sync;
- var fs7 = require("fs");
- function isexe(path11, options, cb) {
- fs7.stat(path11, function(er, stat) {
- cb(er, er ? false : checkStat(stat, options));
- });
- }
- function sync(path11, options) {
- return checkStat(fs7.statSync(path11), options);
- }
- function checkStat(stat, options) {
- return stat.isFile() && checkMode(stat, options);
- }
- function checkMode(stat, options) {
- var mod = stat.mode;
- var uid = stat.uid;
- var gid = stat.gid;
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
- var u = parseInt("100", 8);
- var g = parseInt("010", 8);
- var o = parseInt("001", 8);
- var ug = u | g;
- var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
- return ret;
- }
- }
- });
- // node_modules/isexe/index.js
- var require_isexe = __commonJS({
- "node_modules/isexe/index.js"(exports2, module2) {
- var fs7 = require("fs");
- var core;
- if (process.platform === "win32" || global.TESTING_WINDOWS) {
- core = require_windows();
- } else {
- core = require_mode();
- }
- module2.exports = isexe;
- isexe.sync = sync;
- function isexe(path11, options, cb) {
- if (typeof options === "function") {
- cb = options;
- options = {};
- }
- if (!cb) {
- if (typeof Promise !== "function") {
- throw new TypeError("callback not provided");
- }
- return new Promise(function(resolve, reject) {
- isexe(path11, options || {}, function(er, is) {
- if (er) {
- reject(er);
- } else {
- resolve(is);
- }
- });
- });
- }
- core(path11, options || {}, function(er, is) {
- if (er) {
- if (er.code === "EACCES" || options && options.ignoreErrors) {
- er = null;
- is = false;
- }
- }
- cb(er, is);
- });
- }
- function sync(path11, options) {
- try {
- return core.sync(path11, options || {});
- } catch (er) {
- if (options && options.ignoreErrors || er.code === "EACCES") {
- return false;
- } else {
- throw er;
- }
- }
- }
- }
- });
- // node_modules/which/which.js
- var require_which = __commonJS({
- "node_modules/which/which.js"(exports2, module2) {
- var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
- var path11 = require("path");
- var COLON = isWindows ? ";" : ":";
- var isexe = require_isexe();
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
- var getPathInfo = (cmd, opt) => {
- const colon = opt.colon || COLON;
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
- // windows always checks the cwd first
- ...isWindows ? [process.cwd()] : [],
- ...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
- "").split(colon)
- ];
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
- if (isWindows) {
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
- pathExt.unshift("");
- }
- return {
- pathEnv,
- pathExt,
- pathExtExe
- };
- };
- var which = (cmd, opt, cb) => {
- if (typeof opt === "function") {
- cb = opt;
- opt = {};
- }
- if (!opt)
- opt = {};
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
- const found = [];
- const step = (i) => new Promise((resolve, reject) => {
- if (i === pathEnv.length)
- return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
- const ppRaw = pathEnv[i];
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
- const pCmd = path11.join(pathPart, cmd);
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
- resolve(subStep(p, i, 0));
- });
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
- if (ii === pathExt.length)
- return resolve(step(i + 1));
- const ext = pathExt[ii];
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
- if (!er && is) {
- if (opt.all)
- found.push(p + ext);
- else
- return resolve(p + ext);
- }
- return resolve(subStep(p, i, ii + 1));
- });
- });
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
- };
- var whichSync = (cmd, opt) => {
- opt = opt || {};
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
- const found = [];
- for (let i = 0; i < pathEnv.length; i++) {
- const ppRaw = pathEnv[i];
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
- const pCmd = path11.join(pathPart, cmd);
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
- for (let j = 0; j < pathExt.length; j++) {
- const cur = p + pathExt[j];
- try {
- const is = isexe.sync(cur, { pathExt: pathExtExe });
- if (is) {
- if (opt.all)
- found.push(cur);
- else
- return cur;
- }
- } catch (ex) {
- }
- }
- }
- if (opt.all && found.length)
- return found;
- if (opt.nothrow)
- return null;
- throw getNotFoundError(cmd);
- };
- module2.exports = which;
- which.sync = whichSync;
- }
- });
- // node_modules/path-key/index.js
- var require_path_key = __commonJS({
- "node_modules/path-key/index.js"(exports2, module2) {
- "use strict";
- var pathKey2 = (options = {}) => {
- const environment = options.env || process.env;
- const platform2 = options.platform || process.platform;
- if (platform2 !== "win32") {
- return "PATH";
- }
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
- };
- module2.exports = pathKey2;
- module2.exports.default = pathKey2;
- }
- });
- // node_modules/cross-spawn/lib/util/resolveCommand.js
- var require_resolveCommand = __commonJS({
- "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports2, module2) {
- "use strict";
- var path11 = require("path");
- var which = require_which();
- var getPathKey = require_path_key();
- function resolveCommandAttempt(parsed, withoutPathExt) {
- const env = parsed.options.env || process.env;
- const cwd = process.cwd();
- const hasCustomCwd = parsed.options.cwd != null;
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
- if (shouldSwitchCwd) {
- try {
- process.chdir(parsed.options.cwd);
- } catch (err2) {
- }
- }
- let resolved;
- try {
- resolved = which.sync(parsed.command, {
- path: env[getPathKey({ env })],
- pathExt: withoutPathExt ? path11.delimiter : void 0
- });
- } catch (e) {
- } finally {
- if (shouldSwitchCwd) {
- process.chdir(cwd);
- }
- }
- if (resolved) {
- resolved = path11.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
- }
- return resolved;
- }
- function resolveCommand(parsed) {
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
- }
- module2.exports = resolveCommand;
- }
- });
- // node_modules/cross-spawn/lib/util/escape.js
- var require_escape = __commonJS({
- "node_modules/cross-spawn/lib/util/escape.js"(exports2, module2) {
- "use strict";
- var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
- function escapeCommand(arg) {
- arg = arg.replace(metaCharsRegExp, "^$1");
- return arg;
- }
- function escapeArgument(arg, doubleEscapeMetaChars) {
- arg = `${arg}`;
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
- arg = arg.replace(/(\\*)$/, "$1$1");
- arg = `"${arg}"`;
- arg = arg.replace(metaCharsRegExp, "^$1");
- if (doubleEscapeMetaChars) {
- arg = arg.replace(metaCharsRegExp, "^$1");
- }
- return arg;
- }
- module2.exports.command = escapeCommand;
- module2.exports.argument = escapeArgument;
- }
- });
- // node_modules/shebang-regex/index.js
- var require_shebang_regex = __commonJS({
- "node_modules/shebang-regex/index.js"(exports2, module2) {
- "use strict";
- module2.exports = /^#!(.*)/;
- }
- });
- // node_modules/shebang-command/index.js
- var require_shebang_command = __commonJS({
- "node_modules/shebang-command/index.js"(exports2, module2) {
- "use strict";
- var shebangRegex = require_shebang_regex();
- module2.exports = (string = "") => {
- const match = string.match(shebangRegex);
- if (!match) {
- return null;
- }
- const [path11, argument] = match[0].replace(/#! ?/, "").split(" ");
- const binary = path11.split("/").pop();
- if (binary === "env") {
- return argument;
- }
- return argument ? `${binary} ${argument}` : binary;
- };
- }
- });
- // node_modules/cross-spawn/lib/util/readShebang.js
- var require_readShebang = __commonJS({
- "node_modules/cross-spawn/lib/util/readShebang.js"(exports2, module2) {
- "use strict";
- var fs7 = require("fs");
- var shebangCommand = require_shebang_command();
- function readShebang(command) {
- const size = 150;
- const buffer = Buffer.alloc(size);
- let fd;
- try {
- fd = fs7.openSync(command, "r");
- fs7.readSync(fd, buffer, 0, size, 0);
- fs7.closeSync(fd);
- } catch (e) {
- }
- return shebangCommand(buffer.toString());
- }
- module2.exports = readShebang;
- }
- });
- // node_modules/cross-spawn/lib/parse.js
- var require_parse = __commonJS({
- "node_modules/cross-spawn/lib/parse.js"(exports2, module2) {
- "use strict";
- var path11 = require("path");
- var resolveCommand = require_resolveCommand();
- var escape = require_escape();
- var readShebang = require_readShebang();
- var isWin = process.platform === "win32";
- var isExecutableRegExp = /\.(?:com|exe)$/i;
- var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
- function detectShebang(parsed) {
- parsed.file = resolveCommand(parsed);
- const shebang = parsed.file && readShebang(parsed.file);
- if (shebang) {
- parsed.args.unshift(parsed.file);
- parsed.command = shebang;
- return resolveCommand(parsed);
- }
- return parsed.file;
- }
- function parseNonShell(parsed) {
- if (!isWin) {
- return parsed;
- }
- const commandFile = detectShebang(parsed);
- const needsShell = !isExecutableRegExp.test(commandFile);
- if (parsed.options.forceShell || needsShell) {
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
- parsed.command = path11.normalize(parsed.command);
- parsed.command = escape.command(parsed.command);
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
- const shellCommand = [parsed.command].concat(parsed.args).join(" ");
- parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
- parsed.command = process.env.comspec || "cmd.exe";
- parsed.options.windowsVerbatimArguments = true;
- }
- return parsed;
- }
- function parse(command, args, options) {
- if (args && !Array.isArray(args)) {
- options = args;
- args = null;
- }
- args = args ? args.slice(0) : [];
- options = Object.assign({}, options);
- const parsed = {
- command,
- args,
- options,
- file: void 0,
- original: {
- command,
- args
- }
- };
- return options.shell ? parsed : parseNonShell(parsed);
- }
- module2.exports = parse;
- }
- });
- // node_modules/cross-spawn/lib/enoent.js
- var require_enoent = __commonJS({
- "node_modules/cross-spawn/lib/enoent.js"(exports2, module2) {
- "use strict";
- var isWin = process.platform === "win32";
- function notFoundError(original, syscall) {
- return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
- code: "ENOENT",
- errno: "ENOENT",
- syscall: `${syscall} ${original.command}`,
- path: original.command,
- spawnargs: original.args
- });
- }
- function hookChildProcess(cp, parsed) {
- if (!isWin) {
- return;
- }
- const originalEmit = cp.emit;
- cp.emit = function(name, arg1) {
- if (name === "exit") {
- const err2 = verifyENOENT(arg1, parsed, "spawn");
- if (err2) {
- return originalEmit.call(cp, "error", err2);
- }
- }
- return originalEmit.apply(cp, arguments);
- };
- }
- function verifyENOENT(status, parsed) {
- if (isWin && status === 1 && !parsed.file) {
- return notFoundError(parsed.original, "spawn");
- }
- return null;
- }
- function verifyENOENTSync(status, parsed) {
- if (isWin && status === 1 && !parsed.file) {
- return notFoundError(parsed.original, "spawnSync");
- }
- return null;
- }
- module2.exports = {
- hookChildProcess,
- verifyENOENT,
- verifyENOENTSync,
- notFoundError
- };
- }
- });
- // node_modules/cross-spawn/index.js
- var require_cross_spawn = __commonJS({
- "node_modules/cross-spawn/index.js"(exports2, module2) {
- "use strict";
- var cp = require("child_process");
- var parse = require_parse();
- var enoent = require_enoent();
- function spawn(command, args, options) {
- const parsed = parse(command, args, options);
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
- enoent.hookChildProcess(spawned, parsed);
- return spawned;
- }
- function spawnSync(command, args, options) {
- const parsed = parse(command, args, options);
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
- return result;
- }
- module2.exports = spawn;
- module2.exports.spawn = spawn;
- module2.exports.sync = spawnSync;
- module2.exports._parse = parse;
- module2.exports._enoent = enoent;
- }
- });
- // node_modules/run-applescript/node_modules/strip-final-newline/index.js
- var require_strip_final_newline = __commonJS({
- "node_modules/run-applescript/node_modules/strip-final-newline/index.js"(exports2, module2) {
- "use strict";
- module2.exports = (input) => {
- const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
- const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
- if (input[input.length - 1] === LF) {
- input = input.slice(0, input.length - 1);
- }
- if (input[input.length - 1] === CR) {
- input = input.slice(0, input.length - 1);
- }
- return input;
- };
- }
- });
- // node_modules/run-applescript/node_modules/npm-run-path/index.js
- var require_npm_run_path = __commonJS({
- "node_modules/run-applescript/node_modules/npm-run-path/index.js"(exports2, module2) {
- "use strict";
- var path11 = require("path");
- var pathKey2 = require_path_key();
- var npmRunPath2 = (options) => {
- options = {
- cwd: process.cwd(),
- path: process.env[pathKey2()],
- execPath: process.execPath,
- ...options
- };
- let previous;
- let cwdPath = path11.resolve(options.cwd);
- const result = [];
- while (previous !== cwdPath) {
- result.push(path11.join(cwdPath, "node_modules/.bin"));
- previous = cwdPath;
- cwdPath = path11.resolve(cwdPath, "..");
- }
- const execPathDir = path11.resolve(options.cwd, options.execPath, "..");
- result.push(execPathDir);
- return result.concat(options.path).join(path11.delimiter);
- };
- module2.exports = npmRunPath2;
- module2.exports.default = npmRunPath2;
- module2.exports.env = (options) => {
- options = {
- env: process.env,
- ...options
- };
- const env = { ...options.env };
- const path12 = pathKey2({ env });
- options.path = env[path12];
- env[path12] = module2.exports(options);
- return env;
- };
- }
- });
- // node_modules/run-applescript/node_modules/mimic-fn/index.js
- var require_mimic_fn = __commonJS({
- "node_modules/run-applescript/node_modules/mimic-fn/index.js"(exports2, module2) {
- "use strict";
- var mimicFn = (to, from) => {
- for (const prop of Reflect.ownKeys(from)) {
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
- }
- return to;
- };
- module2.exports = mimicFn;
- module2.exports.default = mimicFn;
- }
- });
- // node_modules/run-applescript/node_modules/onetime/index.js
- var require_onetime = __commonJS({
- "node_modules/run-applescript/node_modules/onetime/index.js"(exports2, module2) {
- "use strict";
- var mimicFn = require_mimic_fn();
- var calledFunctions2 = /* @__PURE__ */ new WeakMap();
- var onetime2 = (function_, options = {}) => {
- if (typeof function_ !== "function") {
- throw new TypeError("Expected a function");
- }
- let returnValue;
- let callCount = 0;
- const functionName = function_.displayName || function_.name || "<anonymous>";
- const onetime3 = function(...arguments_) {
- calledFunctions2.set(onetime3, ++callCount);
- if (callCount === 1) {
- returnValue = function_.apply(this, arguments_);
- function_ = null;
- } else if (options.throw === true) {
- throw new Error(`Function \`${functionName}\` can only be called once`);
- }
- return returnValue;
- };
- mimicFn(onetime3, function_);
- calledFunctions2.set(onetime3, callCount);
- return onetime3;
- };
- module2.exports = onetime2;
- module2.exports.default = onetime2;
- module2.exports.callCount = (function_) => {
- if (!calledFunctions2.has(function_)) {
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
- }
- return calledFunctions2.get(function_);
- };
- }
- });
- // node_modules/run-applescript/node_modules/human-signals/build/src/core.js
- var require_core = __commonJS({
- "node_modules/run-applescript/node_modules/human-signals/build/src/core.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.SIGNALS = void 0;
- var SIGNALS2 = [
- {
- name: "SIGHUP",
- number: 1,
- action: "terminate",
- description: "Terminal closed",
- standard: "posix"
- },
- {
- name: "SIGINT",
- number: 2,
- action: "terminate",
- description: "User interruption with CTRL-C",
- standard: "ansi"
- },
- {
- name: "SIGQUIT",
- number: 3,
- action: "core",
- description: "User interruption with CTRL-\\",
- standard: "posix"
- },
- {
- name: "SIGILL",
- number: 4,
- action: "core",
- description: "Invalid machine instruction",
- standard: "ansi"
- },
- {
- name: "SIGTRAP",
- number: 5,
- action: "core",
- description: "Debugger breakpoint",
- standard: "posix"
- },
- {
- name: "SIGABRT",
- number: 6,
- action: "core",
- description: "Aborted",
- standard: "ansi"
- },
- {
- name: "SIGIOT",
- number: 6,
- action: "core",
- description: "Aborted",
- standard: "bsd"
- },
- {
- name: "SIGBUS",
- number: 7,
- action: "core",
- description: "Bus error due to misaligned, non-existing address or paging error",
- standard: "bsd"
- },
- {
- name: "SIGEMT",
- number: 7,
- action: "terminate",
- description: "Command should be emulated but is not implemented",
- standard: "other"
- },
- {
- name: "SIGFPE",
- number: 8,
- action: "core",
- description: "Floating point arithmetic error",
- standard: "ansi"
- },
- {
- name: "SIGKILL",
- number: 9,
- action: "terminate",
- description: "Forced termination",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGUSR1",
- number: 10,
- action: "terminate",
- description: "Application-specific signal",
- standard: "posix"
- },
- {
- name: "SIGSEGV",
- number: 11,
- action: "core",
- description: "Segmentation fault",
- standard: "ansi"
- },
- {
- name: "SIGUSR2",
- number: 12,
- action: "terminate",
- description: "Application-specific signal",
- standard: "posix"
- },
- {
- name: "SIGPIPE",
- number: 13,
- action: "terminate",
- description: "Broken pipe or socket",
- standard: "posix"
- },
- {
- name: "SIGALRM",
- number: 14,
- action: "terminate",
- description: "Timeout or timer",
- standard: "posix"
- },
- {
- name: "SIGTERM",
- number: 15,
- action: "terminate",
- description: "Termination",
- standard: "ansi"
- },
- {
- name: "SIGSTKFLT",
- number: 16,
- action: "terminate",
- description: "Stack is empty or overflowed",
- standard: "other"
- },
- {
- name: "SIGCHLD",
- number: 17,
- action: "ignore",
- description: "Child process terminated, paused or unpaused",
- standard: "posix"
- },
- {
- name: "SIGCLD",
- number: 17,
- action: "ignore",
- description: "Child process terminated, paused or unpaused",
- standard: "other"
- },
- {
- name: "SIGCONT",
- number: 18,
- action: "unpause",
- description: "Unpaused",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGSTOP",
- number: 19,
- action: "pause",
- description: "Paused",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGTSTP",
- number: 20,
- action: "pause",
- description: 'Paused using CTRL-Z or "suspend"',
- standard: "posix"
- },
- {
- name: "SIGTTIN",
- number: 21,
- action: "pause",
- description: "Background process cannot read terminal input",
- standard: "posix"
- },
- {
- name: "SIGBREAK",
- number: 21,
- action: "terminate",
- description: "User interruption with CTRL-BREAK",
- standard: "other"
- },
- {
- name: "SIGTTOU",
- number: 22,
- action: "pause",
- description: "Background process cannot write to terminal output",
- standard: "posix"
- },
- {
- name: "SIGURG",
- number: 23,
- action: "ignore",
- description: "Socket received out-of-band data",
- standard: "bsd"
- },
- {
- name: "SIGXCPU",
- number: 24,
- action: "core",
- description: "Process timed out",
- standard: "bsd"
- },
- {
- name: "SIGXFSZ",
- number: 25,
- action: "core",
- description: "File too big",
- standard: "bsd"
- },
- {
- name: "SIGVTALRM",
- number: 26,
- action: "terminate",
- description: "Timeout or timer",
- standard: "bsd"
- },
- {
- name: "SIGPROF",
- number: 27,
- action: "terminate",
- description: "Timeout or timer",
- standard: "bsd"
- },
- {
- name: "SIGWINCH",
- number: 28,
- action: "ignore",
- description: "Terminal window size changed",
- standard: "bsd"
- },
- {
- name: "SIGIO",
- number: 29,
- action: "terminate",
- description: "I/O is available",
- standard: "other"
- },
- {
- name: "SIGPOLL",
- number: 29,
- action: "terminate",
- description: "Watched event",
- standard: "other"
- },
- {
- name: "SIGINFO",
- number: 29,
- action: "ignore",
- description: "Request for process information",
- standard: "other"
- },
- {
- name: "SIGPWR",
- number: 30,
- action: "terminate",
- description: "Device running out of power",
- standard: "systemv"
- },
- {
- name: "SIGSYS",
- number: 31,
- action: "core",
- description: "Invalid system call",
- standard: "other"
- },
- {
- name: "SIGUNUSED",
- number: 31,
- action: "terminate",
- description: "Invalid system call",
- standard: "other"
- }
- ];
- exports2.SIGNALS = SIGNALS2;
- }
- });
- // node_modules/run-applescript/node_modules/human-signals/build/src/realtime.js
- var require_realtime = __commonJS({
- "node_modules/run-applescript/node_modules/human-signals/build/src/realtime.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.SIGRTMAX = exports2.getRealtimeSignals = void 0;
- var getRealtimeSignals2 = function() {
- const length = SIGRTMAX2 - SIGRTMIN2 + 1;
- return Array.from({ length }, getRealtimeSignal2);
- };
- exports2.getRealtimeSignals = getRealtimeSignals2;
- var getRealtimeSignal2 = function(value, index) {
- return {
- name: `SIGRT${index + 1}`,
- number: SIGRTMIN2 + index,
- action: "terminate",
- description: "Application-specific signal (realtime)",
- standard: "posix"
- };
- };
- var SIGRTMIN2 = 34;
- var SIGRTMAX2 = 64;
- exports2.SIGRTMAX = SIGRTMAX2;
- }
- });
- // node_modules/run-applescript/node_modules/human-signals/build/src/signals.js
- var require_signals = __commonJS({
- "node_modules/run-applescript/node_modules/human-signals/build/src/signals.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.getSignals = void 0;
- var _os = require("os");
- var _core = require_core();
- var _realtime = require_realtime();
- var getSignals2 = function() {
- const realtimeSignals = (0, _realtime.getRealtimeSignals)();
- const signals = [..._core.SIGNALS, ...realtimeSignals].map(normalizeSignal2);
- return signals;
- };
- exports2.getSignals = getSignals2;
- var normalizeSignal2 = function({
- name,
- number: defaultNumber,
- description,
- action,
- forced = false,
- standard
- }) {
- const {
- signals: { [name]: constantSignal }
- } = _os.constants;
- const supported = constantSignal !== void 0;
- const number = supported ? constantSignal : defaultNumber;
- return { name, number, description, supported, action, forced, standard };
- };
- }
- });
- // node_modules/run-applescript/node_modules/human-signals/build/src/main.js
- var require_main = __commonJS({
- "node_modules/run-applescript/node_modules/human-signals/build/src/main.js"(exports2) {
- "use strict";
- Object.defineProperty(exports2, "__esModule", { value: true });
- exports2.signalsByNumber = exports2.signalsByName = void 0;
- var _os = require("os");
- var _signals = require_signals();
- var _realtime = require_realtime();
- var getSignalsByName2 = function() {
- const signals = (0, _signals.getSignals)();
- return signals.reduce(getSignalByName2, {});
- };
- var getSignalByName2 = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
- return {
- ...signalByNameMemo,
- [name]: { name, number, description, supported, action, forced, standard }
- };
- };
- var signalsByName2 = getSignalsByName2();
- exports2.signalsByName = signalsByName2;
- var getSignalsByNumber2 = function() {
- const signals = (0, _signals.getSignals)();
- const length = _realtime.SIGRTMAX + 1;
- const signalsA = Array.from({ length }, (value, number) => getSignalByNumber2(number, signals));
- return Object.assign({}, ...signalsA);
- };
- var getSignalByNumber2 = function(number, signals) {
- const signal = findSignalByNumber2(number, signals);
- if (signal === void 0) {
- return {};
- }
- const { name, description, supported, action, forced, standard } = signal;
- return {
- [number]: {
- name,
- number,
- description,
- supported,
- action,
- forced,
- standard
- }
- };
- };
- var findSignalByNumber2 = function(number, signals) {
- const signal = signals.find(({ name }) => _os.constants.signals[name] === number);
- if (signal !== void 0) {
- return signal;
- }
- return signals.find((signalA) => signalA.number === number);
- };
- var signalsByNumber2 = getSignalsByNumber2();
- exports2.signalsByNumber = signalsByNumber2;
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/error.js
- var require_error = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/error.js"(exports2, module2) {
- "use strict";
- var { signalsByName: signalsByName2 } = require_main();
- var getErrorPrefix2 = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
- if (timedOut) {
- return `timed out after ${timeout} milliseconds`;
- }
- if (isCanceled) {
- return "was canceled";
- }
- if (errorCode !== void 0) {
- return `failed with ${errorCode}`;
- }
- if (signal !== void 0) {
- return `was killed with ${signal} (${signalDescription})`;
- }
- if (exitCode !== void 0) {
- return `failed with exit code ${exitCode}`;
- }
- return "failed";
- };
- var makeError2 = ({
- stdout,
- stderr,
- all,
- error,
- signal,
- exitCode,
- command,
- escapedCommand,
- timedOut,
- isCanceled,
- killed,
- parsed: { options: { timeout } }
- }) => {
- exitCode = exitCode === null ? void 0 : exitCode;
- signal = signal === null ? void 0 : signal;
- const signalDescription = signal === void 0 ? void 0 : signalsByName2[signal].description;
- const errorCode = error && error.code;
- const prefix = getErrorPrefix2({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
- const execaMessage = `Command ${prefix}: ${command}`;
- const isError = Object.prototype.toString.call(error) === "[object Error]";
- const shortMessage = isError ? `${execaMessage}
- ${error.message}` : execaMessage;
- const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
- if (isError) {
- error.originalMessage = error.message;
- error.message = message;
- } else {
- error = new Error(message);
- }
- error.shortMessage = shortMessage;
- error.command = command;
- error.escapedCommand = escapedCommand;
- error.exitCode = exitCode;
- error.signal = signal;
- error.signalDescription = signalDescription;
- error.stdout = stdout;
- error.stderr = stderr;
- if (all !== void 0) {
- error.all = all;
- }
- if ("bufferedData" in error) {
- delete error.bufferedData;
- }
- error.failed = true;
- error.timedOut = Boolean(timedOut);
- error.isCanceled = isCanceled;
- error.killed = killed && !timedOut;
- return error;
- };
- module2.exports = makeError2;
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/stdio.js
- var require_stdio = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/stdio.js"(exports2, module2) {
- "use strict";
- var aliases2 = ["stdin", "stdout", "stderr"];
- var hasAlias2 = (options) => aliases2.some((alias) => options[alias] !== void 0);
- var normalizeStdio2 = (options) => {
- if (!options) {
- return;
- }
- const { stdio } = options;
- if (stdio === void 0) {
- return aliases2.map((alias) => options[alias]);
- }
- if (hasAlias2(options)) {
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases2.map((alias) => `\`${alias}\``).join(", ")}`);
- }
- if (typeof stdio === "string") {
- return stdio;
- }
- if (!Array.isArray(stdio)) {
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
- }
- const length = Math.max(stdio.length, aliases2.length);
- return Array.from({ length }, (value, index) => stdio[index]);
- };
- module2.exports = normalizeStdio2;
- module2.exports.node = (options) => {
- const stdio = normalizeStdio2(options);
- if (stdio === "ipc") {
- return "ipc";
- }
- if (stdio === void 0 || typeof stdio === "string") {
- return [stdio, stdio, stdio, "ipc"];
- }
- if (stdio.includes("ipc")) {
- return stdio;
- }
- return [...stdio, "ipc"];
- };
- }
- });
- // node_modules/run-applescript/node_modules/signal-exit/signals.js
- var require_signals2 = __commonJS({
- "node_modules/run-applescript/node_modules/signal-exit/signals.js"(exports2, module2) {
- module2.exports = [
- "SIGABRT",
- "SIGALRM",
- "SIGHUP",
- "SIGINT",
- "SIGTERM"
- ];
- if (process.platform !== "win32") {
- module2.exports.push(
- "SIGVTALRM",
- "SIGXCPU",
- "SIGXFSZ",
- "SIGUSR2",
- "SIGTRAP",
- "SIGSYS",
- "SIGQUIT",
- "SIGIOT"
- // should detect profiler and enable/disable accordingly.
- // see #21
- // 'SIGPROF'
- );
- }
- if (process.platform === "linux") {
- module2.exports.push(
- "SIGIO",
- "SIGPOLL",
- "SIGPWR",
- "SIGSTKFLT",
- "SIGUNUSED"
- );
- }
- }
- });
- // node_modules/run-applescript/node_modules/signal-exit/index.js
- var require_signal_exit = __commonJS({
- "node_modules/run-applescript/node_modules/signal-exit/index.js"(exports2, module2) {
- var process8 = global.process;
- var processOk = function(process9) {
- return process9 && typeof process9 === "object" && typeof process9.removeListener === "function" && typeof process9.emit === "function" && typeof process9.reallyExit === "function" && typeof process9.listeners === "function" && typeof process9.kill === "function" && typeof process9.pid === "number" && typeof process9.on === "function";
- };
- if (!processOk(process8)) {
- module2.exports = function() {
- return function() {
- };
- };
- } else {
- assert = require("assert");
- signals = require_signals2();
- isWin = /^win/i.test(process8.platform);
- EE = require("events");
- if (typeof EE !== "function") {
- EE = EE.EventEmitter;
- }
- if (process8.__signal_exit_emitter__) {
- emitter = process8.__signal_exit_emitter__;
- } else {
- emitter = process8.__signal_exit_emitter__ = new EE();
- emitter.count = 0;
- emitter.emitted = {};
- }
- if (!emitter.infinite) {
- emitter.setMaxListeners(Infinity);
- emitter.infinite = true;
- }
- module2.exports = function(cb, opts) {
- if (!processOk(global.process)) {
- return function() {
- };
- }
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
- if (loaded === false) {
- load();
- }
- var ev = "exit";
- if (opts && opts.alwaysLast) {
- ev = "afterexit";
- }
- var remove = function() {
- emitter.removeListener(ev, cb);
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
- unload();
- }
- };
- emitter.on(ev, cb);
- return remove;
- };
- unload = function unload2() {
- if (!loaded || !processOk(global.process)) {
- return;
- }
- loaded = false;
- signals.forEach(function(sig) {
- try {
- process8.removeListener(sig, sigListeners[sig]);
- } catch (er) {
- }
- });
- process8.emit = originalProcessEmit;
- process8.reallyExit = originalProcessReallyExit;
- emitter.count -= 1;
- };
- module2.exports.unload = unload;
- emit = function emit2(event, code, signal) {
- if (emitter.emitted[event]) {
- return;
- }
- emitter.emitted[event] = true;
- emitter.emit(event, code, signal);
- };
- sigListeners = {};
- signals.forEach(function(sig) {
- sigListeners[sig] = function listener() {
- if (!processOk(global.process)) {
- return;
- }
- var listeners = process8.listeners(sig);
- if (listeners.length === emitter.count) {
- unload();
- emit("exit", null, sig);
- emit("afterexit", null, sig);
- if (isWin && sig === "SIGHUP") {
- sig = "SIGINT";
- }
- process8.kill(process8.pid, sig);
- }
- };
- });
- module2.exports.signals = function() {
- return signals;
- };
- loaded = false;
- load = function load2() {
- if (loaded || !processOk(global.process)) {
- return;
- }
- loaded = true;
- emitter.count += 1;
- signals = signals.filter(function(sig) {
- try {
- process8.on(sig, sigListeners[sig]);
- return true;
- } catch (er) {
- return false;
- }
- });
- process8.emit = processEmit;
- process8.reallyExit = processReallyExit;
- };
- module2.exports.load = load;
- originalProcessReallyExit = process8.reallyExit;
- processReallyExit = function processReallyExit2(code) {
- if (!processOk(global.process)) {
- return;
- }
- process8.exitCode = code || /* istanbul ignore next */
- 0;
- emit("exit", process8.exitCode, null);
- emit("afterexit", process8.exitCode, null);
- originalProcessReallyExit.call(process8, process8.exitCode);
- };
- originalProcessEmit = process8.emit;
- processEmit = function processEmit2(ev, arg) {
- if (ev === "exit" && processOk(global.process)) {
- if (arg !== void 0) {
- process8.exitCode = arg;
- }
- var ret = originalProcessEmit.apply(this, arguments);
- emit("exit", process8.exitCode, null);
- emit("afterexit", process8.exitCode, null);
- return ret;
- } else {
- return originalProcessEmit.apply(this, arguments);
- }
- };
- }
- var assert;
- var signals;
- var isWin;
- var EE;
- var emitter;
- var unload;
- var emit;
- var sigListeners;
- var loaded;
- var load;
- var originalProcessReallyExit;
- var processReallyExit;
- var originalProcessEmit;
- var processEmit;
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/kill.js
- var require_kill = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/kill.js"(exports2, module2) {
- "use strict";
- var os3 = require("os");
- var onExit2 = require_signal_exit();
- var DEFAULT_FORCE_KILL_TIMEOUT2 = 1e3 * 5;
- var spawnedKill2 = (kill, signal = "SIGTERM", options = {}) => {
- const killResult = kill(signal);
- setKillTimeout2(kill, signal, options, killResult);
- return killResult;
- };
- var setKillTimeout2 = (kill, signal, options, killResult) => {
- if (!shouldForceKill2(signal, options, killResult)) {
- return;
- }
- const timeout = getForceKillAfterTimeout2(options);
- const t = setTimeout(() => {
- kill("SIGKILL");
- }, timeout);
- if (t.unref) {
- t.unref();
- }
- };
- var shouldForceKill2 = (signal, { forceKillAfterTimeout }, killResult) => {
- return isSigterm2(signal) && forceKillAfterTimeout !== false && killResult;
- };
- var isSigterm2 = (signal) => {
- return signal === os3.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
- };
- var getForceKillAfterTimeout2 = ({ forceKillAfterTimeout = true }) => {
- if (forceKillAfterTimeout === true) {
- return DEFAULT_FORCE_KILL_TIMEOUT2;
- }
- if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
- throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
- }
- return forceKillAfterTimeout;
- };
- var spawnedCancel2 = (spawned, context) => {
- const killResult = spawned.kill();
- if (killResult) {
- context.isCanceled = true;
- }
- };
- var timeoutKill2 = (spawned, signal, reject) => {
- spawned.kill(signal);
- reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
- };
- var setupTimeout2 = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
- if (timeout === 0 || timeout === void 0) {
- return spawnedPromise;
- }
- let timeoutId;
- const timeoutPromise = new Promise((resolve, reject) => {
- timeoutId = setTimeout(() => {
- timeoutKill2(spawned, killSignal, reject);
- }, timeout);
- });
- const safeSpawnedPromise = spawnedPromise.finally(() => {
- clearTimeout(timeoutId);
- });
- return Promise.race([timeoutPromise, safeSpawnedPromise]);
- };
- var validateTimeout2 = ({ timeout }) => {
- if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
- throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
- }
- };
- var setExitHandler2 = async (spawned, { cleanup, detached }, timedPromise) => {
- if (!cleanup || detached) {
- return timedPromise;
- }
- const removeExitHandler = onExit2(() => {
- spawned.kill();
- });
- return timedPromise.finally(() => {
- removeExitHandler();
- });
- };
- module2.exports = {
- spawnedKill: spawnedKill2,
- spawnedCancel: spawnedCancel2,
- setupTimeout: setupTimeout2,
- validateTimeout: validateTimeout2,
- setExitHandler: setExitHandler2
- };
- }
- });
- // node_modules/run-applescript/node_modules/is-stream/index.js
- var require_is_stream = __commonJS({
- "node_modules/run-applescript/node_modules/is-stream/index.js"(exports2, module2) {
- "use strict";
- var isStream2 = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
- isStream2.writable = (stream) => isStream2(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
- isStream2.readable = (stream) => isStream2(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
- isStream2.duplex = (stream) => isStream2.writable(stream) && isStream2.readable(stream);
- isStream2.transform = (stream) => isStream2.duplex(stream) && typeof stream._transform === "function";
- module2.exports = isStream2;
- }
- });
- // node_modules/run-applescript/node_modules/get-stream/buffer-stream.js
- var require_buffer_stream = __commonJS({
- "node_modules/run-applescript/node_modules/get-stream/buffer-stream.js"(exports2, module2) {
- "use strict";
- var { PassThrough: PassThroughStream } = require("stream");
- module2.exports = (options) => {
- options = { ...options };
- const { array } = options;
- let { encoding } = options;
- const isBuffer = encoding === "buffer";
- let objectMode = false;
- if (array) {
- objectMode = !(encoding || isBuffer);
- } else {
- encoding = encoding || "utf8";
- }
- if (isBuffer) {
- encoding = null;
- }
- const stream = new PassThroughStream({ objectMode });
- if (encoding) {
- stream.setEncoding(encoding);
- }
- let length = 0;
- const chunks = [];
- stream.on("data", (chunk) => {
- chunks.push(chunk);
- if (objectMode) {
- length = chunks.length;
- } else {
- length += chunk.length;
- }
- });
- stream.getBufferedValue = () => {
- if (array) {
- return chunks;
- }
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
- };
- stream.getBufferedLength = () => length;
- return stream;
- };
- }
- });
- // node_modules/run-applescript/node_modules/get-stream/index.js
- var require_get_stream = __commonJS({
- "node_modules/run-applescript/node_modules/get-stream/index.js"(exports2, module2) {
- "use strict";
- var { constants: BufferConstants } = require("buffer");
- var stream = require("stream");
- var { promisify } = require("util");
- var bufferStream = require_buffer_stream();
- var streamPipelinePromisified = promisify(stream.pipeline);
- var MaxBufferError = class extends Error {
- constructor() {
- super("maxBuffer exceeded");
- this.name = "MaxBufferError";
- }
- };
- async function getStream2(inputStream, options) {
- if (!inputStream) {
- throw new Error("Expected a stream");
- }
- options = {
- maxBuffer: Infinity,
- ...options
- };
- const { maxBuffer } = options;
- const stream2 = bufferStream(options);
- await new Promise((resolve, reject) => {
- const rejectPromise = (error) => {
- if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
- error.bufferedData = stream2.getBufferedValue();
- }
- reject(error);
- };
- (async () => {
- try {
- await streamPipelinePromisified(inputStream, stream2);
- resolve();
- } catch (error) {
- rejectPromise(error);
- }
- })();
- stream2.on("data", () => {
- if (stream2.getBufferedLength() > maxBuffer) {
- rejectPromise(new MaxBufferError());
- }
- });
- });
- return stream2.getBufferedValue();
- }
- module2.exports = getStream2;
- module2.exports.buffer = (stream2, options) => getStream2(stream2, { ...options, encoding: "buffer" });
- module2.exports.array = (stream2, options) => getStream2(stream2, { ...options, array: true });
- module2.exports.MaxBufferError = MaxBufferError;
- }
- });
- // node_modules/merge-stream/index.js
- var require_merge_stream = __commonJS({
- "node_modules/merge-stream/index.js"(exports2, module2) {
- "use strict";
- var { PassThrough } = require("stream");
- module2.exports = function() {
- var sources = [];
- var output = new PassThrough({ objectMode: true });
- output.setMaxListeners(0);
- output.add = add;
- output.isEmpty = isEmpty;
- output.on("unpipe", remove);
- Array.prototype.slice.call(arguments).forEach(add);
- return output;
- function add(source) {
- if (Array.isArray(source)) {
- source.forEach(add);
- return this;
- }
- sources.push(source);
- source.once("end", remove.bind(null, source));
- source.once("error", output.emit.bind(output, "error"));
- source.pipe(output, { end: false });
- return this;
- }
- function isEmpty() {
- return sources.length == 0;
- }
- function remove(source) {
- sources = sources.filter(function(it) {
- return it !== source;
- });
- if (!sources.length && output.readable) {
- output.end();
- }
- }
- };
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/stream.js
- var require_stream = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/stream.js"(exports2, module2) {
- "use strict";
- var isStream2 = require_is_stream();
- var getStream2 = require_get_stream();
- var mergeStream2 = require_merge_stream();
- var handleInput2 = (spawned, input) => {
- if (input === void 0 || spawned.stdin === void 0) {
- return;
- }
- if (isStream2(input)) {
- input.pipe(spawned.stdin);
- } else {
- spawned.stdin.end(input);
- }
- };
- var makeAllStream2 = (spawned, { all }) => {
- if (!all || !spawned.stdout && !spawned.stderr) {
- return;
- }
- const mixed = mergeStream2();
- if (spawned.stdout) {
- mixed.add(spawned.stdout);
- }
- if (spawned.stderr) {
- mixed.add(spawned.stderr);
- }
- return mixed;
- };
- var getBufferedData2 = async (stream, streamPromise) => {
- if (!stream) {
- return;
- }
- stream.destroy();
- try {
- return await streamPromise;
- } catch (error) {
- return error.bufferedData;
- }
- };
- var getStreamPromise2 = (stream, { encoding, buffer, maxBuffer }) => {
- if (!stream || !buffer) {
- return;
- }
- if (encoding) {
- return getStream2(stream, { encoding, maxBuffer });
- }
- return getStream2.buffer(stream, { maxBuffer });
- };
- var getSpawnedResult2 = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
- const stdoutPromise = getStreamPromise2(stdout, { encoding, buffer, maxBuffer });
- const stderrPromise = getStreamPromise2(stderr, { encoding, buffer, maxBuffer });
- const allPromise = getStreamPromise2(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
- try {
- return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
- } catch (error) {
- return Promise.all([
- { error, signal: error.signal, timedOut: error.timedOut },
- getBufferedData2(stdout, stdoutPromise),
- getBufferedData2(stderr, stderrPromise),
- getBufferedData2(all, allPromise)
- ]);
- }
- };
- var validateInputSync = ({ input }) => {
- if (isStream2(input)) {
- throw new TypeError("The `input` option cannot be a stream in sync mode");
- }
- };
- module2.exports = {
- handleInput: handleInput2,
- makeAllStream: makeAllStream2,
- getSpawnedResult: getSpawnedResult2,
- validateInputSync
- };
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/promise.js
- var require_promise = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/promise.js"(exports2, module2) {
- "use strict";
- var nativePromisePrototype2 = (async () => {
- })().constructor.prototype;
- var descriptors2 = ["then", "catch", "finally"].map((property) => [
- property,
- Reflect.getOwnPropertyDescriptor(nativePromisePrototype2, property)
- ]);
- var mergePromise2 = (spawned, promise) => {
- for (const [property, descriptor] of descriptors2) {
- const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
- Reflect.defineProperty(spawned, property, { ...descriptor, value });
- }
- return spawned;
- };
- var getSpawnedPromise2 = (spawned) => {
- return new Promise((resolve, reject) => {
- spawned.on("exit", (exitCode, signal) => {
- resolve({ exitCode, signal });
- });
- spawned.on("error", (error) => {
- reject(error);
- });
- if (spawned.stdin) {
- spawned.stdin.on("error", (error) => {
- reject(error);
- });
- }
- });
- };
- module2.exports = {
- mergePromise: mergePromise2,
- getSpawnedPromise: getSpawnedPromise2
- };
- }
- });
- // node_modules/run-applescript/node_modules/execa/lib/command.js
- var require_command = __commonJS({
- "node_modules/run-applescript/node_modules/execa/lib/command.js"(exports2, module2) {
- "use strict";
- var normalizeArgs2 = (file, args = []) => {
- if (!Array.isArray(args)) {
- return [file];
- }
- return [file, ...args];
- };
- var NO_ESCAPE_REGEXP2 = /^[\w.-]+$/;
- var DOUBLE_QUOTES_REGEXP2 = /"/g;
- var escapeArg2 = (arg) => {
- if (typeof arg !== "string" || NO_ESCAPE_REGEXP2.test(arg)) {
- return arg;
- }
- return `"${arg.replace(DOUBLE_QUOTES_REGEXP2, '\\"')}"`;
- };
- var joinCommand2 = (file, args) => {
- return normalizeArgs2(file, args).join(" ");
- };
- var getEscapedCommand2 = (file, args) => {
- return normalizeArgs2(file, args).map((arg) => escapeArg2(arg)).join(" ");
- };
- var SPACES_REGEXP2 = / +/g;
- var parseCommand2 = (command) => {
- const tokens = [];
- for (const token of command.trim().split(SPACES_REGEXP2)) {
- const previousToken = tokens[tokens.length - 1];
- if (previousToken && previousToken.endsWith("\\")) {
- tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
- } else {
- tokens.push(token);
- }
- }
- return tokens;
- };
- module2.exports = {
- joinCommand: joinCommand2,
- getEscapedCommand: getEscapedCommand2,
- parseCommand: parseCommand2
- };
- }
- });
- // node_modules/run-applescript/node_modules/execa/index.js
- var require_execa = __commonJS({
- "node_modules/run-applescript/node_modules/execa/index.js"(exports2, module2) {
- "use strict";
- var path11 = require("path");
- var childProcess3 = require("child_process");
- var crossSpawn2 = require_cross_spawn();
- var stripFinalNewline2 = require_strip_final_newline();
- var npmRunPath2 = require_npm_run_path();
- var onetime2 = require_onetime();
- var makeError2 = require_error();
- var normalizeStdio2 = require_stdio();
- var { spawnedKill: spawnedKill2, spawnedCancel: spawnedCancel2, setupTimeout: setupTimeout2, validateTimeout: validateTimeout2, setExitHandler: setExitHandler2 } = require_kill();
- var { handleInput: handleInput2, getSpawnedResult: getSpawnedResult2, makeAllStream: makeAllStream2, validateInputSync } = require_stream();
- var { mergePromise: mergePromise2, getSpawnedPromise: getSpawnedPromise2 } = require_promise();
- var { joinCommand: joinCommand2, parseCommand: parseCommand2, getEscapedCommand: getEscapedCommand2 } = require_command();
- var DEFAULT_MAX_BUFFER2 = 1e3 * 1e3 * 100;
- var getEnv2 = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
- const env = extendEnv ? { ...process.env, ...envOption } : envOption;
- if (preferLocal) {
- return npmRunPath2.env({ env, cwd: localDir, execPath });
- }
- return env;
- };
- var handleArguments2 = (file, args, options = {}) => {
- const parsed = crossSpawn2._parse(file, args, options);
- file = parsed.command;
- args = parsed.args;
- options = parsed.options;
- options = {
- maxBuffer: DEFAULT_MAX_BUFFER2,
- buffer: true,
- stripFinalNewline: true,
- extendEnv: true,
- preferLocal: false,
- localDir: options.cwd || process.cwd(),
- execPath: process.execPath,
- encoding: "utf8",
- reject: true,
- cleanup: true,
- all: false,
- windowsHide: true,
- ...options
- };
- options.env = getEnv2(options);
- options.stdio = normalizeStdio2(options);
- if (process.platform === "win32" && path11.basename(file, ".exe") === "cmd") {
- args.unshift("/q");
- }
- return { file, args, options, parsed };
- };
- var handleOutput2 = (options, value, error) => {
- if (typeof value !== "string" && !Buffer.isBuffer(value)) {
- return error === void 0 ? void 0 : "";
- }
- if (options.stripFinalNewline) {
- return stripFinalNewline2(value);
- }
- return value;
- };
- var execa3 = (file, args, options) => {
- const parsed = handleArguments2(file, args, options);
- const command = joinCommand2(file, args);
- const escapedCommand = getEscapedCommand2(file, args);
- validateTimeout2(parsed.options);
- let spawned;
- try {
- spawned = childProcess3.spawn(parsed.file, parsed.args, parsed.options);
- } catch (error) {
- const dummySpawned = new childProcess3.ChildProcess();
- const errorPromise = Promise.reject(makeError2({
- error,
- stdout: "",
- stderr: "",
- all: "",
- command,
- escapedCommand,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- }));
- return mergePromise2(dummySpawned, errorPromise);
- }
- const spawnedPromise = getSpawnedPromise2(spawned);
- const timedPromise = setupTimeout2(spawned, parsed.options, spawnedPromise);
- const processDone = setExitHandler2(spawned, parsed.options, timedPromise);
- const context = { isCanceled: false };
- spawned.kill = spawnedKill2.bind(null, spawned.kill.bind(spawned));
- spawned.cancel = spawnedCancel2.bind(null, spawned, context);
- const handlePromise = async () => {
- const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult2(spawned, parsed.options, processDone);
- const stdout = handleOutput2(parsed.options, stdoutResult);
- const stderr = handleOutput2(parsed.options, stderrResult);
- const all = handleOutput2(parsed.options, allResult);
- if (error || exitCode !== 0 || signal !== null) {
- const returnedError = makeError2({
- error,
- exitCode,
- signal,
- stdout,
- stderr,
- all,
- command,
- escapedCommand,
- parsed,
- timedOut,
- isCanceled: context.isCanceled,
- killed: spawned.killed
- });
- if (!parsed.options.reject) {
- return returnedError;
- }
- throw returnedError;
- }
- return {
- command,
- escapedCommand,
- exitCode: 0,
- stdout,
- stderr,
- all,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
- };
- const handlePromiseOnce = onetime2(handlePromise);
- handleInput2(spawned, parsed.options.input);
- spawned.all = makeAllStream2(spawned, parsed.options);
- return mergePromise2(spawned, handlePromiseOnce);
- };
- module2.exports = execa3;
- module2.exports.sync = (file, args, options) => {
- const parsed = handleArguments2(file, args, options);
- const command = joinCommand2(file, args);
- const escapedCommand = getEscapedCommand2(file, args);
- validateInputSync(parsed.options);
- let result;
- try {
- result = childProcess3.spawnSync(parsed.file, parsed.args, parsed.options);
- } catch (error) {
- throw makeError2({
- error,
- stdout: "",
- stderr: "",
- all: "",
- command,
- escapedCommand,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- });
- }
- const stdout = handleOutput2(parsed.options, result.stdout, result.error);
- const stderr = handleOutput2(parsed.options, result.stderr, result.error);
- if (result.error || result.status !== 0 || result.signal !== null) {
- const error = makeError2({
- stdout,
- stderr,
- error: result.error,
- signal: result.signal,
- exitCode: result.status,
- command,
- escapedCommand,
- parsed,
- timedOut: result.error && result.error.code === "ETIMEDOUT",
- isCanceled: false,
- killed: result.signal !== null
- });
- if (!parsed.options.reject) {
- return error;
- }
- throw error;
- }
- return {
- command,
- escapedCommand,
- exitCode: 0,
- stdout,
- stderr,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
- };
- module2.exports.command = (command, options) => {
- const [file, ...args] = parseCommand2(command);
- return execa3(file, args, options);
- };
- module2.exports.commandSync = (command, options) => {
- const [file, ...args] = parseCommand2(command);
- return execa3.sync(file, args, options);
- };
- module2.exports.node = (scriptPath, args, options = {}) => {
- if (args && !Array.isArray(args) && typeof args === "object") {
- options = args;
- args = [];
- }
- const stdio = normalizeStdio2.node(options);
- const defaultExecArgv = process.execArgv.filter((arg) => !arg.startsWith("--inspect"));
- const {
- nodePath = process.execPath,
- nodeOptions = defaultExecArgv
- } = options;
- return execa3(
- nodePath,
- [
- ...nodeOptions,
- scriptPath,
- ...Array.isArray(args) ? args : []
- ],
- {
- ...options,
- stdin: void 0,
- stdout: void 0,
- stderr: void 0,
- stdio,
- shell: false
- }
- );
- };
- }
- });
- // node_modules/default-browser/node_modules/signal-exit/signals.js
- var require_signals3 = __commonJS({
- "node_modules/default-browser/node_modules/signal-exit/signals.js"(exports2, module2) {
- module2.exports = [
- "SIGABRT",
- "SIGALRM",
- "SIGHUP",
- "SIGINT",
- "SIGTERM"
- ];
- if (process.platform !== "win32") {
- module2.exports.push(
- "SIGVTALRM",
- "SIGXCPU",
- "SIGXFSZ",
- "SIGUSR2",
- "SIGTRAP",
- "SIGSYS",
- "SIGQUIT",
- "SIGIOT"
- // should detect profiler and enable/disable accordingly.
- // see #21
- // 'SIGPROF'
- );
- }
- if (process.platform === "linux") {
- module2.exports.push(
- "SIGIO",
- "SIGPOLL",
- "SIGPWR",
- "SIGSTKFLT",
- "SIGUNUSED"
- );
- }
- }
- });
- // node_modules/default-browser/node_modules/signal-exit/index.js
- var require_signal_exit2 = __commonJS({
- "node_modules/default-browser/node_modules/signal-exit/index.js"(exports2, module2) {
- var process8 = global.process;
- var processOk = function(process9) {
- return process9 && typeof process9 === "object" && typeof process9.removeListener === "function" && typeof process9.emit === "function" && typeof process9.reallyExit === "function" && typeof process9.listeners === "function" && typeof process9.kill === "function" && typeof process9.pid === "number" && typeof process9.on === "function";
- };
- if (!processOk(process8)) {
- module2.exports = function() {
- return function() {
- };
- };
- } else {
- assert = require("assert");
- signals = require_signals3();
- isWin = /^win/i.test(process8.platform);
- EE = require("events");
- if (typeof EE !== "function") {
- EE = EE.EventEmitter;
- }
- if (process8.__signal_exit_emitter__) {
- emitter = process8.__signal_exit_emitter__;
- } else {
- emitter = process8.__signal_exit_emitter__ = new EE();
- emitter.count = 0;
- emitter.emitted = {};
- }
- if (!emitter.infinite) {
- emitter.setMaxListeners(Infinity);
- emitter.infinite = true;
- }
- module2.exports = function(cb, opts) {
- if (!processOk(global.process)) {
- return function() {
- };
- }
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
- if (loaded === false) {
- load();
- }
- var ev = "exit";
- if (opts && opts.alwaysLast) {
- ev = "afterexit";
- }
- var remove = function() {
- emitter.removeListener(ev, cb);
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
- unload();
- }
- };
- emitter.on(ev, cb);
- return remove;
- };
- unload = function unload2() {
- if (!loaded || !processOk(global.process)) {
- return;
- }
- loaded = false;
- signals.forEach(function(sig) {
- try {
- process8.removeListener(sig, sigListeners[sig]);
- } catch (er) {
- }
- });
- process8.emit = originalProcessEmit;
- process8.reallyExit = originalProcessReallyExit;
- emitter.count -= 1;
- };
- module2.exports.unload = unload;
- emit = function emit2(event, code, signal) {
- if (emitter.emitted[event]) {
- return;
- }
- emitter.emitted[event] = true;
- emitter.emit(event, code, signal);
- };
- sigListeners = {};
- signals.forEach(function(sig) {
- sigListeners[sig] = function listener() {
- if (!processOk(global.process)) {
- return;
- }
- var listeners = process8.listeners(sig);
- if (listeners.length === emitter.count) {
- unload();
- emit("exit", null, sig);
- emit("afterexit", null, sig);
- if (isWin && sig === "SIGHUP") {
- sig = "SIGINT";
- }
- process8.kill(process8.pid, sig);
- }
- };
- });
- module2.exports.signals = function() {
- return signals;
- };
- loaded = false;
- load = function load2() {
- if (loaded || !processOk(global.process)) {
- return;
- }
- loaded = true;
- emitter.count += 1;
- signals = signals.filter(function(sig) {
- try {
- process8.on(sig, sigListeners[sig]);
- return true;
- } catch (er) {
- return false;
- }
- });
- process8.emit = processEmit;
- process8.reallyExit = processReallyExit;
- };
- module2.exports.load = load;
- originalProcessReallyExit = process8.reallyExit;
- processReallyExit = function processReallyExit2(code) {
- if (!processOk(global.process)) {
- return;
- }
- process8.exitCode = code || /* istanbul ignore next */
- 0;
- emit("exit", process8.exitCode, null);
- emit("afterexit", process8.exitCode, null);
- originalProcessReallyExit.call(process8, process8.exitCode);
- };
- originalProcessEmit = process8.emit;
- processEmit = function processEmit2(ev, arg) {
- if (ev === "exit" && processOk(global.process)) {
- if (arg !== void 0) {
- process8.exitCode = arg;
- }
- var ret = originalProcessEmit.apply(this, arguments);
- emit("exit", process8.exitCode, null);
- emit("afterexit", process8.exitCode, null);
- return ret;
- } else {
- return originalProcessEmit.apply(this, arguments);
- }
- };
- }
- var assert;
- var signals;
- var isWin;
- var EE;
- var emitter;
- var unload;
- var emit;
- var sigListeners;
- var loaded;
- var load;
- var originalProcessReallyExit;
- var processReallyExit;
- var originalProcessEmit;
- var processEmit;
- }
- });
- // node_modules/default-browser/node_modules/get-stream/buffer-stream.js
- var require_buffer_stream2 = __commonJS({
- "node_modules/default-browser/node_modules/get-stream/buffer-stream.js"(exports2, module2) {
- "use strict";
- var { PassThrough: PassThroughStream } = require("stream");
- module2.exports = (options) => {
- options = { ...options };
- const { array } = options;
- let { encoding } = options;
- const isBuffer = encoding === "buffer";
- let objectMode = false;
- if (array) {
- objectMode = !(encoding || isBuffer);
- } else {
- encoding = encoding || "utf8";
- }
- if (isBuffer) {
- encoding = null;
- }
- const stream = new PassThroughStream({ objectMode });
- if (encoding) {
- stream.setEncoding(encoding);
- }
- let length = 0;
- const chunks = [];
- stream.on("data", (chunk) => {
- chunks.push(chunk);
- if (objectMode) {
- length = chunks.length;
- } else {
- length += chunk.length;
- }
- });
- stream.getBufferedValue = () => {
- if (array) {
- return chunks;
- }
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
- };
- stream.getBufferedLength = () => length;
- return stream;
- };
- }
- });
- // node_modules/default-browser/node_modules/get-stream/index.js
- var require_get_stream2 = __commonJS({
- "node_modules/default-browser/node_modules/get-stream/index.js"(exports2, module2) {
- "use strict";
- var { constants: BufferConstants } = require("buffer");
- var stream = require("stream");
- var { promisify } = require("util");
- var bufferStream = require_buffer_stream2();
- var streamPipelinePromisified = promisify(stream.pipeline);
- var MaxBufferError = class extends Error {
- constructor() {
- super("maxBuffer exceeded");
- this.name = "MaxBufferError";
- }
- };
- async function getStream2(inputStream, options) {
- if (!inputStream) {
- throw new Error("Expected a stream");
- }
- options = {
- maxBuffer: Infinity,
- ...options
- };
- const { maxBuffer } = options;
- const stream2 = bufferStream(options);
- await new Promise((resolve, reject) => {
- const rejectPromise = (error) => {
- if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
- error.bufferedData = stream2.getBufferedValue();
- }
- reject(error);
- };
- (async () => {
- try {
- await streamPipelinePromisified(inputStream, stream2);
- resolve();
- } catch (error) {
- rejectPromise(error);
- }
- })();
- stream2.on("data", () => {
- if (stream2.getBufferedLength() > maxBuffer) {
- rejectPromise(new MaxBufferError());
- }
- });
- });
- return stream2.getBufferedValue();
- }
- module2.exports = getStream2;
- module2.exports.buffer = (stream2, options) => getStream2(stream2, { ...options, encoding: "buffer" });
- module2.exports.array = (stream2, options) => getStream2(stream2, { ...options, array: true });
- module2.exports.MaxBufferError = MaxBufferError;
- }
- });
- // build/dev-server/server-process.js
- var server_process_exports = {};
- __export(server_process_exports, {
- initServerProcess: () => initServerProcess
- });
- module.exports = __toCommonJS(server_process_exports);
- var import_sys_api_node = require("../sys/node/index.js");
- // src/utils/helpers.ts
- var noop = () => {
- };
- var isFunction = (v) => typeof v === "function";
- var isString = (v) => typeof v === "string";
- // src/utils/message-utils.ts
- var catchError = (diagnostics, err2, msg) => {
- const diagnostic = {
- level: "error",
- type: "build",
- header: "Build Error",
- messageText: "build error",
- lines: []
- };
- if (isString(msg)) {
- diagnostic.messageText = msg.length ? msg : "UNKNOWN ERROR";
- } else if (err2 != null) {
- if (err2.stack != null) {
- diagnostic.messageText = err2.stack.toString();
- } else {
- if (err2.message != null) {
- diagnostic.messageText = err2.message.length ? err2.message : "UNKNOWN ERROR";
- } else {
- diagnostic.messageText = err2.toString();
- }
- }
- }
- if (diagnostics != null && !shouldIgnoreError(diagnostic.messageText)) {
- diagnostics.push(diagnostic);
- }
- return diagnostic;
- };
- var shouldIgnoreError = (msg) => {
- return msg === TASK_CANCELED_MSG;
- };
- var TASK_CANCELED_MSG = `task canceled`;
- // src/utils/path.ts
- var import_path = __toESM(require("path"));
- var normalizePath = (path11, relativize = true) => {
- if (typeof path11 !== "string") {
- throw new Error(`invalid path to normalize`);
- }
- path11 = normalizeSlashes(path11.trim());
- const components = pathComponents(path11, getRootLength(path11));
- const reducedComponents = reducePathComponents(components);
- const rootPart = reducedComponents[0];
- const secondPart = reducedComponents[1];
- const normalized = rootPart + reducedComponents.slice(1).join("/");
- if (normalized === "") {
- return ".";
- }
- if (rootPart === "" && secondPart && path11.includes("/") && !secondPart.startsWith(".") && !secondPart.startsWith("@") && relativize) {
- return "./" + normalized;
- }
- return normalized;
- };
- var normalizeSlashes = (path11) => path11.replace(backslashRegExp, "/");
- var altDirectorySeparator = "\\";
- var urlSchemeSeparator = "://";
- var backslashRegExp = /\\/g;
- var reducePathComponents = (components) => {
- if (!Array.isArray(components) || components.length === 0) {
- return [];
- }
- const reduced = [components[0]];
- for (let i = 1; i < components.length; i++) {
- const component = components[i];
- if (!component) continue;
- if (component === ".") continue;
- if (component === "..") {
- if (reduced.length > 1) {
- if (reduced[reduced.length - 1] !== "..") {
- reduced.pop();
- continue;
- }
- } else if (reduced[0]) continue;
- }
- reduced.push(component);
- }
- return reduced;
- };
- var getRootLength = (path11) => {
- const rootLength = getEncodedRootLength(path11);
- return rootLength < 0 ? ~rootLength : rootLength;
- };
- var getEncodedRootLength = (path11) => {
- if (!path11) return 0;
- const ch0 = path11.charCodeAt(0);
- if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
- if (path11.charCodeAt(1) !== ch0) return 1;
- const p1 = path11.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
- if (p1 < 0) return path11.length;
- return p1 + 1;
- }
- if (isVolumeCharacter(ch0) && path11.charCodeAt(1) === 58 /* colon */) {
- const ch2 = path11.charCodeAt(2);
- if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
- if (path11.length === 2) return 2;
- }
- const schemeEnd = path11.indexOf(urlSchemeSeparator);
- if (schemeEnd !== -1) {
- const authorityStart = schemeEnd + urlSchemeSeparator.length;
- const authorityEnd = path11.indexOf("/", authorityStart);
- if (authorityEnd !== -1) {
- const scheme = path11.slice(0, schemeEnd);
- const authority = path11.slice(authorityStart, authorityEnd);
- if (scheme === "file" && (authority === "" || authority === "localhost") && isVolumeCharacter(path11.charCodeAt(authorityEnd + 1))) {
- const volumeSeparatorEnd = getFileUrlVolumeSeparatorEnd(path11, authorityEnd + 2);
- if (volumeSeparatorEnd !== -1) {
- if (path11.charCodeAt(volumeSeparatorEnd) === 47 /* slash */) {
- return ~(volumeSeparatorEnd + 1);
- }
- if (volumeSeparatorEnd === path11.length) {
- return ~volumeSeparatorEnd;
- }
- }
- }
- return ~(authorityEnd + 1);
- }
- return ~path11.length;
- }
- return 0;
- };
- var isVolumeCharacter = (charCode) => charCode >= 97 /* a */ && charCode <= 122 /* z */ || charCode >= 65 /* A */ && charCode <= 90 /* Z */;
- var getFileUrlVolumeSeparatorEnd = (url, start) => {
- const ch0 = url.charCodeAt(start);
- if (ch0 === 58 /* colon */) return start + 1;
- if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
- const ch2 = url.charCodeAt(start + 2);
- if (ch2 === 97 /* a */ || ch2 === 65 /* A */) return start + 3;
- }
- return -1;
- };
- var pathComponents = (path11, rootLength) => {
- const root = path11.substring(0, rootLength);
- const rest = path11.substring(rootLength).split("/");
- const restLen = rest.length;
- if (restLen > 0 && !rest[restLen - 1]) {
- rest.pop();
- }
- return [root, ...rest];
- };
- // src/utils/output-target.ts
- var import_path3 = require("path");
- // src/utils/result.ts
- var result_exports = {};
- __export(result_exports, {
- err: () => err,
- map: () => map,
- ok: () => ok,
- unwrap: () => unwrap,
- unwrapErr: () => unwrapErr
- });
- var ok = (value) => ({
- isOk: true,
- isErr: false,
- value
- });
- var err = (value) => ({
- isOk: false,
- isErr: true,
- value
- });
- function map(result, fn) {
- if (result.isOk) {
- const val = fn(result.value);
- if (val instanceof Promise) {
- return val.then((newVal) => ok(newVal));
- } else {
- return ok(val);
- }
- }
- if (result.isErr) {
- const value = result.value;
- return err(value);
- }
- throw "should never get here";
- }
- var unwrap = (result) => {
- if (result.isOk) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- var unwrapErr = (result) => {
- if (result.isErr) {
- return result.value;
- } else {
- throw result.value;
- }
- };
- // build/dev-server/dev-server-constants.js
- var DEV_SERVER_URL = "/~dev-server";
- var DEV_MODULE_URL = "/~dev-module";
- var DEV_SERVER_INIT_URL = `${DEV_SERVER_URL}-init`;
- var OPEN_IN_EDITOR_URL = `${DEV_SERVER_URL}-open-in-editor`;
- // build/version.js
- var version = "4.20.0";
- // build/dev-server/content-types-db.json
- var content_types_db_default = { "123": "application/vnd.lotus-1-2-3", "1km": "application/vnd.1000minds.decision-model+xml", "3dml": "text/vnd.in3d.3dml", "3ds": "image/x-3ds", "3g2": "video/3gpp2", "3gp": "video/3gpp", "3gpp": "video/3gpp", "3mf": "model/3mf", "7z": "application/x-7z-compressed", "aab": "application/x-authorware-bin", "aac": "audio/x-aac", "aam": "application/x-authorware-map", "aas": "application/x-authorware-seg", "abw": "application/x-abiword", "ac": "application/vnd.nokia.n-gage.ac+xml", "acc": "application/vnd.americandynamics.acc", "ace": "application/x-ace-compressed", "acu": "application/vnd.acucobol", "acutc": "application/vnd.acucorp", "adp": "audio/adpcm", "aep": "application/vnd.audiograph", "afm": "application/x-font-type1", "afp": "application/vnd.ibm.modcap", "age": "application/vnd.age", "ahead": "application/vnd.ahead.space", "ai": "application/postscript", "aif": "audio/x-aiff", "aifc": "audio/x-aiff", "aiff": "audio/x-aiff", "air": "application/vnd.adobe.air-application-installer-package+zip", "ait": "application/vnd.dvb.ait", "ami": "application/vnd.amiga.ami", "amr": "audio/amr", "apk": "application/vnd.android.package-archive", "apng": "image/apng", "appcache": "text/cache-manifest", "application": "application/x-ms-application", "apr": "application/vnd.lotus-approach", "arc": "application/x-freearc", "arj": "application/x-arj", "asc": "application/pgp-signature", "asf": "video/x-ms-asf", "asm": "text/x-asm", "aso": "application/vnd.accpac.simply.aso", "asx": "video/x-ms-asf", "atc": "application/vnd.acucorp", "atom": "application/atom+xml", "atomcat": "application/atomcat+xml", "atomdeleted": "application/atomdeleted+xml", "atomsvc": "application/atomsvc+xml", "atx": "application/vnd.antix.game-component", "au": "audio/basic", "avci": "image/avci", "avcs": "image/avcs", "avi": "video/x-msvideo", "avif": "image/avif", "aw": "application/applixware", "azf": "application/vnd.airzip.filesecure.azf", "azs": "application/vnd.airzip.filesecure.azs", "azv": "image/vnd.airzip.accelerator.azv", "azw": "application/vnd.amazon.ebook", "b16": "image/vnd.pco.b16", "bat": "application/x-msdownload", "bcpio": "application/x-bcpio", "bdf": "application/x-font-bdf", "bdm": "application/vnd.syncml.dm+wbxml", "bdoc": "application/x-bdoc", "bed": "application/vnd.realvnc.bed", "bh2": "application/vnd.fujitsu.oasysprs", "bin": "application/octet-stream", "blb": "application/x-blorb", "blorb": "application/x-blorb", "bmi": "application/vnd.bmi", "bmml": "application/vnd.balsamiq.bmml+xml", "bmp": "image/x-ms-bmp", "book": "application/vnd.framemaker", "box": "application/vnd.previewsystems.box", "boz": "application/x-bzip2", "bpk": "application/octet-stream", "bsp": "model/vnd.valve.source.compiled-map", "btif": "image/prs.btif", "buffer": "application/octet-stream", "bz": "application/x-bzip", "bz2": "application/x-bzip2", "c": "text/x-c", "c11amc": "application/vnd.cluetrust.cartomobile-config", "c11amz": "application/vnd.cluetrust.cartomobile-config-pkg", "c4d": "application/vnd.clonk.c4group", "c4f": "application/vnd.clonk.c4group", "c4g": "application/vnd.clonk.c4group", "c4p": "application/vnd.clonk.c4group", "c4u": "application/vnd.clonk.c4group", "cab": "application/vnd.ms-cab-compressed", "caf": "audio/x-caf", "cap": "application/vnd.tcpdump.pcap", "car": "application/vnd.curl.car", "cat": "application/vnd.ms-pki.seccat", "cb7": "application/x-cbr", "cba": "application/x-cbr", "cbr": "application/x-cbr", "cbt": "application/x-cbr", "cbz": "application/x-cbr", "cc": "text/x-c", "cco": "application/x-cocoa", "cct": "application/x-director", "ccxml": "application/ccxml+xml", "cdbcmsg": "application/vnd.contact.cmsg", "cdf": "application/x-netcdf", "cdfx": "application/cdfx+xml", "cdkey": "application/vnd.mediastation.cdkey", "cdmia": "application/cdmi-capability", "cdmic": "application/cdmi-container", "cdmid": "application/cdmi-domain", "cdmio": "application/cdmi-object", "cdmiq": "application/cdmi-queue", "cdx": "chemical/x-cdx", "cdxml": "application/vnd.chemdraw+xml", "cdy": "application/vnd.cinderella", "cer": "application/pkix-cert", "cfs": "application/x-cfs-compressed", "cgm": "image/cgm", "chat": "application/x-chat", "chm": "application/vnd.ms-htmlhelp", "chrt": "application/vnd.kde.kchart", "cif": "chemical/x-cif", "cii": "application/vnd.anser-web-certificate-issue-initiation", "cil": "application/vnd.ms-artgalry", "cjs": "application/node", "cla": "application/vnd.claymore", "class": "application/java-vm", "clkk": "application/vnd.crick.clicker.keyboard", "clkp": "application/vnd.crick.clicker.palette", "clkt": "application/vnd.crick.clicker.template", "clkw": "application/vnd.crick.clicker.wordbank", "clkx": "application/vnd.crick.clicker", "clp": "application/x-msclip", "cmc": "application/vnd.cosmocaller", "cmdf": "chemical/x-cmdf", "cml": "chemical/x-cml", "cmp": "application/vnd.yellowriver-custom-menu", "cmx": "image/x-cmx", "cod": "application/vnd.rim.cod", "coffee": "text/coffeescript", "com": "application/x-msdownload", "conf": "text/plain", "cpio": "application/x-cpio", "cpl": "application/cpl+xml", "cpp": "text/x-c", "cpt": "application/mac-compactpro", "crd": "application/x-mscardfile", "crl": "application/pkix-crl", "crt": "application/x-x509-ca-cert", "crx": "application/x-chrome-extension", "cryptonote": "application/vnd.rig.cryptonote", "csh": "application/x-csh", "csl": "application/vnd.citationstyles.style+xml", "csml": "chemical/x-csml", "csp": "application/vnd.commonspace", "css": "text/css", "cst": "application/x-director", "csv": "text/csv", "cu": "application/cu-seeme", "curl": "text/vnd.curl", "cww": "application/prs.cww", "cxt": "application/x-director", "cxx": "text/x-c", "dae": "model/vnd.collada+xml", "daf": "application/vnd.mobius.daf", "dart": "application/vnd.dart", "dataless": "application/vnd.fdsn.seed", "davmount": "application/davmount+xml", "dbf": "application/vnd.dbf", "dbk": "application/docbook+xml", "dcr": "application/x-director", "dcurl": "text/vnd.curl.dcurl", "dd2": "application/vnd.oma.dd2+xml", "ddd": "application/vnd.fujixerox.ddd", "ddf": "application/vnd.syncml.dmddf+xml", "dds": "image/vnd.ms-dds", "deb": "application/x-debian-package", "def": "text/plain", "deploy": "application/octet-stream", "der": "application/x-x509-ca-cert", "dfac": "application/vnd.dreamfactory", "dgc": "application/x-dgc-compressed", "dic": "text/x-c", "dir": "application/x-director", "dis": "application/vnd.mobius.dis", "disposition-notification": "message/disposition-notification", "dist": "application/octet-stream", "distz": "application/octet-stream", "djv": "image/vnd.djvu", "djvu": "image/vnd.djvu", "dll": "application/x-msdownload", "dmg": "application/x-apple-diskimage", "dmp": "application/vnd.tcpdump.pcap", "dms": "application/octet-stream", "dna": "application/vnd.dna", "doc": "application/msword", "docm": "application/vnd.ms-word.document.macroenabled.12", "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "dot": "application/msword", "dotm": "application/vnd.ms-word.template.macroenabled.12", "dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "dp": "application/vnd.osgi.dp", "dpg": "application/vnd.dpgraph", "dra": "audio/vnd.dra", "drle": "image/dicom-rle", "dsc": "text/prs.lines.tag", "dssc": "application/dssc+der", "dtb": "application/x-dtbook+xml", "dtd": "application/xml-dtd", "dts": "audio/vnd.dts", "dtshd": "audio/vnd.dts.hd", "dump": "application/octet-stream", "dvb": "video/vnd.dvb.file", "dvi": "application/x-dvi", "dwd": "application/atsc-dwd+xml", "dwf": "model/vnd.dwf", "dwg": "image/vnd.dwg", "dxf": "image/vnd.dxf", "dxp": "application/vnd.spotfire.dxp", "dxr": "application/x-director", "ear": "application/java-archive", "ecelp4800": "audio/vnd.nuera.ecelp4800", "ecelp7470": "audio/vnd.nuera.ecelp7470", "ecelp9600": "audio/vnd.nuera.ecelp9600", "ecma": "application/ecmascript", "edm": "application/vnd.novadigm.edm", "edx": "application/vnd.novadigm.edx", "efif": "application/vnd.picsel", "ei6": "application/vnd.pg.osasli", "elc": "application/octet-stream", "emf": "image/emf", "eml": "message/rfc822", "emma": "application/emma+xml", "emotionml": "application/emotionml+xml", "emz": "application/x-msmetafile", "eol": "audio/vnd.digital-winds", "eot": "application/vnd.ms-fontobject", "eps": "application/postscript", "epub": "application/epub+zip", "es": "application/ecmascript", "es3": "application/vnd.eszigno3+xml", "esa": "application/vnd.osgi.subsystem", "esf": "application/vnd.epson.esf", "et3": "application/vnd.eszigno3+xml", "etx": "text/x-setext", "eva": "application/x-eva", "evy": "application/x-envoy", "exe": "application/x-msdownload", "exi": "application/exi", "exp": "application/express", "exr": "image/aces", "ext": "application/vnd.novadigm.ext", "ez": "application/andrew-inset", "ez2": "application/vnd.ezpix-album", "ez3": "application/vnd.ezpix-package", "f": "text/x-fortran", "f4v": "video/x-f4v", "f77": "text/x-fortran", "f90": "text/x-fortran", "fbs": "image/vnd.fastbidsheet", "fcdt": "application/vnd.adobe.formscentral.fcdt", "fcs": "application/vnd.isac.fcs", "fdf": "application/vnd.fdf", "fdt": "application/fdt+xml", "fe_launch": "application/vnd.denovo.fcselayout-link", "fg5": "application/vnd.fujitsu.oasysgp", "fgd": "application/x-director", "fh": "image/x-freehand", "fh4": "image/x-freehand", "fh5": "image/x-freehand", "fh7": "image/x-freehand", "fhc": "image/x-freehand", "fig": "application/x-xfig", "fits": "image/fits", "flac": "audio/x-flac", "fli": "video/x-fli", "flo": "application/vnd.micrografx.flo", "flv": "video/x-flv", "flw": "application/vnd.kde.kivio", "flx": "text/vnd.fmi.flexstor", "fly": "text/vnd.fly", "fm": "application/vnd.framemaker", "fnc": "application/vnd.frogans.fnc", "fo": "application/vnd.software602.filler.form+xml", "for": "text/x-fortran", "fpx": "image/vnd.fpx", "frame": "application/vnd.framemaker", "fsc": "application/vnd.fsc.weblaunch", "fst": "image/vnd.fst", "ftc": "application/vnd.fluxtime.clip", "fti": "application/vnd.anser-web-funds-transfer-initiation", "fvt": "video/vnd.fvt", "fxp": "application/vnd.adobe.fxp", "fxpl": "application/vnd.adobe.fxp", "fzs": "application/vnd.fuzzysheet", "g2w": "application/vnd.geoplan", "g3": "image/g3fax", "g3w": "application/vnd.geospace", "gac": "application/vnd.groove-account", "gam": "application/x-tads", "gbr": "application/rpki-ghostbusters", "gca": "application/x-gca-compressed", "gdl": "model/vnd.gdl", "gdoc": "application/vnd.google-apps.document", "ged": "text/vnd.familysearch.gedcom", "geo": "application/vnd.dynageo", "geojson": "application/geo+json", "gex": "application/vnd.geometry-explorer", "ggb": "application/vnd.geogebra.file", "ggt": "application/vnd.geogebra.tool", "ghf": "application/vnd.groove-help", "gif": "image/gif", "gim": "application/vnd.groove-identity-message", "glb": "model/gltf-binary", "gltf": "model/gltf+json", "gml": "application/gml+xml", "gmx": "application/vnd.gmx", "gnumeric": "application/x-gnumeric", "gph": "application/vnd.flographit", "gpx": "application/gpx+xml", "gqf": "application/vnd.grafeq", "gqs": "application/vnd.grafeq", "gram": "application/srgs", "gramps": "application/x-gramps-xml", "gre": "application/vnd.geometry-explorer", "grv": "application/vnd.groove-injector", "grxml": "application/srgs+xml", "gsf": "application/x-font-ghostscript", "gsheet": "application/vnd.google-apps.spreadsheet", "gslides": "application/vnd.google-apps.presentation", "gtar": "application/x-gtar", "gtm": "application/vnd.groove-tool-message", "gtw": "model/vnd.gtw", "gv": "text/vnd.graphviz", "gxf": "application/gxf", "gxt": "application/vnd.geonext", "gz": "application/gzip", "h": "text/x-c", "h261": "video/h261", "h263": "video/h263", "h264": "video/h264", "hal": "application/vnd.hal+xml", "hbci": "application/vnd.hbci", "hbs": "text/x-handlebars-template", "hdd": "application/x-virtualbox-hdd", "hdf": "application/x-hdf", "heic": "image/heic", "heics": "image/heic-sequence", "heif": "image/heif", "heifs": "image/heif-sequence", "hej2": "image/hej2k", "held": "application/atsc-held+xml", "hh": "text/x-c", "hjson": "application/hjson", "hlp": "application/winhlp", "hpgl": "application/vnd.hp-hpgl", "hpid": "application/vnd.hp-hpid", "hps": "application/vnd.hp-hps", "hqx": "application/mac-binhex40", "hsj2": "image/hsj2", "htc": "text/x-component", "htke": "application/vnd.kenameaapp", "htm": "text/html", "html": "text/html", "hvd": "application/vnd.yamaha.hv-dic", "hvp": "application/vnd.yamaha.hv-voice", "hvs": "application/vnd.yamaha.hv-script", "i2g": "application/vnd.intergeo", "icc": "application/vnd.iccprofile", "ice": "x-conference/x-cooltalk", "icm": "application/vnd.iccprofile", "ico": "image/x-icon", "ics": "text/calendar", "ief": "image/ief", "ifb": "text/calendar", "ifm": "application/vnd.shana.informed.formdata", "iges": "model/iges", "igl": "application/vnd.igloader", "igm": "application/vnd.insors.igm", "igs": "model/iges", "igx": "application/vnd.micrografx.igx", "iif": "application/vnd.shana.informed.interchange", "img": "application/octet-stream", "imp": "application/vnd.accpac.simply.imp", "ims": "application/vnd.ms-ims", "in": "text/plain", "ini": "text/plain", "ink": "application/inkml+xml", "inkml": "application/inkml+xml", "install": "application/x-install-instructions", "iota": "application/vnd.astraea-software.iota", "ipfix": "application/ipfix", "ipk": "application/vnd.shana.informed.package", "irm": "application/vnd.ibm.rights-management", "irp": "application/vnd.irepository.package+xml", "iso": "application/x-iso9660-image", "itp": "application/vnd.shana.informed.formtemplate", "its": "application/its+xml", "ivp": "application/vnd.immervision-ivp", "ivu": "application/vnd.immervision-ivu", "jad": "text/vnd.sun.j2me.app-descriptor", "jade": "text/jade", "jam": "application/vnd.jam", "jar": "application/java-archive", "jardiff": "application/x-java-archive-diff", "java": "text/x-java-source", "jhc": "image/jphc", "jisp": "application/vnd.jisp", "jls": "image/jls", "jlt": "application/vnd.hp-jlyt", "jng": "image/x-jng", "jnlp": "application/x-java-jnlp-file", "joda": "application/vnd.joost.joda-archive", "jp2": "image/jp2", "jpe": "image/jpeg", "jpeg": "image/jpeg", "jpf": "image/jpx", "jpg": "image/jpeg", "jpg2": "image/jp2", "jpgm": "video/jpm", "jpgv": "video/jpeg", "jph": "image/jph", "jpm": "video/jpm", "jpx": "image/jpx", "js": "application/javascript", "json": "application/json", "json5": "application/json5", "jsonld": "application/ld+json", "jsonml": "application/jsonml+json", "jsx": "text/jsx", "jxr": "image/jxr", "jxra": "image/jxra", "jxrs": "image/jxrs", "jxs": "image/jxs", "jxsc": "image/jxsc", "jxsi": "image/jxsi", "jxss": "image/jxss", "kar": "audio/midi", "karbon": "application/vnd.kde.karbon", "kdbx": "application/x-keepass2", "key": "application/x-iwork-keynote-sffkey", "kfo": "application/vnd.kde.kformula", "kia": "application/vnd.kidspiration", "kml": "application/vnd.google-earth.kml+xml", "kmz": "application/vnd.google-earth.kmz", "kne": "application/vnd.kinar", "knp": "application/vnd.kinar", "kon": "application/vnd.kde.kontour", "kpr": "application/vnd.kde.kpresenter", "kpt": "application/vnd.kde.kpresenter", "kpxx": "application/vnd.ds-keypoint", "ksp": "application/vnd.kde.kspread", "ktr": "application/vnd.kahootz", "ktx": "image/ktx", "ktx2": "image/ktx2", "ktz": "application/vnd.kahootz", "kwd": "application/vnd.kde.kword", "kwt": "application/vnd.kde.kword", "lasxml": "application/vnd.las.las+xml", "latex": "application/x-latex", "lbd": "application/vnd.llamagraphics.life-balance.desktop", "lbe": "application/vnd.llamagraphics.life-balance.exchange+xml", "les": "application/vnd.hhe.lesson-player", "less": "text/less", "lgr": "application/lgr+xml", "lha": "application/x-lzh-compressed", "link66": "application/vnd.route66.link66+xml", "list": "text/plain", "list3820": "application/vnd.ibm.modcap", "listafp": "application/vnd.ibm.modcap", "litcoffee": "text/coffeescript", "lnk": "application/x-ms-shortcut", "log": "text/plain", "lostxml": "application/lost+xml", "lrf": "application/octet-stream", "lrm": "application/vnd.ms-lrm", "ltf": "application/vnd.frogans.ltf", "lua": "text/x-lua", "luac": "application/x-lua-bytecode", "lvp": "audio/vnd.lucent.voice", "lwp": "application/vnd.lotus-wordpro", "lzh": "application/x-lzh-compressed", "m13": "application/x-msmediaview", "m14": "application/x-msmediaview", "m1v": "video/mpeg", "m21": "application/mp21", "m2a": "audio/mpeg", "m2v": "video/mpeg", "m3a": "audio/mpeg", "m3u": "audio/x-mpegurl", "m3u8": "application/vnd.apple.mpegurl", "m4a": "audio/x-m4a", "m4p": "application/mp4", "m4s": "video/iso.segment", "m4u": "video/vnd.mpegurl", "m4v": "video/x-m4v", "ma": "application/mathematica", "mads": "application/mads+xml", "maei": "application/mmt-aei+xml", "mag": "application/vnd.ecowin.chart", "maker": "application/vnd.framemaker", "man": "text/troff", "manifest": "text/cache-manifest", "map": "application/json", "mar": "application/octet-stream", "markdown": "text/markdown", "mathml": "application/mathml+xml", "mb": "application/mathematica", "mbk": "application/vnd.mobius.mbk", "mbox": "application/mbox", "mc1": "application/vnd.medcalcdata", "mcd": "application/vnd.mcd", "mcurl": "text/vnd.curl.mcurl", "md": "text/markdown", "mdb": "application/x-msaccess", "mdi": "image/vnd.ms-modi", "mdx": "text/mdx", "me": "text/troff", "mesh": "model/mesh", "meta4": "application/metalink4+xml", "metalink": "application/metalink+xml", "mets": "application/mets+xml", "mfm": "application/vnd.mfmp", "mft": "application/rpki-manifest", "mgp": "application/vnd.osgeo.mapguide.package", "mgz": "application/vnd.proteus.magazine", "mid": "audio/midi", "midi": "audio/midi", "mie": "application/x-mie", "mif": "application/vnd.mif", "mime": "message/rfc822", "mj2": "video/mj2", "mjp2": "video/mj2", "mjs": "application/javascript", "mk3d": "video/x-matroska", "mka": "audio/x-matroska", "mkd": "text/x-markdown", "mks": "video/x-matroska", "mkv": "video/x-matroska", "mlp": "application/vnd.dolby.mlp", "mmd": "application/vnd.chipnuts.karaoke-mmd", "mmf": "application/vnd.smaf", "mml": "text/mathml", "mmr": "image/vnd.fujixerox.edmics-mmr", "mng": "video/x-mng", "mny": "application/x-msmoney", "mobi": "application/x-mobipocket-ebook", "mods": "application/mods+xml", "mov": "video/quicktime", "movie": "video/x-sgi-movie", "mp2": "audio/mpeg", "mp21": "application/mp21", "mp2a": "audio/mpeg", "mp3": "audio/mpeg", "mp4": "video/mp4", "mp4a": "audio/mp4", "mp4s": "application/mp4", "mp4v": "video/mp4", "mpc": "application/vnd.mophun.certificate", "mpd": "application/dash+xml", "mpe": "video/mpeg", "mpeg": "video/mpeg", "mpf": "application/media-policy-dataset+xml", "mpg": "video/mpeg", "mpg4": "video/mp4", "mpga": "audio/mpeg", "mpkg": "application/vnd.apple.installer+xml", "mpm": "application/vnd.blueice.multipass", "mpn": "application/vnd.mophun.application", "mpp": "application/vnd.ms-project", "mpt": "application/vnd.ms-project", "mpy": "application/vnd.ibm.minipay", "mqy": "application/vnd.mobius.mqy", "mrc": "application/marc", "mrcx": "application/marcxml+xml", "ms": "text/troff", "mscml": "application/mediaservercontrol+xml", "mseed": "application/vnd.fdsn.mseed", "mseq": "application/vnd.mseq", "msf": "application/vnd.epson.msf", "msg": "application/vnd.ms-outlook", "msh": "model/mesh", "msi": "application/x-msdownload", "msl": "application/vnd.mobius.msl", "msm": "application/octet-stream", "msp": "application/octet-stream", "msty": "application/vnd.muvee.style", "mtl": "model/mtl", "mts": "model/vnd.mts", "mus": "application/vnd.musician", "musd": "application/mmt-usd+xml", "musicxml": "application/vnd.recordare.musicxml+xml", "mvb": "application/x-msmediaview", "mvt": "application/vnd.mapbox-vector-tile", "mwf": "application/vnd.mfer", "mxf": "application/mxf", "mxl": "application/vnd.recordare.musicxml", "mxmf": "audio/mobile-xmf", "mxml": "application/xv+xml", "mxs": "application/vnd.triscape.mxs", "mxu": "video/vnd.mpegurl", "n-gage": "application/vnd.nokia.n-gage.symbian.install", "n3": "text/n3", "nb": "application/mathematica", "nbp": "application/vnd.wolfram.player", "nc": "application/x-netcdf", "ncx": "application/x-dtbncx+xml", "nfo": "text/x-nfo", "ngdat": "application/vnd.nokia.n-gage.data", "nitf": "application/vnd.nitf", "nlu": "application/vnd.neurolanguage.nlu", "nml": "application/vnd.enliven", "nnd": "application/vnd.noblenet-directory", "nns": "application/vnd.noblenet-sealer", "nnw": "application/vnd.noblenet-web", "npx": "image/vnd.net-fpx", "nq": "application/n-quads", "nsc": "application/x-conference", "nsf": "application/vnd.lotus-notes", "nt": "application/n-triples", "ntf": "application/vnd.nitf", "numbers": "application/x-iwork-numbers-sffnumbers", "nzb": "application/x-nzb", "oa2": "application/vnd.fujitsu.oasys2", "oa3": "application/vnd.fujitsu.oasys3", "oas": "application/vnd.fujitsu.oasys", "obd": "application/x-msbinder", "obgx": "application/vnd.openblox.game+xml", "obj": "model/obj", "oda": "application/oda", "odb": "application/vnd.oasis.opendocument.database", "odc": "application/vnd.oasis.opendocument.chart", "odf": "application/vnd.oasis.opendocument.formula", "odft": "application/vnd.oasis.opendocument.formula-template", "odg": "application/vnd.oasis.opendocument.graphics", "odi": "application/vnd.oasis.opendocument.image", "odm": "application/vnd.oasis.opendocument.text-master", "odp": "application/vnd.oasis.opendocument.presentation", "ods": "application/vnd.oasis.opendocument.spreadsheet", "odt": "application/vnd.oasis.opendocument.text", "oga": "audio/ogg", "ogex": "model/vnd.opengex", "ogg": "audio/ogg", "ogv": "video/ogg", "ogx": "application/ogg", "omdoc": "application/omdoc+xml", "onepkg": "application/onenote", "onetmp": "application/onenote", "onetoc": "application/onenote", "onetoc2": "application/onenote", "opf": "application/oebps-package+xml", "opml": "text/x-opml", "oprc": "application/vnd.palm", "opus": "audio/ogg", "org": "text/x-org", "osf": "application/vnd.yamaha.openscoreformat", "osfpvg": "application/vnd.yamaha.openscoreformat.osfpvg+xml", "osm": "application/vnd.openstreetmap.data+xml", "otc": "application/vnd.oasis.opendocument.chart-template", "otf": "font/otf", "otg": "application/vnd.oasis.opendocument.graphics-template", "oth": "application/vnd.oasis.opendocument.text-web", "oti": "application/vnd.oasis.opendocument.image-template", "otp": "application/vnd.oasis.opendocument.presentation-template", "ots": "application/vnd.oasis.opendocument.spreadsheet-template", "ott": "application/vnd.oasis.opendocument.text-template", "ova": "application/x-virtualbox-ova", "ovf": "application/x-virtualbox-ovf", "owl": "application/rdf+xml", "oxps": "application/oxps", "oxt": "application/vnd.openofficeorg.extension", "p": "text/x-pascal", "p10": "application/pkcs10", "p12": "application/x-pkcs12", "p7b": "application/x-pkcs7-certificates", "p7c": "application/pkcs7-mime", "p7m": "application/pkcs7-mime", "p7r": "application/x-pkcs7-certreqresp", "p7s": "application/pkcs7-signature", "p8": "application/pkcs8", "pac": "application/x-ns-proxy-autoconfig", "pages": "application/x-iwork-pages-sffpages", "pas": "text/x-pascal", "paw": "application/vnd.pawaafile", "pbd": "application/vnd.powerbuilder6", "pbm": "image/x-portable-bitmap", "pcap": "application/vnd.tcpdump.pcap", "pcf": "application/x-font-pcf", "pcl": "application/vnd.hp-pcl", "pclxl": "application/vnd.hp-pclxl", "pct": "image/x-pict", "pcurl": "application/vnd.curl.pcurl", "pcx": "image/x-pcx", "pdb": "application/x-pilot", "pde": "text/x-processing", "pdf": "application/pdf", "pem": "application/x-x509-ca-cert", "pfa": "application/x-font-type1", "pfb": "application/x-font-type1", "pfm": "application/x-font-type1", "pfr": "application/font-tdpfr", "pfx": "application/x-pkcs12", "pgm": "image/x-portable-graymap", "pgn": "application/x-chess-pgn", "pgp": "application/pgp-encrypted", "php": "application/x-httpd-php", "pic": "image/x-pict", "pkg": "application/octet-stream", "pki": "application/pkixcmp", "pkipath": "application/pkix-pkipath", "pkpass": "application/vnd.apple.pkpass", "pl": "application/x-perl", "plb": "application/vnd.3gpp.pic-bw-large", "plc": "application/vnd.mobius.plc", "plf": "application/vnd.pocketlearn", "pls": "application/pls+xml", "pm": "application/x-perl", "pml": "application/vnd.ctc-posml", "png": "image/png", "pnm": "image/x-portable-anymap", "portpkg": "application/vnd.macports.portpkg", "pot": "application/vnd.ms-powerpoint", "potm": "application/vnd.ms-powerpoint.template.macroenabled.12", "potx": "application/vnd.openxmlformats-officedocument.presentationml.template", "ppam": "application/vnd.ms-powerpoint.addin.macroenabled.12", "ppd": "application/vnd.cups-ppd", "ppm": "image/x-portable-pixmap", "pps": "application/vnd.ms-powerpoint", "ppsm": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "ppt": "application/vnd.ms-powerpoint", "pptm": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "pqa": "application/vnd.palm", "prc": "application/x-pilot", "pre": "application/vnd.lotus-freelance", "prf": "application/pics-rules", "provx": "application/provenance+xml", "ps": "application/postscript", "psb": "application/vnd.3gpp.pic-bw-small", "psd": "image/vnd.adobe.photoshop", "psf": "application/x-font-linux-psf", "pskcxml": "application/pskc+xml", "pti": "image/prs.pti", "ptid": "application/vnd.pvi.ptid1", "pub": "application/x-mspublisher", "pvb": "application/vnd.3gpp.pic-bw-var", "pwn": "application/vnd.3m.post-it-notes", "pya": "audio/vnd.ms-playready.media.pya", "pyv": "video/vnd.ms-playready.media.pyv", "qam": "application/vnd.epson.quickanime", "qbo": "application/vnd.intu.qbo", "qfx": "application/vnd.intu.qfx", "qps": "application/vnd.publishare-delta-tree", "qt": "video/quicktime", "qwd": "application/vnd.quark.quarkxpress", "qwt": "application/vnd.quark.quarkxpress", "qxb": "application/vnd.quark.quarkxpress", "qxd": "application/vnd.quark.quarkxpress", "qxl": "application/vnd.quark.quarkxpress", "qxt": "application/vnd.quark.quarkxpress", "ra": "audio/x-realaudio", "ram": "audio/x-pn-realaudio", "raml": "application/raml+yaml", "rapd": "application/route-apd+xml", "rar": "application/x-rar-compressed", "ras": "image/x-cmu-raster", "rcprofile": "application/vnd.ipunplugged.rcprofile", "rdf": "application/rdf+xml", "rdz": "application/vnd.data-vision.rdz", "relo": "application/p2p-overlay+xml", "rep": "application/vnd.businessobjects", "res": "application/x-dtbresource+xml", "rgb": "image/x-rgb", "rif": "application/reginfo+xml", "rip": "audio/vnd.rip", "ris": "application/x-research-info-systems", "rl": "application/resource-lists+xml", "rlc": "image/vnd.fujixerox.edmics-rlc", "rld": "application/resource-lists-diff+xml", "rm": "application/vnd.rn-realmedia", "rmi": "audio/midi", "rmp": "audio/x-pn-realaudio-plugin", "rms": "application/vnd.jcp.javame.midlet-rms", "rmvb": "application/vnd.rn-realmedia-vbr", "rnc": "application/relax-ng-compact-syntax", "rng": "application/xml", "roa": "application/rpki-roa", "roff": "text/troff", "rp9": "application/vnd.cloanto.rp9", "rpm": "application/x-redhat-package-manager", "rpss": "application/vnd.nokia.radio-presets", "rpst": "application/vnd.nokia.radio-preset", "rq": "application/sparql-query", "rs": "application/rls-services+xml", "rsat": "application/atsc-rsat+xml", "rsd": "application/rsd+xml", "rsheet": "application/urc-ressheet+xml", "rss": "application/rss+xml", "rtf": "text/rtf", "rtx": "text/richtext", "run": "application/x-makeself", "rusd": "application/route-usd+xml", "s": "text/x-asm", "s3m": "audio/s3m", "saf": "application/vnd.yamaha.smaf-audio", "sass": "text/x-sass", "sbml": "application/sbml+xml", "sc": "application/vnd.ibm.secure-container", "scd": "application/x-msschedule", "scm": "application/vnd.lotus-screencam", "scq": "application/scvp-cv-request", "scs": "application/scvp-cv-response", "scss": "text/x-scss", "scurl": "text/vnd.curl.scurl", "sda": "application/vnd.stardivision.draw", "sdc": "application/vnd.stardivision.calc", "sdd": "application/vnd.stardivision.impress", "sdkd": "application/vnd.solent.sdkm+xml", "sdkm": "application/vnd.solent.sdkm+xml", "sdp": "application/sdp", "sdw": "application/vnd.stardivision.writer", "sea": "application/x-sea", "see": "application/vnd.seemail", "seed": "application/vnd.fdsn.seed", "sema": "application/vnd.sema", "semd": "application/vnd.semd", "semf": "application/vnd.semf", "senmlx": "application/senml+xml", "sensmlx": "application/sensml+xml", "ser": "application/java-serialized-object", "setpay": "application/set-payment-initiation", "setreg": "application/set-registration-initiation", "sfd-hdstx": "application/vnd.hydrostatix.sof-data", "sfs": "application/vnd.spotfire.sfs", "sfv": "text/x-sfv", "sgi": "image/sgi", "sgl": "application/vnd.stardivision.writer-global", "sgm": "text/sgml", "sgml": "text/sgml", "sh": "application/x-sh", "shar": "application/x-shar", "shex": "text/shex", "shf": "application/shf+xml", "shtml": "text/html", "sid": "image/x-mrsid-image", "sieve": "application/sieve", "sig": "application/pgp-signature", "sil": "audio/silk", "silo": "model/mesh", "sis": "application/vnd.symbian.install", "sisx": "application/vnd.symbian.install", "sit": "application/x-stuffit", "sitx": "application/x-stuffitx", "siv": "application/sieve", "skd": "application/vnd.koan", "skm": "application/vnd.koan", "skp": "application/vnd.koan", "skt": "application/vnd.koan", "sldm": "application/vnd.ms-powerpoint.slide.macroenabled.12", "sldx": "application/vnd.openxmlformats-officedocument.presentationml.slide", "slim": "text/slim", "slm": "text/slim", "sls": "application/route-s-tsid+xml", "slt": "application/vnd.epson.salt", "sm": "application/vnd.stepmania.stepchart", "smf": "application/vnd.stardivision.math", "smi": "application/smil+xml", "smil": "application/smil+xml", "smv": "video/x-smv", "smzip": "application/vnd.stepmania.package", "snd": "audio/basic", "snf": "application/x-font-snf", "so": "application/octet-stream", "spc": "application/x-pkcs7-certificates", "spdx": "text/spdx", "spf": "application/vnd.yamaha.smaf-phrase", "spl": "application/x-futuresplash", "spot": "text/vnd.in3d.spot", "spp": "application/scvp-vp-response", "spq": "application/scvp-vp-request", "spx": "audio/ogg", "sql": "application/x-sql", "src": "application/x-wais-source", "srt": "application/x-subrip", "sru": "application/sru+xml", "srx": "application/sparql-results+xml", "ssdl": "application/ssdl+xml", "sse": "application/vnd.kodak-descriptor", "ssf": "application/vnd.epson.ssf", "ssml": "application/ssml+xml", "st": "application/vnd.sailingtracker.track", "stc": "application/vnd.sun.xml.calc.template", "std": "application/vnd.sun.xml.draw.template", "stf": "application/vnd.wt.stf", "sti": "application/vnd.sun.xml.impress.template", "stk": "application/hyperstudio", "stl": "model/stl", "stpx": "model/step+xml", "stpxz": "model/step-xml+zip", "stpz": "model/step+zip", "str": "application/vnd.pg.format", "stw": "application/vnd.sun.xml.writer.template", "styl": "text/stylus", "stylus": "text/stylus", "sub": "text/vnd.dvb.subtitle", "sus": "application/vnd.sus-calendar", "susp": "application/vnd.sus-calendar", "sv4cpio": "application/x-sv4cpio", "sv4crc": "application/x-sv4crc", "svc": "application/vnd.dvb.service", "svd": "application/vnd.svd", "svg": "image/svg+xml", "svgz": "image/svg+xml", "swa": "application/x-director", "swf": "application/x-shockwave-flash", "swi": "application/vnd.aristanetworks.swi", "swidtag": "application/swid+xml", "sxc": "application/vnd.sun.xml.calc", "sxd": "application/vnd.sun.xml.draw", "sxg": "application/vnd.sun.xml.writer.global", "sxi": "application/vnd.sun.xml.impress", "sxm": "application/vnd.sun.xml.math", "sxw": "application/vnd.sun.xml.writer", "t": "text/troff", "t3": "application/x-t3vm-image", "t38": "image/t38", "taglet": "application/vnd.mynfc", "tao": "application/vnd.tao.intent-module-archive", "tap": "image/vnd.tencent.tap", "tar": "application/x-tar", "tcap": "application/vnd.3gpp2.tcap", "tcl": "application/x-tcl", "td": "application/urc-targetdesc+xml", "teacher": "application/vnd.smart.teacher", "tei": "application/tei+xml", "teicorpus": "application/tei+xml", "tex": "application/x-tex", "texi": "application/x-texinfo", "texinfo": "application/x-texinfo", "text": "text/plain", "tfi": "application/thraud+xml", "tfm": "application/x-tex-tfm", "tfx": "image/tiff-fx", "tga": "image/x-tga", "thmx": "application/vnd.ms-officetheme", "tif": "image/tiff", "tiff": "image/tiff", "tk": "application/x-tcl", "tmo": "application/vnd.tmobile-livetv", "toml": "application/toml", "torrent": "application/x-bittorrent", "tpl": "application/vnd.groove-tool-template", "tpt": "application/vnd.trid.tpt", "tr": "text/troff", "tra": "application/vnd.trueapp", "trig": "application/trig", "trm": "application/x-msterminal", "ts": "video/mp2t", "tsd": "application/timestamped-data", "tsv": "text/tab-separated-values", "ttc": "font/collection", "ttf": "font/ttf", "ttl": "text/turtle", "ttml": "application/ttml+xml", "twd": "application/vnd.simtech-mindmapper", "twds": "application/vnd.simtech-mindmapper", "txd": "application/vnd.genomatix.tuxedo", "txf": "application/vnd.mobius.txf", "txt": "text/plain", "u32": "application/x-authorware-bin", "u8dsn": "message/global-delivery-status", "u8hdr": "message/global-headers", "u8mdn": "message/global-disposition-notification", "u8msg": "message/global", "ubj": "application/ubjson", "udeb": "application/x-debian-package", "ufd": "application/vnd.ufdl", "ufdl": "application/vnd.ufdl", "ulx": "application/x-glulx", "umj": "application/vnd.umajin", "unityweb": "application/vnd.unity", "uoml": "application/vnd.uoml+xml", "uri": "text/uri-list", "uris": "text/uri-list", "urls": "text/uri-list", "usdz": "model/vnd.usdz+zip", "ustar": "application/x-ustar", "utz": "application/vnd.uiq.theme", "uu": "text/x-uuencode", "uva": "audio/vnd.dece.audio", "uvd": "application/vnd.dece.data", "uvf": "application/vnd.dece.data", "uvg": "image/vnd.dece.graphic", "uvh": "video/vnd.dece.hd", "uvi": "image/vnd.dece.graphic", "uvm": "video/vnd.dece.mobile", "uvp": "video/vnd.dece.pd", "uvs": "video/vnd.dece.sd", "uvt": "application/vnd.dece.ttml+xml", "uvu": "video/vnd.uvvu.mp4", "uvv": "video/vnd.dece.video", "uvva": "audio/vnd.dece.audio", "uvvd": "application/vnd.dece.data", "uvvf": "application/vnd.dece.data", "uvvg": "image/vnd.dece.graphic", "uvvh": "video/vnd.dece.hd", "uvvi": "image/vnd.dece.graphic", "uvvm": "video/vnd.dece.mobile", "uvvp": "video/vnd.dece.pd", "uvvs": "video/vnd.dece.sd", "uvvt": "application/vnd.dece.ttml+xml", "uvvu": "video/vnd.uvvu.mp4", "uvvv": "video/vnd.dece.video", "uvvx": "application/vnd.dece.unspecified", "uvvz": "application/vnd.dece.zip", "uvx": "application/vnd.dece.unspecified", "uvz": "application/vnd.dece.zip", "vbox": "application/x-virtualbox-vbox", "vbox-extpack": "application/x-virtualbox-vbox-extpack", "vcard": "text/vcard", "vcd": "application/x-cdlink", "vcf": "text/x-vcard", "vcg": "application/vnd.groove-vcard", "vcs": "text/x-vcalendar", "vcx": "application/vnd.vcx", "vdi": "application/x-virtualbox-vdi", "vds": "model/vnd.sap.vds", "vhd": "application/x-virtualbox-vhd", "vis": "application/vnd.visionary", "viv": "video/vnd.vivo", "vmdk": "application/x-virtualbox-vmdk", "vob": "video/x-ms-vob", "vor": "application/vnd.stardivision.writer", "vox": "application/x-authorware-bin", "vrml": "model/vrml", "vsd": "application/vnd.visio", "vsf": "application/vnd.vsf", "vss": "application/vnd.visio", "vst": "application/vnd.visio", "vsw": "application/vnd.visio", "vtf": "image/vnd.valve.source.texture", "vtt": "text/vtt", "vtu": "model/vnd.vtu", "vxml": "application/voicexml+xml", "w3d": "application/x-director", "wad": "application/x-doom", "wadl": "application/vnd.sun.wadl+xml", "war": "application/java-archive", "wasm": "application/wasm", "wav": "audio/x-wav", "wax": "audio/x-ms-wax", "wbmp": "image/vnd.wap.wbmp", "wbs": "application/vnd.criticaltools.wbs+xml", "wbxml": "application/vnd.wap.wbxml", "wcm": "application/vnd.ms-works", "wdb": "application/vnd.ms-works", "wdp": "image/vnd.ms-photo", "weba": "audio/webm", "webapp": "application/x-web-app-manifest+json", "webm": "video/webm", "webmanifest": "application/manifest+json", "webp": "image/webp", "wg": "application/vnd.pmi.widget", "wgt": "application/widget", "wif": "application/watcherinfo+xml", "wks": "application/vnd.ms-works", "wm": "video/x-ms-wm", "wma": "audio/x-ms-wma", "wmd": "application/x-ms-wmd", "wmf": "image/wmf", "wml": "text/vnd.wap.wml", "wmlc": "application/vnd.wap.wmlc", "wmls": "text/vnd.wap.wmlscript", "wmlsc": "application/vnd.wap.wmlscriptc", "wmv": "video/x-ms-wmv", "wmx": "video/x-ms-wmx", "wmz": "application/x-msmetafile", "woff": "font/woff", "woff2": "font/woff2", "wpd": "application/vnd.wordperfect", "wpl": "application/vnd.ms-wpl", "wps": "application/vnd.ms-works", "wqd": "application/vnd.wqd", "wri": "application/x-mswrite", "wrl": "model/vrml", "wsc": "message/vnd.wfa.wsc", "wsdl": "application/wsdl+xml", "wspolicy": "application/wspolicy+xml", "wtb": "application/vnd.webturbo", "wvx": "video/x-ms-wvx", "x32": "application/x-authorware-bin", "x3d": "model/x3d+xml", "x3db": "model/x3d+fastinfoset", "x3dbz": "model/x3d+binary", "x3dv": "model/x3d-vrml", "x3dvz": "model/x3d+vrml", "x3dz": "model/x3d+xml", "x_b": "model/vnd.parasolid.transmit.binary", "x_t": "model/vnd.parasolid.transmit.text", "xaml": "application/xaml+xml", "xap": "application/x-silverlight-app", "xar": "application/vnd.xara", "xav": "application/xcap-att+xml", "xbap": "application/x-ms-xbap", "xbd": "application/vnd.fujixerox.docuworks.binder", "xbm": "image/x-xbitmap", "xca": "application/xcap-caps+xml", "xcs": "application/calendar+xml", "xdf": "application/xcap-diff+xml", "xdm": "application/vnd.syncml.dm+xml", "xdp": "application/vnd.adobe.xdp+xml", "xdssc": "application/dssc+xml", "xdw": "application/vnd.fujixerox.docuworks", "xel": "application/xcap-el+xml", "xenc": "application/xenc+xml", "xer": "application/patch-ops-error+xml", "xfdf": "application/vnd.adobe.xfdf", "xfdl": "application/vnd.xfdl", "xht": "application/xhtml+xml", "xhtml": "application/xhtml+xml", "xhvml": "application/xv+xml", "xif": "image/vnd.xiff", "xla": "application/vnd.ms-excel", "xlam": "application/vnd.ms-excel.addin.macroenabled.12", "xlc": "application/vnd.ms-excel", "xlf": "application/xliff+xml", "xlm": "application/vnd.ms-excel", "xls": "application/vnd.ms-excel", "xlsb": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "xlsm": "application/vnd.ms-excel.sheet.macroenabled.12", "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlt": "application/vnd.ms-excel", "xltm": "application/vnd.ms-excel.template.macroenabled.12", "xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "xlw": "application/vnd.ms-excel", "xm": "audio/xm", "xml": "text/xml", "xns": "application/xcap-ns+xml", "xo": "application/vnd.olpc-sugar", "xop": "application/xop+xml", "xpi": "application/x-xpinstall", "xpl": "application/xproc+xml", "xpm": "image/x-xpixmap", "xpr": "application/vnd.is-xpr", "xps": "application/vnd.ms-xpsdocument", "xpw": "application/vnd.intercon.formnet", "xpx": "application/vnd.intercon.formnet", "xsd": "application/xml", "xsl": "application/xslt+xml", "xslt": "application/xslt+xml", "xsm": "application/vnd.syncml+xml", "xspf": "application/xspf+xml", "xul": "application/vnd.mozilla.xul+xml", "xvm": "application/xv+xml", "xvml": "application/xv+xml", "xwd": "image/x-xwindowdump", "xyz": "chemical/x-xyz", "xz": "application/x-xz", "yaml": "text/yaml", "yang": "application/yang", "yin": "application/yin+xml", "yml": "text/yaml", "ymp": "text/x-suse-ymp", "z1": "application/x-zmachine", "z2": "application/x-zmachine", "z3": "application/x-zmachine", "z4": "application/x-zmachine", "z5": "application/x-zmachine", "z6": "application/x-zmachine", "z7": "application/x-zmachine", "z8": "application/x-zmachine", "zaz": "application/vnd.zzazz.deck+xml", "zip": "application/zip", "zir": "application/vnd.zul", "zirz": "application/vnd.zul", "zmm": "application/vnd.handheld-entertainment+xml" };
- // build/dev-server/dev-server-utils.js
- function responseHeaders(headers, httpCache = false) {
- headers = { ...DEFAULT_HEADERS, ...headers };
- if (httpCache) {
- headers["cache-control"] = "max-age=3600";
- delete headers["date"];
- delete headers["expires"];
- }
- return headers;
- }
- var DEFAULT_HEADERS = {
- "cache-control": "no-cache, no-store, must-revalidate, max-age=0",
- expires: "0",
- date: "Wed, 1 Jan 2000 00:00:00 GMT",
- server: "Stencil Dev Server " + version,
- "access-control-allow-origin": "*",
- "access-control-expose-headers": "*"
- };
- function getBrowserUrl(protocol, address, port, basePath, pathname) {
- address = address === `0.0.0.0` ? `localhost` : address;
- const portSuffix = !port || port === 80 || port === 443 ? "" : ":" + port;
- let path11 = basePath;
- if (pathname.startsWith("/")) {
- pathname = pathname.substring(1);
- }
- path11 += pathname;
- protocol = protocol.replace(/\:/g, "");
- return `${protocol}://${address}${portSuffix}${path11}`;
- }
- function getDevServerClientUrl(devServerConfig, host, protocol) {
- let address = devServerConfig.address;
- let port = devServerConfig.port;
- if (host) {
- address = host;
- port = null;
- }
- return getBrowserUrl(protocol !== null && protocol !== void 0 ? protocol : devServerConfig.protocol, address, port, devServerConfig.basePath, DEV_SERVER_URL);
- }
- function getContentType(filePath2) {
- const last = filePath2.replace(/^.*[/\\]/, "").toLowerCase();
- const ext = last.replace(/^.*\./, "").toLowerCase();
- const hasPath = last.length < filePath2.length;
- const hasDot = ext.length < last.length - 1;
- return (hasDot || !hasPath) && content_types_db_default[ext] || "application/octet-stream";
- }
- function isHtmlFile(filePath2) {
- filePath2 = filePath2.toLowerCase().trim();
- return filePath2.endsWith(".html") || filePath2.endsWith(".htm");
- }
- function isCssFile(filePath2) {
- filePath2 = filePath2.toLowerCase().trim();
- return filePath2.endsWith(".css");
- }
- var TXT_EXT = ["css", "html", "htm", "js", "json", "svg", "xml"];
- function isSimpleText(filePath2) {
- const ext = filePath2.toLowerCase().trim().split(".").pop();
- return TXT_EXT.includes(ext);
- }
- function isExtensionLessPath(pathname) {
- const parts = pathname.split("/");
- const lastPart = parts[parts.length - 1];
- return !lastPart.includes(".");
- }
- function isSsrStaticDataPath(pathname) {
- const parts = pathname.split("/");
- const fileName = parts[parts.length - 1].split("?")[0];
- return fileName === "page.state.json";
- }
- function getSsrStaticDataPath(req) {
- const parts = req.url.href.split("/");
- const fileName = parts[parts.length - 1];
- const fileNameParts = fileName.split("?");
- parts.pop();
- let ssrPath = new URL(parts.join("/")).href;
- if (!ssrPath.endsWith("/") && req.headers) {
- const h = new Headers(req.headers);
- if (h.get("referer").endsWith("/")) {
- ssrPath += "/";
- }
- }
- return {
- ssrPath,
- fileName: fileNameParts[0],
- hasQueryString: typeof fileNameParts[1] === "string" && fileNameParts[1].length > 0
- };
- }
- function isDevClient(pathname) {
- return pathname.startsWith(DEV_SERVER_URL);
- }
- function isDevModule(pathname) {
- return pathname.includes(DEV_MODULE_URL);
- }
- function isOpenInEditor(pathname) {
- return pathname === OPEN_IN_EDITOR_URL;
- }
- function isInitialDevServerLoad(pathname) {
- return pathname === DEV_SERVER_INIT_URL;
- }
- function isDevServerClient(pathname) {
- return pathname === DEV_SERVER_URL;
- }
- function shouldCompress(devServerConfig, req) {
- if (!devServerConfig.gzip) {
- return false;
- }
- if (req.method !== "GET") {
- return false;
- }
- const acceptEncoding = req.headers && req.headers["accept-encoding"];
- if (typeof acceptEncoding !== "string") {
- return false;
- }
- if (!acceptEncoding.includes("gzip")) {
- return false;
- }
- return true;
- }
- // node_modules/open/index.js
- var import_node_process6 = __toESM(require("process"), 1);
- var import_node_buffer3 = require("buffer");
- var import_node_path3 = __toESM(require("path"), 1);
- var import_node_url2 = require("url");
- var import_node_child_process4 = __toESM(require("child_process"), 1);
- var import_promises = __toESM(require("fs/promises"), 1);
- var import_node_fs5 = require("fs");
- var import_is_wsl = __toESM(require_is_wsl(), 1);
- // node_modules/define-lazy-prop/index.js
- function defineLazyProperty(object, propertyName, valueGetter) {
- const define2 = (value) => Object.defineProperty(object, propertyName, { value, enumerable: true, writable: true });
- Object.defineProperty(object, propertyName, {
- configurable: true,
- enumerable: true,
- get() {
- const result = valueGetter();
- define2(result);
- return result;
- },
- set(value) {
- define2(value);
- }
- });
- return object;
- }
- // node_modules/default-browser/index.js
- var import_node_process5 = __toESM(require("process"), 1);
- // node_modules/default-browser-id/index.js
- var import_os = __toESM(require("os"), 1);
- var import_fs = require("fs");
- var import_bplist_parser = __toESM(require_bplistParser(), 1);
- var import_untildify = __toESM(require_untildify(), 1);
- var macOsVersion = Number(import_os.default.release().split(".")[0]);
- var filePath = (0, import_untildify.default)(macOsVersion >= 14 ? "~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist" : "~/Library/Preferences/com.apple.LaunchServices.plist");
- async function defaultBrowserId() {
- if (process.platform !== "darwin") {
- throw new Error("macOS only");
- }
- let bundleId = "com.apple.Safari";
- let buffer;
- try {
- buffer = await import_fs.promises.readFile(filePath);
- } catch (error) {
- if (error.code === "ENOENT") {
- return bundleId;
- }
- throw error;
- }
- const data = import_bplist_parser.default.parseBuffer(buffer);
- const handlers = data && data[0].LSHandlers;
- if (!handlers || handlers.length === 0) {
- return bundleId;
- }
- for (const handler of handlers) {
- if (handler.LSHandlerURLScheme === "http" && handler.LSHandlerRoleAll) {
- bundleId = handler.LSHandlerRoleAll;
- break;
- }
- }
- return bundleId;
- }
- // node_modules/run-applescript/index.js
- var import_execa = __toESM(require_execa(), 1);
- async function runAppleScriptAsync(script) {
- if (process.platform !== "darwin") {
- throw new Error("macOS only");
- }
- const { stdout } = await (0, import_execa.default)("osascript", ["-e", script]);
- return stdout;
- }
- // node_modules/bundle-name/index.js
- async function bundleName(bundleId) {
- return runAppleScriptAsync(`tell application "Finder" to set app_path to application file id "${bundleId}" as string
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
- }
- // node_modules/titleize/index.js
- function titleize(string) {
- if (typeof string !== "string") {
- throw new TypeError("Expected a string");
- }
- return string.toLowerCase().replace(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
- }
- // node_modules/default-browser/node_modules/execa/index.js
- var import_node_buffer2 = require("buffer");
- var import_node_path2 = __toESM(require("path"), 1);
- var import_node_child_process3 = __toESM(require("child_process"), 1);
- var import_node_process4 = __toESM(require("process"), 1);
- var import_cross_spawn = __toESM(require_cross_spawn(), 1);
- // node_modules/strip-final-newline/index.js
- function stripFinalNewline(input) {
- const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
- const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
- if (input[input.length - 1] === LF) {
- input = input.slice(0, -1);
- }
- if (input[input.length - 1] === CR) {
- input = input.slice(0, -1);
- }
- return input;
- }
- // node_modules/npm-run-path/index.js
- var import_node_process = __toESM(require("process"), 1);
- var import_node_path = __toESM(require("path"), 1);
- var import_node_url = require("url");
- // node_modules/npm-run-path/node_modules/path-key/index.js
- function pathKey(options = {}) {
- const {
- env = process.env,
- platform: platform2 = process.platform
- } = options;
- if (platform2 !== "win32") {
- return "PATH";
- }
- return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
- }
- // node_modules/npm-run-path/index.js
- var npmRunPath = ({
- cwd = import_node_process.default.cwd(),
- path: pathOption = import_node_process.default.env[pathKey()],
- preferLocal = true,
- execPath = import_node_process.default.execPath,
- addExecPath = true
- } = {}) => {
- const cwdString = cwd instanceof URL ? (0, import_node_url.fileURLToPath)(cwd) : cwd;
- const cwdPath = import_node_path.default.resolve(cwdString);
- const result = [];
- if (preferLocal) {
- applyPreferLocal(result, cwdPath);
- }
- if (addExecPath) {
- applyExecPath(result, execPath, cwdPath);
- }
- return [...result, pathOption].join(import_node_path.default.delimiter);
- };
- var applyPreferLocal = (result, cwdPath) => {
- let previous;
- while (previous !== cwdPath) {
- result.push(import_node_path.default.join(cwdPath, "node_modules/.bin"));
- previous = cwdPath;
- cwdPath = import_node_path.default.resolve(cwdPath, "..");
- }
- };
- var applyExecPath = (result, execPath, cwdPath) => {
- const execPathString = execPath instanceof URL ? (0, import_node_url.fileURLToPath)(execPath) : execPath;
- result.push(import_node_path.default.resolve(cwdPath, execPathString, ".."));
- };
- var npmRunPathEnv = ({ env = import_node_process.default.env, ...options } = {}) => {
- env = { ...env };
- const pathName = pathKey({ env });
- options.path = env[pathName];
- env[pathName] = npmRunPath(options);
- return env;
- };
- // node_modules/mimic-fn/index.js
- var copyProperty = (to, from, property, ignoreNonConfigurable) => {
- if (property === "length" || property === "prototype") {
- return;
- }
- if (property === "arguments" || property === "caller") {
- return;
- }
- const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
- const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
- if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
- return;
- }
- Object.defineProperty(to, property, fromDescriptor);
- };
- var canCopyProperty = function(toDescriptor, fromDescriptor) {
- return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
- };
- var changePrototype = (to, from) => {
- const fromPrototype = Object.getPrototypeOf(from);
- if (fromPrototype === Object.getPrototypeOf(to)) {
- return;
- }
- Object.setPrototypeOf(to, fromPrototype);
- };
- var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
- ${fromBody}`;
- var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
- var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
- var changeToString = (to, from, name) => {
- const withName = name === "" ? "" : `with ${name.trim()}() `;
- const newToString = wrappedToString.bind(null, withName, from.toString());
- Object.defineProperty(newToString, "name", toStringName);
- Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
- };
- function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
- const { name } = to;
- for (const property of Reflect.ownKeys(from)) {
- copyProperty(to, from, property, ignoreNonConfigurable);
- }
- changePrototype(to, from);
- changeToString(to, from, name);
- return to;
- }
- // node_modules/onetime/index.js
- var calledFunctions = /* @__PURE__ */ new WeakMap();
- var onetime = (function_, options = {}) => {
- if (typeof function_ !== "function") {
- throw new TypeError("Expected a function");
- }
- let returnValue;
- let callCount = 0;
- const functionName = function_.displayName || function_.name || "<anonymous>";
- const onetime2 = function(...arguments_) {
- calledFunctions.set(onetime2, ++callCount);
- if (callCount === 1) {
- returnValue = function_.apply(this, arguments_);
- function_ = null;
- } else if (options.throw === true) {
- throw new Error(`Function \`${functionName}\` can only be called once`);
- }
- return returnValue;
- };
- mimicFunction(onetime2, function_);
- calledFunctions.set(onetime2, callCount);
- return onetime2;
- };
- onetime.callCount = (function_) => {
- if (!calledFunctions.has(function_)) {
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
- }
- return calledFunctions.get(function_);
- };
- var onetime_default = onetime;
- // node_modules/default-browser/node_modules/execa/lib/error.js
- var import_node_process2 = __toESM(require("process"), 1);
- // node_modules/default-browser/node_modules/human-signals/build/src/main.js
- var import_node_os2 = require("os");
- // node_modules/default-browser/node_modules/human-signals/build/src/realtime.js
- var getRealtimeSignals = () => {
- const length = SIGRTMAX - SIGRTMIN + 1;
- return Array.from({ length }, getRealtimeSignal);
- };
- var getRealtimeSignal = (value, index) => ({
- name: `SIGRT${index + 1}`,
- number: SIGRTMIN + index,
- action: "terminate",
- description: "Application-specific signal (realtime)",
- standard: "posix"
- });
- var SIGRTMIN = 34;
- var SIGRTMAX = 64;
- // node_modules/default-browser/node_modules/human-signals/build/src/signals.js
- var import_node_os = require("os");
- // node_modules/default-browser/node_modules/human-signals/build/src/core.js
- var SIGNALS = [
- {
- name: "SIGHUP",
- number: 1,
- action: "terminate",
- description: "Terminal closed",
- standard: "posix"
- },
- {
- name: "SIGINT",
- number: 2,
- action: "terminate",
- description: "User interruption with CTRL-C",
- standard: "ansi"
- },
- {
- name: "SIGQUIT",
- number: 3,
- action: "core",
- description: "User interruption with CTRL-\\",
- standard: "posix"
- },
- {
- name: "SIGILL",
- number: 4,
- action: "core",
- description: "Invalid machine instruction",
- standard: "ansi"
- },
- {
- name: "SIGTRAP",
- number: 5,
- action: "core",
- description: "Debugger breakpoint",
- standard: "posix"
- },
- {
- name: "SIGABRT",
- number: 6,
- action: "core",
- description: "Aborted",
- standard: "ansi"
- },
- {
- name: "SIGIOT",
- number: 6,
- action: "core",
- description: "Aborted",
- standard: "bsd"
- },
- {
- name: "SIGBUS",
- number: 7,
- action: "core",
- description: "Bus error due to misaligned, non-existing address or paging error",
- standard: "bsd"
- },
- {
- name: "SIGEMT",
- number: 7,
- action: "terminate",
- description: "Command should be emulated but is not implemented",
- standard: "other"
- },
- {
- name: "SIGFPE",
- number: 8,
- action: "core",
- description: "Floating point arithmetic error",
- standard: "ansi"
- },
- {
- name: "SIGKILL",
- number: 9,
- action: "terminate",
- description: "Forced termination",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGUSR1",
- number: 10,
- action: "terminate",
- description: "Application-specific signal",
- standard: "posix"
- },
- {
- name: "SIGSEGV",
- number: 11,
- action: "core",
- description: "Segmentation fault",
- standard: "ansi"
- },
- {
- name: "SIGUSR2",
- number: 12,
- action: "terminate",
- description: "Application-specific signal",
- standard: "posix"
- },
- {
- name: "SIGPIPE",
- number: 13,
- action: "terminate",
- description: "Broken pipe or socket",
- standard: "posix"
- },
- {
- name: "SIGALRM",
- number: 14,
- action: "terminate",
- description: "Timeout or timer",
- standard: "posix"
- },
- {
- name: "SIGTERM",
- number: 15,
- action: "terminate",
- description: "Termination",
- standard: "ansi"
- },
- {
- name: "SIGSTKFLT",
- number: 16,
- action: "terminate",
- description: "Stack is empty or overflowed",
- standard: "other"
- },
- {
- name: "SIGCHLD",
- number: 17,
- action: "ignore",
- description: "Child process terminated, paused or unpaused",
- standard: "posix"
- },
- {
- name: "SIGCLD",
- number: 17,
- action: "ignore",
- description: "Child process terminated, paused or unpaused",
- standard: "other"
- },
- {
- name: "SIGCONT",
- number: 18,
- action: "unpause",
- description: "Unpaused",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGSTOP",
- number: 19,
- action: "pause",
- description: "Paused",
- standard: "posix",
- forced: true
- },
- {
- name: "SIGTSTP",
- number: 20,
- action: "pause",
- description: 'Paused using CTRL-Z or "suspend"',
- standard: "posix"
- },
- {
- name: "SIGTTIN",
- number: 21,
- action: "pause",
- description: "Background process cannot read terminal input",
- standard: "posix"
- },
- {
- name: "SIGBREAK",
- number: 21,
- action: "terminate",
- description: "User interruption with CTRL-BREAK",
- standard: "other"
- },
- {
- name: "SIGTTOU",
- number: 22,
- action: "pause",
- description: "Background process cannot write to terminal output",
- standard: "posix"
- },
- {
- name: "SIGURG",
- number: 23,
- action: "ignore",
- description: "Socket received out-of-band data",
- standard: "bsd"
- },
- {
- name: "SIGXCPU",
- number: 24,
- action: "core",
- description: "Process timed out",
- standard: "bsd"
- },
- {
- name: "SIGXFSZ",
- number: 25,
- action: "core",
- description: "File too big",
- standard: "bsd"
- },
- {
- name: "SIGVTALRM",
- number: 26,
- action: "terminate",
- description: "Timeout or timer",
- standard: "bsd"
- },
- {
- name: "SIGPROF",
- number: 27,
- action: "terminate",
- description: "Timeout or timer",
- standard: "bsd"
- },
- {
- name: "SIGWINCH",
- number: 28,
- action: "ignore",
- description: "Terminal window size changed",
- standard: "bsd"
- },
- {
- name: "SIGIO",
- number: 29,
- action: "terminate",
- description: "I/O is available",
- standard: "other"
- },
- {
- name: "SIGPOLL",
- number: 29,
- action: "terminate",
- description: "Watched event",
- standard: "other"
- },
- {
- name: "SIGINFO",
- number: 29,
- action: "ignore",
- description: "Request for process information",
- standard: "other"
- },
- {
- name: "SIGPWR",
- number: 30,
- action: "terminate",
- description: "Device running out of power",
- standard: "systemv"
- },
- {
- name: "SIGSYS",
- number: 31,
- action: "core",
- description: "Invalid system call",
- standard: "other"
- },
- {
- name: "SIGUNUSED",
- number: 31,
- action: "terminate",
- description: "Invalid system call",
- standard: "other"
- }
- ];
- // node_modules/default-browser/node_modules/human-signals/build/src/signals.js
- var getSignals = () => {
- const realtimeSignals = getRealtimeSignals();
- const signals = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
- return signals;
- };
- var normalizeSignal = ({
- name,
- number: defaultNumber,
- description,
- action,
- forced = false,
- standard
- }) => {
- const {
- signals: { [name]: constantSignal }
- } = import_node_os.constants;
- const supported = constantSignal !== void 0;
- const number = supported ? constantSignal : defaultNumber;
- return { name, number, description, supported, action, forced, standard };
- };
- // node_modules/default-browser/node_modules/human-signals/build/src/main.js
- var getSignalsByName = () => {
- const signals = getSignals();
- return Object.fromEntries(signals.map(getSignalByName));
- };
- var getSignalByName = ({
- name,
- number,
- description,
- supported,
- action,
- forced,
- standard
- }) => [name, { name, number, description, supported, action, forced, standard }];
- var signalsByName = getSignalsByName();
- var getSignalsByNumber = () => {
- const signals = getSignals();
- const length = SIGRTMAX + 1;
- const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals));
- return Object.assign({}, ...signalsA);
- };
- var getSignalByNumber = (number, signals) => {
- const signal = findSignalByNumber(number, signals);
- if (signal === void 0) {
- return {};
- }
- const { name, description, supported, action, forced, standard } = signal;
- return {
- [number]: {
- name,
- number,
- description,
- supported,
- action,
- forced,
- standard
- }
- };
- };
- var findSignalByNumber = (number, signals) => {
- const signal = signals.find(({ name }) => import_node_os2.constants.signals[name] === number);
- if (signal !== void 0) {
- return signal;
- }
- return signals.find((signalA) => signalA.number === number);
- };
- var signalsByNumber = getSignalsByNumber();
- // node_modules/default-browser/node_modules/execa/lib/error.js
- var getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
- if (timedOut) {
- return `timed out after ${timeout} milliseconds`;
- }
- if (isCanceled) {
- return "was canceled";
- }
- if (errorCode !== void 0) {
- return `failed with ${errorCode}`;
- }
- if (signal !== void 0) {
- return `was killed with ${signal} (${signalDescription})`;
- }
- if (exitCode !== void 0) {
- return `failed with exit code ${exitCode}`;
- }
- return "failed";
- };
- var makeError = ({
- stdout,
- stderr,
- all,
- error,
- signal,
- exitCode,
- command,
- escapedCommand,
- timedOut,
- isCanceled,
- killed,
- parsed: { options: { timeout, cwd = import_node_process2.default.cwd() } }
- }) => {
- exitCode = exitCode === null ? void 0 : exitCode;
- signal = signal === null ? void 0 : signal;
- const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
- const errorCode = error && error.code;
- const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
- const execaMessage = `Command ${prefix}: ${command}`;
- const isError = Object.prototype.toString.call(error) === "[object Error]";
- const shortMessage = isError ? `${execaMessage}
- ${error.message}` : execaMessage;
- const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
- if (isError) {
- error.originalMessage = error.message;
- error.message = message;
- } else {
- error = new Error(message);
- }
- error.shortMessage = shortMessage;
- error.command = command;
- error.escapedCommand = escapedCommand;
- error.exitCode = exitCode;
- error.signal = signal;
- error.signalDescription = signalDescription;
- error.stdout = stdout;
- error.stderr = stderr;
- error.cwd = cwd;
- if (all !== void 0) {
- error.all = all;
- }
- if ("bufferedData" in error) {
- delete error.bufferedData;
- }
- error.failed = true;
- error.timedOut = Boolean(timedOut);
- error.isCanceled = isCanceled;
- error.killed = killed && !timedOut;
- return error;
- };
- // node_modules/default-browser/node_modules/execa/lib/stdio.js
- var aliases = ["stdin", "stdout", "stderr"];
- var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
- var normalizeStdio = (options) => {
- if (!options) {
- return;
- }
- const { stdio } = options;
- if (stdio === void 0) {
- return aliases.map((alias) => options[alias]);
- }
- if (hasAlias(options)) {
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
- }
- if (typeof stdio === "string") {
- return stdio;
- }
- if (!Array.isArray(stdio)) {
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
- }
- const length = Math.max(stdio.length, aliases.length);
- return Array.from({ length }, (value, index) => stdio[index]);
- };
- // node_modules/default-browser/node_modules/execa/lib/kill.js
- var import_node_os3 = __toESM(require("os"), 1);
- var import_signal_exit = __toESM(require_signal_exit2(), 1);
- var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
- var spawnedKill = (kill, signal = "SIGTERM", options = {}) => {
- const killResult = kill(signal);
- setKillTimeout(kill, signal, options, killResult);
- return killResult;
- };
- var setKillTimeout = (kill, signal, options, killResult) => {
- if (!shouldForceKill(signal, options, killResult)) {
- return;
- }
- const timeout = getForceKillAfterTimeout(options);
- const t = setTimeout(() => {
- kill("SIGKILL");
- }, timeout);
- if (t.unref) {
- t.unref();
- }
- };
- var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
- var isSigterm = (signal) => signal === import_node_os3.default.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
- var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
- if (forceKillAfterTimeout === true) {
- return DEFAULT_FORCE_KILL_TIMEOUT;
- }
- if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
- throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
- }
- return forceKillAfterTimeout;
- };
- var spawnedCancel = (spawned, context) => {
- const killResult = spawned.kill();
- if (killResult) {
- context.isCanceled = true;
- }
- };
- var timeoutKill = (spawned, signal, reject) => {
- spawned.kill(signal);
- reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
- };
- var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise) => {
- if (timeout === 0 || timeout === void 0) {
- return spawnedPromise;
- }
- let timeoutId;
- const timeoutPromise = new Promise((resolve, reject) => {
- timeoutId = setTimeout(() => {
- timeoutKill(spawned, killSignal, reject);
- }, timeout);
- });
- const safeSpawnedPromise = spawnedPromise.finally(() => {
- clearTimeout(timeoutId);
- });
- return Promise.race([timeoutPromise, safeSpawnedPromise]);
- };
- var validateTimeout = ({ timeout }) => {
- if (timeout !== void 0 && (!Number.isFinite(timeout) || timeout < 0)) {
- throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout}\` (${typeof timeout})`);
- }
- };
- var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
- if (!cleanup || detached) {
- return timedPromise;
- }
- const removeExitHandler = (0, import_signal_exit.default)(() => {
- spawned.kill();
- });
- return timedPromise.finally(() => {
- removeExitHandler();
- });
- };
- // node_modules/default-browser/node_modules/execa/lib/pipe.js
- var import_node_fs = require("fs");
- var import_node_child_process = require("child_process");
- // node_modules/is-stream/index.js
- function isStream(stream) {
- return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
- }
- function isWritableStream(stream) {
- return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
- }
- // node_modules/default-browser/node_modules/execa/lib/pipe.js
- var isExecaChildProcess = (target) => target instanceof import_node_child_process.ChildProcess && typeof target.then === "function";
- var pipeToTarget = (spawned, streamName, target) => {
- if (typeof target === "string") {
- spawned[streamName].pipe((0, import_node_fs.createWriteStream)(target));
- return spawned;
- }
- if (isWritableStream(target)) {
- spawned[streamName].pipe(target);
- return spawned;
- }
- if (!isExecaChildProcess(target)) {
- throw new TypeError("The second argument must be a string, a stream or an Execa child process.");
- }
- if (!isWritableStream(target.stdin)) {
- throw new TypeError("The target child process's stdin must be available.");
- }
- spawned[streamName].pipe(target.stdin);
- return target;
- };
- var addPipeMethods = (spawned) => {
- if (spawned.stdout !== null) {
- spawned.pipeStdout = pipeToTarget.bind(void 0, spawned, "stdout");
- }
- if (spawned.stderr !== null) {
- spawned.pipeStderr = pipeToTarget.bind(void 0, spawned, "stderr");
- }
- if (spawned.all !== void 0) {
- spawned.pipeAll = pipeToTarget.bind(void 0, spawned, "all");
- }
- };
- // node_modules/default-browser/node_modules/execa/lib/stream.js
- var import_node_fs2 = require("fs");
- var import_get_stream = __toESM(require_get_stream2(), 1);
- var import_merge_stream = __toESM(require_merge_stream(), 1);
- var validateInputOptions = (input) => {
- if (input !== void 0) {
- throw new TypeError("The `input` and `inputFile` options cannot be both set.");
- }
- };
- var getInputSync = ({ input, inputFile }) => {
- if (typeof inputFile !== "string") {
- return input;
- }
- validateInputOptions(input);
- return (0, import_node_fs2.readFileSync)(inputFile);
- };
- var handleInputSync = (options) => {
- const input = getInputSync(options);
- if (isStream(input)) {
- throw new TypeError("The `input` option cannot be a stream in sync mode");
- }
- return input;
- };
- var getInput = ({ input, inputFile }) => {
- if (typeof inputFile !== "string") {
- return input;
- }
- validateInputOptions(input);
- return (0, import_node_fs2.createReadStream)(inputFile);
- };
- var handleInput = (spawned, options) => {
- const input = getInput(options);
- if (input === void 0) {
- return;
- }
- if (isStream(input)) {
- input.pipe(spawned.stdin);
- } else {
- spawned.stdin.end(input);
- }
- };
- var makeAllStream = (spawned, { all }) => {
- if (!all || !spawned.stdout && !spawned.stderr) {
- return;
- }
- const mixed = (0, import_merge_stream.default)();
- if (spawned.stdout) {
- mixed.add(spawned.stdout);
- }
- if (spawned.stderr) {
- mixed.add(spawned.stderr);
- }
- return mixed;
- };
- var getBufferedData = async (stream, streamPromise) => {
- if (!stream || streamPromise === void 0) {
- return;
- }
- stream.destroy();
- try {
- return await streamPromise;
- } catch (error) {
- return error.bufferedData;
- }
- };
- var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
- if (!stream || !buffer) {
- return;
- }
- if (encoding) {
- return (0, import_get_stream.default)(stream, { encoding, maxBuffer });
- }
- return import_get_stream.default.buffer(stream, { maxBuffer });
- };
- var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
- const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
- const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
- const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
- try {
- return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
- } catch (error) {
- return Promise.all([
- { error, signal: error.signal, timedOut: error.timedOut },
- getBufferedData(stdout, stdoutPromise),
- getBufferedData(stderr, stderrPromise),
- getBufferedData(all, allPromise)
- ]);
- }
- };
- // node_modules/default-browser/node_modules/execa/lib/promise.js
- var nativePromisePrototype = (async () => {
- })().constructor.prototype;
- var descriptors = ["then", "catch", "finally"].map((property) => [
- property,
- Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
- ]);
- var mergePromise = (spawned, promise) => {
- for (const [property, descriptor] of descriptors) {
- const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
- Reflect.defineProperty(spawned, property, { ...descriptor, value });
- }
- };
- var getSpawnedPromise = (spawned) => new Promise((resolve, reject) => {
- spawned.on("exit", (exitCode, signal) => {
- resolve({ exitCode, signal });
- });
- spawned.on("error", (error) => {
- reject(error);
- });
- if (spawned.stdin) {
- spawned.stdin.on("error", (error) => {
- reject(error);
- });
- }
- });
- // node_modules/default-browser/node_modules/execa/lib/command.js
- var import_node_buffer = require("buffer");
- var import_node_child_process2 = require("child_process");
- var normalizeArgs = (file, args = []) => {
- if (!Array.isArray(args)) {
- return [file];
- }
- return [file, ...args];
- };
- var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
- var DOUBLE_QUOTES_REGEXP = /"/g;
- var escapeArg = (arg) => {
- if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
- return arg;
- }
- return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
- };
- var joinCommand = (file, args) => normalizeArgs(file, args).join(" ");
- var getEscapedCommand = (file, args) => normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
- var SPACES_REGEXP = / +/g;
- var parseExpression = (expression) => {
- const typeOfExpression = typeof expression;
- if (typeOfExpression === "string") {
- return expression;
- }
- if (typeOfExpression === "number") {
- return String(expression);
- }
- if (typeOfExpression === "object" && expression !== null && !(expression instanceof import_node_child_process2.ChildProcess) && "stdout" in expression) {
- const typeOfStdout = typeof expression.stdout;
- if (typeOfStdout === "string") {
- return expression.stdout;
- }
- if (import_node_buffer.Buffer.isBuffer(expression.stdout)) {
- return expression.stdout.toString();
- }
- throw new TypeError(`Unexpected "${typeOfStdout}" stdout in template expression`);
- }
- throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
- };
- var concatTokens = (tokens, nextTokens, isNew) => isNew || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
- ...tokens.slice(0, -1),
- `${tokens[tokens.length - 1]}${nextTokens[0]}`,
- ...nextTokens.slice(1)
- ];
- var parseTemplate = ({ templates, expressions, tokens, index, template }) => {
- const templateString = template != null ? template : templates.raw[index];
- const templateTokens = templateString.split(SPACES_REGEXP).filter(Boolean);
- const newTokens = concatTokens(
- tokens,
- templateTokens,
- templateString.startsWith(" ")
- );
- if (index === expressions.length) {
- return newTokens;
- }
- const expression = expressions[index];
- const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
- return concatTokens(
- newTokens,
- expressionTokens,
- templateString.endsWith(" ")
- );
- };
- var parseTemplates = (templates, expressions) => {
- let tokens = [];
- for (const [index, template] of templates.entries()) {
- tokens = parseTemplate({ templates, expressions, tokens, index, template });
- }
- return tokens;
- };
- // node_modules/default-browser/node_modules/execa/lib/verbose.js
- var import_node_util = require("util");
- var import_node_process3 = __toESM(require("process"), 1);
- var verboseDefault = (0, import_node_util.debuglog)("execa").enabled;
- var padField = (field, padding) => String(field).padStart(padding, "0");
- var getTimestamp = () => {
- const date = /* @__PURE__ */ new Date();
- return `${padField(date.getHours(), 2)}:${padField(date.getMinutes(), 2)}:${padField(date.getSeconds(), 2)}.${padField(date.getMilliseconds(), 3)}`;
- };
- var logCommand = (escapedCommand, { verbose }) => {
- if (!verbose) {
- return;
- }
- import_node_process3.default.stderr.write(`[${getTimestamp()}] ${escapedCommand}
- `);
- };
- // node_modules/default-browser/node_modules/execa/index.js
- var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
- var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
- const env = extendEnv ? { ...import_node_process4.default.env, ...envOption } : envOption;
- if (preferLocal) {
- return npmRunPathEnv({ env, cwd: localDir, execPath });
- }
- return env;
- };
- var handleArguments = (file, args, options = {}) => {
- const parsed = import_cross_spawn.default._parse(file, args, options);
- file = parsed.command;
- args = parsed.args;
- options = parsed.options;
- options = {
- maxBuffer: DEFAULT_MAX_BUFFER,
- buffer: true,
- stripFinalNewline: true,
- extendEnv: true,
- preferLocal: false,
- localDir: options.cwd || import_node_process4.default.cwd(),
- execPath: import_node_process4.default.execPath,
- encoding: "utf8",
- reject: true,
- cleanup: true,
- all: false,
- windowsHide: true,
- verbose: verboseDefault,
- ...options
- };
- options.env = getEnv(options);
- options.stdio = normalizeStdio(options);
- if (import_node_process4.default.platform === "win32" && import_node_path2.default.basename(file, ".exe") === "cmd") {
- args.unshift("/q");
- }
- return { file, args, options, parsed };
- };
- var handleOutput = (options, value, error) => {
- if (typeof value !== "string" && !import_node_buffer2.Buffer.isBuffer(value)) {
- return error === void 0 ? void 0 : "";
- }
- if (options.stripFinalNewline) {
- return stripFinalNewline(value);
- }
- return value;
- };
- function execa2(file, args, options) {
- const parsed = handleArguments(file, args, options);
- const command = joinCommand(file, args);
- const escapedCommand = getEscapedCommand(file, args);
- logCommand(escapedCommand, parsed.options);
- validateTimeout(parsed.options);
- let spawned;
- try {
- spawned = import_node_child_process3.default.spawn(parsed.file, parsed.args, parsed.options);
- } catch (error) {
- const dummySpawned = new import_node_child_process3.default.ChildProcess();
- const errorPromise = Promise.reject(makeError({
- error,
- stdout: "",
- stderr: "",
- all: "",
- command,
- escapedCommand,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- }));
- mergePromise(dummySpawned, errorPromise);
- return dummySpawned;
- }
- const spawnedPromise = getSpawnedPromise(spawned);
- const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
- const processDone = setExitHandler(spawned, parsed.options, timedPromise);
- const context = { isCanceled: false };
- spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
- spawned.cancel = spawnedCancel.bind(null, spawned, context);
- const handlePromise = async () => {
- const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
- const stdout = handleOutput(parsed.options, stdoutResult);
- const stderr = handleOutput(parsed.options, stderrResult);
- const all = handleOutput(parsed.options, allResult);
- if (error || exitCode !== 0 || signal !== null) {
- const returnedError = makeError({
- error,
- exitCode,
- signal,
- stdout,
- stderr,
- all,
- command,
- escapedCommand,
- parsed,
- timedOut,
- isCanceled: context.isCanceled || (parsed.options.signal ? parsed.options.signal.aborted : false),
- killed: spawned.killed
- });
- if (!parsed.options.reject) {
- return returnedError;
- }
- throw returnedError;
- }
- return {
- command,
- escapedCommand,
- exitCode: 0,
- stdout,
- stderr,
- all,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
- };
- const handlePromiseOnce = onetime_default(handlePromise);
- handleInput(spawned, parsed.options);
- spawned.all = makeAllStream(spawned, parsed.options);
- addPipeMethods(spawned);
- mergePromise(spawned, handlePromiseOnce);
- return spawned;
- }
- function execaSync(file, args, options) {
- const parsed = handleArguments(file, args, options);
- const command = joinCommand(file, args);
- const escapedCommand = getEscapedCommand(file, args);
- logCommand(escapedCommand, parsed.options);
- const input = handleInputSync(parsed.options);
- let result;
- try {
- result = import_node_child_process3.default.spawnSync(parsed.file, parsed.args, { ...parsed.options, input });
- } catch (error) {
- throw makeError({
- error,
- stdout: "",
- stderr: "",
- all: "",
- command,
- escapedCommand,
- parsed,
- timedOut: false,
- isCanceled: false,
- killed: false
- });
- }
- const stdout = handleOutput(parsed.options, result.stdout, result.error);
- const stderr = handleOutput(parsed.options, result.stderr, result.error);
- if (result.error || result.status !== 0 || result.signal !== null) {
- const error = makeError({
- stdout,
- stderr,
- error: result.error,
- signal: result.signal,
- exitCode: result.status,
- command,
- escapedCommand,
- parsed,
- timedOut: result.error && result.error.code === "ETIMEDOUT",
- isCanceled: false,
- killed: result.signal !== null
- });
- if (!parsed.options.reject) {
- return error;
- }
- throw error;
- }
- return {
- command,
- escapedCommand,
- exitCode: 0,
- stdout,
- stderr,
- failed: false,
- timedOut: false,
- isCanceled: false,
- killed: false
- };
- }
- var normalizeScriptStdin = ({ input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin: "inherit" } : {};
- var normalizeScriptOptions = (options = {}) => ({
- preferLocal: true,
- ...normalizeScriptStdin(options),
- ...options
- });
- function create$(options) {
- function $2(templatesOrOptions, ...expressions) {
- if (!Array.isArray(templatesOrOptions)) {
- return create$({ ...options, ...templatesOrOptions });
- }
- const [file, ...args] = parseTemplates(templatesOrOptions, expressions);
- return execa2(file, args, normalizeScriptOptions(options));
- }
- $2.sync = (templates, ...expressions) => {
- if (!Array.isArray(templates)) {
- throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");
- }
- const [file, ...args] = parseTemplates(templates, expressions);
- return execaSync(file, args, normalizeScriptOptions(options));
- };
- return $2;
- }
- var $ = create$();
- // node_modules/default-browser/windows.js
- var windowsBrowserProgIds = {
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
- MSEdgeDHTML: { name: "Edge", id: "com.microsoft.edge" },
- // On macOS, it's "com.microsoft.edgemac"
- MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
- // Newer Edge/Win10 releases
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" },
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
- ChromeHTML: { name: "Chrome", id: "com.google.chrome" }
- };
- var UnknownBrowserError = class extends Error {
- };
- async function defaultBrowser(_execa = execa2) {
- const result = await _execa("reg", [
- "QUERY",
- " HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice",
- "/v",
- "ProgId"
- ]);
- const match = new RegExp("ProgId\\s*REG_SZ\\s*(?<id>\\S+)").exec(result.stdout);
- if (!match) {
- throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(result.stdout)}`);
- }
- const { id } = match.groups;
- const browser = windowsBrowserProgIds[id];
- if (!browser) {
- throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
- }
- return browser;
- }
- // node_modules/default-browser/index.js
- async function defaultBrowser2() {
- if (import_node_process5.default.platform === "linux") {
- const { stdout } = await execa2("xdg-mime", ["query", "default", "x-scheme-handler/http"]);
- const name = titleize(stdout.trim().replace(/.desktop$/, "").replace("-", " "));
- return {
- name,
- id: stdout
- };
- }
- if (import_node_process5.default.platform === "darwin") {
- const id = await defaultBrowserId();
- const name = await bundleName(id);
- return { name, id };
- }
- if (import_node_process5.default.platform === "win32") {
- return defaultBrowser();
- }
- throw new Error("Only macOS, Linux, and Windows are supported");
- }
- // node_modules/is-inside-container/index.js
- var import_node_fs4 = __toESM(require("fs"), 1);
- // node_modules/is-docker/index.js
- var import_node_fs3 = __toESM(require("fs"), 1);
- var isDockerCached;
- function hasDockerEnv() {
- try {
- import_node_fs3.default.statSync("/.dockerenv");
- return true;
- } catch {
- return false;
- }
- }
- function hasDockerCGroup() {
- try {
- return import_node_fs3.default.readFileSync("/proc/self/cgroup", "utf8").includes("docker");
- } catch {
- return false;
- }
- }
- function isDocker() {
- if (isDockerCached === void 0) {
- isDockerCached = hasDockerEnv() || hasDockerCGroup();
- }
- return isDockerCached;
- }
- // node_modules/is-inside-container/index.js
- var cachedResult;
- var hasContainerEnv = () => {
- try {
- import_node_fs4.default.statSync("/run/.containerenv");
- return true;
- } catch {
- return false;
- }
- };
- function isInsideContainer() {
- if (cachedResult === void 0) {
- cachedResult = hasContainerEnv() || isDocker();
- }
- return cachedResult;
- }
- // node_modules/open/index.js
- var import_meta = {};
- var __dirname = import_node_path3.default.dirname((0, import_node_url2.fileURLToPath)(new (require("url").URL)("file:" + __filename).href));
- var localXdgOpenPath = import_node_path3.default.join(__dirname, "xdg-open");
- var { platform, arch } = import_node_process6.default;
- var getWslDrivesMountPoint = /* @__PURE__ */ (() => {
- const defaultMountPoint = "/mnt/";
- let mountPoint;
- return async function() {
- if (mountPoint) {
- return mountPoint;
- }
- const configFilePath = "/etc/wsl.conf";
- let isConfigFileExists = false;
- try {
- await import_promises.default.access(configFilePath, import_node_fs5.constants.F_OK);
- isConfigFileExists = true;
- } catch {
- }
- if (!isConfigFileExists) {
- return defaultMountPoint;
- }
- const configContent = await import_promises.default.readFile(configFilePath, { encoding: "utf8" });
- const configMountPoint = new RegExp("(?<!#.*)root\\s*=\\s*(?<mountPoint>.*)", "g").exec(configContent);
- if (!configMountPoint) {
- return defaultMountPoint;
- }
- mountPoint = configMountPoint.groups.mountPoint.trim();
- mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
- return mountPoint;
- };
- })();
- var pTryEach = async (array, mapper) => {
- let latestError;
- for (const item of array) {
- try {
- return await mapper(item);
- } catch (error) {
- latestError = error;
- }
- }
- throw latestError;
- };
- var baseOpen = async (options) => {
- var _a, _b;
- options = {
- wait: false,
- background: false,
- newInstance: false,
- allowNonzeroExitCode: false,
- ...options
- };
- if (Array.isArray(options.app)) {
- return pTryEach(options.app, (singleApp) => baseOpen({
- ...options,
- app: singleApp
- }));
- }
- let { name: app, arguments: appArguments = [] } = (_a = options.app) != null ? _a : {};
- appArguments = [...appArguments];
- if (Array.isArray(app)) {
- return pTryEach(app, (appName) => baseOpen({
- ...options,
- app: {
- name: appName,
- arguments: appArguments
- }
- }));
- }
- if (app === "browser" || app === "browserPrivate") {
- const ids = {
- "com.google.chrome": "chrome",
- "google-chrome.desktop": "chrome",
- "org.mozilla.firefox": "firefox",
- "firefox.desktop": "firefox",
- "com.microsoft.msedge": "edge",
- "com.microsoft.edge": "edge",
- "microsoft-edge.desktop": "edge"
- };
- const flags = {
- chrome: "--incognito",
- firefox: "--private-window",
- edge: "--inPrivate"
- };
- const browser = await defaultBrowser2();
- if (browser.id in ids) {
- const browserName = ids[browser.id];
- if (app === "browserPrivate") {
- appArguments.push(flags[browserName]);
- }
- return baseOpen({
- ...options,
- app: {
- name: apps[browserName],
- arguments: appArguments
- }
- });
- }
- throw new Error(`${browser.name} is not supported as a default browser`);
- }
- let command;
- const cliArguments = [];
- const childProcessOptions = {};
- if (platform === "darwin") {
- command = "open";
- if (options.wait) {
- cliArguments.push("--wait-apps");
- }
- if (options.background) {
- cliArguments.push("--background");
- }
- if (options.newInstance) {
- cliArguments.push("--new");
- }
- if (app) {
- cliArguments.push("-a", app);
- }
- } else if (platform === "win32" || import_is_wsl.default && !isInsideContainer() && !app) {
- const mountPoint = await getWslDrivesMountPoint();
- command = import_is_wsl.default ? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe` : `${import_node_process6.default.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`;
- cliArguments.push(
- "-NoProfile",
- "-NonInteractive",
- "-ExecutionPolicy",
- "Bypass",
- "-EncodedCommand"
- );
- if (!import_is_wsl.default) {
- childProcessOptions.windowsVerbatimArguments = true;
- }
- const encodedArguments = ["Start"];
- if (options.wait) {
- encodedArguments.push("-Wait");
- }
- if (app) {
- encodedArguments.push(`"\`"${app}\`""`);
- if (options.target) {
- appArguments.push(options.target);
- }
- } else if (options.target) {
- encodedArguments.push(`"${options.target}"`);
- }
- if (appArguments.length > 0) {
- appArguments = appArguments.map((arg) => `"\`"${arg}\`""`);
- encodedArguments.push("-ArgumentList", appArguments.join(","));
- }
- options.target = import_node_buffer3.Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
- } else {
- if (app) {
- command = app;
- } else {
- const isBundled = !__dirname || __dirname === "/";
- let exeLocalXdgOpen = false;
- try {
- await import_promises.default.access(localXdgOpenPath, import_node_fs5.constants.X_OK);
- exeLocalXdgOpen = true;
- } catch {
- }
- const useSystemXdgOpen = (_b = import_node_process6.default.versions.electron) != null ? _b : platform === "android" || isBundled || !exeLocalXdgOpen;
- command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
- }
- if (appArguments.length > 0) {
- cliArguments.push(...appArguments);
- }
- if (!options.wait) {
- childProcessOptions.stdio = "ignore";
- childProcessOptions.detached = true;
- }
- }
- if (options.target) {
- cliArguments.push(options.target);
- }
- if (platform === "darwin" && appArguments.length > 0) {
- cliArguments.push("--args", ...appArguments);
- }
- const subprocess = import_node_child_process4.default.spawn(command, cliArguments, childProcessOptions);
- if (options.wait) {
- return new Promise((resolve, reject) => {
- subprocess.once("error", reject);
- subprocess.once("close", (exitCode) => {
- if (!options.allowNonzeroExitCode && exitCode > 0) {
- reject(new Error(`Exited with code ${exitCode}`));
- return;
- }
- resolve(subprocess);
- });
- });
- }
- subprocess.unref();
- return subprocess;
- };
- var open = (target, options) => {
- if (typeof target !== "string") {
- throw new TypeError("Expected a `target`");
- }
- return baseOpen({
- ...options,
- target
- });
- };
- function detectArchBinary(binary) {
- if (typeof binary === "string" || Array.isArray(binary)) {
- return binary;
- }
- const { [arch]: archBinary } = binary;
- if (!archBinary) {
- throw new Error(`${arch} is not supported`);
- }
- return archBinary;
- }
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
- if (wsl && import_is_wsl.default) {
- return detectArchBinary(wsl);
- }
- if (!platformBinary) {
- throw new Error(`${platform} is not supported`);
- }
- return detectArchBinary(platformBinary);
- }
- var apps = {};
- defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
- darwin: "google chrome",
- win32: "chrome",
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
- }, {
- wsl: {
- ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
- x64: ["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe", "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]
- }
- }));
- defineLazyProperty(apps, "firefox", () => detectPlatformBinary({
- darwin: "firefox",
- win32: "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
- linux: "firefox"
- }, {
- wsl: "/mnt/c/Program Files/Mozilla Firefox/firefox.exe"
- }));
- defineLazyProperty(apps, "edge", () => detectPlatformBinary({
- darwin: "microsoft edge",
- win32: "msedge",
- linux: ["microsoft-edge", "microsoft-edge-dev"]
- }, {
- wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
- }));
- defineLazyProperty(apps, "browser", () => "browser");
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
- var open_default = open;
- // build/dev-server/open-in-browser.js
- async function openInBrowser(opts) {
- await open_default(opts.url);
- }
- // build/dev-server/server-context.js
- var import_graceful_fs = __toESM(require("../sys/node/graceful-fs.js"));
- var import_path4 = __toESM(require("path"));
- var import_util = __toESM(require("util"));
- function createServerContext(sys, sendMsg, devServerConfig, buildResultsResolves, compilerRequestResolves) {
- const logRequest = (req, status) => {
- if (devServerConfig) {
- sendMsg({
- requestLog: {
- method: req.method || "?",
- url: req.pathname || "?",
- status
- }
- });
- }
- };
- const serve500 = (req, res, error, xSource) => {
- try {
- res.writeHead(500, responseHeaders({
- "content-type": "text/plain; charset=utf-8",
- "x-source": xSource
- }));
- res.write(import_util.default.inspect(error));
- res.end();
- logRequest(req, 500);
- } catch (e) {
- sendMsg({ error: { message: "serve500: " + e } });
- }
- };
- const serve404 = (req, res, xSource, content = null) => {
- try {
- if (req.pathname === "/favicon.ico") {
- const defaultFavicon = import_path4.default.join(devServerConfig.devServerDir, "static", "favicon.ico");
- res.writeHead(200, responseHeaders({
- "content-type": "image/x-icon",
- "x-source": `favicon: ${xSource}`
- }));
- const rs = import_graceful_fs.default.createReadStream(defaultFavicon);
- rs.on("error", (err2) => {
- res.writeHead(404, responseHeaders({
- "content-type": "text/plain; charset=utf-8",
- "x-source": `createReadStream error: ${err2}, ${xSource}`
- }));
- res.write(import_util.default.inspect(err2));
- res.end();
- });
- rs.pipe(res);
- return;
- }
- if (content == null) {
- content = ["404 File Not Found", "Url: " + req.pathname, "File: " + req.filePath].join("\n");
- }
- res.writeHead(404, responseHeaders({
- "content-type": "text/plain; charset=utf-8",
- "x-source": xSource
- }));
- res.write(content);
- res.end();
- logRequest(req, 400);
- } catch (e) {
- serve500(req, res, e, xSource);
- }
- };
- const serve302 = (req, res, pathname = null) => {
- logRequest(req, 302);
- res.writeHead(302, { location: pathname || devServerConfig.basePath || "/" });
- res.end();
- };
- const getBuildResults = () => new Promise((resolve, reject) => {
- if (serverCtx.isServerListening) {
- buildResultsResolves.push({ resolve, reject });
- sendMsg({ requestBuildResults: true });
- } else {
- reject("dev server closed");
- }
- });
- const getCompilerRequest = (compilerRequestPath) => new Promise((resolve, reject) => {
- if (serverCtx.isServerListening) {
- compilerRequestResolves.push({
- path: compilerRequestPath,
- resolve,
- reject
- });
- sendMsg({ compilerRequestPath });
- } else {
- reject("dev server closed");
- }
- });
- const serverCtx = {
- connectorHtml: null,
- dirTemplate: null,
- getBuildResults,
- getCompilerRequest,
- isServerListening: false,
- logRequest,
- prerenderConfig: null,
- serve302,
- serve404,
- serve500,
- sys
- };
- return serverCtx;
- }
- // build/dev-server/server-http.js
- var http = __toESM(require("http"));
- var https = __toESM(require("https"));
- var net = __toESM(require("net"));
- // build/dev-server/request-handler.js
- var import_path9 = __toESM(require("path"));
- // build/dev-server/serve-dev-client.js
- var import_path6 = __toESM(require("path"));
- // build/dev-server/open-in-editor.js
- var import_open_in_editor_api = __toESM(require("./open-in-editor-api"));
- async function serveOpenInEditor(serverCtx, req, res) {
- let status = 200;
- const data = {};
- try {
- const editors2 = await getEditors();
- if (editors2.length > 0) {
- await parseData(editors2, serverCtx.sys, req, data);
- await openDataInEditor(data);
- } else {
- data.error = `no editors available`;
- }
- } catch (e) {
- data.error = e + "";
- status = 500;
- }
- serverCtx.logRequest(req, status);
- res.writeHead(status, responseHeaders({
- "content-type": "application/json; charset=utf-8"
- }));
- res.write(JSON.stringify(data, null, 2));
- res.end();
- }
- async function parseData(editors2, sys, req, data) {
- const qs = req.searchParams;
- if (!qs.has("file")) {
- data.error = `missing file`;
- return;
- }
- data.file = qs.get("file");
- if (qs.has("line") && !isNaN(qs.get("line"))) {
- data.line = parseInt(qs.get("line"), 10);
- }
- if (typeof data.line !== "number" || data.line < 1) {
- data.line = 1;
- }
- if (qs.has("column") && !isNaN(qs.get("column"))) {
- data.column = parseInt(qs.get("column"), 10);
- }
- if (typeof data.column !== "number" || data.column < 1) {
- data.column = 1;
- }
- let editor = qs.get("editor");
- if (typeof editor === "string") {
- editor = editor.trim().toLowerCase();
- if (editors2.some((e) => e.id === editor)) {
- data.editor = editor;
- } else {
- data.error = `invalid editor: ${editor}`;
- return;
- }
- } else {
- data.editor = editors2[0].id;
- }
- const stat = await sys.stat(data.file);
- data.exists = stat.isFile;
- }
- async function openDataInEditor(data) {
- if (!data.exists || data.error) {
- return;
- }
- try {
- const opts = {
- editor: data.editor
- };
- const editor = import_open_in_editor_api.default.configure(opts, (err2) => data.error = err2 + "");
- if (data.error) {
- return;
- }
- data.open = `${data.file}:${data.line}:${data.column}`;
- await editor.open(data.open);
- } catch (e) {
- data.error = e + "";
- }
- }
- var editors = null;
- function getEditors() {
- if (!editors) {
- editors = new Promise(async (resolve) => {
- const editors2 = [];
- try {
- await Promise.all(Object.keys(import_open_in_editor_api.default.editors).map(async (editorId) => {
- const isSupported = await isEditorSupported(editorId);
- editors2.push({
- id: editorId,
- priority: EDITOR_PRIORITY[editorId],
- supported: isSupported
- });
- }));
- } catch (e) {
- }
- resolve(editors2.filter((e) => e.supported).sort((a, b) => {
- if (a.priority < b.priority)
- return -1;
- if (a.priority > b.priority)
- return 1;
- return 0;
- }).map((e) => {
- return {
- id: e.id,
- name: EDITORS[e.id]
- };
- }));
- });
- }
- return editors;
- }
- async function isEditorSupported(editorId) {
- let isSupported = false;
- try {
- await import_open_in_editor_api.default.editors[editorId].detect();
- isSupported = true;
- } catch (e) {
- }
- return isSupported;
- }
- var EDITORS = {
- atom: "Atom",
- code: "Code",
- emacs: "Emacs",
- idea14ce: "IDEA 14 Community Edition",
- phpstorm: "PhpStorm",
- sublime: "Sublime",
- webstorm: "WebStorm",
- vim: "Vim",
- visualstudio: "Visual Studio"
- };
- var EDITOR_PRIORITY = {
- code: 1,
- atom: 2,
- sublime: 3,
- visualstudio: 4,
- idea14ce: 5,
- webstorm: 6,
- phpstorm: 7,
- vim: 8,
- emacs: 9
- };
- // build/dev-server/serve-file.js
- var import_buffer = require("buffer");
- var import_graceful_fs2 = __toESM(require("../sys/node/graceful-fs.js"));
- var import_path5 = __toESM(require("path"));
- var zlib = __toESM(require("zlib"));
- async function serveFile(devServerConfig, serverCtx, req, res) {
- try {
- if (isSimpleText(req.filePath)) {
- let content = await serverCtx.sys.readFile(req.filePath, "utf8");
- if (devServerConfig.websocket && isHtmlFile(req.filePath) && !isDevServerClient(req.pathname)) {
- content = appendDevServerClientScript(devServerConfig, req, content);
- } else if (isCssFile(req.filePath)) {
- content = updateStyleUrls(req.url, content);
- }
- if (shouldCompress(devServerConfig, req)) {
- res.writeHead(200, responseHeaders({
- "content-type": getContentType(req.filePath) + "; charset=utf-8",
- "content-encoding": "gzip",
- vary: "Accept-Encoding"
- }));
- zlib.gzip(content, { level: 9 }, (_, data) => {
- res.end(data);
- });
- } else {
- res.writeHead(200, responseHeaders({
- "content-type": getContentType(req.filePath) + "; charset=utf-8",
- "content-length": import_buffer.Buffer.byteLength(content, "utf8")
- }));
- res.write(content);
- res.end();
- }
- } else {
- res.writeHead(200, responseHeaders({
- "content-type": getContentType(req.filePath),
- "content-length": req.stats.size
- }));
- import_graceful_fs2.default.createReadStream(req.filePath).pipe(res);
- }
- serverCtx.logRequest(req, 200);
- } catch (e) {
- serverCtx.serve500(req, res, e, "serveFile");
- }
- }
- function updateStyleUrls(url, oldCss) {
- const versionId = url.searchParams.get("s-hmr");
- const hmrUrls = url.searchParams.get("s-hmr-urls");
- if (versionId && hmrUrls) {
- hmrUrls.split(",").forEach((hmrUrl) => {
- urlVersionIds.set(hmrUrl, versionId);
- });
- }
- const reg = /url\((['"]?)(.*)\1\)/gi;
- let result;
- let newCss = oldCss;
- while ((result = reg.exec(oldCss)) !== null) {
- const oldUrl = result[2];
- const parsedUrl = new URL(oldUrl, url);
- const fileName = import_path5.default.basename(parsedUrl.pathname);
- const versionId2 = urlVersionIds.get(fileName);
- if (!versionId2) {
- continue;
- }
- parsedUrl.searchParams.set("s-hmr", versionId2);
- newCss = newCss.replace(oldUrl, parsedUrl.pathname);
- }
- return newCss;
- }
- var urlVersionIds = /* @__PURE__ */ new Map();
- function appendDevServerClientScript(devServerConfig, req, content) {
- var _a, _b, _c;
- const devServerClientUrl = getDevServerClientUrl(devServerConfig, (_b = (_a = req.headers) === null || _a === void 0 ? void 0 : _a["x-forwarded-host"]) !== null && _b !== void 0 ? _b : req.host, (_c = req.headers) === null || _c === void 0 ? void 0 : _c["x-forwarded-proto"]);
- const iframe = `<iframe title="Stencil Dev Server Connector ${version} ⚡" src="${devServerClientUrl}" style="display:block;width:0;height:0;border:0;visibility:hidden" aria-hidden="true"></iframe>`;
- return appendDevServerClientIframe(content, iframe);
- }
- function appendDevServerClientIframe(content, iframe) {
- if (content.includes("</body>")) {
- return content.replace("</body>", `${iframe}</body>`);
- }
- if (content.includes("</html>")) {
- return content.replace("</html>", `${iframe}</html>`);
- }
- return `${content}${iframe}`;
- }
- // build/dev-server/serve-dev-client.js
- async function serveDevClient(devServerConfig, serverCtx, req, res) {
- try {
- if (isOpenInEditor(req.pathname)) {
- return serveOpenInEditor(serverCtx, req, res);
- }
- if (isDevServerClient(req.pathname)) {
- return serveDevClientScript(devServerConfig, serverCtx, req, res);
- }
- if (isInitialDevServerLoad(req.pathname)) {
- req.filePath = import_path6.default.join(devServerConfig.devServerDir, "templates", "initial-load.html");
- } else {
- const staticFile = req.pathname.replace(DEV_SERVER_URL + "/", "");
- req.filePath = import_path6.default.join(devServerConfig.devServerDir, "static", staticFile);
- }
- try {
- req.stats = await serverCtx.sys.stat(req.filePath);
- if (req.stats.isFile) {
- return serveFile(devServerConfig, serverCtx, req, res);
- }
- return serverCtx.serve404(req, res, "serveDevClient not file");
- } catch (e) {
- return serverCtx.serve404(req, res, `serveDevClient stats error ${e}`);
- }
- } catch (e) {
- return serverCtx.serve500(req, res, e, "serveDevClient");
- }
- }
- async function serveDevClientScript(devServerConfig, serverCtx, req, res) {
- try {
- if (serverCtx.connectorHtml == null) {
- const filePath2 = import_path6.default.join(devServerConfig.devServerDir, "connector.html");
- serverCtx.connectorHtml = serverCtx.sys.readFileSync(filePath2, "utf8");
- if (typeof serverCtx.connectorHtml !== "string") {
- return serverCtx.serve404(req, res, `serveDevClientScript`);
- }
- const devClientConfig = {
- basePath: devServerConfig.basePath,
- editors: await getEditors(),
- reloadStrategy: devServerConfig.reloadStrategy
- };
- serverCtx.connectorHtml = serverCtx.connectorHtml.replace("window.__DEV_CLIENT_CONFIG__", JSON.stringify(devClientConfig));
- }
- res.writeHead(200, responseHeaders({
- "content-type": "text/html; charset=utf-8"
- }));
- res.write(serverCtx.connectorHtml);
- res.end();
- } catch (e) {
- return serverCtx.serve500(req, res, e, `serveDevClientScript`);
- }
- }
- // build/dev-server/serve-dev-node-module.js
- async function serveDevNodeModule(serverCtx, req, res) {
- try {
- const results = await serverCtx.getCompilerRequest(req.pathname);
- const headers = {
- "content-type": "application/javascript; charset=utf-8",
- "content-length": Buffer.byteLength(results.content, "utf8"),
- "x-dev-node-module-id": results.nodeModuleId,
- "x-dev-node-module-version": results.nodeModuleVersion,
- "x-dev-node-module-resolved-path": results.nodeResolvedPath,
- "x-dev-node-module-cache-path": results.cachePath,
- "x-dev-node-module-cache-hit": results.cacheHit
- };
- res.writeHead(results.status, responseHeaders(headers));
- res.write(results.content);
- res.end();
- } catch (e) {
- serverCtx.serve500(req, res, e, `serveDevNodeModule`);
- }
- }
- // build/dev-server/serve-directory-index.js
- var import_path7 = __toESM(require("path"));
- async function serveDirectoryIndex(devServerConfig, serverCtx, req, res) {
- const indexFilePath = import_path7.default.join(req.filePath, "index.html");
- req.stats = await serverCtx.sys.stat(indexFilePath);
- if (req.stats.isFile) {
- req.filePath = indexFilePath;
- return serveFile(devServerConfig, serverCtx, req, res);
- }
- if (!req.pathname.endsWith("/")) {
- return serverCtx.serve302(req, res, req.pathname + "/");
- }
- try {
- const dirFilePaths = await serverCtx.sys.readDir(req.filePath);
- try {
- if (serverCtx.dirTemplate == null) {
- const dirTemplatePath = import_path7.default.join(devServerConfig.devServerDir, "templates", "directory-index.html");
- serverCtx.dirTemplate = serverCtx.sys.readFileSync(dirTemplatePath);
- }
- const files = await getFiles(serverCtx.sys, req.url, dirFilePaths);
- const templateHtml = serverCtx.dirTemplate.replace("{{title}}", getTitle(req.pathname)).replace("{{nav}}", getName(req.pathname)).replace("{{files}}", files);
- serverCtx.logRequest(req, 200);
- res.writeHead(200, responseHeaders({
- "content-type": "text/html; charset=utf-8",
- "x-directory-index": req.pathname
- }));
- res.write(templateHtml);
- res.end();
- } catch (e) {
- return serverCtx.serve500(req, res, e, "serveDirectoryIndex");
- }
- } catch (e) {
- return serverCtx.serve404(req, res, "serveDirectoryIndex");
- }
- }
- async function getFiles(sys, baseUrl, dirItemNames) {
- const items = await getDirectoryItems(sys, baseUrl, dirItemNames);
- if (baseUrl.pathname !== "/") {
- items.unshift({
- isDirectory: true,
- pathname: "../",
- name: ".."
- });
- }
- return items.map((item) => {
- return `
- <li class="${item.isDirectory ? "directory" : "file"}">
- <a href="${item.pathname}">
- <span class="icon"></span>
- <span>${item.name}</span>
- </a>
- </li>`;
- }).join("");
- }
- async function getDirectoryItems(sys, baseUrl, dirFilePaths) {
- const items = await Promise.all(dirFilePaths.map(async (dirFilePath) => {
- const fileName = import_path7.default.basename(dirFilePath);
- const url = new URL(fileName, baseUrl);
- const stats = await sys.stat(dirFilePath);
- const item = {
- name: fileName,
- pathname: url.pathname,
- isDirectory: stats.isDirectory
- };
- return item;
- }));
- return items;
- }
- function getTitle(pathName) {
- return pathName;
- }
- function getName(pathName) {
- const dirs = pathName.split("/");
- dirs.pop();
- let url = "";
- return dirs.map((dir, index) => {
- url += dir + "/";
- const text = index === 0 ? `~` : dir;
- return `<a href="${url}">${text}</a>`;
- }).join("<span>/</span>") + "<span>/</span>";
- }
- // build/dev-server/ssr-request.js
- var import_path8 = __toESM(require("path"));
- async function ssrPageRequest(devServerConfig, serverCtx, req, res) {
- try {
- let status = 500;
- let content = "";
- const { hydrateApp, srcIndexHtml, diagnostics } = await setupHydrateApp(devServerConfig, serverCtx);
- if (!diagnostics.some((diagnostic) => diagnostic.level === "error")) {
- try {
- const opts = getSsrHydrateOptions(devServerConfig, serverCtx, req.url);
- const ssrResults = await hydrateApp.renderToString(srcIndexHtml, opts);
- diagnostics.push(...ssrResults.diagnostics);
- status = ssrResults.httpStatus;
- content = ssrResults.html;
- } catch (e) {
- catchError(diagnostics, e);
- }
- }
- if (diagnostics.some((diagnostic) => diagnostic.level === "error")) {
- content = getSsrErrorContent(diagnostics);
- status = 500;
- }
- if (devServerConfig.websocket) {
- content = appendDevServerClientScript(devServerConfig, req, content);
- }
- serverCtx.logRequest(req, status);
- res.writeHead(status, responseHeaders({
- "content-type": "text/html; charset=utf-8",
- "content-length": Buffer.byteLength(content, "utf8")
- }));
- res.write(content);
- res.end();
- } catch (e) {
- serverCtx.serve500(req, res, e, `ssrPageRequest`);
- }
- }
- async function ssrStaticDataRequest(devServerConfig, serverCtx, req, res) {
- try {
- const data = {};
- let httpCache = false;
- const { hydrateApp, srcIndexHtml, diagnostics } = await setupHydrateApp(devServerConfig, serverCtx);
- if (!diagnostics.some((diagnostic) => diagnostic.level === "error")) {
- try {
- const { ssrPath, hasQueryString } = getSsrStaticDataPath(req);
- const url = new URL(ssrPath, req.url);
- const opts = getSsrHydrateOptions(devServerConfig, serverCtx, url);
- const ssrResults = await hydrateApp.renderToString(srcIndexHtml, opts);
- diagnostics.push(...ssrResults.diagnostics);
- ssrResults.staticData.forEach((s) => {
- if (s.type === "application/json") {
- data[s.id] = JSON.parse(s.content);
- } else {
- data[s.id] = s.content;
- }
- });
- data.components = ssrResults.components.map((c) => c.tag).sort();
- httpCache = hasQueryString;
- } catch (e) {
- catchError(diagnostics, e);
- }
- }
- if (diagnostics.length > 0) {
- data.diagnostics = diagnostics;
- }
- const status = diagnostics.some((diagnostic) => diagnostic.level === "error") ? 500 : 200;
- const content = JSON.stringify(data);
- serverCtx.logRequest(req, status);
- res.writeHead(status, responseHeaders({
- "content-type": "application/json; charset=utf-8",
- "content-length": Buffer.byteLength(content, "utf8")
- }, httpCache && status === 200));
- res.write(content);
- res.end();
- } catch (e) {
- serverCtx.serve500(req, res, e, `ssrStaticDataRequest`);
- }
- }
- async function setupHydrateApp(devServerConfig, serverCtx) {
- let srcIndexHtml = null;
- let hydrateApp = null;
- const buildResults = await serverCtx.getBuildResults();
- const diagnostics = [];
- if (serverCtx.prerenderConfig == null && isString(devServerConfig.prerenderConfig)) {
- const compilerPath = import_path8.default.join(devServerConfig.devServerDir, "..", "compiler", "stencil.js");
- const compiler = require(compilerPath);
- const prerenderConfigResults = compiler.nodeRequire(devServerConfig.prerenderConfig);
- diagnostics.push(...prerenderConfigResults.diagnostics);
- if (prerenderConfigResults.module && prerenderConfigResults.module.config) {
- serverCtx.prerenderConfig = prerenderConfigResults.module.config;
- }
- }
- if (!isString(buildResults.hydrateAppFilePath)) {
- diagnostics.push({ messageText: `Missing hydrateAppFilePath`, level: `error`, type: `ssr`, lines: [] });
- } else if (!isString(devServerConfig.srcIndexHtml)) {
- diagnostics.push({ messageText: `Missing srcIndexHtml`, level: `error`, type: `ssr`, lines: [] });
- } else {
- srcIndexHtml = await serverCtx.sys.readFile(devServerConfig.srcIndexHtml);
- if (!isString(srcIndexHtml)) {
- diagnostics.push({
- level: `error`,
- lines: [],
- messageText: `Unable to load src index html: ${devServerConfig.srcIndexHtml}`,
- type: `ssr`
- });
- } else {
- const hydrateAppFilePath = import_path8.default.resolve(buildResults.hydrateAppFilePath);
- require.cache = {};
- const Module = require("module");
- Module._cache[hydrateAppFilePath] = void 0;
- hydrateApp = require(hydrateAppFilePath);
- }
- }
- return {
- hydrateApp,
- srcIndexHtml,
- diagnostics
- };
- }
- function getSsrHydrateOptions(devServerConfig, serverCtx, url) {
- const opts = {
- url: url.href,
- addModulePreloads: false,
- approximateLineWidth: 120,
- inlineExternalStyleSheets: false,
- minifyScriptElements: false,
- minifyStyleElements: false,
- removeAttributeQuotes: false,
- removeBooleanAttributeQuotes: false,
- removeEmptyAttributes: false,
- removeHtmlComments: false,
- prettyHtml: true
- };
- const prerenderConfig = serverCtx === null || serverCtx === void 0 ? void 0 : serverCtx.prerenderConfig;
- if (isFunction(prerenderConfig === null || prerenderConfig === void 0 ? void 0 : prerenderConfig.hydrateOptions)) {
- const userOpts = prerenderConfig.hydrateOptions(url);
- if (userOpts) {
- Object.assign(opts, userOpts);
- }
- }
- if (isFunction(serverCtx.sys.applyPrerenderGlobalPatch)) {
- const orgBeforeHydrate = opts.beforeHydrate;
- opts.beforeHydrate = (document) => {
- const devServerBaseUrl = new URL(devServerConfig.browserUrl);
- const devServerHostUrl = devServerBaseUrl.origin;
- serverCtx.sys.applyPrerenderGlobalPatch({
- devServerHostUrl,
- window: document.defaultView
- });
- if (typeof orgBeforeHydrate === "function") {
- return orgBeforeHydrate(document);
- }
- };
- }
- return opts;
- }
- function getSsrErrorContent(diagnostics) {
- return `<!doctype html>
- <html>
- <head>
- <title>SSR Error</title>
- <style>
- body {
- font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace !important;
- }
- </style>
- </head>
- <body>
- <h1>SSR Dev Error</h1>
- ${diagnostics.map((diagnostic) => `
- <p>
- ${diagnostic.messageText}
- </p>
- `)}
- </body>
- </html>`;
- }
- // build/dev-server/request-handler.js
- function createRequestHandler(devServerConfig, serverCtx) {
- let userRequestHandler = null;
- if (typeof devServerConfig.requestListenerPath === "string") {
- userRequestHandler = require(devServerConfig.requestListenerPath);
- }
- return async function(incomingReq, res) {
- async function defaultHandler() {
- try {
- const req = normalizeHttpRequest(devServerConfig, incomingReq);
- if (!req.url) {
- return serverCtx.serve302(req, res);
- }
- if (devServerConfig.pingRoute !== null && req.pathname === devServerConfig.pingRoute) {
- return serverCtx.getBuildResults().then((result) => {
- if (!result.hasSuccessfulBuild) {
- return serverCtx.serve500(incomingReq, res, "Build not successful", "build error");
- }
- res.writeHead(200, "OK");
- res.write("OK");
- res.end();
- }).catch(() => serverCtx.serve500(incomingReq, res, "Error getting build results", "ping error"));
- }
- if (isDevClient(req.pathname) && devServerConfig.websocket) {
- return serveDevClient(devServerConfig, serverCtx, req, res);
- }
- if (isDevModule(req.pathname)) {
- return serveDevNodeModule(serverCtx, req, res);
- }
- if (!isValidUrlBasePath(devServerConfig.basePath, req.url)) {
- return serverCtx.serve404(req, res, `invalid basePath`, `404 File Not Found, base path: ${devServerConfig.basePath}`);
- }
- if (devServerConfig.ssr) {
- if (isExtensionLessPath(req.url.pathname)) {
- return ssrPageRequest(devServerConfig, serverCtx, req, res);
- }
- if (isSsrStaticDataPath(req.url.pathname)) {
- return ssrStaticDataRequest(devServerConfig, serverCtx, req, res);
- }
- }
- req.stats = await serverCtx.sys.stat(req.filePath);
- if (req.stats.isFile) {
- return serveFile(devServerConfig, serverCtx, req, res);
- }
- if (req.stats.isDirectory) {
- return serveDirectoryIndex(devServerConfig, serverCtx, req, res);
- }
- const xSource = ["notfound"];
- const validHistoryApi = isValidHistoryApi(devServerConfig, req);
- xSource.push(`validHistoryApi: ${validHistoryApi}`);
- if (validHistoryApi) {
- try {
- const indexFilePath = import_path9.default.join(devServerConfig.root, devServerConfig.historyApiFallback.index);
- xSource.push(`indexFilePath: ${indexFilePath}`);
- req.stats = await serverCtx.sys.stat(indexFilePath);
- if (req.stats.isFile) {
- req.filePath = indexFilePath;
- return serveFile(devServerConfig, serverCtx, req, res);
- }
- } catch (e) {
- xSource.push(`notfound error: ${e}`);
- }
- }
- return serverCtx.serve404(req, res, xSource.join(", "));
- } catch (e) {
- return serverCtx.serve500(incomingReq, res, e, `not found error`);
- }
- }
- if (typeof userRequestHandler === "function") {
- await userRequestHandler(incomingReq, res, defaultHandler);
- } else {
- await defaultHandler();
- }
- };
- }
- function isValidUrlBasePath(basePath, url) {
- let pathname = url.pathname;
- if (!pathname.endsWith("/")) {
- pathname += "/";
- }
- if (!basePath.endsWith("/")) {
- basePath += "/";
- }
- return pathname.startsWith(basePath);
- }
- function normalizeHttpRequest(devServerConfig, incomingReq) {
- const req = {
- method: (incomingReq.method || "GET").toUpperCase(),
- headers: incomingReq.headers,
- acceptHeader: incomingReq.headers && typeof incomingReq.headers.accept === "string" && incomingReq.headers.accept || "",
- host: incomingReq.headers && typeof incomingReq.headers.host === "string" && incomingReq.headers.host || null,
- url: null,
- searchParams: null
- };
- const incomingUrl = (incomingReq.url || "").trim() || null;
- if (incomingUrl) {
- if (req.host) {
- req.url = new URL(incomingReq.url, `http://${req.host}`);
- } else {
- req.url = new URL(incomingReq.url, `http://dev.stenciljs.com`);
- }
- req.searchParams = req.url.searchParams;
- }
- if (req.url) {
- const parts = req.url.pathname.replace(/\\/g, "/").split("/");
- req.pathname = parts.map((part) => decodeURIComponent(part)).join("/");
- if (req.pathname.length > 0 && !isDevClient(req.pathname)) {
- req.pathname = "/" + req.pathname.substring(devServerConfig.basePath.length);
- }
- req.filePath = normalizePath(import_path9.default.normalize(import_path9.default.join(devServerConfig.root, import_path9.default.relative("/", req.pathname))));
- }
- return req;
- }
- function isValidHistoryApi(devServerConfig, req) {
- if (!devServerConfig.historyApiFallback) {
- return false;
- }
- if (req.method !== "GET") {
- return false;
- }
- if (!req.acceptHeader.includes("text/html")) {
- return false;
- }
- if (!devServerConfig.historyApiFallback.disableDotRule && req.pathname.includes(".")) {
- return false;
- }
- return true;
- }
- // build/dev-server/server-http.js
- function createHttpServer(devServerConfig, serverCtx) {
- const reqHandler = createRequestHandler(devServerConfig, serverCtx);
- const credentials = devServerConfig.https;
- return credentials ? https.createServer(credentials, reqHandler) : http.createServer(reqHandler);
- }
- async function findClosestOpenPort(host, port) {
- async function t(portToCheck) {
- const isTaken = await isPortTaken(host, portToCheck);
- if (!isTaken) {
- return portToCheck;
- }
- return t(portToCheck + 1);
- }
- return t(port);
- }
- function isPortTaken(host, port) {
- return new Promise((resolve, reject) => {
- const tester = net.createServer().once("error", () => {
- resolve(true);
- }).once("listening", () => {
- tester.once("close", () => {
- resolve(false);
- }).close();
- }).on("error", (err2) => {
- reject(err2);
- }).listen(port, host);
- });
- }
- // build/dev-server/server-web-socket.js
- var import_ws = __toESM(require("./ws.js"));
- function createWebSocket(httpServer, onMessageFromClient) {
- const wsConfig = {
- server: httpServer
- };
- const wsServer = new import_ws.default.Server(wsConfig);
- function heartbeat() {
- this.isAlive = true;
- }
- wsServer.on("connection", (ws2) => {
- ws2.on("message", (data) => {
- try {
- onMessageFromClient(JSON.parse(data.toString()));
- } catch (e) {
- console.error(e);
- }
- });
- ws2.isAlive = true;
- ws2.on("pong", heartbeat);
- ws2.on("error", console.error);
- });
- const pingInterval = setInterval(() => {
- wsServer.clients.forEach((ws2) => {
- if (!ws2.isAlive) {
- return ws2.close(1e3);
- }
- ws2.isAlive = false;
- ws2.ping(noop);
- });
- }, 1e4);
- return {
- sendToBrowser: (msg) => {
- if (msg && wsServer && wsServer.clients) {
- const data = JSON.stringify(msg);
- wsServer.clients.forEach((ws2) => {
- if (ws2.readyState === ws2.OPEN) {
- ws2.send(data);
- }
- });
- }
- },
- close: () => {
- return new Promise((resolve, reject) => {
- clearInterval(pingInterval);
- wsServer.clients.forEach((ws2) => {
- ws2.close(1e3);
- });
- wsServer.close((err2) => {
- if (err2) {
- reject(err2);
- } else {
- resolve();
- }
- });
- });
- }
- };
- }
- // build/dev-server/server-process.js
- function initServerProcess(sendMsg) {
- let server = null;
- let webSocket = null;
- let serverCtx = null;
- const buildResultsResolves = [];
- const compilerRequestResolves = [];
- const startServer = async (msg) => {
- const devServerConfig = msg.startServer;
- devServerConfig.port = await findClosestOpenPort(devServerConfig.address, devServerConfig.port);
- devServerConfig.browserUrl = getBrowserUrl(devServerConfig.protocol, devServerConfig.address, devServerConfig.port, devServerConfig.basePath, "/");
- devServerConfig.root = normalizePath(devServerConfig.root);
- const sys = (0, import_sys_api_node.createNodeSys)({ process });
- serverCtx = createServerContext(sys, sendMsg, devServerConfig, buildResultsResolves, compilerRequestResolves);
- server = createHttpServer(devServerConfig, serverCtx);
- webSocket = devServerConfig.websocket ? createWebSocket(server, sendMsg) : null;
- server.listen(devServerConfig.port, devServerConfig.address);
- serverCtx.isServerListening = true;
- if (devServerConfig.openBrowser) {
- const initialLoadUrl = getBrowserUrl(devServerConfig.protocol, devServerConfig.address, devServerConfig.port, devServerConfig.basePath, devServerConfig.initialLoadUrl || DEV_SERVER_INIT_URL);
- openInBrowser({ url: initialLoadUrl });
- }
- sendMsg({ serverStarted: devServerConfig });
- };
- const closeServer = () => {
- const promises = [];
- buildResultsResolves.forEach((r) => r.reject("dev server closed"));
- buildResultsResolves.length = 0;
- compilerRequestResolves.forEach((r) => r.reject("dev server closed"));
- compilerRequestResolves.length = 0;
- if (serverCtx) {
- if (serverCtx.sys) {
- promises.push(serverCtx.sys.destroy());
- }
- }
- if (webSocket) {
- promises.push(webSocket.close());
- webSocket = null;
- }
- if (server) {
- promises.push(new Promise((resolve) => {
- server.close((err2) => {
- if (err2) {
- console.error(`close error: ${err2}`);
- }
- resolve();
- });
- }));
- }
- Promise.all(promises).finally(() => {
- sendMsg({
- serverClosed: true
- });
- });
- };
- const receiveMessageFromMain = (msg) => {
- try {
- if (msg) {
- if (msg.startServer) {
- startServer(msg);
- } else if (msg.closeServer) {
- closeServer();
- } else if (msg.compilerRequestResults) {
- for (let i = compilerRequestResolves.length - 1; i >= 0; i--) {
- const r = compilerRequestResolves[i];
- if (r.path === msg.compilerRequestResults.path) {
- r.resolve(msg.compilerRequestResults);
- compilerRequestResolves.splice(i, 1);
- }
- }
- } else if (serverCtx) {
- if (msg.buildResults && !msg.isActivelyBuilding) {
- buildResultsResolves.forEach((r) => r.resolve(msg.buildResults));
- buildResultsResolves.length = 0;
- }
- if (webSocket) {
- webSocket.sendToBrowser(msg);
- }
- }
- }
- } catch (e) {
- let stack = null;
- if (e instanceof Error) {
- stack = e.stack;
- }
- sendMsg({
- error: { message: e + "", stack }
- });
- }
- };
- return receiveMessageFromMain;
- }
- // Annotate the CommonJS export names for ESM import in node:
- 0 && (module.exports = {
- initServerProcess
- });
|